mesa-examples icon indicating copy to clipboard operation
mesa-examples copied to clipboard

Add seir vaccination example

Open BittuAgarwal1237 opened this issue 8 months ago • 8 comments

Summary

Adds a SEIR epidemic model with a government vaccination policy meta-agent.

Motive

There's no population-level epidemic spreading example in mesa-examples. The existing virus_antibody model works at the biological/cellular level, but nothing shows how a disease spreads through a population on a grid and how a policy intervention affects that. This fills that gap.

Implementation

PersonAgents move through four states --Susceptible, Exposed, Infected, Recovered, based on contact with infected neighbors. A GovernmentAgent monitors the infection rate each step and triggers vaccination campaigns when it crosses a threshold, directly moving some susceptible people to recovered. Activation is explicit and bottom-up: people act first, then the government responds. No legacy schedulers used.

Usage Examples

pip install mesa[rec]
python -m solara run app.py

Sliders let you adjust transmission rate, incubation period, infection duration, vaccination threshold, and campaign size. The grid shows agent states in color and two charts track SEIR curves and when vaccination campaigns are active.

@jackiekazil @tpike3 @EwoutH Screenshot 2026-03-03 175709

BittuAgarwal1237 avatar Mar 04 '26 12:03 BittuAgarwal1237

Thanks for the PR. Could you try to fix the pre-commit issues?

EwoutH avatar Mar 15 '26 20:03 EwoutH

done!!! @EwoutH @tpike3

BittuAgarwal1237 avatar Mar 17 '26 17:03 BittuAgarwal1237

You have probably pushed two different models.

codebreaker32 avatar Mar 17 '26 18:03 codebreaker32

Fixed! Removed the hierarchical organization model from this branch -it belongs in a separate PR. This PR now contains only the SEIR model @codebreaker32

BittuAgarwal1237 avatar Mar 19 '26 09:03 BittuAgarwal1237

Please remove it from README.md as well

codebreaker32 avatar Mar 19 '26 10:03 codebreaker32

done @codebreaker32

BittuAgarwal1237 avatar Mar 19 '26 10:03 BittuAgarwal1237

Updated all the feedback - used State Enum, switched to agents_by_type with shuffle_do, fixed README (removed requirements.txt, added paper citation, added model to main README). Model tested locally and running fine! @EwoutH @codebreaker32

BittuAgarwal1237 avatar Mar 21 '26 13:03 BittuAgarwal1237

done the changes @codebreaker32

BittuAgarwal1237 avatar Mar 21 '26 17:03 BittuAgarwal1237