Skip to content

Unify simulation execution on run_stepwise() #18

@Hackatro

Description

@Hackatro

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions