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

Add pollinator-plant cascade extinction model

Open savirpatil opened this issue 8 months ago • 4 comments

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.

savirpatil avatar Mar 03 '26 22:03 savirpatil

This PR looks empty. Could you check?

EwoutH avatar Mar 15 '26 20:03 EwoutH

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.

savirpatil avatar Mar 15 '26 23:03 savirpatil

Thanks. Seems like an interesting topic.

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

EwoutH avatar Mar 16 '26 03:03 EwoutH

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.

savirpatil avatar Mar 20 '26 02:03 savirpatil