Closed jcus0006 closed 7 months ago
This turned out to be mostly relevant because the contact network doesn't require the whole number of properties like the itinerary does.
Did some preliminary tests to compare performance with the full collection and with the partial collection:
With regards to the itinerary, with full agents, average over 3 runs was: 175.43s (starting futures took 102.92s on average)
with partial agents, average over 3 runs was: 138.64s (starting futures took 74.52s on average)
However, the partial collection has the drawback that once synced with the main collection, it would replace it with a partial version of the properties. This was not really relevant for the "vaccination_days" subject that this issue tackles, because "vaccination_days" should have been passed to the itinerary in the first place (in fact the itinerary would likely need access to the property on subsequent days). but the issue still applies to the contact network, which would suffer the same problem should its partial dict be synced directly with the main agents_dynamic dict (in terms of replacing the full properties with partial ones).
In light of this, I implemented a method that actually splits all dynamic agent information into 2 collections. 1 collection is dedicated for itinerary related structures, and the other is dedicated for epidemiological events structures such as test days, test results days and vaccination days, among others.
Average over 3 runs for this was: 139.82s (starting futures took 73.49s on average)
This is great. We solve the problem and practically lose no time.
However, the first result does not make a lot of sense. The numbers listed above are purely itinerary based. And the itinerary includes (more or less) all the properties in the agents_dynamic collection. There is considerable difference and I should dedicate some more time to figure out the source of this discrepancy.
In the meantime however, I will run the full simulation for day 1 for both the itinerary and the contact network.
To protect performance and reduce the number of writes required, we replace the agent by index in the main agents_dynamic dict:
agents_dynamic[agentid] = it_agents[agentid]
however it_agents is a partial dict, and messes up the main dict.
This also applies to all the other "missing" properties.
Updating each property 1 by 1 may be too fine grained and is likely to take too much time.
An alternative needs to be considered, e.g. splitting the data required by different stages of the itinerary into different collections.