Closed benoitgaudou closed 4 years ago
project_path
is only accessible within an experiment, while case_study
path is used in the global to initialize the simulation ...
I have almost finish struggling with path dependency but still have a strange behavior: see the TODO in Parameters.gaml
action build_data_set_path
(line 254) @AlexisDrogoul @benoitgaudou
@ptaillandier found a workaround applying the const: true
facets for the default values. However, the problem remain the same for non-constant variables. As a consequence, you cannot choose you case_study. In fact it is even more weird, because the variable case_study
is correctly initialized whereas datasets_folder
is nil, even if a value have been assigned
It is a bit obscure, but I guess the order in which the variables are initialised plays a role here. I would bet that GAMA does not find the dependencies between the call to build_data_set_path
and the two default variables. Can you try two things ?
world.
prefixes, which are not really usefulbuild_data_set_path
two parameters (the default values) and use them in the function rather than using directly the global variables.Tell me if any of these changes modify the behaviour.
@AlexisDrogoul I already try these two solutions: for the first one, variable are nil whatever I can do, whereas the second solution is ok but does not provide a solution. The main issue is when you try to give non constant variables (case_study and datasets_folder) a value which is partly recognize by Gama ... I push the model as it is, so you can try by yourself (with nasty write statement in build_data_set_path)
No, the issue is in the computation of dependencies between the variables, which determines the order in which they are initialised. That's why the second solution works: you force the order of initialisation explicitly by using the two constants in the call to the function (these 2 constants must be initialised before calling the function, whereas they must not if they are simply used in the function). This is a bug in GAMA, but the second solution should work well while I'm figuring out how to fix it in GAMA (w/o breaking the compilation phase with recursive functions).
Up to now, all the file paths are determined from the location of the experiment that is launched.
To avoid error and give more flexibility to modeler in their definition of experiment, we should use project_path to define path.