Closed benoitgaudou closed 4 years ago
@chapuisk commit (inversing operand of the action createPolicy) seems to fix the issue:
policy <- createPolicy(not(c[1]), not(c[0]));
But, reading the code, we can see:
in Authority.gaml: for action createPolicy, the operand should be first for the school, then for work.
AbstractPolicy createPolicy (bool school, bool work) {
in the current code (after Kevin's commit), we have:
action define_policy{
ask Authority {
list<bool> c <- world.ask_closures();
ask world {do console_output(sample(c),"School and workplace shutdown.gaml");}
policy <- createPolicy(not(c[1]), not(c[0]));
}
}
list<bool> ask_closures {
return list<bool>(user_input("Select closure politics: ", [enter("School closure",true),enter("Workplace closure",true)]).values);
}
So (intuitively) the result for ask_closures
should be a list with first a boolean for school and a second for work. So inversing the operand in the call of createPolicy is not coherent.
In fact, the issue seems to come from the fact that calling .values
does not respect the order in which the map, produced by the user_input
, has been created.
So we should not rely on the order of the values.... and return the whole map.
Ok I change the management of user_input to take into account the fact that returned map is unordered !
When running the model
School and workplace shutdown.gaml
, I notice that the user_input window does not seem to behave as expected:When working place closure is set to true, and school closure set to false:
The simulation seems to show the converse behavior (as many individuals move to the working place in the bottom left of the picture)