|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.Presentable
com.xj.anylogic.engine.Utilities
com.xj.anylogic.engine.Experiment<ROOT>
com.xj.anylogic.engine.ExperimentParamVariation<ROOT>
ROOT - class of root objectpublic abstract class ExperimentParamVariation<ROOT extends ActiveObject>
Experiment used to run simulation several times with different parameter
values. To use this experiment you need to subclass from it.
By default, this experiment works in range parameters variation mode
(override getRangeParametersNumber(),
calculateRangeParameterValuesNumbers(),
setupRangeVariedParameter(ActiveObject, int, int, boolean),
setupRootParameters(ActiveObject, int, boolean) methods),
for freeform parameters override getMaximumIterations() and
setupRootParameters(ActiveObject, int, boolean) methods
Experiments which use replications should call
setUseReplications(boolean) and
setFixedReplicationsNumber(int) or
setVariableReplicationsNumber(int, int, int, double) from overridden
Experiment.setup(java.awt.Container) method,
For varied replications number mode also
getValueForConfidenceComputation(ActiveObject) method should be
overridden define
| Field Summary | |
|---|---|
static int |
CONFIDENCE_LEVEL_80
Confidence level constant 80% |
static int |
CONFIDENCE_LEVEL_90
Confidence level constant 90% |
static int |
CONFIDENCE_LEVEL_95
Confidence level constant 95% |
static int |
CONFIDENCE_LEVEL_98
Confidence level constant 98% |
static int |
CONFIDENCE_LEVEL_99
Confidence level constant 99% |
static int |
CONFIDENCE_LEVEL_99_9
Confidence level constant 99.9% |
| Fields inherited from class com.xj.anylogic.engine.Experiment |
|---|
ERROR, FINISHED, IDLE, modelExecutionCommandQueue, mutexModelActionQueue, OPEN_RESULTS, OPEN_SNAPSHOT, PAUSE, PAUSED, PLEASE_WAIT, RUN, RUNNING, SAVE_RESULTS, SAVE_SNAPSHOT, STEP, STOP |
| Fields inherited from class com.xj.anylogic.engine.Utilities |
|---|
AM, APRIL, AUGUST, DAY, DECEMBER, FEBRUARY, FRIDAY, HOUR, infinity, JANUARY, JULY, JUNE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TIME_UNIT_DAY, TIME_UNIT_HOUR, TIME_UNIT_MILLISECOND, TIME_UNIT_MINUTE, TIME_UNIT_SECOND, TIME_UNIT_WEEK, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK, YEAR |
| Constructor Summary | |
|---|---|
ExperimentParamVariation()
|
|
ExperimentParamVariation(boolean allowParallelEvaluations)
Same as ExperimentParamVariation() but allows to disable
parallel evaluations on multicore/multiprocessor systems
(which are enabled by default) |
|
| Method Summary | |
|---|---|
int[] |
calculateRangeParameterValuesNumbers()
This method should be overridden in experiments which work with parameters varied in range This method will be called only one time |
boolean |
evaluateStopConditions(ROOT root)
User's extention point for experiment stop conditions By default returns false |
int |
getCurrentIteration()
Returns the current iteration number (1, 2...) |
int |
getCurrentReplication()
Returns the replication number for the current iteration (1, 2...) |
Engine |
getEngine()
It is strongly recommended not to call this method because of possible parallel execution environment. |
int |
getMaximumIterations()
Returns total number of iterations being performed in this experiment Default implementation works with range varied parameters Override in subclass if experiment uses free-form parameters |
java.lang.Object |
getMutexRead_xjal()
|
java.lang.Object |
getMutexWrite_xjal()
|
int |
getNumberOfCompletedIterations()
Returns the number of completed iterations. |
int |
getParallelEvaluatorsCount()
Returns the number of parallel evaluators used in this experiment. |
double |
getProgress()
Returns the progress of the experiment: a number between 0 and 1 corresponding to the part of the experiment completed so far (based on iteration count or time limit), or -1 if this cannot be calculated. |
int |
getRangeParametersNumber()
This method should be overridden to return the number of parameters varied in range in the corresponding experiments |
int |
getRunCount()
Returns the number of the current simulation run, more precisely the number of times the model was destroyed. |
double |
getRunTimeSeconds()
Returns the real duration of the experiment in seconds. |
double[] |
getSimulationProgress_xjal(double[] output)
This method is not designed to be called by user and may be changed/removed in the future releases. |
int |
getState()
Returns the current state of the experiment. |
long |
getStep()
Returns the number of events executed by the engine. |
double |
getValueForConfidenceComputation(ROOT root)
Returns the value used in confidence computation when experiment uses replications and variable replications number is used Must be implemented in a subclass in such experiments. |
boolean |
isLastReplication()
Return true if we have run the last replication for the current iteration |
boolean |
isUseReplications()
Returns true if experiment uses replications |
void |
onAfterIteration()
User's extension point for after iteration code By default does nothing |
void |
pause()
Pauses the model execution. |
void |
registerPresentation_xjal(Presentation presentation)
This method isn't designed to be called by user. |
void |
run()
Runs the model from the current state. |
void |
setFixedReplicationsNumber(int replicationsNumber)
Sets experiment to use a fixed number of replications. |
void |
setupRangeVariedParameter(ROOT root,
int paramIndex,
int valueIndex,
boolean callOnChangeActions)
This method should be overridden in experiments which work with parameters varied in range |
void |
setupRootParameters(ROOT root,
int index,
boolean callOnChangeActions)
Setups all parameters of root object Default implementation works only with range varied parameters Override in subclass if experiment uses freeform parameters or uses range varied parameters and has fixed parameters, in this case overridden method should call super.setupRootParameters(root, index); and then setup
values for fixed parameters
|
void |
setUseReplications(boolean useReplications)
Sets experiment to use replications This is setup method, user should not call it |
void |
setVariableReplicationsNumber(int minimumReplications,
int maximumReplications,
int confidenceLevel)
Deprecated. This method is deprecated. Use setVariableReplicationsNumber(int, int, int, double) instead |
void |
setVariableReplicationsNumber(int minimumReplications,
int maximumReplications,
int confidenceLevel,
double errorPercent)
Sets experiment to stop replications after the minimum replications when the confidence level is reached (i.e. mean confidence is within the given percentage errorPercent of the value obtained at the last
replication)
maximum replications number is reached
For fixed number of replications use
setFixedReplicationsNumber(int)This is optimization setup method, user should not call it |
void |
step()
Performs one step of the model execution. |
void |
stop()
Terminates the model execution, destroys and forgets the model and calls garbage collector, but keeps all experiment data. |
| Methods inherited from class com.xj.anylogic.engine.Experiment |
|---|
close, createRoot, error, getCommandLineArguments, getName, getPresentation, getSnapshotFileName, getWindowHeight, getWindowWidth, initDefaultRandomNumberGenerator, isCommandEnabled, isLoadRootFromSnapshot, onBeforeSimulationRun, onDestroy_xjal, onDestroy, onEngineFinished, onError, reset, setCommandLineArguments_xjal, setLoadRootFromSnapshot, setName, setup, setupEngine |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CONFIDENCE_LEVEL_80
80%
setVariableReplicationsNumber(int, int, int, double),
Constant Field Valuespublic static final int CONFIDENCE_LEVEL_90
90%
setVariableReplicationsNumber(int, int, int, double),
Constant Field Valuespublic static final int CONFIDENCE_LEVEL_95
95%
setVariableReplicationsNumber(int, int, int, double),
Constant Field Valuespublic static final int CONFIDENCE_LEVEL_98
98%
setVariableReplicationsNumber(int, int, int, double),
Constant Field Valuespublic static final int CONFIDENCE_LEVEL_99
99%
setVariableReplicationsNumber(int, int, int, double),
Constant Field Valuespublic static final int CONFIDENCE_LEVEL_99_9
99.9%
setVariableReplicationsNumber(int, int, int, double),
Constant Field Values| Constructor Detail |
|---|
public ExperimentParamVariation()
public ExperimentParamVariation(boolean allowParallelEvaluations)
ExperimentParamVariation() but allows to disable
parallel evaluations on multicore/multiprocessor systems
(which are enabled by default)
allowParallelEvaluations - if false, the
iterations/replications of experiment will be performed
sequentiallygetParallelEvaluatorsCount()| Method Detail |
|---|
public final double getProgress()
public int getCurrentIteration()
public int getNumberOfCompletedIterations()
getCurrentIteration()
because of parallel (multi-threaded) implementation.
public int getCurrentReplication()
isUseReplications()) before
calling this method
public final boolean isUseReplications()
true if experiment uses replications
true if experiment uses replications,
false otherwisepublic void setUseReplications(boolean useReplications)
setFixedReplicationsNumber(int),
setVariableReplicationsNumber(int, int, int, double)public void setFixedReplicationsNumber(int replicationsNumber)
setVariableReplicationsNumber(int, int, int, double)
replicationsNumber - the number of replications to be runsetUseReplications(boolean)
public void setVariableReplicationsNumber(int minimumReplications,
int maximumReplications,
int confidenceLevel,
double errorPercent)
errorPercent of the value obtained at the last
replication)
setFixedReplicationsNumber(int)
minimumReplications - minimum number of replicationsmaximumReplications - minimum number of replicationsconfidenceLevel - one of
CONFIDENCE_LEVEL_80
CONFIDENCE_LEVEL_90
CONFIDENCE_LEVEL_95
CONFIDENCE_LEVEL_98
CONFIDENCE_LEVEL_99
CONFIDENCE_LEVEL_99_9
errorPercent - the error percentage as a value > 0 and < 1.setUseReplications(boolean)public final boolean isLastReplication()
public boolean evaluateStopConditions(ROOT root)
false
true if experiment needs to be terminated after
current iteration/replicationpublic int getRangeParametersNumber()
public void setupRangeVariedParameter(ROOT root,
int paramIndex,
int valueIndex,
boolean callOnChangeActions)
root - root ActiveObject whose parameter value is being setupparamIndex - index of parameter (from 0 to
getRangeParametersNumber())valueIndex - index of parameter value (from 0 to
getRangeParameterValuesNumber(paramIndex) - 1)callOnChangeActions - if true this method should use
set_* methods of root to setup
parameters, otherwise parameter values should be simply
assigned to the fields of rootpublic int getMaximumIterations()
public void setupRootParameters(ROOT root,
int index,
boolean callOnChangeActions)
super.setupRootParameters(root, index); and then setup
values for fixed parameters
root - root ActiveObject whose parameters are being setupindex - iteration number (0-based)callOnChangeActions - if true this method should use
set_* methods of root to setup
parameters, otherwise parameter values should be simply
assigned to the fields of rootpublic double getValueForConfidenceComputation(ROOT root)
root - the root active object
public int[] calculateRangeParameterValuesNumbers()
public final Engine getEngine()
root.getEngine() instead.
Although, the method will most likely return the expected engine,
this could be conceptually better to get engine by using root.getEngine()
where root - is the root (main) active object class.
public long getStep()
Experiment
getStep in class Experiment<ROOT extends ActiveObject>public double[] getSimulationProgress_xjal(double[] output)
output - will be used for output if its length matches the number
of processors, otherwise new array will be created and returned
Engine.getProgress()public final int getRunCount()
Experiment
getRunCount in class Experiment<ROOT extends ActiveObject>
@Deprecated
public void setVariableReplicationsNumber(int minimumReplications,
int maximumReplications,
int confidenceLevel)
setVariableReplicationsNumber(int, int, int, double) instead
public void onAfterIteration()
public java.lang.Object getMutexRead_xjal()
getMutexRead_xjal in class Experiment<ROOT extends ActiveObject>public java.lang.Object getMutexWrite_xjal()
getMutexWrite_xjal in class Experiment<ROOT extends ActiveObject>public void registerPresentation_xjal(Presentation presentation)
Experiment
public int getParallelEvaluatorsCount()
public final int getState()
getState in class Experiment<ROOT extends ActiveObject>public final double getRunTimeSeconds()
getRunTimeSeconds in class Experiment<ROOT extends ActiveObject>public final void run()
run in class Experiment<ROOT extends ActiveObject>public final void step()
step in class Experiment<ROOT extends ActiveObject>public final void pause()
pause in class Experiment<ROOT extends ActiveObject>public final void stop()
stop in class Experiment<ROOT extends ActiveObject>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||