return to table of content

Enhancing Factorio with SAT solvers

zero_k
24 replies
1d3h

This is cool :) My only small gripe is that python-sat (i.e. pysat) is nice, but it kinda hides all the work that SAT solver writers (like me... :D) do. It gives a nice interface to access them all, but it also means that e.g. if something doesn't work, the user may not know who to contact as they may not be aware which SAT solver they are using. I guess it's the rule of something becoming so mainstream that the authors of the underlying technology fade away, and those doing the (actually really hard work!) of maintaining the common API are referenced only.

I have seen publications/work where the SAT solver was credited only as pysat, which is not a SAT solver :) Kinda cool and sad at the same time!

rapfaria
18 replies
1d2h

But as an user, why would he/she care about how it works on the background, even if there is an issue? Surely the average Factorio player is perhaps familiar with programming, but isn't working over an abstraction exactly why solutions like these work?

lucideer
15 replies
1d1h

But as an user, why would he/she care about how it works

I find this (extremely prevalent) perspective increasingly demoralising.

Why wouldn't he/she care?

There's an important distinction here between the use of the word "should" and "would". The user of course shouldn't be required to care, but making a decision on their behalf that they won't is fundamentally different.

This is of course largely driven by the sorry state of UX where the responsibility to integrate rich choice & flexibility into refined simple interfaces is shirked in favour of achieving the same simplicity via the lazier approach of design minimalism.

yareal
6 replies
1d1h

Who wrote the network transport code that shepherded the bits from your post to the hacker news backend? What Ethernet devices did it transit and who wrote that code? What tradeoffs were made between hardware performance characteristics in the interrupt handlers in your network card? What about your keyboard? Did you choose cat 5 or cat 6 cables for this post to HN? Were those cables shielded?

There are many many occasions where something is below the level of abstraction that you care about. Don't assume that because you care about a particular level of abstraction that everyone else should too.

lucideer
4 replies
23h44m

Who wrote the network transport code that shepherded the bits from your post to the hacker news backend? What Ethernet devices did it transit and who wrote that code? What tradeoffs were made between hardware performance characteristics in the interrupt handlers in your network card? What about your keyboard? Did you choose cat 5 or cat 6 cables for this post to HN? Were those cables shielded?

Are you asking whether I know these things or whether I'd like to? Or whether I'd like the freedom to make choices about these questions -vs- each of them being chosen for me without opportunity for input or insight?

I don't think it's particularly controversial to say that, for most people, independent of their level of technical knowledge, the ideal is for answers to all of your questions to be available & accessible in some way, & for there to be choice in that market.

People can choose to take simple defaults without delving into the hows & whys but I can't see why those same people would object to others having choice & transparency around those defaults.

In summary: I don't know what point you're trying to make.

yareal
1 replies
22h8m

You asked "why wouldn't they care?" I'd argue you don't care below some level of abstraction.

I'm pointing out that we all have a limited capacity to care at different levels of depth. And people might not want to care because they have other things they want to care about.

You don't care about the whole stack you use. Others don't either, you sound like you are chastising others for not caring.

lucideer
0 replies
4h59m

people might not want to care [...] you sound like you are chastising others for not caring.

You sound like you're reading things from my comments that suit your own rebuttal rather than what I've actually said.

From my first comment:

The user of course shouldn't be required to care

from my second comment;

People can choose to take simple defaults without delving into the hows & whys

I'm literally just arguing for choice, transparency & availability. I'm not proposing placing any further burdens on users regardless of what they want to care about.

lupusreal
1 replies
23h30m

Anyone can learn these things (the workings of pysat) if they want to. Sometimes the inner workings and history of things is hidden as proprietary secrets, but usually that isn't the case and somebody who's curious can dig into how things work and who invented them.

lucideer
0 replies
4h56m

This is very true in this case, but not in all cases, & I think the gp's point w.r.t. such things being (relatively) obscured applies universally. All systems stand to benefit from constructive feedback on things being clearer & more transparent.

Barrin92
0 replies
19h2m

where something is below the level of abstraction that you care about.

and because this attitude has become so prevalent people now pile shoddy abstraction on top of shoddy abstraction without interest or ability to reason about what that does down the stack.

