Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use projet_path to redefine all the global variable #21

Closed
benoitgaudou opened this issue May 5, 2020 · 7 comments
Closed

Use projet_path to redefine all the global variable #21

benoitgaudou opened this issue May 5, 2020 · 7 comments
Labels
bug Something isn't working

Comments

@benoitgaudou
Copy link
Contributor

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.

@benoitgaudou benoitgaudou added the bug Something isn't working label May 5, 2020
@chapuisk
Copy link
Collaborator

chapuisk commented May 5, 2020

project_path is only accessible within an experiment, while case_study path is used in the global to initialize the simulation ...

@chapuisk
Copy link
Collaborator

chapuisk commented May 5, 2020

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

@chapuisk
Copy link
Collaborator

chapuisk commented May 5, 2020

@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

@AlexisDrogoul
Copy link
Contributor

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 ?

  1. Remove all the world. prefixes, which are not really useful
  2. Pass to build_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.

@chapuisk
Copy link
Collaborator

chapuisk commented May 5, 2020

@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)

@AlexisDrogoul
Copy link
Contributor

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).

@chapuisk
Copy link
Collaborator

chapuisk commented May 6, 2020

Bug fix (gama-platform/gama@81f6d2f)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants