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

Migration guide: Intro, upgrade strategy, model.agents, headers #2314

Merged
merged 2 commits into from
Sep 22, 2024
Merged

Conversation

EwoutH
Copy link
Member

@EwoutH EwoutH commented Sep 21, 2024

For the migration guide:

  • Write a short introduction
  • Add an recommended upgrade strategy
  • Add some notes on model.agents
  • Make whitespaces and headers more consistent

For the migration guide:
- Write a short introduction
- Add an recommended upgrade strategy
- Add some notes on model.agents
- Make whitespaces and headers more consistent
@EwoutH EwoutH added the docs Release notes label label Sep 21, 2024
## Mesa 3.0
<!-- TODO small introduction-->
Mesa 3.0 introduces significant changes to core functionalities, such as agent and model initialization, scheduling, and visualization. The guide below outlines these changes and provides instructions for migrating your existing Mesa projects to version 3.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

"encompassing" is more apt than "such as". Otherwise, the sentence implies as if visualization was newly for the first time in Mesa 3.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

Made it “including”

- `self._agents_by_type`: A dictionary of AgentSets, organizing agents by their type.
- `self._all_agents`: An AgentSet containing all agents in the model.

These internal structures are used to efficiently manage and access agents. Users should interact with agents through the public `model.agents` property, which returns the `self._all_agents` AgentSet.
Copy link
Contributor

Choose a reason for hiding this comment

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

If I want to scrutinize an agent from model.agents, could be for data collection, but more often for debugging purpose, how would I do this efficiently? Currently, it is doable with select(at_most=1), but this returns yet another AgentSet. In Polars, I can do df.row(2).

Copy link
Contributor

@Corvince Corvince Sep 21, 2024

Choose a reason for hiding this comment

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

You can just do list-like model.agents[2]

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't see there is __getitem__ documented in the public API: https://mesa.readthedocs.io/en/latest/apis/agent.html. This feature is documented in the code, but doesn't show up there.

Copy link
Contributor

Choose a reason for hiding this comment

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

What if I want to access by a unique ID instead of the index? (iloc vs loc in pandas)

Copy link
Member Author

Choose a reason for hiding this comment

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

All good questions, but I don’t think they are relevant to this PR.

Maybe open an issue or discussion about this?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's relevant in the sense that the user may have to do such thing in their existing code.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don’t exactly understand what you want added / modified, so could you open an PR to add it?

@EwoutH EwoutH merged commit 0abffa4 into main Sep 22, 2024
2 checks passed
EwoutH added a commit to EwoutH/mesa that referenced this pull request Sep 24, 2024
…ectmesa#2314)

* Migration guide: Intro, upgrade strategy, model.agents, headers

For the migration guide:
- Write a short introduction
- Add an recommended upgrade strategy
- Add some notes on model.agents
- Make whitespaces and headers more consistent
@quaquel quaquel deleted the mig_guide branch October 30, 2024 16:51
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