Skip to content

Commit 4e76eff

Browse files
authored
Use performance optimized shuffle_do() method (#201)
Replace shuffle().do() in 18 models with the performance optimized shuffle_do() method.
1 parent 26624c0 commit 4e76eff

File tree

4 files changed

+4
-4
lines changed
  • examples/basic

4 files changed

+4
-4
lines changed

examples/basic/boid_flockers/boid_flockers/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,4 @@ def make_agents(self):
143143
self.space.place_agent(boid, pos)
144144

145145
def step(self):
146-
self.agents.shuffle().do("step")
146+
self.agents.shuffle_do("step")

examples/basic/boltzmann_wealth_model/boltzmann_wealth_model/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, N=100, width=10, height=10):
3838
self.datacollector.collect(self)
3939

4040
def step(self):
41-
self.agents.shuffle().do("step")
41+
self.agents.shuffle_do("step")
4242
# collect data
4343
self.datacollector.collect(self)
4444

examples/basic/schelling/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def step(self):
9191
Run one step of the model.
9292
"""
9393
self.happy = 0 # Reset counter of happy agents
94-
self.agents.shuffle().do("step")
94+
self.agents.shuffle_do("step")
9595

9696
self.datacollector.collect(self)
9797

examples/basic/virus_on_network/virus_on_network/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def resistant_susceptible_ratio(self):
9595
return math.inf
9696

9797
def step(self):
98-
self.agents.shuffle().do("step")
98+
self.agents.shuffle_do("step")
9999
# collect data
100100
self.datacollector.collect(self)
101101

0 commit comments

Comments
 (0)