Skip to content

Add continuous predator-prey model and refine documentation#7

Open
Ishwarpatra wants to merge 7 commits into
mesa:mainfrom
Ishwarpatra:add-predator-prey-model
Open

Add continuous predator-prey model and refine documentation#7
Ishwarpatra wants to merge 7 commits into
mesa:mainfrom
Ishwarpatra:add-predator-prey-model

Conversation

@Ishwarpatra
Copy link
Copy Markdown

Mesa 4.0 ContinuousSpace Predator-Prey Benchmark

Summary

This project adds a modern ContinuousSpace predator-prey benchmark to the Mesa 4.0 ecosystem. It serves as a showcase for the new agent-centric API pattern, utilizing:

  • self.agents.shuffle_do("step") for optimized scheduling.
  • ContinuousSpaceAgent for high-fidelity spatial movement.
  • A complete suite including a runnable model, Solara-based visualization, and a headless performance runner.

Motive

Currently, Mesa examples lack a standardized benchmark for continuous-space environments. This project aims to bridge that gap by providing:

  • Spatial Index Scaling: A reproducible control-case to measure how spatial indices handle high agent densities.
  • Performance Benchmarking: A CI-friendly check to ensure performance stability across Mesa updates.
  • Reference Implementation: A clean, up-to-date code path for maintainers and researchers to follow when building spatial models.

Implementation Details

The prey_predator module is structured as follows:

  • agents.py: Implementation of Prey and Predator logic.
  • model.py: Definition of the continuous environment and scheduler.
  • app.py: Interactive UI using Solara.
  • run.py: Script for headless execution and benchmarking.

Standards & Compliance

  • Mesa 4.0 Compatibility: Adheres to the latest API signatures and best practices.
  • Code Quality: Verified with ruff check and formatted via ruff format.
  • Documentation: Level-setting README including behavior, parameters, and expected Lotka–Volterra cycle results.

Usage Guide

Interactive Visualization

To launch the interactive dashboard:

solara run app.py

Headless Benchmarking

To run the model for performance data without a GUI:

python run.py

Dependency Installation

pip install -r requirements.txt
pip install solara

Future Roadmap

  • Physics Integration: Adding high-speed collision detection and resolution.
  • Chemistry Simulation: Implementing reactive transformation cycles.
  • Scalability: Stress testing the spatial index with 10k+ agents.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fc3d3d66-466b-40fc-9770-e666a2fb3bd0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant