def run_policies( district_cases: Dict[str, pd.DataFrame], # timeseries for each district populations: pd.Series, # population for each district districts: Sequence[str], # list of district names migrations: np.matrix, # O->D migration matrix, normalized gamma: float, # 1/infectious period Rmw: Dict[str, float], # mandatory regime R Rvw: Dict[str, float], # voluntary regime R lockdown_period: int, # how long to run lockdown total: int = 90 * days, # how long to run simulation eval_period: int = 2 * weeks, # adaptive evaluation perion beta_scaling: float = 1.0, # robustness scaling: how much to shift empirical beta by seed: int = 0 # random seed for simulation ): lockdown_matrix = np.zeros(migrations.shape) # lockdown 1 model_A = model(districts, populations, district_cases, seed) simulate_lockdown(model_A, lockdown_period, total, Rmw, Rvw, lockdown_matrix, migrations) # lockdown 1 model_B = model(districts, populations, district_cases, seed) simulate_lockdown(model_B, lockdown_period + 6, total, Rmw, Rvw, lockdown_matrix, migrations) # lockdown + adaptive controls model_C = model(districts, populations, district_cases, seed) simulate_adaptive_control(model_C, lockdown_period, total, lockdown_matrix, migrations, Rmw, { district: beta_scaling * Rv * gamma for (district, Rv) in Rvw.items() }, { district: beta_scaling * Rm * gamma for (district, Rm) in Rmw.items() }, evaluation_period=eval_period) return model_A, model_B, model_C
def run_policies(seed): model_A = model(seed) simulate_lockdown(model_A, lockdown_period, total, {"SULSEL": Rt_m_scaled}, {"SULSEL": Rt_v_scaled}, np.zeros((1, 1)), np.zeros((1, 1))) # lockdown 1 model_B = model(seed) simulate_lockdown(model_B, lockdown_period + 2 * weeks, total, {"SULSEL": Rt_m_scaled}, {"SULSEL": Rt_v_scaled}, np.zeros((1, 1)), np.zeros((1, 1))) # lockdown + adaptive controls model_C = model(seed) simulate_adaptive_control(model_C, lockdown_period + 2 * weeks, total, np.zeros((1, 1)), np.zeros( (1, 1)), {"SULSEL": Rt_m_scaled}, {"SULSEL": gamma * Rt_v_scaled}, {"SULSEL": gamma * Rt_m_scaled}) return model_A, model_B, model_C
def run_policies(migrations, district_names, populations, district_time_series, Rm, Rv, gamma, seed, initial_lockdown=13 * days, total_time=190 * days): # run various policy scenarios lockdown = np.zeros(migrations.shape) # 1. release lockdown 31 May release = get_model(district_names, populations, district_time_series, seed) simulate_lockdown(release, lockdown_period=initial_lockdown + 4 * weeks, total_time=total_time, RR0_mandatory=Rm, RR0_voluntary=Rv, lockdown=lockdown.copy(), migrations=migrations) # 3. adaptive release starting 31 may adaptive = get_model(district_names, populations, district_time_series, seed) simulate_adaptive_control( adaptive, initial_lockdown, total_time, lockdown, migrations, Rm, {district: R * gamma for (district, R) in Rv.items()}, {district: R * gamma for (district, R) in Rm.items()}, evaluation_period=1 * weeks) return (release, adaptive)
def run_policies( ward_cases: Dict[str, pd.DataFrame], # timeseries for each ward populations: pd.Series, # population for each ward wards: Sequence[str], # list of ward names migrations: np.matrix, # O->D migration matrix, normalized gamma: float, # 1/infectious period Rmw: Dict[str, float], # mandatory regime R Rvw: Dict[str, float], # mandatory regime R total: int = 188 * days, # how long to run simulation eval_period: int = 2 * weeks, # adaptive evaluation perion beta_scaling: float = 1.0, # robustness scaling: how much to shift empirical beta by seed: int = 0 # random seed for simulation ): lockdown = np.zeros(migrations.shape) # 8 day lockdown model_A = model(wards, populations, ward_cases, seed) simulate_lockdown(model_A, 8 * days, total, Rmw, Rvw, lockdown, migrations) # 8 day + 4 week lockdown model_B = model(wards, populations, ward_cases, seed) simulate_lockdown(model_B, 8 * days + 4 * weeks, total, Rmw, Rvw, lockdown, migrations) # 8 day lockdown + adaptive controls model_C = model(wards, populations, ward_cases, seed) simulate_adaptive_control( model_C, 8 * days, total, lockdown, migrations, Rmw, {ward: beta_scaling * Rv * gamma for (ward, Rv) in Rvw.items()}, {ward: beta_scaling * Rm * gamma for (ward, Rm) in Rmw.items()}, evaluation_period=eval_period) return model_A, model_B, model_C