Enhancing Factorio with SAT solvers

SAT and constraint solvers are being used to automatically generate optimal belt balancer layouts in the factory-building game Factorio, replacing trial-and-error blueprints for routing items evenly across conveyor belts. Commenters connect these designs to classic network topologies like Beneš and Clos networks, analog telephony, and real-world logistics and optimization tools, highlighting how game problems mirror serious NP-hard scheduling and routing challenges. Opinions differ on how essential perfect balancing is in actual gameplay, but many see this as a compelling example of “over-engineering for fun” and a gateway for players to learn about formal methods and optimization.

Project purpose and technical aspects

  • Tool uses SAT solving to generate optimal Factorio belt balancers for specified input/output counts.
  • Handles non-trivial layouts, e.g., compact 90-degree 4×4 balancers; commenters find these practically useful and blueprint-worthy.
  • Discussion ties balancer math to classic network topologies (Beneš and Clos networks) and notes that power-of-two balancers can often be composed or oversized (e.g., use 8→8 for 7→7).
  • Some suggest extending constraints to generate “universal” balancers and mixed-width balancers (e.g., 12→24, 12→36), and combining narrow balancers to form wider ones.

SAT/CSP solvers and tooling

  • Strong enthusiasm for SAT and CSP solvers as general tools for NP-hard discrete problems.
  • Other examples mentioned: ILP-based ship optimizers, game loadout optimizers, and metaheuristics (e.g., OptaPlanner/Timefold) used on Factorio layouts.
  • One commenter wonders about real-world factories using similar optimization, but no concrete examples are given.

Belt balancers: mechanics, utility, and controversy

  • Balancers are described as common but poorly understood; most players copy vetted blueprints since designing and testing is error-prone.
  • Key mechanical points: belts have two independent lanes; splitters preserve lanes; non–power-of-two and “same lane” balancers are especially tricky.
  • Pro-balancer arguments: crucial for train unloading and mining outposts to avoid uneven depletion and stuck trains.
  • Skeptical view: balancers often just hide upstream shortages; many cases are better handled with priority splitters, schedules, or trains; some call extensive balancing a “fool’s errand” even if optimizable by SAT.

Factorio and optimization playstyles

  • Many praise Factorio as deeply engaging, akin to programming or circuit design, especially for people who enjoy puzzles and optimization.
  • Others find it tedious or too similar to work, citing lack of tests and reliance on external blueprints.
  • Multiple factory/building games are compared (Satisfactory, Oxygen Not Included, Mindustry, Dyson Sphere Program), highlighting different balances of stress, guidance, and complexity.
  • Some players intentionally avoid maximal throughput, favoring kanban-style, logic-heavy but low-throughput designs.

Abstraction, credit, and user awareness

  • Discussion around PySAT: convenient abstraction but can obscure which underlying solver is used and who should be credited.
  • Debate over whether users “should” or “would” care about underlying solvers:
    • One side emphasizes abstraction and user indifference to internals.
    • The other stresses transparency, proper attribution, and the value of understanding at least one level below one’s usual abstraction.
  • Analogies are drawn to SQL vs specific databases and to deep software/hardware stacks, with differing views on where to draw the line of practical concern.