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

the model that is run by the provider

simulationRunCache

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

Constructors

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

Secondary constructor for the SimulationProvider class.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

An identifier for the model. By default, this is the modelIdentifier property of model. This property is used to ensure that simulation execution requests are intended for the associated model.

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

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 override fun simulate(evaluationRequest: EvaluationRequest): Map<ModelInputs, Result<ResponseMap>>

Executes multiple simulations based on the provided evaluation request 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 within the evaluation request.