Factory solver based on linear programming

by B_head

The Factorio calculator. Calculate the quantities of machines and ingredients required in a factory to hit your target production rate. (Compatible with 2.1; see changelog)

Utilities
3 months ago
2.0
2.55K

b Runtime crash on selecting fluid as constraint

13 days ago
(updated 12 days ago)

Hi! I adapted v0.8.2 for the 2.1 experimental branch and used it with v0.17.2 of Factory Library, and the mod works fine at first look, but every time I select a fluid as a constraint in the Factory Solver, I get the following error message, after which the game returns to the main menu:

The mod Factory solver based on linear programming (1.0.0) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event factory_solver::on_gui_click (ID 1)
LuaEntityPrototype doesn't contain key pumping_speed.
stack traceback:
    [C]: in function '__index'
    __factory_solver__/ui/solution_settings.lua:138: in function 'get_pump_throughputs'
    __factory_solver__/ui/solution_settings.lua:235: in function 'build_throughput_buttons'
    __factory_solver__/ui/solution_settings.lua:305: in function 'build_amount_popup'
    __factory_solver__/ui/solution_settings.lua:414: in function 'build_constraint_row'
    __factory_solver__/ui/solution_settings.lua:450: in function 'handler'
    __flib__/gui.lua:173: in function 'dispatch'
    __factory_solver__/fs_util.lua:233: in function 'dispatch_to_subtree'
    __factory_solver__/ui/constraint_adder.lua:183: in function 'handler'
    __flib__/gui.lua:173: in function 'dispatch'
    __factory_solver__/control.lua:394: in function <__factory_solver__/control.lua:393>

I also quickly tested with Factorio 2.0 (along with v0.16.5 of Factorio Library and v2.5.1 of Creative Mod), and the same error did not occur.

[EDIT]: It would seem that the pumping_speed property is no longer accessible at runtime in 2.1 (and the use of that access was already formally deprecated in 2.0). Replacing it with get_pumping_speed("normal") seems to work, but I can see in your code that you were trying to avoid some self-bound-call trap associated with that (not that I understand). I tested and saw no special increase in RAM-usage when using the solver with fluid constraints.

New response