plan_factory
Optimize factory production with linear programming across unlocked recipes, controlling resource sources, exports, machine clocks, and objectives like max power or minimum raw usage.
Instructions
Optimise a factory with an LP over this world's unlocked recipes.
sources says which resource nodes may feed the plan, as a list of selectors --
named regions, radii, grid cells, compass directions, or specific node ids::
["north"] everything in the northern half
["region:Northern Forest"] one named region
["near:0,-2000,900"] within 900 m of (0, -2000) metres
["node:BP_ResourceNode30_103"] one exact node (repeatable)
["grid:X3Y4", "grid:X3Y5"] specific grid cells
["north", "resource:Crude Oil"] narrow a location to one resourceOmit it and the whole map is in scope. Use search_resource_nodes to discover ids.
Machine counts are whole buildings at a derived clock: a 52.8 machine-equivalent result is reported as 53 machines at 99.6%. That is exact, always a clean ratio, and provably the power-optimal way to run that throughput, so ordinary ratio underclocking is automatic and needs no parameter.
extractor_clocks overclocks the SOURCE NODES only, e.g. [1.0, 1.5, 2.0, 2.5].
That is the usual play: a node set is fixed, so speed is the only way to get more
out of it, whereas overclocking production machines mostly burns power. Each
machine above 100% needs Power Shards, which nothing here counts.
clocks is only for asking a different question: passing [0.5, 1.0] lets the
solver SPREAD throughput over more machines to save power, which is real but not
free, so each machine is priced at machine_cost_mw (default 5 MW, just above
the 2.58 MW/machine that trade was measured to be worth). Overclock modes are not
offered by default because they consume Power Shards, which nothing here counts.
objective: max_mw | max_item | min_raw | min_machines | min_power. Every item is balanced as an EQUALITY, so a byproduct with no consumer makes the plan infeasible rather than silently vanishing.
exports is the whitelist of what may leave, and the single most load-bearing
argument here; default is power only, which is often infeasible for crude oil::
exports=["MW"] power out, plant must be self-powered
exports=["Plastic", "Rubber"] items out, NO power export
exports=["MW", "Plastic", "Rubber"] both -- MW must be listed explicitlyTwo things worth reading twice. The power token is MW (mw, power and
Power all work too), not the item name of anything. And exports
replaces the default rather than extending it: naming an item drops MW, which
is deliberate, because exporting MW also forbids drawing from the existing grid.
A token matching no item is refused by name rather than solved around.
sloops is a BUDGET, not a switch: it is how many Somersloops you will actually
commit, and the solver spends up to that many wherever they buy the most. Default 0
spends none, because only a fixed number exist on the whole map and a plan that
quietly assumed them would be unbuildable. Each one costs 4x power for 2x output on
its machine, so they are placed one at a time across many machines rather than
filling one -- output is linear in sloops and power is quadratic, so spreading wins.
logistics_items pins named items into the belt/pipe table however small their
flow, as rows ADDED to the limit biggest by volume. Without it, a two-item
question can fall off the bottom of a big plan's flow table.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| plan | No | recall a saved plan by name | |
| save | No | ||
| limit | No | max rows (hard cap 25) | |
| world | No | ||
| clocks | No | ||
| sloops | No | Somersloops the plan may spend; 0 spends none | |
| exports | No | ||
| save_as | No | store this request under a name | |
| sources | No | ||
| supplied | No | items another plan hands this one, {item: per-minute} | |
| objective | No | max_mw | |
| allow_sinks | No | ||
| for_factory | No | factory label this plan is for | |
| target_item | No | ||
| only_recipes | No | ||
| recycle_once | No | recipes that may run but must not feed each other, e.g. ['Recycled'] | |
| exclude_recipes | No | ||
| export_minimums | No | ||
| logistics_items | No | items whose belt/pipe rows to pin, whatever their volume | |
| machine_cost_mw | No | ||
| only_free_nodes | No | ||
| plan_notes_text | No | note stored with save_as | |
| extractor_clocks | No | ||
| water_extractors | No | how many Water Extractors your site can actually hold |