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

Rng value set in the preference view is wiped once a simulation is run and closed #222

Closed lesquoyb closed 1 month ago

lesquoyb commented 3 months ago

Describe the bug If you setup a new value of the rng in the preference view and run a simulation, it is taken into account during that simulation, but once you close the simulation the value of the rng is reset to the default one. So you basically have to restart gama if you change the rng to make sure it will stay.

Expected behavior I understand that this behaviour is normal when you setup the value for rng at the experiment level, either in the parameters of the experiment or by code (though currently not working, see #221), this should only last the time of one simulation. But in the case of setting it in the preference view, it should be considered as the new default right away and not reset every time you run a simulation with the previous default. An alternative would be to explicitly tell the user that they have to restart gama when setting a new rng, though I think there's much left to do to have it working right away.

AlexisDrogoul commented 3 months ago

I cannot reproduce this behavior. If I write the model :

model rrr

/* Insert your model definition here */

global {

init {
    write rng;
}

}

experiment rr;

Then setting the random number generator name in the preferences sticks without issues and is not reset.

lesquoyb commented 3 months ago

I was manipulating the gama.pref_rng_name, I guess it's not a good idea, what is the point of this variable ?