Skip to content

Add pollinator-plant cascade extinction model#352

Open
savirpatil wants to merge 12 commits intomesa:mainfrom
savirpatil:add-pollinator-cascade-model
Open

Add pollinator-plant cascade extinction model#352
savirpatil wants to merge 12 commits intomesa:mainfrom
savirpatil:add-pollinator-cascade-model

Conversation

@savirpatil
Copy link

@savirpatil savirpatil commented Mar 3, 2026

Summary

Adds a bipartite pollinator-plant cascade extinction model demonstrating emergent cascade failures using the Network discrete space.

Motive

This model was built to demonstrate usage of the Network discrete space with a bipartite graph structure. This model also demonstrates a real-world phenomenon, showing how pollinator loss triggers delayed plant collapse and mirroring colony collapse dynamics that can be seen in real ecosystems.

Implementation

  • Builds a bipartite graph using 'networkx.bipartite.random_graph' wrapped in the 'Network' discrete space
  • Agents inherit from 'CellAgent' and access neighbors via 'cell.connections'
  • Pollinator energy and plant health are continuous attributes that decline based on how many of their network neighbors are still alive, producing cascade behavior from the bottom up
  • Cumulative plant deaths are tracked via a model-level counter since dead agents are removed from 'model.agents'

Usage Examples

Static 3-panel visualization

python run.py

Interactive Solara dashboard

solara run app.py

The dashboard provides sliders for number of pollinators, plants, and network connectivity, allowing exploration of how network density affects the cascading effect.

Additional Notes

  • Includes unit tests (run w/ 'python -m pytest') suite covering initialization, step behavior, forced extinction, and reproducibility

This PR was developed with AI assistance (Claude) for code generation
and debugging. All code has been reviewed, tested, and understood before making the pull request.

@EwoutH
Copy link
Member

EwoutH commented Mar 15, 2026

This PR looks empty. Could you check?

@savirpatil
Copy link
Author

This PR looks empty. Could you check?

Hi @EwoutH,
Thanks for letting me know and I updated the PR so it isn't empty anymore.

@EwoutH
Copy link
Member

EwoutH commented Mar 16, 2026

Thanks. Seems like an interesting topic.

To move forward, please do a self-review and request a peer-review (see pinned issue)

@savirpatil
Copy link
Author

Self Review:
Does it belong?
This is an original addition with no meaningful overlap with existing examples. It is the only example in the repo that uses a bipartite network structure via Mesa's Network discrete space, and the cascade extinction phenomenon it demonstrates, where plant collapse lags behind pollinator loss, is grounded in real ecology. The model is well-scoped with two agent types, continuous health/energy attributes, and neighbor-driven decline rules are all that is needed to produce the emergent behavior. It does a good job of showcasing a Mesa feature (Network space with cell.connections) that no other example currently covers.

Is it correct and current?
The model uses current Mesa APIs throughout, CellAgent, Network, agents.select, shuffle_do, and DataCollector are all used correctly.

Is it clean?
The code is clean, well-structured, and easy to follow. The agent logic is readable and the inline comments explaining the energy/health mechanics are helpful as well. The inclusion of a proper test suite covering initialization, step behavior, forced extinction, and reproducibility is also a positive. The README is solid and covers parameters, output, and references clearly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants