Scenario

class Scenario(val model: Model, inputs: Map<String, Double>, name: String, numberReplications: Int = model.numberOfReplications, lengthOfReplication: Double = model.lengthOfReplication, lengthOfReplicationWarmUp: Double = model.lengthOfReplicationWarmUp) : Identity, ExperimentIfc

A scenario represents the specification of a model to run, with some inputs. Each scenario will produce a simulation run. In the context of running multiple scenarios, it is important that the scenario names be unique to permit automated storage within a KSL database. The name of the scenario is used to assign the name of the model's experiment prior to simulating the model. In this manner, each experiment can have a unique name.

Parameters

model

The model to be simulated

inputs

The map of inputs (based on control names) to apply to the model

name

The name of the scenario. It should be unique within the context of a set of scenario being executed by a ScenarioRunner.

numberReplications

the number of replications for the scenario. By default, this is the current setting of the model.

lengthOfReplication

the length of each replication for the scenario. By default, this is the current setting of the model.

lengthOfReplicationWarmUp

the length of the warmup period for each replication for the scenario. By default, this is the current setting of the model.

Constructors

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

Properties

Link copied to clipboard

The reset next sub stream option This option indicates whether the random variables used during the replication within the experiment will be reset to their next sub-stream after running each replication. The default is TRUE. This ensures that the random variables will jump to the next sub-stream within their current stream at the end of a replication. This will cause the random variables in each subsequent replication to start in the same sub-stream in the underlying random number streams if the replication is repeatedly used and the ResetStartStreamOption is set to false (which is the default) and then jump to the next sub-stream (if this option is on). This option has no effect if there is only 1 replication in an experiment.

Link copied to clipboard
open override val antitheticOption: Boolean

Indicates whether antithetic replications should be run. The default is false. If set the user must supply an even number of replications; otherwise an exception will be thrown. The replications will no longer be independent; however, pairs of replications will be independent. Thus, the number of independent samples will be one-half of the specified number of replications

Link copied to clipboard
open override val currentReplicationId: Int

The identifier for the current replication. Each replication in the set of replications for the experiment has a unique identifier. This returns the identifier for the current replication. An identifier of 0 represents that no replications have been run

Link copied to clipboard
open override val currentReplicationNumber: Int

The current number of replications that have been run for this experiment

Link copied to clipboard
open override var experimentalControls: Map<String, Double>

Holds values for each controllable parameter of the simulation model.

Link copied to clipboard
open override val experimentId: Int

The identity of the experiment

Link copied to clipboard
open override var experimentName: String

The name of the experiment

Link copied to clipboard

Causes garbage collection System.gc() to be invoked after each replication. The default is false

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

The specified length of each planned replication for this experiment. The default is Double.POSITIVE_INFINITY.

Link copied to clipboard

The length of time from the start of an individual replication to the warm-up event for that replication.

The maximum allowable execution time "wall" clock time for an individual replication to complete processing in nanoseconds. Set the maximum allotted (suggested) execution (real) clock for a replication. This is a proposed value because the execution time requirement is only checked after the completion of each replication After it is discovered that cumulative time for executing the replication has exceeded the maximum time, then the process will be ended (perhaps) not completing other replications.

Link copied to clipboard
Link copied to clipboard
override val name: String
Link copied to clipboard
open override var numberOfReplications: Int

The number of replications to run for this experiment

Link copied to clipboard

Indicates the number of times the streams should be advanced prior to running the experiment

Link copied to clipboard
open override val numChunks: Int

Indicates if the replications associated with this experiment are part of set of experiments with the same name. A chunk is an ordered subset of replications for an experiment. This field indicates the number of chunks within the experiment. There should be at least 1 chunk. If there is 1 chunk then all replications of the experiment are run as one chunk (simulation run)

Link copied to clipboard
open override val repIdRange: IntRange

The range of replication identifiers for the experiment based on the starting replication identifier and the number of replications to be executed.

Link copied to clipboard

A flag to indicate whether each replication within the experiment should be re-initialized at the beginning of each replication. True means that it will be re-initialized.

Link copied to clipboard
open override var resetStartStreamOption: Boolean

The reset start stream option This option indicates whether the random variables used during the experiment will be reset to their starting stream prior to running the first replication. The default is FALSE. This ensures that the random variable's streams WILL NOT be reset prior to running the experiment. This will cause different experiments or the same experiment run multiple times that use the same random variables (via the same model) to continue within their current stream. Therefore, the experiments will be independent when invoked within the same program execution. To get common random number (CRN), run the experiments in different program executions OR set this option to true prior to running the experiment again within the same program invocation.

Link copied to clipboard
open override var runErrorMsg: String
Link copied to clipboard
open override val runName: String

An optional label for the chunk

Link copied to clipboard

Can be used to supply a function that will set up the model prior to being run. This would allow for the assignment properties or invoking of additional logic prior to simulating the model.

Link copied to clipboard

returns the last generated simulation run

Link copied to clipboard
open override var startingRepId: Int

The starting id for the sequence of identifiers used to label the replications of the experiment

Functions

Link copied to clipboard
open override fun changeRunParameters(runParameters: ExperimentRunParametersIfc)

Changes the experiment run parameters for the experiment. This does not include the current number of replications or the experiment's id. Any property in ExperimentRunParametersIfc may be changed.

Link copied to clipboard
open override fun experimentInstance(): Experiment

Returns a new Experiment based on this experiment.

Link copied to clipboard

Extracts a data class representing the experiment's run parameters

Link copied to clipboard
open override fun hasExperimentalControls(): Boolean
Link copied to clipboard
open override fun hasMoreReplications(): Boolean

Checks if the current number of replications that have been executed is less than the number of replications specified.

Link copied to clipboard
open override fun numberOfReplications(numReps: Int, antitheticOption: Boolean)

Sets the desired number of replications for the experiment

Link copied to clipboard
fun simulate()

Simulates the scenario by simulating the model at its current experimental run parameters using the supplied inputs. Generates a new simulation run with each execution.

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