Reproducible model runs
To make model runs
- In the Projects
select the experiment.
- In the Properties
view, open Randomness
- Select the option Fixed seed (reproducible model runs).
- Specify the seed value of the random number
generator in the Seed value field to the right.
If you run the model with the Fixed seed of random
number generator, but the results are not reproducible, please check
your model according to the list below:
For all experiments:
- Model should not contain HashMap
collections. Use LinkedHashMap.
- Do not use System.currentTimeMillis(),
new Date() and
similar functions that return current system time.
- Results are reproducible only in case of complete model
restart (model window is closed), but multiple experiments in a row
(Start -> Stop -> Start -> …) are
different. It means that each model run leaves
“garbage” in user data. For instance, static
variables are common for all model runs. If one iteration changed the
value, another one would use the modified value.
- In case of external data sources, it makes sense to check
that input data is not changed while the model is running: new
iteration will use modified input data.
- User-defined Random
class ( e.g. Collections.shuffle()
or Math.random() )
should not be used in the model. Use getDefaultRandomNumberGenerator()
function to get access to the model random numbers stream.
- If conversion from date to model time is used, model
start/stop date should be specified in the experiment properties, Model time section.
- Dynamic properties of shapes should not contain any
functions that change something in the model.
- Custom parallel threads (if any) should be correctly
synchronized and put in order.
functions should not be called in the model.
For experiments with multiple iterations:
- Experiment should not contain static variables or fields
that are changed from within iteration.
- Random Number Generator in a custom experiment should be
reset or reinitialized before each new model run.
- Optimization experiment with parallel evaluations may give
different results each time. New set of parameters values is formed
based on previous solutions. The number of these solutions at specific
moment of time can vary because of different execution speed of each
iteration. Disable parallel evaluations to get the same result each
- If results of the experiment with multiple iterations do
not correspond to results of Simulation experiment, it makes sense to
check model start/stop time, random seed, selection mode for
simultaneous events and other engine settings.