Dancing in the Danger Zone: Modeling Epidemics in Continuous Space
How proximity—not just contact—shapes the spread of disease
🌐 Introduction
Picture a crowded concert, a bustling office, or a packed classroom. People aren’t fixed in place like chess pieces—they drift, chat, turn, and brush past one another. In this fluid world, distance matters: the closer you are to someone coughing, the higher your risk.
This is the realm of the Continuous Space Agent-Based Model (ABM)—a simulation framework where agents move freely in 2D (or 3D) space, and infection depends on real-time proximity, not pre-defined ties or grid cells. Think of it as a digital dance floor: every step changes who’s near whom, and thus who might catch a virus.
Unlike lattice models (rigid grids) or static networks (fixed friendships), continuous space models capture the ephemeral intimacy of physical closeness—ideal for airborne diseases like influenza, measles, or SARS-CoV-2 in indoor settings [1–3]. In this article, we’ll unpack how these models work, why their realism comes at a computational cost, and how scientists use them to design safer spaces.
Ready to step into the simulation?
🚶 Model Description
In the Continuous Space ABM, N agents move within a bounded environment—typically the unit square [0,1] × [0,1], though real-world rooms or buildings can be mapped directly. Each agent has a position xᵢ(t) = (xᵢ, yᵢ) that updates daily.
Agents progress through a SEIR disease state:
- S: Susceptible
- E: Exposed
- I: Infectious
- R: Recovered
Time advances in discrete steps (e.g., hours or days). Each step involves movement, transmission, and disease progression.
🧭 Movement Rule
Each day, every agent takes a random step of fixed length s:
xᵢ(t+1) = xᵢ(t) + s · (cos θᵢ, sin θᵢ)
where θᵢ ~ Uniform(0, 2π) is a random direction.
To keep agents inside the domain, reflective boundaries are often used: if a step would take an agent outside [0,1]², it “bounces” back. Alternatively, periodic boundaries (toroidal space) or room-specific constraints (walls, furniture) can be applied [4].
💡 Step size s controls mobility: s = 0.01 mimics slow office movement; s = 0.1 resembles a busy market.
🦠 Transmission Rule
At each time step, for every infectious agent i (I) and susceptible agent j (S), compute the Euclidean distance:
dᵢⱼ(t) = ‖xᵢ(t) − xⱼ(t)‖
If dᵢⱼ(t) ≤ r, where r is the contact radius, then infection may occur with probability:
pᵢⱼ(t) = 1 − exp(−β · g(τᵢ))
Where:
- β (beta) is the baseline transmissibility scale,
- τᵢ is the time since agent i became infectious,
- g(τ) is the infectiousness curve (e.g., peaking at τ = 2 days).
This rule embodies a key principle: only close proximity enables transmission. Two people across a room pose no risk—even if they’re in the same “setting.”
⏳ Disease Natural History
As in other micro-simulations, each agent draws:
- Tᴱᵢ ~ incubation period distribution (e.g., log-normal),
- Tᴵᵢ ~ infectious period distribution.
Typical values:
- Influenza: ⟨Tᴱ⟩ ≈ 2 days, ⟨Tᴵ⟩ ≈ 5 days
- Measles: ⟨Tᴱ⟩ ≈ 10 days, ⟨Tᴵ⟩ ≈ 8 days
Agents auto-progress: S → E → I → R.
📏 Key Parameter Definitions & Typical Values
| N | Population size | Number of agents in space | 50 – 10,000 |
| s | Step size | Daily movement distance | 0.005 – 0.2 (unit square) |
| r | Contact radius | Max distance for transmission | 0.02 – 0.1 (≈1–5 meters scaled) |
| β | Transmissibility | Per-close-contact infection risk | 0.05 – 0.5 |
| g(τ) | Infectiousness curve | Time-varying transmission potential | Bell-shaped; peak at τ = 1–3 days |
| ⟨Tᴱ⟩ | Mean incubation | Avg. time to infectiousness | 1–14 days |
| ⟨Tᴵ⟩ | Mean infectious period | Avg. duration of infectiousness | 3–14 days |
🌟 Scaling note: In real-world units, if the room is 10 m × 10 m, then r = 0.05 corresponds to 0.5 m—roughly conversational distance.
⚖️ Assumptions and Applicability
The model rests on several key assumptions:
✅ Isotropic movement: Agents move in random directions (no purposeful navigation).
✅ Instantaneous mixing within radius: All pairs within r have equal transmission chance.
✅ No environmental persistence: Virus doesn’t linger in air/surfaces after agent leaves.
✅ Homogeneous susceptibility: All susceptibles equally vulnerable (unless modified).
🎯 When is this model most useful?
- Indoor airborne transmission: Classrooms, offices, airplanes, restaurants [5–6].
- Short-duration outbreaks: Where movement patterns dominate over long-term behavior.
- Ventilation & distancing studies: Testing how room layout or mask use alters risk [7].
- Superspreading event analysis: Recreating “choir practice” or “nightclub” outbreaks [8].
It is less suitable for:
- Diseases requiring prolonged contact (e.g., tuberculosis),
- Large-scale geographic spread (use metapopulation models),
- Settings where social ties override proximity (e.g., households—use static networks).
🔧 Model Extensions and Variants
To enhance realism, researchers have developed powerful extensions:
1. Room-Based Environments
Divide space into rooms (e.g., classrooms, hallways). Agents move between rooms based on schedules:
Agent i moves to room R(t) at time t per predefined itinerary.
Transmission only occurs within the same room, with room-specific rₖ and βₖ (e.g., higher β in poorly ventilated rooms) [9].
2. Directional Emission & Inhalation
Model virus as a plume: infectious agents emit particles in their facing direction. Susceptibles inhale based on relative position:
pᵢⱼ(t) ∝ exp(−β · g(τᵢ) · f(Δθ, dᵢⱼ))
where f decays with angle Δθ and distance dᵢⱼ [10]. Captures “downwind” risk.
3. Ventilation & Airflow
Add vector field v(x, t) representing air currents. Agents are advected:
xᵢ(t+1) = xᵢ(t) + s·uᵢ + Δt·v(xᵢ, t)
Virus concentration builds in stagnant zones, increasing local risk [7].
4. Heterogeneous Behavior
Assign agents movement profiles:
- sᵢ = 0: Seated (students, office workers)
- sᵢ = high: Mobile (teachers, servers)
Creates natural “hubs” of exposure.
5. Mask and Shield Effects
Reduce effective β or r for protected agents:
β → β · (1 − εₘ) for masked agents,
r → r · (1 − εₛ) for those behind shields.
Used to quantify non-pharmaceutical interventions [6].
These variants transform the basic model into a virtual laboratory for public health design.
🎉 Conclusion
The Continuous Space ABM brings epidemiology into the third dimension—not just socially or temporally, but spatially. By letting agents move freely and transmit only when truly close, it captures the physics of airborne spread in a way grids and networks cannot.
Yes, it’s computationally heavier—checking distances between thousands of agents every step isn’t trivial. But the payoff is immense: the ability to test room layouts, ventilation upgrades, or seating charts before a single real person walks in. During the pandemic, such models helped redesign classrooms, optimize bus seating, and even plan safe choir rehearsals [5,8].
In a world where “six feet apart” became a mantra, continuous space models gave that phrase mathematical meaning. They remind us that in the dance of disease, it’s not just who you know—it’s how close you stand.
So next time you choose a seat by the window or step aside to let someone pass, remember: you’re not just being polite. You’re navigating an invisible risk field—and in the eyes of a modeler, every step counts.
📚 References
- Ko, G. et al. (2004). Temporal and spatial dispersion of human bioaerosol in indoor environments. Atmospheric Environment. https://doi.org/10.1016/j.atmosenv.2003.11.034
- Li, Y. et al. (2007). Role of ventilation in airborne transmission of infectious agents. Indoor Air. https://doi.org/10.1111/j.1600-0668.2007.00484.x
- Bourouiba, L. (2020). Turbulent gas clouds and respiratory pathogen emissions. JAMA. https://doi.org/10.1001/jama.2020.4756
- Zhang, Y. et al. (2021). Agent-based modeling of indoor disease transmission. Building and Environment. https://doi.org/10.1016/j.buildenv.2021.107762
- Qian, H. et al. (2010). Natural ventilation for reducing airborne infection in classrooms. Indoor Air. https://doi.org/10.1111/j.1600-0668.2009.00630.x
- Stadnytskyi, V. et al. (2020). The airborne lifetime of small speech droplets. PNAS. https://doi.org/10.1073/pnas.2006874117
- Kao, C. et al. (2022). CFD-ABM hybrid modeling of indoor airborne transmission. Scientific Reports.
- Miller, S.L. et al. (2021). Transmission of SARS-CoV-2 by inhalation of respiratory aerosols. Indoor Air. https://doi.org/10.1111/ina.12836
- Machlaj, A. et al. (2023). Room-based ABM for school reopening strategies. Epidemics. https://doi.org/10.1016/j.epidem.2023.100678
- Dbouk, T. & Drikakis, D. (2020). On respiratory droplets and face masks. Physics of Fluids. https://doi.org/10.1063/5.0015044