Ensure model's reproducibility
There has been a huge effort made in GAMA development in order to ensure the reproducibility of the simulations, i.e. when several simulations of the same models are launched with the same random generator seed and same parameter values, they are supposed to provide the same results.
Nevertheless, GAMA provides several ways to speed up simulations runs, e.g. by making parallel the execution of some agents' behaviors. The use of parallelism may destroy the reproducibility of the simulations. More generally, there are many sources of uncertainty which can break this reproducibility.
How to ensure reproducibility of a model?​
If you aim at reproducibility, you need to reduce as much as possible all the sources of uncertainty.
- Fix the random number generator seed: give a value to the
seedattribute of the model (it shows up in the outline of any opened model, besidecycleandrng), or leave it to the default seed of the platform described below. - Keep the random number generator on
mersenne, which is the default of the platform (pref_rng_name): the other generators have not been tested as thoroughly for reproducibility. Two companion preferences make a fixed seed the norm rather than an exception, but neither is on by default:pref_rng_define_seed(defaultfalse) activatespref_rng_default_seed(default1;0means "undefined", i.e. a random seed is drawn), whose value is then taken by every simulation that does not set its ownseed. All three sit in the Random number generation group of theExecutiontab of Support > Preferences. The seed is also absent from the parameters view until you tickpref_rng_in_parameters(defaultfalse) in the Parameters group of the same tab, which is what makes the seed of a run visible and editable while it runs. - Reduce the parallel execution of agents' behaviors.
- remove all the explicitly parallel execution, in particular remove / set to false all the
parallelfacets (e.g. in the loop, ask...). - Set all of GAMA's settings regarding parallelization to false. You can find them in Support > Preferences, under the
Executiontab, in theParallelismgroup, to disable them globally, or you can leave them to their default and turn them off only for your experiment, through the corresponding variables of theplatformspecies, as shown below:
- remove all the explicitly parallel execution, in particular remove / set to false all the
experiment any_exp title: "any exp" {
init {
// Do not let grids schedule their agents in parallel
gama.pref_parallel_grids <- false;
// Do not let experiments run their simulations in parallel
gama.pref_parallel_simulations <- false;
// Do not let species schedule their agents in parallel
gama.pref_parallel_species <- false;
// Do not run the replications of a batch in parallel either
gama.pref_parallel_simulations_all <- false;
// Run any population sequentially, however small
gama.pref_parallel_threshold <- 0;
}
}
- Displays are computed independently of the simulation, and in parallel. Limit computation and model modifications in the aspects.
- Remove any modification of the model in the aspects.
- Do not use any random operators in the aspects (e.g.
rnd,one_of,any...).
- The use of asynchronous communications (using network) with external applications, the use of files (in particular if they are changed externally) can also modify the behavior of simulations