gama-platform / gama

Main repository for developing the 2024+ versions of GAMA
https://gama-platform.org
GNU General Public License v3.0
20 stars 5 forks source link

Setting seed value doesn't work in test experiments #178

Open lesquoyb opened 4 months ago

lesquoyb commented 4 months ago

Describe the bug The setting of a value for the seed in the experiment declaration is ignored in experiments of type test. Which is not the case in GUI.

To Reproduce Steps to reproduce the behavior:

  1. Copy paste this model:

model seed

experiment t type:test { float seed <- 0.001;

test te {
    write rnd(0.0,1.0);
}

}

experiment g type:gui { float seed <- 0.001;

init {
    write rnd(0.0,1.0);
}

}


3. Run the experiment t and reload it
4. See that the printed value is different everytime
5. You can do the same with the experiment g and see that the value stays the same
lesquoyb commented 4 months ago

note: actually setting the seed inside a unit test works as expected, and there is some point to not setting the value globally, as normally unit tests should be thought to be run independently and in any order. So I suggest that we just add a warning when the user tries to set the seed directly in the experiment declaration instead of inside a test