simulate
suspend fun simulate(scenarios: IntProgression = myScenarios.indices, clearAllData: Boolean = true, onScenarioComplete: (scenarioName: String, snapshot: SimulationSnapshot.ExperimentCompleted?) -> Unit? = null, executionMode: ExecutionMode = ksl.app.config.ExecutionMode.CONCURRENT, onScenarioStart: (scenarioName: String, scenarioIndex: Int, totalScenarios: Int) -> Unit? = null, onReplicationStart: suspend (scenarioName: String, repNumber: Int, totalReps: Int) -> Unit? = null, onReplicationEnd: suspend (scenarioName: String, repNumber: Int, totalReps: Int) -> Unit? = null, onScenarioReplications: (scenarioName: String, snapshots: List<SimulationSnapshot.ReplicationCompleted>) -> Unit? = null, onScenarioReplicationsCompleted: (scenarioName: String, scenarioIndex: Int, totalScenarios: Int) -> Unit? = null)(source)
Runs the selected scenarios concurrently and writes results to kslDb.
This is a suspend function and must be called from a coroutine scope. For command-line or test use, wrap with runBlocking { runner.simulate() }.
Parameters
scenarios
Indices (into scenarioList) of the scenarios to execute. Defaults to all registered scenarios.
clear All Data
When true (the default) the database is cleared before any simulation starts. Set to false only when the caller has guaranteed that no existing experiment names will collide with the names of scenarios being run; a collision will cause SnapshotBatchWriter to throw during the commit phase.