Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
Thanks for the PR. Could you try to fix the pre-commit issues? |
|
You have probably pushed two different models. |
Merge branch 'main' of https://github.com/BittuAgarwal1237/mesa-examples into add-seir-vaccination-example
6670806 to
6cf3e34
Compare
|
Fixed! Removed the hierarchical organization model from this branch -it belongs in a separate PR. This PR now contains only the SEIR model @codebreaker32 |
|
Please remove it from README.md as well |
|
done @codebreaker32 |
examples/seir_vaccination/agents.py
Outdated
| States: | ||
| S - Susceptible: healthy, can get infected | ||
| E - Exposed: infected but not yet contagious | ||
| I - Infected: contagious, can spread to neighbors | ||
| R - Recovered: immune, cannot be infected again |
There was a problem hiding this comment.
I think using a proper Enum would be better, ref https://github.com/mesa/mesa/blob/main/mesa/examples/advanced/epstein_civil_violence/agents.py
examples/seir_vaccination/app.py
Outdated
|
|
||
| def agent_portrayal(agent): | ||
| return { | ||
| "color": STATE_COLORS.get(agent.state, "grey"), |
There was a problem hiding this comment.
Using raw dict is deprecated, Use AgentPortrayalStyle
There was a problem hiding this comment.
Thanks for the suggestion! I looked into AgentPortrayalStyle but it doesn't seem to be available in the current Mesa dev version (4.0.0.dev0). Happy to update once it's added to the codebase, for now keeping the dict-based portrayal. Let me know if there's another approach you'd prefer!
There was a problem hiding this comment.
examples/seir_vaccination/model.py
Outdated
|
|
||
| def step(self): | ||
| # 1. All people act first | ||
| for person in self.population: |
There was a problem hiding this comment.
Can we use agents_by_type here?
| person.step() | ||
|
|
||
| # 2. Government monitors and responds | ||
| self.government.step() |
There was a problem hiding this comment.
You should use agents_by_type and then can use shuffle_do for Random Activation
examples/seir_vaccination/README.md
Outdated
| ```bash | ||
| python -m venv venv | ||
| source venv/bin/activate # Windows: venv\Scripts\activate | ||
| pip install -r requirements.txt |
There was a problem hiding this comment.
There's no requirements.txt?
| ## Overview | ||
|
|
||
| This model simulates how a disease spreads through a population on a grid, and how a government responds when things get bad enough. | ||
|
|
There was a problem hiding this comment.
could you cite the original paper as well?
| ### [Humanitarian Aid Distribution Model](https://github.com/mesa/mesa-examples/tree/main/examples/humanitarian_aid_distribution) | ||
|
|
||
| This model simulates a humanitarian aid distribution scenario using a needs-based behavioral architecture. Beneficiaries have dynamic needs (water, food) and trucks distribute aid using a hybrid triage system. | ||
|
|
There was a problem hiding this comment.
Add your model here
|
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! |
c7d2aed to
3cdbce1
Compare
for more information, see https://pre-commit.ci
|
done the changes @codebreaker32 |
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_antibodymodel 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
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
