SimulationRunCacheIfc

A simulation run cache should be designed to efficiently look up a simulation run based on a given set of input settings.

Inheritors

Properties

Link copied to clipboard
abstract val capacity: Int

The maximum permitted size of the cache

Link copied to clipboard

A rule to govern which solution should be evicted when the cache capacity is met.

Functions

Link copied to clipboard
abstract fun clear()

Removes all items from the cache

Link copied to clipboard
abstract fun put(modelInputs: ModelInputs, simulationRun: SimulationRun): SimulationRun?

Places the simulation run into the cache. It is important that implementors ensure that the input names and response names associated with the request are consistent with the input names and response names of the simulation run.

Link copied to clipboard
open fun putAll(from: Map<out ModelInputs, SimulationRun>)

Places all input-solution pairs into the cache

Link copied to clipboard
abstract fun remove(modelInputs: ModelInputs): SimulationRun?

Looks up and removes the simulation run associated with the supplied request. Null is returned if there is no associated simulation run. It is important that implementors handle the reduced size relative to the cache.

Link copied to clipboard

Retrieves the simulation runs associated with the requests

Link copied to clipboard
open operator fun set(modelInputs: ModelInputs, simulationRun: SimulationRun)

Allows use of bracket operator for setting values

Link copied to clipboard

Retrieves the simulation runs in the cache as a list of simulation runs

Link copied to clipboard

Partitions the simulation runs into groups that are determined by the model inputs that have the same input and response names. Any simulation runs that have model inputs with the same input names and response names are grouped together into a map.

Link copied to clipboard

Translates the maps returned by toMappedDataGroupedByModelInputNames() into data frames holding the input-response data for each replication.

Link copied to clipboard

Cached simulation runs are associated with instances of ModelInputs. The equality of model inputs is determined by the model identifier, the names (and values) of the inputs, and the names of the desired responses. For the purposes of this function, we assume that the simulation runs are grouped (partitioned) by those model inputs that have the same input names and same requested responses. See simulationRunsGroupedByModelInputNames(). This function returns the inputs and replication responses within a map of maps. The outer map represents the common input names and requested responses, and the inner map the inputs and responses. You can think of the inner map as holding the columns of the simulation run inputs and responses for each replication within the run. This "tabular" representation is useful for analysis of input to output relationships. The model input values will be repeated for each replication. The response values represent the observed replication average for the response. The outer grouping is necessary because not every requested simulation run will have the same input names and/or requested responses. The grouping ensures those that have common names (inputs/response) will be within the associated map.