The lesson from this isn't "you don't need to care about how things work" but invest some time into going one or two levels deeper than you "need" to. If you have no idea how things work under the hood the moment things tend to break or leak you're going to end up clueless.

fho
2 replies
22h38m

The question is: where do you draw the line?

* The SAT wrapper? * The SAT library? * The math library the SAT library depends upon? * The LibC? * The operating system? * The processor? * The lithography machine manufacturers? * The guys that provided the raw silicone?

lucideer
0 replies
4h45m

There's no hard line to be drawn anywhere - trying to shoehorn the argument into the metaphor of a line somewhere doesn't track.

Two framings to attempt to answer your question reasonably:

Framing 1: Should information on all the things you listed be available & accessible? In an ideal world, I think so.

Of course that doesn't translate to all of them being pushed into users faces while they attempt to play Factorio (they don't even know how to install python & haven't even unlocked balancers yet). It just means: can I find it on the internet. Right now, thankfully, I can for most of it (sadly silicon supply chain transparency isn't quite where it could be).

Framing 2: Should the above information be readily apparent: that's a question that's much more dependent on degrees of abstraction. In this case, the gp is offering feedback that the SAT libraries are at a level of abstraction that makes them relevant enough to someone running the python tool in their cli. I would tend to agree.

cellularmitosis
0 replies
22h27m

"...or as I've taken to calling it recently, SAT slash LAPACK slash MUSL slash GNU slash Linux"

beeboobaa
2 replies
21h59m

Techbros always insist on infantilizing users. I think it's a weird combination of gatekeeping and a superiority complex.

funcDropShadow
1 replies
4h34m

Techbros always insist on infantilizing users.

Why do you use Techbros as a derogative term here? How does it contribute to the discussion?

I think it's a weird combination of gatekeeping and a superiority complex.

Why is it gatekeeping, if you ask for UIs that are not only optimized for the most novice user, but also for more advanced users? I'd say it is the other way around. People designing UIs that can only be used for the most easy tasks are gatekeeping. They are keeping out the power users or those who want to become a power user. I've often wondered whether the lack of a smooth path between tools for laymen and tools for professionals is the true reason why it is hard to use computers for more than content consumption.

lucideer
0 replies
3h52m

I think you might have misinterpreted the commenter you're replying to: it sounds like you're arguing for the same side of the argument?

snoutie
1 replies
1d1h

I don't see this that critically. Joe Schmoe and Programmmer Paul live in two different worlds. Joe might be into finace where I don't care about how anything is calculated so long as the right amount is in my bank account by the end of the month. Maybe they use a fancy excel sheet or SAP-FI or whatever.

I don't think that the missing interest in either topics is particulary demoralizing.

But on a different note: it is demoralizing when you need to cooperate with that other world, when Paul needs to create that program in sap for the calculations and Joe does not care for the inner workings or Paul for the formulas. That makes communication so much harder.

lucideer
0 replies
23h53m

Joe Schmoe and Programmmer Paul live in two different worlds

This is essentially the problem: the driving of the world to extremes. Joe's & Paul's worlds are demarcated by the systems they operate in. Their knowledge is not only limited by their primary areas of interest but by what's made evident to them through their daily interactions.

As an individual Paul may have zero interest in "Joe's world" & Joe may individually have less than zero interest in what solvers are operating in Factorio, but those are individual stories, not generalities. When you're generalising about people you're looking at a spectrum of interest within which you need to acknowledge that (a) programmers are humans who use tools too: DX isn't the only area that needs to cater to programmers, they also use Spotify & banking apps & play games just like everyone else. And (b), similarly there's a million Joes out there who will never write a line of code but still possess a technical interest that goes beyond wilful ignorance.

munchbunny
0 replies
1d

Surely the average Factorio player is perhaps familiar with programming, but isn't working over an abstraction exactly why solutions like these work?

The vast majority of Factorio players are not familiar with programming. A small but very vocal and very enthusiastic minority are though.

madars
0 replies
1d1h

At least in the past some SAT solvers were vastly better on certain kinds of problems. E.g. cryptominisat had native handling of XOR clauses which no other solver did. By referencing pertinent details of your experimental setup you could save others who want to build upon your work a lot of time.

