OrderedSet86 / gtnh-flow

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

Failing to create chart for bauxite slurry #17

Closed garaiza-93 closed 6 months ago

garaiza-93 commented 1 year ago

I'm trying to recreate this chart in gtnh-flow: image

Config

# === FUNCTIONALITY SETTINGS ===
POWER_LINE: true # Automatically burns all leftover fuels
DO_NOT_BURN: # If POWER_LINE is true, don't burn these
  - toluene
  - phenol
  - hydrogen
  - creosote oil
  - sulfuric naphtha
  - sulfuric gas
  - sulfuric heavy fuel
  - sulfuric light fuel
  - coal tar oil
  - naphtha
  - creosote oil
  - biomass
  - oil
  - seed oil
OUTPUT_FORMAT: png # png or pdf (pdf is searchable)
USE_RAINBOW_EDGES: true # feature to help distinguish between overlapping edges
DUR_FORMAT: sec # choose either "ticks" or "sec"
VIEW_ON_COMPLETION: false
KEEP_BACK_EDGES: false

PRINT_BOTTLENECKS: true
USE_BOTTLENECK_EXACT_VOLTAGE: false
BOTTLENECK_MIN_VOLTAGE: IV
MAX_BOTTLENECKS: 5

# === VISUALS ===
GENERAL_FONT: arial  # nodes and edges
SUMMARY_FONT: arial
GROUP_FONT: verdana
NODE_FONTSIZE: 11
EDGE_FONTSIZE: 10
GROUP_FONTSIZE: 18
BACKGROUND_COLOR: '#043742'
EDGECOLOR_CYCLE:
  - '#b58900' # 'yellow'
  - '#cb4b16' # 'orange'
  - '#dc322f' # 'red'
  - '#d33682' # 'magenta'
  - '#6c71c4' # 'violet'
  - '#268bd2' # 'blue'
  - '#2aa198' # 'cyan'
  - '#859900' # 'green'
SOURCESINK_COLOR: 'ghostwhite'
NONLOCKEDNODE_COLOR: 'lightblue2'
LOCKEDNODE_COLOR: 'green'
POSITIVE_COLOR: '#859900'
NEGATIVE_COLOR: '#dc322f'

ORIENTATION: 'TB'
# TB: Vertical, LR: Horizontal, BT: Vertical Inverted, RL: Horizontal Inverted
# [TB, LR, BT, RL]

LINE_STYLE: 'spline'
# [line, spline, polyline, curved] 

RANKSEP: '1.25'
NODESEP: '0.25'
# Node separation size in X/Y. 
# This is a suggestion, the graphing algorithm will ignore numbers that are too small.

COMBINE_INPUTS: true
COMBINE_OUTPUTS: true
# Whether to (visually) create a new meta node before multi-input/after multi-output ports

# { You should probably only modify these if you are dev
DEBUG_SHOW_EVERY_STEP: false
SHOW_MACHINE_INDICES: false
STRIP_BRACKETS: true
# }

Error

> bauxite_slurry.yaml
INFO:root:Fixing factory cycle by redirecting "Sodium Hydroxide" to sink
INFO:root:Fixing factory cycle by redirecting "Sodium Hydroxide" to sink
INFO:root:Fixing factory cycle by redirecting "Aluminium Hydroxide" to sink
INFO:root:Fixing factory cycle by redirecting "Sodium Hydroxide" to sink
INFO:root:Fixing factory cycle by redirecting "Sodium Hydroxide" to sink
INFO:root:Fixing factory cycle by redirecting "Quicklime" to sink
INFO:root:Fixing factory cycle by redirecting "Carbon Dioxide" to sink
INFO:root:Fixing factory cycle by redirecting "Quicklime" to sink
INFO:root:Running linear solver...
INFO:root:Solving multi-output scenario involving sodium dust!
INFO:root:Solving multi-input scenario involving sodium hydroxide!
INFO:root:Solving multi-output scenario involving sodium hydroxide!
Traceback (most recent call last):
  File "/home/goose/gitclones/gtnh-flow/factory_graph.py", line 135, in <module>
    pc.run()
  File "/home/goose/gitclones/gtnh-flow/factory_graph.py", line 128, in run
    self.run_interactive()
  File "/home/goose/gitclones/gtnh-flow/factory_graph.py", line 98, in run_interactive
    self.generate_one(project_name)
  File "/home/goose/gitclones/gtnh-flow/factory_graph.py", line 54, in generate_one
    self.graph_gen(self, project_name[:-5], recipes, self.graph_config)
  File "/home/goose/gitclones/gtnh-flow/src/graph/_solver.py", line 620, in systemOfEquationsSolverGraphGen
    solver.run()
  File "/home/goose/gitclones/gtnh-flow/src/graph/_solver.py", line 65, in run
    self._addMachineMachineEdges() # add equations between machines, including complex situations - eg multi IO
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/goose/gitclones/gtnh-flow/src/graph/_solver.py", line 283, in _addMachineMachineEdges
    self.variables[self.arrayIndex(a, product, 'O')]
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
IndexError: list index out of range

YAML

- m: mixer
  tier: HV
  I:
    purified bauxite: 32
    sodium hydroxide: 9
    quicklime: 4
    water: 5000
  O:
    bauxite slurry: 8000
  eut: 120
  dur: 10
  number: 1
- m: oil cracker
  tier: HV
  I:
    steam: 2000
    bauxite slurry: 32000
  O:
    heated bauxite slurry: 32000
  eut: 400
  dur: 8
- m: large chemical reactor
  tier: HV
  I:
    carbon dioxide: 5000
    heated bauxite slurry: 32000
    aluminium hydroxide: 1
  O:
    alumina: 80
    sodium carbonate: 9
    calcite: 10
    bauxite slag: 16
    sluice juice: 5000
  eut: 400
  dur: 15
- m: large chemical reactor
  tier: HV
  I:
    calcite: 5
  O:
    quicklime: 2
    carbon dioxide: 1000
  eut: 30
  dur: 12
- m: centrifuge
  tier: HV
  I:
    bauxite slag: 1
  O:
    rutile: 1
    gallium: 0.3
    quicklime: 0.2
    silicon dioxide: 0.9
    iron dust: 0.8
  eut: 120
  dur: 2
- m: centrifuge
  tier: HV
  I:
    sluice juice: 1000
  O:
    stone dust: 1
    iron dust: 0.4
    copper dust: 0.2
    tin dust: 0.2
    nickel dust: 0.2
    antimony dust: 0.2
  eut: 120
  dur: 2
- m: electrolyzer
  tier: HV
  I:
    sodium carbonate: 6
  O:
    sodium dust: 2
    carbon dust: 1
    oxygen: 3000
  eut: 60
  dur: 4.8
- m: large chemical reactor
  tier: HV
  I:
    sodium dust: 1
    water: 1000
  O:
    sodium hydroxide: 3
    hydrogen: 1000
  eut: 30
  dur: 10
- m: large chemical reactor
  tier: HV
  I:
    sodium dust: 1
    water: 1000
  O:
    sodium hydroxide: 3
    hydrogen: 1000
  eut: 30
  dur: 10
- m: large chemical reactor
  tier: HV
  I:
    aluminium dust: 16
    sodium hydroxide: 48
    water: 16000
  O:
    sodium aluminate: 64
    hydrogen: 48000
  eut: 480
  dur: 20
- m: large chemical reactor
  tier: HV
  I:
    sodium aluminate: 4
    water: 2000
  O:
    aluminium hydroxide: 7
    sodium hydroxide: 3
  eut: 120
  dur: 2.5
OrderedSet86 commented 6 months ago

gtnh-flow now correctly describes the issue instead of failing with IndexError:

Traceback (most recent call last):
  File "/home/order/Dropbox/OrderedSetCode/game-optimization/minecraft/flow/factory_graph.py", line 69, in generate_one
    self.graph_gen(self, project_name[:-5], recipes, self.graph_config)
  File "/home/order/Dropbox/OrderedSetCode/game-optimization/minecraft/flow/src/graph/_solver.py", line 668, in systemOfEquationsSolverGraphGen
    solver.run()
  File "/home/order/Dropbox/OrderedSetCode/game-optimization/minecraft/flow/src/graph/_solver.py", line 77, in run
    self._solve()
  File "/home/order/Dropbox/OrderedSetCode/game-optimization/minecraft/flow/src/graph/_solver.py", line 333, in _solve
    raise RuntimeError(
RuntimeError: 
    Unsolved variables - machine system is underdefined.
    Likely cause is either disconnected machines or too little information.

factory_graph.py:72 ERROR Error generating graph for project "devtest/bauxite.yaml": 
    Unsolved variables - machine system is underdefined.
    Likely cause is either disconnected machines or too little information.
factory_graph.py:73 ERROR If error cause is not obvious, please notify dev: https://github.com/OrderedSet86/gtnh-flow/issues

The issue can be seen in the debug chart - there are two copies of the same LCR process, so it is unclear how to split between the two. AKA too little information. Removing one of the sodium dust LCRs solves the problem image