Skip to content

Commit b7396d0

Browse files
committed
Try yourself exercise 7 and cpp exercises
1 parent 65caee5 commit b7396d0

5 files changed

Lines changed: 57 additions & 3 deletions

File tree

cpp-tutorials/exercises/exercise01.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,10 @@ int main()
6363

6464
// We export the results as csv which is saved in the current folder. Then we can plot the results using plot_secir_results.py.
6565
auto export_status = result.export_csv("../../cpp-tutorials/exercises/results_ode.csv");
66+
67+
// Try yourself
68+
// You have seen how to set up and run MEmilio's ODE-SECIR model. You can now explore the model yourself. Here are some suggestions what you can do:
69+
// - **Controlling the transmission process**: What happens if you modify the transmission probability or the contact frequency in the same way?
70+
// - **Diseases with severe courses**: Increase the proportion of severe or critical cases. What happens to the number of deaths?
71+
// - **Asymptomatic courses**: How does disease dynamics behave if we only have pre-symptomatic and no asymptomatic cases? What happens if we increase the average time in the non-symptomatic state?
6672
}

cpp-tutorials/exercises/exercise03.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,9 @@ int main()
6161

6262
// We export the results as csv which is saved in the current folder. Then we can plot the results using plot_secir_results.py.
6363
auto export_status = result.export_csv("../../cpp-tutorials/exercises/results_ode_npis.csv");
64+
65+
//Try yourself
66+
// After having learned how to use dampings, you can now try out yourself. Some suggestions what you can try are:
67+
// - **Lifting non-pharmaceutical interventions (NPIs)**: Can you temporarily implement an NPI and lift it again after 2 weeks?
68+
// - **Increasing contact rates**: Increase the contact rate after 20 days. What does this do to the simulated disease spread?
6469
}

cpp-tutorials/exercises/exercise05.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,9 @@ int main()
7474

7575
// We export the results as csv which is saved in the current folder. Then we can plot the results using plot_secir_results.py.
7676
auto export_status = result.export_csv("../../cpp-tutorials/exercises/results_ode_ageres.csv");
77+
78+
// Try yourself
79+
// Now you can explore an age-resolved SECIR-model yourself. Examples what you can do are:
80+
// - **Even more age groups**: Initialize a model with 5 (age) groups with each group having a 2 times higher risk of dying from critical infection than the group before.
81+
// - **Age-dependent contact rates**: How can you include varying contact rates between age groups? Increase the contact rate within age group 1 and between age group 1 and 2.
7782
}

cpp-tutorials/exercises/exercise07.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,9 @@ int main()
114114

115115
// We export the results for region 0 as csv which is saved in the current folder. Then we can plot the results using plot_secir_results.py.
116116
auto export_status = result_region0.export_csv("../../cpp-tutorials/exercises/results_ode_region0.csv");
117+
118+
// Try yourself
119+
// You can now explore the Graph-ODE model yourself. Here are some suggestions what you can do:
120+
// - **Exchanging individuals between regions with different frequencies**: Set up two identical models with two regions (nodes) and symmetric exchange between regions. The first model exchanges individuals twice a day and the second every hour. How does that influence infection dynamics?
121+
// - **Spatial heterogeneity**: Add a third region to the model. Commuters of the third region only commute to the second region with a rate twice as high as the mobility rate between the first and second region.
117122
}

exercises/exercise07.py

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,31 @@ def _(mo):
239239

240240

241241
@app.cell
242-
def _(graph, mio, model, np, osecir):
242+
def _(model, np):
243243
# One coefficient per (age group x compartment)
244244
mobility_coefficients = 0.1 * np.ones(model.populations.numel())
245-
# Dead individuals do not commute
246-
mobility_coefficients[osecir.InfectionState.Dead] = 0
245+
return (mobility_coefficients,)
246+
247+
248+
@app.cell
249+
def _(mo):
250+
mo.md(r"""
251+
### Exercise
252+
253+
Set the mobility coefficients for `Dead` individuals to zero:
254+
Hint: For the first age group this can be done via `mobility_coefficients[0 * int(osecir.InfectionState.Dead) + osecir.InfectionState.Dead] = 0`.
255+
""")
256+
return
257+
258+
259+
@app.cell
260+
def _():
261+
# Insert code here
262+
return
263+
264+
265+
@app.cell
266+
def _(graph, mio, mobility_coefficients):
247267
mobility_params = mio.MobilityParameters(mobility_coefficients)
248268
# Add two edges to graph
249269
graph.add_edge(0, 1, mobility_params)
@@ -359,5 +379,18 @@ def _(osecir, plt, result_region0_interpolated, result_region1_interpolated):
359379
return
360380

361381

382+
@app.cell
383+
def _(mo):
384+
mo.md(r"""
385+
## Try yourself
386+
387+
You can now explore the Graph-ODE model yourself. Here are some suggestions what you can do:
388+
389+
- **Exchanging individuals between regions with different frequencies**: Set up two identical models with two regions (nodes) and symmetric exchange between regions. The first model exchanges individuals twice a day and the second every hour. How does that influence infection dynamics?
390+
- **Spatial heterogeneity**: Add a third region to the model. Commuters of the third region only commute to the second region with a rate twice as high as the mobility rate between the first and second region.
391+
""")
392+
return
393+
394+
362395
if __name__ == "__main__":
363396
app.run()

0 commit comments

Comments
 (0)