Class ShrinkParameterspaceIterator
- All Implemented Interfaces:
FWSimFieldContainer
Documentation
In each iteration step, the range of a parameter is shrunk by cShrinkFactor and centered around the the actual value of the parameter.
Initial step
Values for each cal variable's min and max or sigma and mean are taken from initial configuration.
Subsequent steps
If the cal variable has a value, calculated by a simulation and selected by a selector in the previous iteration, then the new range will be centered around this value. Otherwise the new range will be centered around the midpoint of the previous range.
If cDrift is set to true then the new range can exceed the initial min and max values. Otherwise the new range will be cut to fit inside the original range. If it is false, then min and max properties have to be give, even if you wan to use only mean and sigma.
Calculation for iteration step \(i \gt 1\): \[ \begin{eqnarray} mean_i & = & \begin{cases} parametervalue & \text{if parametervalue is set} \\ \frac{max_{i-1} + min_{i-1}}{2} & \text{else} \end{cases} \\ radius_i & = & \frac{max_{i-1} - min_{i-1}}{2} \cdot cShrinkFactor \\ min_i & = & \begin{cases} mean_i - radius_i & \text{if } cDrift \text{ is true} \\ \max(mean_i - radius_i,min_1) & \text{else} \end{cases} \\ max_i & = & \begin{cases} mean_i + radius_i & \text{if } cDrift \text{ is true} \\ \min(mean_i + radius_i,max_1) & \text{else} \end{cases} \\ sigma_i & = & sigma_{i-1} \cdot cShrinkFactor \end{eqnarray} \]Stop condition
The iterator runs maximum maxCount times. Iteration will stop earlier, if the constraint rule becomes false.
Example
Defining and configuring an iterator
| <iterator id="Iterator" class="net.simplace.sim.control.iterators.ShrinkParameterspaceIterator">
| <input id="cShrinkFactor" datatype="DOUBLE">.5</input>
| <input id="cDrift" datatype="BOOLEAN">false</input>
| <input id="maxCount" datatype="INT">5</input>
| <constraint description="" rule="${Selector.BestErrorValue} > 46" />
| <cal id="SLA" datatype="DOUBLE" target="vSLA">
| <input id="min" datatype="DOUBLE">0.01</input>
| <input id="max" datatype="DOUBLE">0.1</input>
| <input id="sigma" datatype="DOUBLE">0.0025</input>
| <input id="mean" datatype="DOUBLE">0.02</input>
| </cal>
| <cal id="LUE" datatype="DOUBLE" target="vLUE">
| <input id="min" datatype="DOUBLE">1</input>
| <input id="max" datatype="DOUBLE">5</input>
| <input id="sigma" datatype="DOUBLE">0.21</input>
| <input id="mean" datatype="DOUBLE">3.0</input>
| </cal>
| </iterator>
Iterator calculates min/max/mean/sigma for two parameters vSLA and vLUE.
Initial interval for vLUE is from 1.0 to 5.0. In each interation step, the size of the interval will be half of the previous size. E.g. if after iteration step 1 the selected LUE will be 3.7, then the new intervall will range from 2.7 to 4.7. If the selected LUE after iteration step 2 will be 3.8, then the new intervall will range from 3.3 to 4.3 etc... If the selected LUE after iteration step 2 will be 4.6, then the new interval will range from 4.1 to 5.0, as the designed upper bound 5.1 is bigger than initial max value 5.0.
Using the iterator by a generator
| <generator id="Generator" class="net.simplace.client.simulation.lap.generators.RandomSimGenerator"> | <input id="cCount" datatype="INT">100</input> | <cal id="LUE" datatype="DOUBLE" target="vLUE"> | <input id="min" datatype="DOUBLE" source="vLUE_min" /> | <input id="max" datatype="DOUBLE" source="vLUE_max" /> | <input id="sigma" datatype="DOUBLE" source="Iterator.LUE.sigma" /> | <input id="mean" datatype="DOUBLE" source="Iterator.LUE.mean" /> | <input id="distribution" datatype="CHAR">Normal</input> | </cal> | <cal id="SLA" datatype="DOUBLE" target="vSLA"> | <input id="min" datatype="DOUBLE" source="vSLA_min" /> | <input id="max" datatype="DOUBLE" source="vSLA_max" /> | <input id="distribution" datatype="CHAR">Uniform</input> | </cal> | </generator>
The generator will generate 100 simulations in each, chosing vLUE from a normal distribution centered around the mean and sigma values provided by the iterator. As sigma becomes smaller, the range of the values will be smaller.
Notice that for vSLA min and max are independent from the iterator, so in each step the values will be randomly chosen from the same range.
- Author:
- G. Krauss
-
Field Summary
Fields inherited from class FWSimulationIterator
iInputMap, iMaxRunCountFields inherited from class FWSimulationControlContainer
iCache, iCals, iConstraint, iContainerElement, iControlMap, iFieldMap, iIdentifier, iInputs, iName, iParams, iSession, iSimulationMap -
Constructor Summary
ConstructorsConstructorDescriptionShrinkParameterspaceIterator(org.jdom2.Element aSimulationIteratorElement, FWSimSession aSession) -
Method Summary
Modifier and TypeMethodDescriptionHashMap<String, FWSimVariable<?>> Creates the inputscDriftandcShrinkFactorin addition tomaxCount.voidinit()Takes over the inputs; the data of previous iterations is not kept.protected booleanIn the first iteration the initial ranges are remembered; in later iterations the range of each calibration variable is shrunk around the value of the best simulation of the previous iteration (see the class description).Methods inherited from class FWSimulationIterator
createSimulationIterator, getIterationCount, getMaxIterationCountMethods inherited from class FWSimulationControlContainer
addProcessTime, addVariable, checkCondition, evaluate, getContentType, getCreateFormXML, getEditFormXML, getFieldMap, getFrequence, getInputVariables, getName, getOrderNumber, getOutputVariables, getVariable, getVarMap, isConditionCheck, readInputCalAndConstraint, removeVariable, setPropertyValue, toXML
-
Constructor Details
-
ShrinkParameterspaceIterator
public ShrinkParameterspaceIterator(org.jdom2.Element aSimulationIteratorElement, FWSimSession aSession) - Parameters:
aSimulationIteratorElement- theiteratorelementaSession- the session
-
-
Method Details
-
createVariables
Creates the inputscDriftandcShrinkFactorin addition tomaxCount.- Specified by:
createVariablesin interfaceFWSimFieldContainer- Overrides:
createVariablesin classFWSimulationIterator- Returns:
- the variables, keyed by name
- See Also:
-
init
public void init()Takes over the inputs; the data of previous iterations is not kept.- Overrides:
initin classFWSimulationIterator
-
iterate
In the first iteration the initial ranges are remembered; in later iterations the range of each calibration variable is shrunk around the value of the best simulation of the previous iteration (see the class description). The decision is made byDefaultSimulationIterator.iterate(String).Note: expects at least one selected simulation from the previous iteration.
- Overrides:
iteratein classDefaultSimulationIterator- Parameters:
aProjectID- id of the project, ornullin GLOBAL calibration mode- Returns:
trueif another iteration is run- See Also:
-