Skip to content

Commit 2ff526f

Browse files
committed
small changes
1 parent 2fde9bd commit 2ff526f

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

cpp-tutorials/abm/tutorial_abm_households.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ int main(int argc, char* argv[])
125125
// creates the actual persons and their home locations.
126126
//
127127
// CLI parameters (see usage at top of main):
128-
// argv[1] = n_households (population size: 50, 125, 500)
129-
// argv[2] = infected_frac (initial infected fraction: 0.05, 0.2, 0.5)
130-
// argv[3] = sim_days (simulation duration: 15, 30, 90)
128+
// argv[1] = n_households (number of households, default: 125)
129+
// argv[2] = infected_frac (initial infected fraction, default: 0.2)
130+
// argv[3] = sim_days (simulation duration, default: 30)
131131
int n_households = arg_n_households;
132132

133133
// --- Type A: two-person household (1 parent + 1 child) -------------------
@@ -242,9 +242,8 @@ int main(int argc, char* argv[])
242242
}
243243

244244
// *** Run the simulation. ***
245-
// We simulate 30 days. The Simulation object takes ownership of the model.
246-
// A History logger records the number of persons in each InfectionState
247-
// at every time step.
245+
// By default, we simulate 30 days. The Simulation object takes ownership of the model.
246+
// A History logger records the number of persons in each InfectionState at every time step.
248247
auto t0 = mio::abm::TimePoint(0);
249248
auto tmax = t0 + mio::abm::days(arg_sim_days);
250249
auto sim = mio::abm::Simulation(t0, std::move(model));

cpp-tutorials/abm/viz_and_run_abm_tutorials.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
# ══════════════════════════════════════════════════════════════════════
2020
# CONFIGURATION – pick ONE tutorial and ONE run (1, 2, or 3)
2121
# ══════════════════════════════════════════════════════════════════════
22-
TUTORIAL = "vaccination" # "household", "testing", or "vaccination"
23-
RUN = 4 # 1, 2, or 3 (see tables below)
22+
TUTORIAL = "household" # "household", "testing", or "vaccination"
23+
RUN = 2 # 1, 2, or 3 (see tables below)
2424

2525
# ── 3 runs per tutorial ──────────────────────────────────────────────
2626
#
@@ -67,12 +67,12 @@
6767
"vaccination": {"exe": "tutorial_abm_vaccination", "file": "abm_vaccination.txt", "title": "Tutorial 3 – Vaccination"},
6868
}
6969

70-
cfg = _config[TUTORIAL]
71-
run_cfg = RUNS[TUTORIAL][RUN]
72-
root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
73-
bin_dir = os.path.join(root_dir, "build", "bin")
74-
exe_path = os.path.join(bin_dir, cfg["exe"])
75-
fpath = os.path.join(bin_dir, cfg["file"])
70+
cfg = _config[TUTORIAL]
71+
run_cfg = RUNS[TUTORIAL][RUN]
72+
root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
73+
bin_dir = os.path.join(root_dir, "build", "bin")
74+
exe_path = os.path.join(bin_dir, cfg["exe"])
75+
fpath = os.path.join(bin_dir, cfg["file"])
7676

7777
# ── Run the executable ────────────────────────────────────────────────
7878
cmd = [exe_path] + run_cfg["args"]
@@ -88,7 +88,8 @@
8888

8989
# ── Infection-state columns & colours ─────────────────────────────────
9090
states = ['S', 'E', 'I_NS', 'I_Sy', 'I_Sev', 'I_Crit', 'R', 'D']
91-
colors = ['blue', 'orange', 'gold', 'red', 'darkred', 'purple', 'green', 'black']
91+
colors = ['blue', 'orange', 'gold', 'red',
92+
'darkred', 'purple', 'green', 'black']
9293
labels = ['Susceptible', 'Exposed', 'Infected (No Symptoms)',
9394
'Infected (Symptomatic)', 'Infected (Severe)',
9495
'Infected (Critical)', 'Recovered', 'Dead']
@@ -110,8 +111,8 @@
110111
ax.set_ylim(bottom=0)
111112

112113
plt.tight_layout()
113-
outpng = f'abm_{TUTORIAL}_run{RUN}.png'
114+
outpng = os.path.join(fpath, f'abm_{TUTORIAL}_run{RUN}.png')
114115
plt.savefig(outpng, dpi=300, bbox_inches='tight')
115116
print(f"\nFinal counts:\n{final.to_string()}")
116-
print(f"Plot saved as '{outpng}'")
117+
print(f"Plot saved at '{outpng}'")
117118
plt.show()

0 commit comments

Comments
 (0)