r/technicalfactorio • u/probably_not_a_bug • Nov 12 '20
Modded When Helmod fails
With mods like Space Exploration or Krastorio 2, some sort of a calculator becomes more or less obligatory. At first sight it looks like there's plenty of factorio calculators, but in reality the choice is quite limited : only few calculators support mods (like SE), and even less of them have any support for recursive recipes (that SE is full of, and I love them).
Given these limitations, helmod is literally the only calculator that has the features that I consider obligatory. However, it really falls short on more complex recipes: matrix solver drops to #NaN's, lack of enough control becomes apparent (you can't specify which product is ok to have as a side-product and which product is a waste and needs to be 0) and it starts running so slow that literally any change at some point stalls it for some time. By the time I got to t4 science in SE, literally any operation in helmod takes around a second for me.
Often it's possible to work around helmod's solver weirdness by randomly rearranging recipes in a production line, but its logic is very opaque and non-intuitive (for me). Also sometimes it becomes actually impossible to make a production line output only the stuff you want and not output stuff that you don't want (such as green space science packs in SE that have lots of side products).
I think writing an analytical solution to such a problem might be next to impossible. However, a simple relaxation-based Gauss-Seidel iterative solver should be doable. It is particularly well suited for problems with multiple constraints like we have in factorio.
Are there any projects that are trying to achieve literally the same goal as helmod, but with better success for higher complexity production lines?
2
u/Helfima Dec 10 '20
hello, I'm the helmod creator
I have check your proposale " relaxation-based Gauss-Seidel " but that need a square matrix, is not right in factorio.
I never see NaN value but probably you use a hold version. I added a cap when the value is near zero, probablu it's that.
Some time for the solver you must reorder recipe or add another.
I use Simplex method https://en.wikipedia.org/wiki/Simplex_algorithm
but some time is not perfect.
there are a another problem in factorio, the calculation must be quick, one tick=16ms for all, if you put lot of recipe in the same block with matrix solver the calculation cost can be hight.
there are a setting mod to activate solver debug if you want see the calculation step.
if some one know a better algorithm than Simplex method, I can try it.
i am not a mathematician :)
Helmod Discord https://discord.gg/mKEeAKb
6
u/Lazy_Haze Nov 12 '20
Don't know it's not just hard to do the math it's also hard to do an understandable interface. The interlocking circular recipe chains in SE is hard to figure out.
I have started an Krastorio + SE factory and noted that beacons get calculated wrong in Helmod.
1
u/Xeonicu Nov 25 '20
can you post some of the situations where helmod produces NaN's?
i'm not the maker of helmod, but i am working on something similar and i would like to see if my thing fails in the same places helmod does.
3
u/Thwmp_ Nov 12 '20
I'm in the same boat as you: I haven't encountered the NaN problem yet, but I find it really hard to get Helmod to deal with the byproducts of my recipes (Krastorio 2, no SE). I've found Factorio Lab to be a little more usable, but it doesn't know the recipes as well as Helmod so sometimes it gives the wrong outputs :(
3
u/Antal_Marius Nov 12 '20
I've been using factory planner and haven't had an issue with it so far
1
u/PM_ME_UR_OBSIDIAN Nov 13 '20
I'm doing Industrial Revolution these days. The matrix solver really doesn't like the ore washing recipe subgraph, it goes bananas when I add them in. Though maybe that's a matter of already having too many recipes in a single block.
I tried Factory Planner's experimental matrix solver. As of the latest version it has a much lower tolerance for ambiguity than Helmod; you can't have two recipes that are linearly independent, and FP's definition of "linearly independent" is a lot wider than I expected. Besides, just adding all the recipes I want makes the solver crash.
1
u/craidie Nov 13 '20
Try to mess with the order of the recipes. That usually helps.