imperialCHEPI/healthgps

[ENHANCEMENT] Allow for saving and replaying baseline simulation

alexdewar opened this issue · 0 comments

It would be useful if users could run an intervention simulation without also having to run the baseline simulation at the same time. Currently, there is no way to do this; if you want to run multiple intervention simulations with the same baseline simulation (i.e. the same random seed), you end up re-running the baseline simulation in parallel each time. This is a waste of memory and CPU resources. In addition, quite a lot of complexity is required to pass messages back and forth between the baseline and intervention simulations, which could (eventually) be removed, simplifying the code and improving performance by removing locking contention.

For now, let's just start by allowing users to save and replay the baseline simulation. You can run a baseline simulation by itself, so we just need to modify this mode of operation to allow for saving this data somewhere. Then we need to change the "intervention mode" so that it can read the adjustment messages from disk rather than a parallel simulation.

We should make all this optional for now. Once the researchers have confirmed that this workflow works for them, we can consider ripping out all the messaging code.

I should add that this approach does have one potential drawback: in the case where a user wants to run only one intervention simulation they will still need to run the baseline simulation separately beforehand which might be slower than running them in parallel, depending on available CPU resources etc. Without testing, we have no way to know whether performance will be worse or better though, so we will need to do this in the longer term, so we can assess what our options are. In the absolute worst case, we could just pass data between simulations via a file/named pipe and still do our big refactor.