FIG. 28

Epidemic on a Network

Python lab · SIRS on a graph · Contagion
‹ All models

An SIRS epidemic on a random contact network, from the Python ABM lab. Infected agents lose health and can die, recovered agents stay immune for a while and then become susceptible again, and a small chance of infection from outside keeps the disease circulating. Susceptible agents watch their neighbours and isolate when too many are sick. Optuna searched for an infection that never dies out but returns in regular waves without wiping out the population; this is the winning setting, run offline and played back.

Engine
Mesa 3.5 · NetworkX
Network
280 nodes · average degree 4 · 10 infected at start
Key parameters
spread 0.59 · immunity wanes 0.074 · outside infection 0.029
Run
500 steps · seed 33700
Tuning
Optuna, 500 trials · winner #337
Score
0.8931 of 1 (persistence, waves, regularity, survival)
Colours
white = susceptible · red = infected · green = recovered · dim = empty
Infected agents · 5–109 · one value per step, downsampled
Susceptible, infected and recovered agents over the run
Susceptible, infected and recovered agents over the run
Optuna score of every tuning trial
Optuna score of every tuning trial
Source · Python ABM lab (Mesa + Optuna) — python/abm-sim in this repo
NotesFIG. 28 · Sheet 29

Infection, waning immunity and self-isolation on a contact network, tuned so the disease returns in regular waves. A recorded run.

DrawingSimulation Lab — Sheet 29 / 30
DisciplineComplex Systems
MethodNumerical / Agent
Date2026.05.30