nismod / smif

Simulation Modelling Integration Framework
http://www.itrc.org.uk
MIT License
22 stars 6 forks source link

DecisionModule does not accumulate state #333

Closed willu47 closed 5 years ago

willu47 commented 5 years ago

We are dealing with system state in an inconsistent manner, which means that while pre-specified planning decisions are included in every year of the state file, outputs from previous years of a decision module are not rewritten to a state file.

Solutions:

TLDR; either write separately and read in a bundle, or read separately and write in a bundle;

  1. only write pre-specified planning in base timestep state file and accumulate state through successive years for each decision iteration/timestep path followed, rewriting only the current decisions in each state file, reading them all in through the data_handle.get_state method
  2. the statefile in each timestep holds the complete history, so only the most recent statefile is needed to see a history of all the interventions that took place in a particular timestep/iteration path.
willu47 commented 5 years ago

In chat with Tom:

willu47 commented 5 years ago

Methods to tidy up include:

data_layer/*/*_data_store.py

data_layer/store.py

decisions/decision.py

  1. Strip out all concept of multiple strategies and pre-specified planning - both initial conditions and pre-specified planning can be handled using the existing concept of state. They should be read in and filtered by the get_state method for the current timestep.
    • this may require interventions to drop lifetime attribute, and the state to be pre-computed so that an intervention is present in the state for each timestep during its lifetime
  2. Decision module creates a register of available interventions. These should contain the set of interventions minus the subset of interventions installed in pre-specified and initial condition states.
  3. Decision module requires access to previous timestep/iteration state. (#334)
  4. DecisionManager get_and_save_decisions writes state for the current timestep which excludes pre-specified and initial_conditions