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

Remove schedulers from benchmark models. #2308

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion benchmarks/BoltzmannWealth/boltzmann_wealth.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def __init__(self, seed=None, n=100, width=10, height=10):
super().__init__(seed)
self.num_agents = n
self.grid = mesa.space.MultiGrid(width, height, True)
self.schedule = mesa.time.RandomActivation(self)
self.datacollector = mesa.DataCollector(
model_reporters={"Gini": compute_gini}, agent_reporters={"Wealth": "wealth"}
)
Expand Down
4 changes: 1 addition & 3 deletions benchmarks/Flocking/flocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def __init__(
self.height = height
self.simulator = simulator

self.schedule = mesa.time.RandomActivation(self)
self.space = mesa.space.ContinuousSpace(self.width, self.height, True)
self.factors = {
"cohere": cohere,
Expand All @@ -138,11 +137,10 @@ def __init__(
**self.factors,
)
self.space.place_agent(boid, pos)
self.schedule.add(boid)

def step(self):
"""Run the model for one step."""
self.schedule.step()
self.agents.shuffle_do("step")


if __name__ == "__main__":
Expand Down
5 changes: 1 addition & 4 deletions benchmarks/Schelling/schelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from mesa import Model
from mesa.experimental.cell_space import CellAgent, OrthogonalMooreGrid
from mesa.time import RandomActivation


class SchellingAgent(CellAgent):
Expand Down Expand Up @@ -67,7 +66,6 @@ def __init__(
self.minority_pc = minority_pc
self.simulator = simulator

self.schedule = RandomActivation(self)
self.grid = OrthogonalMooreGrid(
[height, width],
torus=True,
Expand All @@ -84,12 +82,11 @@ def __init__(
agent_type = 1 if self.random.random() < self.minority_pc else 0
agent = SchellingAgent(self, agent_type, radius, homophily)
agent.move_to(cell)
self.schedule.add(agent)

def step(self):
"""Run one step of the model."""
self.happy = 0 # Reset counter of happy agents
self.schedule.step()
self.agents.shuffle_do("step")


if __name__ == "__main__":
Expand Down
Loading