Klasse RandomSimGenerator
- Alle implementierten Schnittstellen:
net.simplace.sim.util.FWSimFieldContainer
Distributions
For each model variable the user can chose one of the distribution below:
| Distribution | Distribution Parameters | Optional Param. | Return datatype | Remark |
| Uniform | min, max | DOUBLE | ||
| Normal | mean, sigma | min, max | DOUBLE | |
| Exponential | lambda | min, max | DOUBLE | |
| Poisson | lambda | min, max | INT | |
| Binomial | n, p | min, max | INT | n has to be of type INT |
| Choice | values | frequencies | any | Choses randomly a value from a list. Values have to be an array of the same type as the cal variable |
If min and max are specified and the generated value exceeds them, new random numbers are generated until one fits the interval. The number of trials is limited to cMaxAttemptsOutOfRange. If no number is found, the parameter set is skipped.
Generated parameter sets can be further restricted by constraints.
Variable specific configuration
Arbitrary number of calibration variables (either INT or DOUBLE, depending on distribution used). When using the distribution Choice, then the datatype can be additionally CHAR, DATE or BOOLEAN.
| <cal id="VariableName" target="vModuleName">
For each calibration variable the distribution and it's parametrization as in the table above.
| <cal id="VariableName" target="vModelParameter" datatype="DOUBLE"> | <input id="distribution" datatype="CHAR">DISTRIBUTION</input> | <input id="PARAMETER1" datatype="DOUBLE">3.0</input> | <input id="PARAMETER2" datatype="DOUBLE">.5</input> | </cal>
General configuration
| Name | DATATYPE | Description |
| cCount | INT | the number of parameter sets to be generated, mandatory |
| cRandomSeed | CHAR | optional random seed for the generator. Can be a long integer, therefore it has datatype CHAR |
| cMaxAttemptsOutOfRange | INT | maximum number of trials to re-generate a random number if it's value is outside min/max range |
A constraint prohibits the creation of invalid variable values.
| <constraint rule="${Generator.TsumMaturity} > ${Generator.TsumAnthesis}+100">
Remark
The number of created simulations can be smaller than Count.
- the min and max attributes of the generated values may prohibit generation of some parameter sets
- an additional constraint on the parameter set may prevent generation of a simulation
The random seed is set only on initialization of the generator. That means, that a subsequent iteration or a subsequent project can not set it's individual random seed.
Example
|<generator id="Generator" class="net.simplace.sim.control.generators.RandomSimGenerator">
|
| <cal id="TsumAnthesis" datatype="DOUBLE" target="vTsumAnt">
| <input id="distribution" datatype="CHAR">Uniform</input>
| <input id="min" datatype="DOUBLE">0</input>
| <input id="max" datatype="DOUBLE" source="vTsumMax" />
| </cal>
|
| <cal id="TsumMat" datatype="DOUBLE" target="vTsumMat">
| <input id="distribution" datatype="CHAR">Normal</input>
| <input id="sigma" datatype="DOUBLE" source="Iterator.TsumMat.sigma" />
| <input id="mean" datatype="DOUBLE" source="Iterator.TsumMat.mean" />
| <input id="min" datatype="DOUBLE">0</input>
| <input id="max" datatype="DOUBLE" source="vTsumMax" />
| </cal>
|
| <cal id="Soiltype" datatype="CHAR" target="vSoiltype">
| <input id="distribution" datatype="CHAR">Choice</input>
| <input id="values" datatype="CHARARRAY">{loam,sand,sandyloam}</input>
| <input id="frequencies" datatype="DOUBLEARRAY" >{2,9,6}</input>
| </cal>
|
| <input id="cRandomSeed" datatype="CHAR">342345734</input>
| <input id="cCount" datatype="INT">100</input>
|
| <constraint rule="${Generator.TsumMaturity} > ${Generator.TsumAnthesis}+100">
|
|</generator>
- Autor:
- Gunther Krauss
-
Feldübersicht
Von Klasse geerbte Felder net.simplace.sim.control.FWSimulationGenerator
iContentType, iSimulationsMapVon Klasse geerbte Felder net.simplace.sim.control.FWSimulationControlContainer
iCache, iCals, iConstraint, iContainerElement, iControlMap, iFieldMap, iInputMap, iInputs, iName, iParams, iSession, iSimulationMap -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungRandomSimGenerator(org.jdom2.Element aGeneratorElement, net.simplace.sim.FWSimSession aSession, HashMap<String, net.simplace.sim.util.FWSimVariable<?>> aFieldMap, net.simplace.sim.util.FWSimVariable.CONTENT_TYPE aContentType) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidprotected static intReturn the index of the first break, that is bigger than the value.voidinit()protected static doublenextRandom(Random randomizer, String distribution, double min, double max, double mean, double sigma, double lambda, double p, int n) Generates a next random numberVon Klasse geerbte Methoden net.simplace.sim.control.FWSimulationGenerator
addSimulation, canUpdate, clearSimulations, createSimulationGenerator, finalize, getSimulation, getSimulationsListSize, initializeProject, reset, setFinished, setInitial, updateSimulations, writeSimulationVon Klasse geerbte Methoden net.simplace.sim.control.FWSimulationControlContainer
addProcessTime, addVariable, checkCondition, evaluate, getContentType, getCreateFormXML, getEditFormXML, getFieldMap, getFrequence, getInputVariables, getName, getOrderNumber, getOutputVariables, getVariable, getVarMap, isConditionCheck, readInputCalAndConstraint, removeVariable, setPropertyValue, toXML
-
Konstruktordetails
-
RandomSimGenerator
-
-
Methodendetails
-
init
public void init()- Setzt außer Kraft:
initin Klassenet.simplace.sim.control.generators.DefaultSimulationGenerator
-
createVariables
- Angegeben von:
createVariablesin Schnittstellenet.simplace.sim.util.FWSimFieldContainer- Setzt außer Kraft:
createVariablesin Klassenet.simplace.sim.control.generators.DefaultSimulationGenerator
-
generate
public void generate(net.simplace.sim.control.FWSimulationControlCache aCache, ResultSet aResultSet) throws SQLException - Setzt außer Kraft:
generatein Klassenet.simplace.sim.control.generators.DefaultSimulationGenerator- Löst aus:
SQLException
-
nextRandom
protected static double nextRandom(Random randomizer, String distribution, double min, double max, double mean, double sigma, double lambda, double p, int n) Generates a next random number- Parameter:
randomizer-distribution-min-max-mean-sigma-lambda-p-n-- Gibt zurück:
- random number
-
getIndex
Return the index of the first break, that is bigger than the value.- Parameter:
value- a value between 0 and 1breaks- an array of ordered values between 0 and 1- Gibt zurück:
- index
-