SimulationProvider

This simulation provider will execute evaluation requests on the same model and collect the desired responses. This provider runs the model's replications locally and sequentially in the same execution thread as the requests.

Note that the model is reused. This may cause issues in a parallel execution environment or if the model is mutated externally. The secondary constructor will create a new model instance for use by the provider. Use the primary constructor if you are certain that there are no issues with sharing the model instance.

Parameters

model

a function that promises to create the model that will be executed. The model that is created is assumed to be configured to run.

simulationRunCache

if supplied the cache will be used to store executed simulation runs.

useCachedSimulationRuns

Indicates whether the provider should use cached simulation runs when responding to requests. The default is false. If the simulation runs are not cached, this option has no effect.

Constructors

Link copied to clipboard
constructor(modelCreator: () -> Model, simulationRunCache: SimulationRunCacheIfc? = null, useCachedSimulationRuns: Boolean = false)

Secondary constructor for the SimulationProvider class.

Properties

Link copied to clipboard

Used to count the number of times that the simulation model is executed. Each execution can be considered a different experiment

Link copied to clipboard
open override val simulationRunCache: SimulationRunCacheIfc? = null
Link copied to clipboard
open override var useCachedSimulationRuns: Boolean

Functions

Link copied to clipboard
open override fun areInputNamesValid(inputNames: Set<String>): Boolean

Indicates if the input names are valid. The input names are valid if they are empty. If they are not empty, then they must be a subset of the input names associated with the model.

Link copied to clipboard
open override fun areResponseNamesValid(responseNames: Set<String>): Boolean

Indicates if the response names are valid. The response names are valid if they are empty. If they are not empty, then they must be a subset of the response names associated with the model.

Link copied to clipboard
open override fun isModelValid(modelIdentifier: String): Boolean

Indicates if the model identified by the modelIdentifier is valid. That is, this provider can perform simulation runs on the model.

Link copied to clipboard
open fun isRequestValid(request: RequestData): Boolean

Indicates if the request is valid. The request is valid if

Link copied to clipboard

Causes the execution counter to be reset to 0. Care must be taken if a database is used to collect simulation results. The names of the experiments are based on the value of the counter. An error will occur if multiple experiments have the same name in the database. You will likely want to export and clear the data from the database before running additional simulations.

Link copied to clipboard

Executes multiple simulations based on the provided list of request data and maps each request to a corresponding ResponseMap. Each request is processed individually, and the results of the simulations are stored as a key-value pair in the returned map. If the input list is empty, an exception is thrown. This default implementation runs all the requests sequentially based on the order of the supplied list.