-
Notifications
You must be signed in to change notification settings - Fork 165
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
Replace RandomActivation and SimultaneousActivation schedulers with AgentSet functionality #161
Conversation
And believe it or not, the final error is the DataCollector that tries to gather attributes from agents that don't have said attributes. |
0f572c8
to
3d94b69
Compare
Replace all usages of model.schedule.agents with the use of the model.agents AgentSet in all examples.
Replace the old RandomActivation scheduler with AgentSet functionality. self.agents.shuffle.do("step") is equivalent and self.schedule.step() with an RandomActivation scheduler, and model behavior should not change.
The SimultaneousActivation scheduler used a "step" and "advanced" function in the Agent. These have been renamed for each model to be more descriptive (like "determine_state" and "assume_state"), and then the model step was replace by something like: self.agents.do("determine_state") self.agents.do("assume_state") Docstring was also updated accordingly.
Schedulers don't exist anymore, so we don't need to add agents anymore. Agents are automatically added to model.agents on Agent initialisation.
These models use complex schedulers which warrant an separate PR.
It doesn't have a step function and there is only one, so it shouldn't be an Agent, just an Python object.
f1cf42b
to
bd60c41
Compare
I updated the PR description and title and cleaned up the commit history as far as feasible. Looking forward to reviews! |
Other than the 2 comments, everything else LGTM. Feel free to rebase and merge after they had been addressed. |
fa1aee4
to
ffa0958
Compare
With rht’s approval I’m going to merge this. @jackiekazil and @tpike3 I would still love your take, if you have any feedback let me know. |
…lity This commit reverts PR projectmesa#161 projectmesa#161 That PR assumed that time advancement would be done automatically, like proposed in projectmesa/mesa#2223 We encountered some underlying issues with time, which we couldn't resolve in time.
This commit reverts PR #161 #161 That PR assumed that time advancement would be done automatically, like proposed in projectmesa/mesa#2223 We encountered some underlying issues with time, which we couldn't resolve in time.
…onality (projectmesa#170)" This reinstates PR projectmesa#161 after the previous revert.
…onality This reinstates PR projectmesa#161 after the previous revert.
…onality This reinstates PR projectmesa#161 after the previous revert.
…onality This reinstates PR projectmesa#161 after the previous revert.
…onality This reinstates PR projectmesa#161 after the previous revert.
This commit reverts PR #161 projectmesa/mesa-examples#161 That PR assumed that time advancement would be done automatically, like proposed in #2223 We encountered some underlying issues with time, which we couldn't resolve in time.
This commit reverts PR #161 projectmesa/mesa-examples#161 That PR assumed that time advancement would be done automatically, like proposed in #2223 We encountered some underlying issues with time, which we couldn't resolve in time.
…lity (projectmesa#170) This commit reverts PR projectmesa#161 projectmesa/mesa-examples#161 That PR assumed that time advancement would be done automatically, like proposed in projectmesa#2223 We encountered some underlying issues with time, which we couldn't resolve in time.
…lity (projectmesa#170) This commit reverts PR projectmesa#161 projectmesa/mesa-examples#161 That PR assumed that time advancement would be done automatically, like proposed in projectmesa#2223 We encountered some underlying issues with time, which we couldn't resolve in time.
This PR replace all the
RandomActivation
andSimultaneousActivation
schedulers used in the example models with AgentSet functionality. This simplifies models and allows for easier and more flexible modification of these models. It algins the examples with the current best practices in Mesa.RandomActivation (b7f67c7)
The RandomActivation schedulers were removed, and in the Model.step() function the schedule step was replaced with an AgentSet operation, like:
The following RandomActivation schedulers were removed:
SimultaneousActivation (7e396fe)
To remove the SimultaneousActivation schedulers, the Agent methods were renamed from
step()
andadvance()
to more descriptive functions. The model step was updated accordingly:The following SimultaneousActivation schedulers were removed:
Relevant tickets