OrderedSet86 / gtnh-flow

Factory Optimization Flowcharts for Gregtech: New Horizons
MIT License
84 stars 24 forks source link

NotImplementedError not hitting #12

Closed austinmccalley closed 1 year ago

austinmccalley commented 1 year ago

I get an empty set error when using the following config: https://paste.super.fish/p/LT2qXI.yaml for integrated logic circuits. I implemented a fix for it with PR #11 to prevent the crash and allow it to hit the NotImplementedError error.

Here is the NotImplementedError when the PR is implemented

E:\code\gtnh-flow>python factory_graph.py
Please enter project path (example: "power/oil/light_fuel.yaml", tab autocomplete allowed)
> circuits/integrated_logic_circuit.yaml
INFO:root:Fixing factory cycle by redirecting "Ruby Lens" to sink
INFO:root:Fixing factory cycle by redirecting "Monocrystalline Silicon Boule" to sink
INFO:root:Running linear solver...
INFO:root:Solving multi-output scenario involving fine copper wire!
EmptySet
INFO:root:Searching for inconsistency in system of equations...
Traceback (most recent call last):
  File "E:\code\gtnh-flow\factory_graph.py", line 94, in <module>
    pc.run()
  File "E:\code\gtnh-flow\factory_graph.py", line 88, in run
    graph_gen(self, project_name, recipes, graph_config)
  File "E:\code\gtnh-flow\src\graph\_solver.py", line 611, in systemOfEquationsSolverGraphGen
    solver.run()
  File "E:\code\gtnh-flow\src\graph\_solver.py", line 67, in run
    self._solve()
  File "E:\code\gtnh-flow\src\graph\_solver.py", line 353, in _solve
    self._searchForInconsistency()
  File "E:\code\gtnh-flow\src\graph\_solver.py", line 417, in _searchForInconsistency
    raise NotImplementedError(f'{expr} {sorted(solved_values.items(), key=lambda tup: str(tup[0]))}')
NotImplementedError: 0 [(v0, 4), (v1, 8), (v10, 1), (v11, 2), (v12, 8), (v13, 4), (v14, 4), (v16, 4), (v19, 1.00000000000000), (v2, 4), (v22, 1.00000000000000), (v24, 1.00000000000000), (v25, 4.00000000000000), (v28, 1.00000000000000), (v3, 2), (v31, 8.00000000000000), (v32, 1.00000000000000), (v33, 4.00000000000000), (v37, 1.00000000000000), (v39, 1.00000000000000), (v4, 1), (v41, 1.00000000000000), (v42, 1.00000000000000), (v44, 4.00000000000000), (v45, 32.0000000000000), (v48, 4.00000000000000), (v49, 4.00000000000000), (v5, 4), (v6, 4), (v7, 8), (v8, 1), (v9, 16)]
OrderedSet86 commented 1 year ago

The "target" argument means "force the machine to have a count that matches this product per second quantity." You should not use it on every node. You should have one, or perhaps 2-3 of them (in rare cases) in the entire yaml file. The information from the one machine propagates to everything else in the graph.

When I remove all "target" args but the first target: integrated logic circuit: 1 I get this, which I believe is your desired output: test

The README does not cover the usage of target so I think this is the root issue and I have pushed a PR accordingly. The NotImplementedError as it exists is vague, but should never be reached from a normal (ie describes a real GTNH scenario) YAML config file.