jcus0006 / mtdcovabm

Distributed Covid 19 Agent Based Model modelled on Maltese data.
0 stars 0 forks source link

Tourists are dynamically added and removed from global memory but this is not reflected in the remote workers #26

Closed jcus0006 closed 9 months ago

jcus0006 commented 9 months ago

Had a hunch that tourists data was being maintained on the main memory while switching the tourism implementation to be similar to local itinerary in terms of using it_agents and agents_epi.

During this investigation, found a bug whereby cells_agents_timesteps were being removed before the local_itinerary, which means that tourists and locals were not mixing. This means that once fixed the contact network and contact tracing will be slower (as there will be more data to process), but definitely more realistic.

The contact network requires the "agents_static" dict and without it, it crashes. The fact that cells_agents_timesteps was being cleared before calling the local itinerary was the reason why the contact network was not failing in the first place.

Luckily we can use a simple client.submit and specify each worker, and update the "agents_static" by removing existing tourists and adding new ones. It is important that tourists that leave (and agents that are deceased) are cleared, so as to keep memory within control. A simple example has already been tried to prove that the worker.data object can be updated during runtime. In this regard, must get rid of the "new_tourists" key, or rather change it to some structure/s that make sense.

Once the main issue is fixed, must continue updating the tourist itinerary to use it_agents and agents_epi, like the rest of the simulation. An attempt to do this was in fact the reason why this issue was discovered in the first place.