CityScope / CS_Simulation_GAMA

Agent Based Simulation platform for CityScope
GNU General Public License v3.0
30 stars 21 forks source link

Run Several Simulations with this model #134

Open LAAP opened 3 years ago

LAAP commented 3 years ago

Dear @agrignard ,

I am planning us writing an article base in the statistical outputs from this simulation.

Keeping that in mind we need to run the simulation as minimum of 30 times, the AUTONOMUS model, and 30 times the NORMAL model, and gather the outputs in "very well labeled" csv files.

Te idea is triggering the infection at the same moment in all the simulations and run all of them the same amount of time (cicles). Enough time to see how infection rises the pick or not and stabilizes

I can run this manually (a mess) or you can implement 1 line of code (like @maitaneiruretagoyena did in her Dynamic Urban Planing code, and make our life easier...

Thank you @agrignard !

agrignard commented 3 years ago

@LAAP I can try to spend some time on this. However you can also run differnet simulation and the results will be store in different csv and start to work on the Excel Macro to analysis those data.

I will try to have something more automatic soon using a batch experiment

agrignard commented 3 years ago

Ok @LAAP you should now have your magic line... we'll see later how you can thanks me ;-)

However I think you/ones could have wrote this line easily by just looking at the batch documentation here:https://gama-platform.github.io/wiki/Batch-Batch

Basically you want to ask Gama to run N simulations (and save the results in a file at the end of the simulation) and you consider that a simulation is over after 24 hour (it can be another condition like when 90% of the population is infected or whatever)

OK SO JUST WRITE IT in GAMA LIKE THIS

experiment 'Run N simulations' type: batch repeat: 10 keep_seed: true until: ( time > 24#hour ) {
}

So just update this repo and run the Green button called Run N simulations in Autonomous_Covid_Community.gaml and play with the facet repeat (now set to 10) to define the number of experiment you want. Each experiment will create a .csv file (e.g output2021-03-02 11:38:32_sim0.csv)

All the 'smart' save is happening here

    reflex save_model_output when: every(#hours) and savetoCSV{
        write "save to csv at time:" + time;
        save [time,cycle,date("now"),length(ViralPeople),length(building),
        length(building where (each.type="residential")),length(building where (each.type="shopping")),length(building where (each.type="business")),
        length(people where (each.macroTrip=false)),length(people where (each.macroTrip=true)),
        PANDEMIC_LEVEL, CITY_EFFICIENCY, SAFETY_LEVEL,
        nb_susceptible,nb_infected, nb_recovered, nb_death
        ] to: filePathName type:"csv" rewrite: false;
    }

2 important parameters you might want to consider: 1/ The step of the simulation. (right ow set to #10sec) line 25

  1. The moment you save the status of the sim. now set to every(#hours) but you can play with that
LAAP commented 3 years ago

Thank you very much @agrignard !

I will find the way of paying you! Hahahah! This is great!

I do not have implemented this before, even when it is in the GAMA tutorials because what it took you 30min, it takes me 1 or 2 weeks... maybe a month. Hahahah!

I will test it this weekend and let's see what can we learn from the model and the statistics ;)

agrignard commented 3 years ago

@LAAP when you'll have time to test it I think we can close this issue

LAAP commented 3 years ago

@agrignard , I may need some navigation to run this. What about you helping me in our next zoom call?

agrignard commented 3 years ago

ok

LAAP commented 3 years ago

Hi @agrignard ,

I have been trying and I found several issues that I will list here. You can decide if you want to divide it into individual issues or not:

a) Triggering the pandemic: It is not working any more either at the "City Model" or at the "Run "N" simulation". For triggering the pandemic in the model we use to have to press a key letter at the keyboard. This Key is not working any more at the "City Model", and I do not know how to trigger it at the "Run "N" simulation". I have runned 10 times and the result was always "0" at the Pandemic level:

Captura de pantalla 2021-04-22 a las 19 10 30

b) Comparison between the 2 scenarios: At the "Run "N" simulation" it is not possible to decide what "city" are we simulating (Autonomous or conventional). Remember, that the point of N simulations is to make comparisons between the two city models

c) Comparison between the different parameters on each simulation: At the "Run "N" simulation" it is not possible to decide or change the different parameters from the "City Model" :

Captura de pantalla 2021-04-22 a las 19 17 52

Remember, that the point of N simulations is to make comparisons between the two city models and the different parameters, and make a sensitive analysis of them.