RVParameterSetter

class RVParameterSetter(model: Model)

The purpose of this class is to work with a model instance to facilitate the changes of parameters associated with random variables. The parameters of random variables can be changes and then applied to the model. A change in the underlying data is not applied to the associated model until explicitly applied to the model.

Constructors

Link copied to clipboard
constructor(model: Model)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Uses parametersAsDoubles to get a map of map, then flattens the map to a single map with the key as the concatenated key of the outer and inner keys concatenated with the current value of the rvParamConCatString character string, which is "." by default.

Link copied to clipboard

The id of the associated model

Link copied to clipboard

The model element name of the associated model

Link copied to clipboard

Converts double and integer parameters to a Map that holds a Map, with the outer key being the random variable name and the inner map the parameter names as keys and the parameter values as values. Ignores any double array parameters and converts any integer parameter values to double values. The resulting map can be used for data transfer.

Link copied to clipboard
Link copied to clipboard

The key to this map is the unique name of the random variable within the model. The associated value is an instance of RVParameters which can be used to get the associated parameters and to change the parameter values. The map cannot be modified, but the values can be retrieved and changed as needed. Changing the values have no effect within the model until they are applied.

Link copied to clipboard

The parameters held by the model in a list of a data class

Functions

Link copied to clipboard

If a RVParameterSetter has been created based on a model, then this method can be used to apply changed parameters to the model. The primary use of the function occurs in the setUpExperiment() function of the model. If the model has a RVParameterSetter then it is used to apply any potential parameter changes to the model automatically prior to running the experiment. This method could be used at any time to change the parameters of the model; however, changing the parameter setting during the execution of a model is highly discouraged. The parameter changes ensure that the underlying random number stream remains the same.

Link copied to clipboard
fun changeParameter(rvName: String, paramName: String, value: Double): Boolean

A convenience method to change the named parameter of the named random variable to the supplied value. This will work with either double or integer parameters. Integer parameters are coerced to the rounded up value of the supplied double, provided that the integer can hold the supplied value. If the named random variable is not in the setter, then no value will change. If the named parameter is not associated with the random variable type, then no change occurs. In other words, the action fails, silently by returning false.

Link copied to clipboard

A convenience method that will set any Double or Integer parameter to the supplied double value provided that the named random variable is available to be set, and it has the named parameter.

Link copied to clipboard
fun containsParameter(rvName: String, paramName: String): Boolean

A convenience method to check if the named random variable exists and if so, if the named paramName exists for it parameters

Link copied to clipboard

Uses parametersAsDoubles to get a map of map, then flattens the map to a single map with the key as the concatenated key of the outer and inner keys concatenated with the supplied character string. The combined key needs to be unique and not be present within the random variable names.

Link copied to clipboard

Converts the results of the property flatParametersAsDoubles to a Json string

Link copied to clipboard

Converts the results of the property parametersAsDoubles to a Json string

Link copied to clipboard

Gets a parameters instance for the named random variable. This will be the current parameter settings being used in the model. This instance can be changed and then applied to the model.

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