-
Notifications
You must be signed in to change notification settings - Fork 929
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
Conversation
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
docs/migration_guide.md
Outdated
## 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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)
.
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
…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
For the migration guide: