-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_configs.py
121 lines (107 loc) · 2.92 KB
/
generate_configs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
from covidsim.simulation import SimulationParameters, VaccinationParameters
from covidsim.interventions import CloseSchools, WearMask
import json
import itertools
CONSULTORIOS = 640
POPULATION = [i*715_000 // 11_201_549 for i in [
586_000,
623_000,
572_000,
675_000,
691_000,
772_000,
766_000,
636_000,
729_000,
981_000,
1004_000,
856_000,
592_000,
492_000,
492_000,
270_000,
270_000,
95_000,
45_000,
45_000,
]]
PARAMETERS = dict(
abdala_inmunidad = [0.5, 0.6, 0.7, 0.8, 0.9],
abdala_reduccion = [0.9, 0.8, 0.7],
strategy=["bottom-up", "top-down"],
mask_effect=[0.3, 0.2, 0.05],
remove_mask=[0,1,2,3,4,5,6],
open_schools=[0,1,2,3,4,5,6],
infected=[10, 20, 30, 40, 50],
)
def generate_config(
# soberana_inmunidad: float,
# soberana_reduccion: float,
abdala_inmunidad: float,
abdala_reduccion: float,
strategy: str,
mask_effect: float,
remove_mask: int,
open_schools: int,
infected: int,
):
params = SimulationParameters(
days=180,
foreigner_arrivals=0,
chance_of_infection=0.01,
initial_infected=infected,
initial_recovered=7_000,
total_population=POPULATION,
working_population=0.65
)
vaccines = [
# VaccinationParameters(
# name="Soberana",
# start_day=0,
# age_bracket=[20,80],
# vaccinated_per_day=1000,
# maximum_immunity=soberana_inmunidad,
# symptom_reduction=soberana_reduccion,
# effect_duration=180,
# shots=3,
# shots_every=28,
# effect_growth=50,
# strategy=strategy,
# ),
VaccinationParameters(
name="Abdala",
start_day=0,
age_bracket=[20,80],
vaccinated_per_day=(50 * CONSULTORIOS, 150 * CONSULTORIOS),
maximum_immunity=abdala_inmunidad,
symptom_reduction=abdala_reduccion,
effect_duration=180,
shots=3,
shots_every=14,
effect_growth=30,
strategy=strategy
)
]
interventions = [
WearMask(0, 30*remove_mask, mask_effect),
CloseSchools(0, 30*open_schools),
]
return dict(
params.__dict__,
vaccines=[
v.__dict__ for v in vaccines
],
interventions=[
dict(i.__dict__, type=i.description()) for i in interventions
]
)
if __name__ == "__main__":
keys = PARAMETERS.keys()
for i, permutation in enumerate(itertools.product(*PARAMETERS.values())):
kwargs = { k:v for k,v in zip(keys, permutation) }
config = generate_config(**kwargs)
with open(f"params/matanzas/matanzas_{i+1:-05}.json", "w") as fp:
print("\r", end="")
print(i+1, end="")
json.dump(config, fp, indent=4)
print(f"\nDone.")