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!
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?
> 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.
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.
> 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.
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).
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"
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
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.
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.
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.
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.
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.
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.
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!
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...
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.
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
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?
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.)
> 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.
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.
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.
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
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.
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.
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?
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!
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.
The vast majority of Factorio players are not familiar with programming. A small but very vocal and very enthusiastic minority are though.
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).
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"
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.
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.
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.
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!
It's fun for some.
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?
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.)
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.
source: 3000 hours+ on the game :)
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.
(Hi probable coworker)
[0] https://arxiv.org/pdf/2310.01505.pdf