-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate benchmarks and example models #2473
Commits on Nov 9, 2024
-
benchmarks: Use official example models
Use the official example models for the benchmarks
Configuration menu - View commit details
-
Copy full SHA for 14ab282 - Browse repository at this point
Copy the full SHA 14ab282View commit details -
wolf_sheep: Merge benchmark model into example model
Key changes and improvements in this merged version: 1. Used the experimental cell space features: - Switched to the more efficient `OrthogonalVonNeumannGrid` - Leveraged `CellAgent` and `FixedAgent` base classes - Used the cell's neighborhood property for movement 2. Implemented discrete event scheduling for grass regrowth: - Used the experimental `ABMSimulator` for event scheduling - Replaced the countdown-based grass regrowth with scheduled events 3. Modern Mesa practices: - Used `agents_by_type` for agent management - Employed `shuffle_do()` for efficient random activation - Proper initialization of the Model class with `super().__init__()` - Clear data collection setup with dedicated model reporters 4. Code organization: - Maintained separation between agents and model - Added detailed docstrings - Used property decorators for grass state management - Consistent style and naming conventions 5. Additional improvements: - Made grass optional while keeping full functionality - Improved type hints and property usage - More efficient agent selection and movement - Better encapsulation of agent behaviors
Configuration menu - View commit details
-
Copy full SHA for 4cb6b3e - Browse repository at this point
Copy the full SHA 4cb6b3eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9eb4b23 - Browse repository at this point
Copy the full SHA 9eb4b23View commit details -
flocking: Merge benchmark model into example model
The merged implementation includes several improvements: 1. Code Organization: - Separated into agents.py and model.py following Mesa best practices - Clear docstrings and comments throughout - Consistent code style 2. Modern Mesa Features: - Uses AgentSet's shuffle_do() for random activation - Proper initialization using super().__init__() - Direct access to model.agents 3. Improvements to the Boid Implementation: - Better vector normalization handling - Added tracking of average heading for statistics - More robust neighbor handling - Cleaner separation of the three flocking behaviors - Added parameter validation and documentation 4. Key Changes: - Simplified the step() method using AgentSet - Improved documentation and type hints - Added model statistics tracking - Made parameter names more descriptive - Better default parameters for stable flocking
Configuration menu - View commit details
-
Copy full SHA for b0c217f - Browse repository at this point
Copy the full SHA b0c217fView commit details -
boltzmann: Merge benchmark model into example model
Merged the two implementations with the following improvements and best practices: 1. Code Organization: - Separated model and agent code into distinct files - Added comprehensive docstrings following Google style - Improved code organization and readability 2. Model Implementation: - Used Mesa 3.0's automatic agent management via `model.agents` - Used `shuffle_do()` for random agent activation 3. Agent Implementation: - Simplified agent code while maintaining functionality - Improved method documentation - Added clear separation of responsibilities between methods 4. Latest Mesa Best Practices: - Proper model initialization using `super().__init__(seed=seed)` - Use of `model.agents` instead of a scheduler - Clear attribute definitions and typing - Consistent code style following Mesa conventions 5. Performance Considerations: - Efficient use of list operations - Minimal object creation during runtime - Direct access to model properties This implementation maintains all the core functionality while being more organized, better documented, and following current Mesa best practices. It uses only stable features and avoids experimental ones. The main changes from the original implementations: 1. Unified the different versions of the Gini coefficient calculation 2. Added proper docstrings throughout 3. Removed duplicate code 4. Added the optional run_model method from one version 5. Simplified some method implementations
Configuration menu - View commit details
-
Copy full SHA for a06e4fe - Browse repository at this point
Copy the full SHA a06e4feView commit details -
examples: Apply suggestions from code review
Co-authored-by: Jan Kwakkel <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for f474f6c - Browse repository at this point
Copy the full SHA f474f6cView commit details -
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
Configuration menu - View commit details
-
Copy full SHA for 10908ce - Browse repository at this point
Copy the full SHA 10908ceView commit details -
Configuration menu - View commit details
-
Copy full SHA for 8a382d9 - Browse repository at this point
Copy the full SHA 8a382d9View commit details -
examples: Rename BoltzmannWealthModel to BoltzmannWealth
Makes it consistent with naming of other example models
Configuration menu - View commit details
-
Copy full SHA for 946ee2e - Browse repository at this point
Copy the full SHA 946ee2eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9982231 - Browse repository at this point
Copy the full SHA 9982231View commit details