klysm
3 replies
1d2h

And that's exactly the power of SAT right? It's a universal way of expressing a large set of problems.

everforward
2 replies
1d1h

In the same sense that SQL is a universal way of expressing a large set of problems.

I.e. all the implementations speak the same language, but they operate and prioritize differently.

SAT solvers are NP-Hard, so there isn't a single SAT solver to rule them all. Which one you choose matters, same as with databases. CockroachDB, PostgreSQL and SQLite all speak SQL, but are not interchangeable. Same with SAT solvers.

I'd agree with OP; the SAT writers should get more credit. It's a hard problem, and I'd bet most of us are either incapable or unwilling to spend ages working on it (myself included, no shade intended). It's also vitally important. To my understanding, SAT solvers underly most package managers. It's how npm or pip or apt know what version to install for each package such that no version violates another packages constraints (if any, it's also where the "no valid version combinations exist" message comes from).

Sesse__
1 replies
22h14m

apt doesn't use a SAT solver; it has its own heuristics. (Seemingly it _can_ call out to an external one if you give the --solver argument, which in 20+ years of Debian I have never seen anyone use, and which I didn't know of before I made a search now to make sure.)

everforward
0 replies
21h12m

Oh, that's interesting, thanks for the correction!

Now I have some reading material for when I'm bored. I'm curious how they handle it without a SAT solver.

natpalmer1776
0 replies
1d2h

In a way, you and every other author who created a SAT solver being used by pysat ARE pysat! :)

Another way to look at it is that you are the "giant" in the famous quote "If I have seen further than others, it is by standing on the shoulders of giants"

dexwiz
23 replies
1d1h

Balancers are probably one of the most common but least understood parts of Factorio. Most players copy a blueprint book from the web, and don’t think about it. They are very tricky to build by hand without a deep understanding of belt mechanics and high attention to detail. Also without testing it’s easy to build one that looks correct but fails under certain conditions.

Same lane balancers and powers of two aren’t bad, but anything else usually requires loop backs so the network becomes cyclic.

Also every belt in Factorio is two independent lanes. Splitters will move items between belts but always preserve lanes. A 4-2 splitter should compress 4 left-only lanes across 4 belts to 2 belts of 2 left and 2 right lanes. The naive splitter setup wont do that.

declan_roberts
17 replies
1d1h

As someone who’s never played factorial it sounds incredibly boring and tedious from the outside.

fnordpiglet
9 replies
1d1h

It’s built for engineers that are nerds at heart and love building because they love building. There are certainly engineers that love making engineer money, and there’s nothing wrong with that. But what one finds boring and tedious another may find pleasure in.

I would say given how loved factorio is a reasonable position is to assume they’re not all entire idiots that can’t distinguish between fun and tedium and give it a try!

moomin
8 replies
1d1h

Factorio, Satisfactory and Oxygen Not Included (very different games) all have this thing of building something while it's running, debugging and expanding it, and give you fairly meaningful rewards in terms of new challenges and removing tedium.

To compare:

* Satisfactory: the lowest stress, best guided, the prettiest and the easiest to analyse. A lot of the challenge involves figuring out how to best use 3D space. 1.0 is coming this year.

* Factorio: Biters provide a base level of threat making your factory breaking a potential problem. But you can switch it off. Much more complex tech tree and routing. But building railways is pretty tedious compared to Satisfactory (which is a pity when they're essential.)

* Oxygen Not Included: Everything you try to do has side effects. The game physics matters _a lot_. Mess up and everything dies. Easily the most stressful of the three. Has the shallowest tech tree of the lot, too.

All are good, although I cannot recommend Oxygen Not Included if you want to relax while playing.

noahtallen
3 replies
1d

Building trains is my favorite part of Factorio :) Satisfactory trains are fun because of the 3D designs for the railway you can do (stations, bridges, etc.) I think Factorio 2.0 (with the new space age expansion) will fix all this. The most tedious parts of trains (odd curve/placement limitations) will be fixed, and we’ll get more features like bridges and schedule interrupts

greiskul
1 replies
21h18m

For me the tedious part of trains is that you pretty much have to use blueprints, and preferably a blueprint book of intersections. And creating your own intersections is very easy to make mistakes. I love how flexible the system is, but I don't like when a game forces you to use out of game resources like third party blueprints.

tomoyoirl
0 replies
17h50m

One does not need to use third party blueprints for train intersections at all, and it is easy to make designs where the intersections are robust. Not necessarily the highest performance, or most compact layouts, but a little reasoning goes a long way.

(They’re handy for the stations where you’re loading the train, though.)

moomin
0 replies
20h35m

If you could actually build them effectively with a personal port it would be a lot less painful. As it is, slapping down a huge ghost rail isn’t as useful as it should be.

jcranmer
0 replies
21h48m

* Oxygen Not Included: Everything you try to do has side effects. The game physics matters _a lot_. Mess up and everything dies. Easily the most stressful of the three. Has the shallowest tech tree of the lot, too.

ONI is a thermodynamics simulator disguised as a colony simulator.

itishappy
0 replies
17h21m

Tossing two more into the ring:

* Mindustry: Free casual episodic tower defense factory sim. Level based instead of infinite build, levels take about an hour.

* Dyson Sphere Program: Build factories that span start systems. Best looking game of the bunch, imho. Go from punching trees to a Kardashev type II/III civilization.

If you're into Factorio or Satisfactory, I highly recommend checking out Dyson Sphere Program.

bee_rider
0 replies
22h13m

Mindustry is also good, similar to Factorio but with a little more focus on the threat and a little less focus on the base building.

TillE
0 replies
1d

I'd say Satisfactory is primarily an exploration game, Factorio is about building, and ONI is about constantly living on the knife's edge of limited and rapidly dwindling resources. It's a brilliant, intricate design but yeah it's stressful.

bee_rider
2 replies
1d1h

If that sounds boring, you should hear about a first person shooter. You just click on heads.

Emma_Goldman
1 replies
23h18m

I get that this is a humourous and offhanded comment, but it's the equivalent of saying that basketball is 'just bouncing a ball'. A surprising amount of complexity emerges from putting teams of humans into a competitive sandbox environment with conflicting goals to, in each example, 'put the ball in the other team's basket', or 'click on the other team's avatars until they die'. They also overlap in that both are ultimately based on entering a skillful kinesthetic flow state, of becoming one with the ball, or your digital avatar, and gliding seamlessly, through muscle mechanics you've trained over hundreds of hours, through situations which are dynamic and non-identical because they involve opposing humans capable of interactivity and learning.

I've never really understood why FPS games are considered 'dumb'. All video games leverage our innate capacities of entertainment to fix our attention on unreal worlds, often to distraction, even addiction. Given that, it's difficult to transpose ideas of high and low brow onto the medium. The whole enterprise is dumb by design.

bee_rider
0 replies
22h7m

I agree actually, I just went with the maximally reductive description to make a point.

dexwiz
0 replies
1d1h

Yeah that is why most players just copy blueprints for balancers that have been vetted by people who do enjoy it. There are also mods that trivialize the task by creating oversized item chests that you can hook many inputs and outputs to. But the belt system is very optimized so a belt based balancer is almost always better for cpu usage. Also I think balancers are overrated and most of the time when you need huge balancers you should actually be using trains.

chornesays
0 replies
22h27m

It's a great test for what type of engineer you are. -- 1) Loves optimizing their belts: An engineer's engineer -- 2) Loves getting it to barely work and moves on: Hacker/Prototyper -- 3) Loves closing the game: Product Manager

TillE
0 replies
1d

You don't have to actually do any optimization at all, you can beat the game (launch a rocket) with inefficient spaghetti designs.

TeMPOraL
0 replies
1d1h

Think of it like Minecraft-like top-down 2D survival game (fun) with crafting (fun!), but which lets you automate away all the tedium of crafting, and then lets you automate all the automation, and...

It's fun for some.

appplication
2 replies
1d1h

One of the biggest reasons I’ve never dove into optimizing for factorio is the lack of tests. But then again if it had tests it’s probably feel too much like real work.

dexwiz
0 replies
1d1h

You can set up test suites in the editor put it’s a pain, because you have to build things like clocks and counters with in game mechanics or use mods.

But half the fun of the game is you can test in production because you’ll only cause downtime for yourself. I surveyed Reddit once and most people play with no or only minimal planning.

Ma8ee
0 replies
22h18m

Too much like real work was exactly what I felt after only a few hours of Factorio.

slaymaker1907
0 replies
17h47m

Oh yeah, splitters are the one thing I haven’t tried to build myself because they’re so tricky. I’ve done a ton with circuit networks and trains, but belt balancers are far less intuitive to work with.

calamari4065
0 replies
1d1h

You'd think that with as many hundreds of 4-4 balancers I've built, I'd remember the correct arrangement of splitters, but no, I somehow always flip the input or output splitters and end up with a subtly wrong balancer that I won't notice until a hundred hours and many dozens of copies later. I've totally given up and just resigned to using a blueprint book.

snapcaster
21 replies
1d4h

This is super cool! Will never not upvote a post about factorio. If anyone is reading this and into programming you should try the game, it's incredible

source: 3000 hours+ on the game :)

zeroonetwothree
15 replies
1d3h

To me it feels like programming with an awkward IDE.

elbear
7 replies
1d2h

So ... not enjoyable? I have yet to try it, but I was thinking of giving it a shot after reading so many positive comments.

rgoulter
1 replies
1d1h

I like how someone described it:

- I feel the same engagement as programming, but I don't have to be reliable or be told what to do: amazing.

- I feel the same engagement as programming, but I don't get anything out of doing it: this feels like work.

elbear
0 replies
22h11m

Yeah, the first one sounds good.

jl6
1 replies
1d2h

You can play it in many different ways. One advanced playstyle is to use combinators heavily, but you don't need to. A lot of people get hooked on optimizing their factories, which leads down a rabbit hole of ratio calculation, but that's also not required. It's perfectly enjoyable without doing anything extremely technical.

rgoulter
0 replies
1d1h

I'd say "feels like programming" applies to even a vanilla playstyle.

Broadly, the game is about building up systems. Even in a disorganised first playthrough, you'll naturally find 'systems' for solving things. (They'll just be hard to change, and hard to scale up, and hard to build upon).

Which is somewhat similar to how a someone who just learned to program might be able to complete a task, but probably in a way a more experienced dev wouldn't.

shepherdjerred
0 replies
1d2h

There's a free demo on Steam. Like anything, you're going to find people in both camps. The only way to know is to try it yourself.

falcolas
0 replies
1d2h

IMO, it's more like circuit design than programming. Similar mindset, slightly different method of solving issues.

And personally, if you're a fan of puzzles and optimization, I think you'll love it. There's an amazing amount of gameplay for the price. Worst case, you're out $35 and supporting an amazing developer.

dexwiz
0 replies
1d2h

You can do a lot of programming activities but different than web standards. It leans more into process engineering concepts. You can program. But it’s ladder logic and expressions instead of text. You can build dependency injection but it’s a rail network instead of annotation. Many similar concepts but expressed in a different form.

shepherdjerred
4 replies
1d2h

I get the same vibe, but it does make me wonder if text-based IDEs could somehow be replaced with something more intuitive like Factorio.

taeric
2 replies
1d2h

Domain specific tools do exist. :D

Easy example is level editors for video games. Rarely are those made by editing source code.

Other examples would be stuff like the kitchen designer in Ikea. Or, really, most any CAD tool.

shepherdjerred
1 replies
1d1h

Totally! I was wondering if those domain-specific tools would ever become more general, e.g. imagine writing general purpose programs in a 3D environment.

In particular, I was wondering if this could be a fantastic application of VR/Apple's Vision headset -- a 3D IDE of some sort, where you could organize code spatially, or where the code is (are?) objects that you manipulate instead of plaintext.

taeric
0 replies
1d

I don't think spatially laying out symbolic code is likely to get that useful. We already heavily resist significant whitespace. I am fond of "ascii art" for tests and any code where it can help, but I get the impression I'm in the minority there.

That said, expanding a palette to "things" that are placed in a very physical way makes sense. I'd suggest not thinking of it in terms of IDE, though. It is very common in CAD and other "editor" environments. Has been, for a long time, even.

__alexs
0 replies
1d2h

Yes it's called LabView. Has only slightly better usability than Factorio IME.

noqc
0 replies
1d2h

Yeah, you got it.

calamari4065
0 replies
1d

I've been tinkering with a custom programming language that compiles into a blueprint of Factorio logic pieces.

Apparently normal Factorio doesn't cause me enough suffering. I have to invent a problem to solve in the most absurdly complex way possible.

(Un)fortunately, wube has saved me from myself. They posted previews of new in game logic pieces that render most of what I was doing obsolete. I might pick it back up after the update, not sure yet.

Marthinwurer
2 replies
1d

Alternatively, you should avoid it like you would crack cocaine or heroin, because it's that addicting.

snapcaster
0 replies
20h46m

Yes fair enough, I should probably be a little more cautious about recommending it to people on this forum :)

Izikiel43
0 replies
22h25m

Yeah, that's my issue with the game, I know if I start playing I won't stop for a few days

tmtvl
0 replies
21h9m

I bought the game a few years ago and have about 20 hours in it. That's like 5 or so attempts of me trying my damnedest to get into it and bouncing off. I thitk GregTech just ruined me and my expectations for a crafting game.

nindalf
0 replies
1d1h

Completely agree with this. For people interested, I wrote about why software folks would enjoy Factorio (https://blog.nindalf.com/posts/factorio-and-software-enginee...).

Chirono
8 replies
1d5h

For anyone wondering what this does, it looks like it produces optimal configurations for belt balancers given a specified number of input and output belts. Belt balancers evenly distribute items between belts: https://wiki.factorio.com/Balancer_mechanics

perihelions
7 replies
1d4h

Fun to see that that math (linked in that wiki) coincides with early 20th-century analog telephony problems—the problem of how to arrange electromechanical switches to support large numbers of simultaneous circuits, avoiding bottlenecks.

There's people reading Bell Labs technical papers from the 1950's as part of the process of playing an addictive video game.

TeMPOraL
6 replies
1d

There's people reading Bell Labs technical papers from the 1950's as part of the process of playing an addictive video game.

It's a nice break from reading orbital mechanics textbooks as part of the process of playing another addictive video game.

beacon294
3 replies
23h52m

What games?

kroltan
0 replies
23h10m

Bell labs => Factorio

Orbital mechanics => Kerbal Space Program

jconnop
0 replies
23h10m

The latter is surely Kerbal Space Program.

Izikiel43
0 replies
22h51m

Sounds like kerbal space program?

skirmish
0 replies
15h47m

I personally bought this real world fighter plane tactics book for playing military flight sims: https://www.amazon.com/dp/0870210599 .

perihelions
0 replies
1d

Origin of my HN name! :)

Sohcahtoa82
7 replies
1d

Is belt balancing really that important in Factorio?

I've played Factorio, but only launched the rocket once and I think have about 100 hours in it. I never bothered with belt balancing, and simply had many rows of belts traveling east, with splitters moving things to columns of assemblers which then go to another belt to the east.

As I expanded the factory to build new products, I'd play whack-a-mole with fixing bottle necks in materials. Heck, I never even used trains or any sort of drone.

Have I just never built a factory big enough to need balancing? What does it really accomplish versus just overproducing source materials and allowing the factory to back up a little?

ynik
4 replies
1d

Belt balancing is necessary when unloading trains, as otherwise uneven consumption can lead to some chests/wagons running out of resources but the train doesn't leave because other wagons are still full.

For mining outputs, it can also be nice to avoid the outpost getting slow/stuck (never able to fill a train) when ore runs out for the outer lanes of miners.

Anywhere else, balancers are unnecessary and just serve to obfuscate a lack of resources.

(But if you really want to play without any balancers at all, that's quite possible: the train problems can also be solved by letting trains leave on a schedule independent of cargo status. All remaining balancers, including those on mining outposts, can be replaced with priority splitters.)

a1369209993
2 replies
18h19m

Belt balancing is necessary when unloading trains, as otherwise uneven consumption can lead to some chests/wagons running out of resources

Not in general, actually. If you standardize on N-wagon trains, and build assemblers (et al) in groups of N, each assembler can take inputs from one wagon in lockstep with N-1 other assemblers taking from the N-1 other wagons, and since productivity is deterministic[0], they'll also produce outputs in lockstep.

This means that as long as all your input trains are balanced (they should be, by being completely full), all your output trains will also be balanced. Science labs are same as any other machine, just without output, and trains feeding a logistics network can unload into active provider chests.

In practice I pretty much only use balancers for a: mining outposts, or b: random kludges, at least when and if I'm using trains as my main transport mechanism.

0: Ask me about quality once 2.0 drops; for now I just special-case uranium processing.

jnwatson
1 replies
17h48m

It is even easier if you standardize on power-of-2-sized trains.

a1369209993
0 replies
17h21m

Strictly speaking it hardly ever actually matters, but yeah I usually use N=8 just so I don't have to care.

It should definitely be a even number so that if your machine layout doesn't work modulo 7 tiles (=1 wagon-length), you can group up pairs and use 14 tiles, but it might be helpful to use N=6 or N=12, and sometimes build modulo 21 tiles. (I haven't needed/tryed that so far, so I can't comment on how well it works.)

chainingsolid
0 replies
17h47m

You could also solve uneven train unloading by just having the train leave after a certain ammount of time or empty.

somat
0 replies
14h58m

The common method of playing factorio is to maximize throughput, nothing wrong with that, But I don't enjoy it much. I always play trying to create minimal belt, back pressure driven kanban type systems, heavy on logic, light on throughput. While I get the distinct feeling I am "playing it wrong" I enjoy setting up logic more than balancing belts.

aeneasmackenzie
0 replies
23h56m

It ensures that your X belt input blueprint and your X belt output blueprint are actually using X belts and not bottlenecked on one somewhere. At a certain point it stops being necessary except for loading and unloading trains, unless you use circuits.

kzrdude
6 replies
1d4h

Even the 90 degree turn 4x4 balancer is new to me, nice to see.

less_less
2 replies
22h39m

The 90 degree turn 4x4 balancer is even better if your inputs and/or outputs are on opposite sides, making a T-shape. This is pretty common depending on the position of the balancer. In that case it fits into a 4x6 rectangle.

kzrdude
1 replies
19h46m

Do you happen to have a picture? Not sure I follow that, what are the three legs of the T shape, I mean?

Arrath
0 replies
15h53m

Sounds like having inputs entering left/right meeting in a balancer that turns the inputs 90 and outputs up or down.

r2_pilot
0 replies
1d4h

I didn't see that (I've been using these for a while now, they're especially helpful with my K2+SE run) so I'll have to check into that some more.

patio11
0 replies
1d3h

That’s going straight into my blueprint book; solves a problem I have at almost every mining train station much more elegantly than the standard linear 4x4 does.

francoisdevlin
0 replies
1d4h

Dude, that is sick.

ivanjermakov
3 replies
1d4h

What is the math name for the problem of belt balancing? The one that SAT solvers solve.

Perhaps Beneš network?

reaperman
0 replies
23h2m

Clos networks is what I studied for factorio belt balancing.

r2_pilot
0 replies
1d4h

It's the Boolean satisfiability problem : https://en.m.wikipedia.org/wiki/Boolean_satisfiability_probl...

dragontamer
0 replies
1d2h

Benes network is a simple recursive pattern for power-of-2. So a 4-to-4, 8-to-8, and 16-to-16 perfect balancer can be calculated out by hand using Benes networks.

This allegedly creates odd-numbers like 7-to-7 balancers. But in my experience, i just grab a 8-to-8 balancer from my blueprints and ignore 1 input/output.

thenipper
2 replies
1d2h

I definitely knew people in the Wayfair logistics org that used the same kind of algos that we used at work with their Factorio games...

amohn9
1 replies
1d

Maybe instead of using our OR tools for Factorio, we should run our supply chain simulations in Factorio...

(Hi probable coworker)

thenipper
0 replies
21h26m

hello definite coworker

sapiogram
1 replies
1d4h

Can this also generate "universal" balancers? I've found them more useful in practice: https://wiki.factorio.com/Balancer_mechanics#Universal_balan...

klysm
0 replies
1d4h

I don't see why that couldn't be added as constraints

jamesrom
1 replies
15h16m

This is awesome, but balancing belts is usually a fool's errand. It's better to design your base as factories with inputs prioritized with priority splitters.

fnordpiglet
0 replies
14h30m

Is it a fools errand if a SAT solver can tell you the optimal belt balancer configuration?

Yesway
1 replies
1d4h

You can combine narrow balancers to make wider balancers. That way it is possible to save space, energy, latency .... same as is done in modern CPU / GPUs...

And funny enough, ultimate Factorio tool is tool to make great cpus... ;)

