Open eterevsky opened 1 year ago
Hello, sorry for not getting back to your well thought-out post earlier. I'm pretty out of my depth when it comes to this topic, but I will try and wade into the topic when I tackle a solver rewrite that is upcoming one of these days. I'll keep this suggestion in mind!
After I wrote this proposal, I had a look at a couple of other tools and it looks like Helmod and https://factoriolab.github.io/ are already doing this.
Yeah seems like it. It's not a panacea from what I've heard about it in Helmod, it definitely still has failure modes. We'll see how it goes.
Suggestion
Recently I've been trying to model a mid-game SeaBlock factory in Factory Planner. With too many circular dependencies between the recipes, both traditional and matrix solvers were basically broken. What I am wondering is whether it would be possible to overcome these problems by using a linear programming optimization algorithm, like Simplex method.
The overall logic would be as follows:
This looks like a typical linear programming problem, which could be solved by any method of solving linear programming problems. The advantages of this compared to just solving a system of linear equations is that this way we are able to correctly handle several different recipes producing the same products as well as any other cases which result in linear dependencies in the system.
As an additional benefit, it is possible to give user a choice which byproducts they want to allow. Just change some of the constraints on $y_j$ from inequalities $y_j \ge 0$ to $y_j = 0$.
It looks like there's at least one usable implementation of Simplex algorithm in Lua here: https://github.com/geoffleyland/luasimplex.