Skip to content
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

Merged
merged 10 commits into from
Nov 9, 2024

Commits on Nov 9, 2024

  1. benchmarks: Use official example models

    Use the official example models for the benchmarks
    EwoutH committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    14ab282 View commit details
    Browse the repository at this point in the history
  2. 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
    EwoutH committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    4cb6b3e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9eb4b23 View commit details
    Browse the repository at this point in the history
  4. 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
    EwoutH committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    b0c217f View commit details
    Browse the repository at this point in the history
  5. 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
    EwoutH committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    a06e4fe View commit details
    Browse the repository at this point in the history
  6. examples: Apply suggestions from code review

    Co-authored-by: Jan Kwakkel <[email protected]>
    EwoutH and quaquel authored Nov 9, 2024
    Configuration menu
    Copy the full SHA
    f474f6c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    10908ce View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    8a382d9 View commit details
    Browse the repository at this point in the history
  9. examples: Rename BoltzmannWealthModel to BoltzmannWealth

    Makes it consistent with naming of other example models
    EwoutH committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    946ee2e View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    9982231 View commit details
    Browse the repository at this point in the history