Closed Sopel97 closed 6 months ago
The enforced removal of back edges was due to the old algorithm, which could not handle them properly. I think it is fine to add a config option, but it should be default KEEP_BACK_EDGES: false
for reasons I'll explain below.
The new LP-based one ""can"" handle them, with the caveat that it can have a confusing choice of external product in the cycle (it can pick anything in a positive or negative recycling loop to sink/source) and this has downstream ramifications for the rest of the calculated recycling. You can read more about this here: https://github.com/OrderedSet86/flow2/blob/main/math.md
I'll take a look at your YAML files in a bit.
Actually, it looks like this version of gtnh-flow doesn't even handle adding source/sink at all in cycles. For example, I took your non-[recycle] chart and removed the replenishing source of sulfuric acid. The solver just spits out "hey there's an unresolved variable" and quits.
- m: mixer
tier: HV
I:
diesel: 1000
tetranitromethane: 20
O:
cetane-boosted diesel: 1000
eut: 480
dur: 1
target:
cetane-boosted diesel: 1000
- m: chemical reactor
tier: MV
I:
nitric acid: 8000
ethenone: 1000
O:
tetranitromethane: 2000
eut: 120
dur: 24
- m: chemical reactor
tier: MV
I:
acetic acid: 1000
sulfuric acid: 1000
O:
ethenone: 1000
diluted sulfuric acid: 1000
eut: 120
dur: 8
- m: distillery
tier: LV
I:
diluted sulfuric acid: 75
O:
sulfuric acid: 50
eut: 30
dur: 1.5
- m: chemical reactor
tier: LV
I:
methanol: 1000
carbon monoxide: 1000
O:
acetic acid: 1000
eut: 30
dur: 15
- m: chemical reactor
tier: MV
I:
hydrogen: 4000
carbon monoxide: 1000
O:
methanol: 1000
eut: 96
dur: 6
- m: chemical reactor
tier: LV
I:
charcoal: 1
oxygen: 1000
O:
carbon monoxide: 1000
eut: 7
dur: 4
- m: chemical reactor
tier: LV
I:
nitrogen dioxide: 2000
water: 1000
O:
nitric acid: 2000
nitric oxide: 1000
eut: 30
dur: 12
- m: chemical reactor
tier: LV
I:
oxygen: 1000
nitric oxide: 1000
O:
nitrogen dioxide: 1000
eut: 30
dur: 8
- m: chemical reactor
tier: LV
I:
oxygen: 5000
ammonia: 2000
O:
nitric oxide: 2000
eut: 30
dur: 8
- m: chemical reactor
tier: HV
I:
nitrogen: 1000
hydrogen: 3000
O:
ammonia: 1000
eut: 384
dur: 16
The first crash is probably a logic error with the implementation of the variable code, but I'm probably just going to ignore it in favor of development on flowv2...
The IndexError
issue is fixed now, and there is the KEEP_BACK_EDGES: false
flag from earlier. Flow V2 dev is out of the scope of this issue so closing
This is the diagram I want, without
[recycle]
annotations. It does not work, crashes.Diagram (1):
This is the diagram (1) modified to actually compile, needed 2
[recycle]
outputs. Notice, however, that the output is not ideal. It resolves to a positive production of sulfuric acid and nitric oxide. Diagram (2):Now. I don't know the reason why the first one crashes, nor the reason why the second doesn't solve it completely. What I know is that not removing the back edges fixes the issue, and actually shows where the reuse happens in the diagram. I think it's all more natural to include back edges in intrinsically cyclic processes; I don't understand why the backedges are being removed at all.
I think it should at least be an option to keep back edges, so that a larger set of diagrams can be resolved.