djgroen / flee

flee agent-based modelling code
BSD 3-Clause "New" or "Revised" License
8 stars 7 forks source link

Double-check agent totals in coupled simulations #27

Closed djgroen closed 11 months ago

djgroen commented 4 years ago

Is the total # of agents in both models equal to the ones in refugees.csv? Are agents from the microscale model indeed added up correctly when adding new agents every time step?

alirezajahani60 commented 3 years ago

In my opinion, the total # of agents in both models are not equal to the ones in refugees,csv because DataTable.py are unable to read them properly when it is called in run_mscale.py. Besides, the agents of the microscale model are not added up from macroscale correctly and we see a very low number of agents in microscale results. Perhaps because of coupling.py missfunctionality. I need help to find the bug and resolve it.

djgroen commented 3 years ago

There are two ways to get the UNHCR raw data:

  1. Directly read the numbers from refugees.csv (SumFromCamps=False)
  2. Directly read the numbers from all .csv files and add them up (SumFromCamps=True).

The second one is more robust, but doesn't work in multiscale mode due to camps being split across simulations.

Perhaps you can either (a) modify DataTable such that it always obtains both (1) and (2), and that you can simply select between the two in your script with the SumFromCamps flag? (b) write your own routine that does this?

That would eliminate the need to rerun for debugging purposes I think.

In any case, first check that the right number of agents are inserted in your simulation at timestep = 0, before you start looking at timestep = 1 and beyond.

alirezajahani60 commented 3 years ago

With SumFromCamps=False: 1) Since our refugees.csv has 0 value in timestep=0 so new_refs=0 2) But for timestep=1 the new_refs=403 for both macro and micro and it means it divides the refugees.csv value at timestep=1 which is 807 by two (2 x 403) 3) The same is happening at timestep=2 (807 --> 2x x404) 4) However, for the rest of timesteps, unlike the values in refugees.csv, the new_refs values are very low, sometimes negative

djgroen commented 11 months ago

I believe this probably has been solved a while ago, but if not we will be overhauling the implementation much more fundamentally anyway.