Skip to content

v3.0 alpha 4 (pre-release)

Pre-release
Pre-release
Compare
Choose a tag to compare
@EwoutH EwoutH released this 09 Sep 15:42
· 297 commits to main since this release
eaf7457

Highlights

Mesa 3.0.0a4 contains two major breaking changes:

  1. The Agent's unique_id is now automatically assigned, so doesn't need to be passed to the Agent class anymore. In a subclassed custom Agent, like normally used, this now looks like this:

    class Wolf(Agent):
    -    def __init__(self, unique_id, model, energy=None):
    +    def __init__(self, model, energy=None):
            # When initializing the super class (Agent), passing unique_id isn't needed anymore
    -        super().__init__(unique_id, model)
    +        super().__init__(model)
    
    - wolf = Wolf(unique_id, model)
    + wolf = Wolf(model)

    Example models were updated in mesa-examples#194, which shows more examples on how to update existing models.

  2. Our visualisation API is being overhauled, to be more flexible and powerful. For more details, see #2278.

    • An initial update to the tutorial was made in #2289 and is available here.
    • An initial example model was updated in mesa-examples#195, and more examples will be updated in mesa-examples#195.
    • The old SolaraViz API is still available at mesa.experimental, but might be removed in future releases.

Furthermore, the AgentSet has a new agg method to quickly get an aggerate value (for example min_energy = model.agents.agg("energy", min)) (#2266), The Model get_agents_of_type function is replaced by directly exposing the agents_by_type property (which can be accessed as a dict) (#2267, mesa-examples#190) and the AgentSet get() methods can now handle missing values by replacing it with a default value (#2279).

Finally, it fixes a bug in which the Grid's move_agent_to_one_of method with selection="closest" selected a location deterministically, instead of randomly (#2118).

What's Changed

⚠️ Breaking changes

🎉 New features added

🛠 Enhancements made

  • Model: Replace get_agents_of_type method with agents_by_type property by @EwoutH in #2267
  • add default SolaraViz by @Corvince in #2280
  • Simplify ModelController by @Corvince in #2282
  • Add default values and missing value handling to agentset.get by @quaquel in #2279

🐛 Bugs fixed

  • Fix deterministic behavior in move_agent_to_one_of with selection="closest" by @OrenBochman in #2118

📜 Documentation improvements

  • docs: Fix Visualization Tutorial (main branch) by @EwoutH in #2271
  • Docs: Fix broken relative links by removing .html suffix by @EwoutH in #2274
  • Readthedocs: Don't let notebook failures pass silently by @EwoutH in #2276
  • Update viz tutorial to the new API by @Corvince in #2289

🔧 Maintenance

  • Resolve multiprocessing warning, state Python 3.13 support by @rht in #2246

New Contributors

Full Changelog: v3.0.0a3...v3.0.0a4