RVParameter Setter
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.
Properties
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.
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.
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.
The parameters held by the model in a list of a data class
Functions
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.
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.
A convenience method to check if the named random variable exists and if so, if the named paramName exists for it parameters
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.
Converts the results of the property flatParametersAsDoubles to a Json string
Converts the results of the property parametersAsDoubles to a Json string
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.