ScenarioRunner

class ScenarioRunner(name: String, scenarioList: List<Scenario> = emptyList(), val pathToOutputDirectory: Path = KSL.createSubDirectory(name.replace(" ", "_") + "_OutputDir"), val kslDb: KSLDatabase = KSLDatabase("${name}.db".replace(" ", "_"), pathToOutputDirectory)) : Identity

Facilitates the running of many scenarios in a sequence. A KSLDatabase is used to capture the statistics for each scenario. Each scenario is treated like a different experiment. The scenarios can be based on the same or different models. The scenarios also capture the inputs and results via a SimulationRun.

Parameters

name

of the scenario runner. By default, this name is used as the name of the database

scenarioList

a list of scenarios to execute

kslDb

the KSLDatabase that will hold the results from the scenarios

Constructors

Link copied to clipboard
constructor(name: String, scenarioList: List<Scenario> = emptyList(), pathToOutputDirectory: Path = KSL.createSubDirectory(name.replace(" ", "_") + "_OutputDir"), kslDb: KSLDatabase = KSLDatabase("${name}.db".replace(" ", "_"), pathToOutputDirectory))

Properties

Link copied to clipboard

The database observers that were attached to the models. This property could be used to turn off all or some of the observers

Link copied to clipboard
override val id: Int
Link copied to clipboard
Link copied to clipboard
open override var label: String?
Link copied to clipboard
override val name: String
Link copied to clipboard
Link copied to clipboard

A read only list of the scenarios to be run.

Link copied to clipboard

Functions

Link copied to clipboard
fun addScenario(model: Model, inputs: Map<String, Double>, name: String, numberReplications: Int = model.numberOfReplications, lengthOfReplication: Double = model.lengthOfReplication, lengthOfReplicationWarmUp: Double = model.lengthOfReplicationWarmUp): Scenario

Adds a scenario to the possible scenarios to simulate. The name of the scenario (based on the model's experiment) must be unique within the context of the list of scenarios to run.

Link copied to clipboard

Gets the database observer by the scenario name or null if not there.

Link copied to clipboard

Sets the number replications for each scenario to a common number of replications.

Link copied to clipboard

Gets the scenario by its name or null if not there.

Link copied to clipboard
fun simulate(scenarios: IntProgression = myScenarios.indices, clearAllData: Boolean = true)

Interprets the integer progression as the indices of the contained scenarios that should be simulated. If the progression is not a valid index then no scenario is simulated.

Link copied to clipboard
open override fun toString(): String