This is the flat 2D agent-based companion to the 3D SIR Epidemic Model. Instead of a continuous population fraction, every dot here is an individual agent wandering the plane at its own random heading. Infection is a real proximity event: each frame, every susceptible agent checks nearby infected agents (via a spatial grid, not brute force) and rolls a per-contact transmission probability scaled from β. Infected agents recover after a randomised duration drawn around 1/γ, not a fixed countdown, so recovery times form a real distribution rather than a single number.
The chart below plots two things on the same axes: solid lines are the actual counted S/I/R populations from the agent simulation, and dashed lines are the same day's S/I/R solved from the deterministic ODEs dS/dt = −βSI, dI/dt = βSI−γI, dR/dt = γI (integrated with the same β, γ and starting conditions, population-normalised). Watching the two tracks diverge and re-converge is the point: the stochastic, spatial agent model and the mean-field differential-equation model make the same qualitative prediction but not an identical one, especially with small N or when the outbreak nearly fails to take off by chance.
- Agents N — number of individuals on the plane.
- Initial infected — agents seeded as Infected at t=0.
- Vaccinated % — fraction of the remaining population immunised before the run starts (drawn green, counted as Recovered/immune in both agent and ODE tallies).
- Transmission β — per-contact infection probability scale; also the ODE's β.
- Recovery rate γ — controls both the ODE decay and the mean of each agent's randomised infectious period.
- Infection radius — how close (in pixels) an infected agent must be to a susceptible one to risk transmission.