Skip to content

Show locations in an optional section of the space tutorial - #4127

Open
EwoutH wants to merge 2 commits into
mesa:mainfrom
EwoutH:tutorial-locations
Open

EwoutH wants to merge 2 commits into
mesa:mainfrom
EwoutH:tutorial-locations

Conversation

@EwoutH

@EwoutH EwoutH commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a short, optional section to the end of the Adding Space tutorial that shows the experimental locations from #3940. The main path of the tutorial is unchanged.

Motive

It's important for our features to be well documented so users can find and use them.

Implementation

One notebook, five new cells before "Next Steps", marked optional and experimental:

  • model.regions is a 2×2 grid over the same area as the 10×10 grid, through cell_size.
  • RegionalMoneyAgent declares cell = CellLocation("grid") and region = CellLocation("regions", follows=cell). move and give_money are the same as MoneyAgent's.
  • It runs the model, shows one agent's cell and region before and after, and compares wealth across the four regions.

The agent subclasses Agent rather than CellAgent, since a location can only follow another location; the section says so.

Usage Examples

class RegionalMoneyAgent(mesa.Agent):
    cell = CellLocation("grid")
    region = CellLocation("regions", follows=cell)

Additional Notes

  • It's the first tutorial content that imports from mesa.experimental, which is why it's an optional section at the end rather than a change to the main path.
  • The whole notebook runs as a script with -W error; ruff check and ruff format --check pass.
  • AI use: drafted with Claude Opus 5.5.

Add a short, optional section to the end of the Adding Space tutorial. It gives the Boltzmann money agents a region on a coarse 2x2 grid that follows their cell, using the experimental CellLocation and follows=, and compares wealth across regions. The main path of the tutorial is unchanged.

Assisted-by: Claude Opus 5.5
@github-actions github-actions Bot added the docs Release notes label label Nov 16, 2026
@EwoutH
EwoutH marked this pull request as ready for review November 16, 2026 21:17
@EwoutH

EwoutH commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Thanks for the approval Jan!

@tpike3 any comments?

@codebreaker32 codebreaker32 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

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

Labels

docs Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants