gama-platform / gama

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

Parameter not working with explicit create in experiment #130

Closed chapuisk closed 2 months ago

chapuisk commented 4 months ago

Describe the bug When the experiment explicitly overload the _init_ action to create a simulation parameters are not working anymore. It may be relatated to discussion #63

To Reproduce copy-past this simple example model:

global {

    int nb <- 0 parameter:true;

    init { create o number:nb; write sample(nb);}

}

species o {}

experiment explicitinit {
    action _init_ {
        create simulation with:[name::"supercoolname"];
    }
}

experiment implicitinit {}

launch both experiment edit: change the value of nb in the parameter panel Reload the simulation variable nb do not change with explicit init action

Expected behavior either to warn modeler or to turn parameter active even with explicit init action in experiment

Additional context hence, all parameter of the pedestrian model examples are disable

AlexisDrogoul commented 4 months ago

Sorry -- I don't understand the issue. When I launch both experiments, I have the same result, with the difference that one is name supercoolname and not the other, but the parameter nb is displayed in both cases.

chapuisk commented 4 months ago

@AlexisDrogoul if you change the value of the parameter in UI and reload simulation, the value won't change in the supercoolname simulation !

AlexisDrogoul commented 3 months ago

Actually, if one moves the create simulation to a reflex in the experiment, the simulation is (correctly) recreated with a value of 10 when the experiment is relaunched, but after that, at each step, it is created with 0. So the problem is that it seems to be the call to create that does not take into account the UI parameters.

AlexisDrogoul commented 3 months ago

I have identified and -- normally -- fixed the problem in https://github.com/gama-platform/gama/commit/9d1a9d435c04e70d862dbae6fd1996c88adcbfd2. Please test as this is quite a sensitive area !