simulate

suspend fun simulate(modelIdentifier: String = model.modelIdentifier, inputs: Map<String, Double> = mapOf(), stringInputs: Map<String, String> = mapOf(), jsonInputs: Map<String, String> = mapOf(), experimentRunParameters: ExperimentRunParameters = model.extractRunParameters()): SimulationRun(source)

Builds a SimulationRun and executes it cooperatively.

The inputs have the same meaning as SimulationRunner.simulate. Cancellation is checked before the experiment starts and between replications.


suspend fun simulate(simulationRun: SimulationRun, onReplicationStarted: suspend (Int, Int) -> Unit? = null, onReplicationEnded: suspend (Int, Int) -> Unit? = null): SimulationRun(source)

Runs simulationRun using the public replication-step API on Model.

The current replication is allowed to finish once it starts. A cancellation request is observed before the next replication begins, then rethrown so parent scopes see true coroutine cancellation instead of a failed simulation.

Optional per-replication progress callbacks. onReplicationStarted fires immediately before each runNextReplication() call; onReplicationEnded fires immediately after. Both receive the 1-based replication index and the total replication count. Used by ConcurrentScenarioRunner to forward per-scenario progress to the orchestrator's event lifecycle. When both callbacks are null this method behaves exactly as the original no-callback overload.