Melodie always calls Model.run(), but the intended execution path going forward is
run_stepwise() — the generator that yields after every tick, writes each tick to
Postgres, and (later) lets an external RL agent inject parameter changes between steps.
Today run() and run_stepwise() are two independent loops that have drifted apart:
run() — self.iterator(...) + data_collector.save() (CSV) + _log_scenario_summary(). No per-tick DB write. This is the only path anything currently calls.
run_stepwise() — plain range(...) + TickWriter per tick (Postgres) + yield. No CSV save, no summary. No caller (referenced only in its own docstring).
The goal is to make run() delegate to run_stepwise() so there is a single tick loop
and a single execution path, while keeping a "run completely through + show logs" mode as a
fallback.
Melodie always calls
Model.run(), but the intended execution path going forward isrun_stepwise()— the generator that yields after every tick, writes each tick toPostgres, and (later) lets an external RL agent inject parameter changes between steps.
Today
run()andrun_stepwise()are two independent loops that have drifted apart:run()—self.iterator(...)+data_collector.save()(CSV) +_log_scenario_summary(). No per-tick DB write. This is the only path anything currently calls.run_stepwise()— plainrange(...)+TickWriterper tick (Postgres) +yield. No CSV save, no summary. No caller (referenced only in its own docstring).The goal is to make
run()delegate torun_stepwise()so there is a single tick loopand a single execution path, while keeping a "run completely through + show logs" mode as a
fallback.