I like your, what i presume is, "joke" animation at the end…

Yesway
0 replies
1d

whole system look can provide some unexpected "optimizations" too. is balancing really even needed in/as a solution... in cases when synchronization is not necessary you can simplify system greatly just by oversaturating belts with inputs. output machinery cadence dictates whole feeding mechanism rate.

Lichtso
1 replies
1d5h

Cool project! Wish we would see more applications of SAT solvers or logic programming in general.

JonChesterfield
0 replies
1d3h

SAT solvers are magic. CSP solvers are the same magic with a much friendlier interface.

Got a discrete NP hard problem? A CSP solver will probably get that done.

yogurtboy
0 replies
1d1h

This is really cool! Is there a page that has a list of useful concepts like this that might not be explicitly mentioned in the game itself? I don't have that much fun trolling the forums.

terrelln
0 replies
1d3h

I've recently started playing Factorio for the first time, and was thinking about using SAT solvers for automated sub-factory blueprint design with beacons. E.g. for a given recipe how do I design a sub-factory that builds the recipe with the minimum number of entities (or a given total entity weight, to allow for weighting buildings based on their impact on UPS). I've seen a paper [0] on a similar problem, but it doesn't take beacons into account. It seems like beacons make the problem significantly harder, because now positioning matters in order to share beacons. Does anyone have any ideas on how to approach this?

[0] https://arxiv.org/pdf/2310.01505.pdf

makerdiety
0 replies
17h7m

Doing anything with Turing-complete games like Factorio or Minecraft is never impressive. Because building SAT solvers or, more generally, logic gate nodes for an abstract Turing based computing machine with digital video game items like in-game conveyor belts is only running a simulation on top of a finite substrate that isn't optimized for productive work. And I don't care one bit about people deriving pleasure from leisure like digital entertainment.

In contrast, what is impressive amounts to nothing less than discovering a successor to the universal Turing machine. And you can do that with pen and paper instead of fancy technical equipment like a clunky and uncomfortable development environment that's concerned with manipulating virtual conveyor belts as one of its programming primitives.

jvanderbot
0 replies
1d4h

This is my favorite pastime as well! Well done. I've also dipped my toes in the "over engineer a game" with:

A highfleet ship optimizer which chooses optimal module sets using ILP at

https://hfopt.jodavaho.io (try desktop site on mobile)

And a hunt showdown loadout A/B test package that lets you run stats queries on your game journal at (for now)

https://crates.io/crates/kda-tools

j2kun
0 replies
1d

I wonder if there are any real-world factory configurations that employ SAT solving techniques.

ineedasername
0 replies
22h38m

On Valentines Day? Seriously?

This post should be titled “I’m going to ruin Valentine’s Day for every Factorio player here with a non-Factorio partner”

I’ll see you all in a month, linking to my own post titled “How Factorio Ruined My Marriage”

ge0ffrey
0 replies
5h56m

I once optimized Factorio's belts with OptaPlanner (now Timefold.ai), our open source metaheuristics solver in Java.

The source code is still here: https://github.com/kiegroup/optaplanner-quickstarts/tree/8.6...

bloopernova
0 replies
1d3h

Interesting! My standard play style in Factorio is to use rail squares and 12-lanes inside those squares. I use 12 because 2 warehouses from the warehouse mod are 12 squares wide. All my blueprints are based on that, along with all the Angels+Bobs mods it makes for a fun-to-me playthrough. All my blueprints are based on 12 buildings, and it's neat because many of the modded buildings are 3, 5, or 7 squares wide so I have 3 standard sizes of lane direction changes, inputs, outputs, etc. In my current playthrough I'm up to almost 1,000 stations :D

I would like to see if this can create a 12 to 12 universal+lane+throughput-unlimited balancer. Plus I've been wanting a 12 to 24, 12 to 36, and 12 to 48 lane balancer too because I'm a masochist :)