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

Reinstate PR #161: Replace schedulers with AgentSet functionality #183

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

EwoutH
Copy link
Member

@EwoutH EwoutH commented Aug 30, 2024

This reinstates PR #161 after the previous revert in #170.

Now that projectmesa/mesa#2223 is merged, these examples are fully functional again without schedulers.

Original description of #161 below.


This PR replace all the RandomActivation and SimultaneousActivation 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

The RandomActivation schedulers were removed, and in the Model.step() function the schedule step was replaced with an AgentSet operation, like:

-        self.schedule.step()
+        self.agents.shuffle().do("step")

The following RandomActivation schedulers were removed:

  • bank_reserves
  • boid_flockers
  • boltzmann_wealth_model
  • boltzmann_wealth_model_experimental
  • boltzmann_wealth_model_network
  • caching_and_replay
  • charts
  • el_farol
  • epstein_civil_violence
  • forest_fire
  • hotelling_law
  • schelling
  • shape_example
  • virus_on_network

SimultaneousActivation

To remove the SimultaneousActivation schedulers, the Agent methods were renamed from step() and advance() to more descriptive functions. The model step was updated accordingly:

-        self.schedule.step()
+        self.agents.do("determine_state")
+        self.agents.do("assume_state")

The following SimultaneousActivation schedulers were removed:

  • hex_snowflake
  • color_patches
  • conways_game_of_life

Relevant tickets

@EwoutH EwoutH force-pushed the revert_revert_step_increase branch from a044bf0 to 39ecf27 Compare August 30, 2024 08:38
@EwoutH EwoutH marked this pull request as ready for review August 30, 2024 08:40
@EwoutH
Copy link
Member Author

EwoutH commented Aug 30, 2024

Test function exactly as expected: Since #2223 is not in the latest pre-release, that's supposed to fail. The main branch passes also as expected.

EwoutH added 2 commits August 30, 2024 16:05
…onality

This reinstates PR projectmesa#161 after the previous revert.
Confirm that model.steps is correctly increased to  10, and not some other value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants