From 6e25c2a9d757dfe7a2e328c53ba61d4f9fdd7da4 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Sat, 21 Sep 2024 09:31:39 +0200 Subject: [PATCH] Update benchmarks to use shuffle_do() --- benchmarks/BoltzmannWealth/boltzmann_wealth.py | 2 +- benchmarks/WolfSheep/wolf_sheep.py | 4 ++-- mesa/experimental/devs/examples/epstein_civil_violence.py | 2 +- mesa/experimental/devs/examples/wolf_sheep.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/benchmarks/BoltzmannWealth/boltzmann_wealth.py b/benchmarks/BoltzmannWealth/boltzmann_wealth.py index 041445f1b8f..93d4da14aec 100644 --- a/benchmarks/BoltzmannWealth/boltzmann_wealth.py +++ b/benchmarks/BoltzmannWealth/boltzmann_wealth.py @@ -60,7 +60,7 @@ def __init__(self, seed=None, n=100, width=10, height=10): def step(self): """Run the model for a single step.""" - self.agents.shuffle().do("step") + self.agents.shuffle_do("step") # collect data self.datacollector.collect(self) diff --git a/benchmarks/WolfSheep/wolf_sheep.py b/benchmarks/WolfSheep/wolf_sheep.py index 0999fc77842..16c01e000c1 100644 --- a/benchmarks/WolfSheep/wolf_sheep.py +++ b/benchmarks/WolfSheep/wolf_sheep.py @@ -227,8 +227,8 @@ def __init__( def step(self): """Run one step of the model.""" - self.agents_by_type[Sheep].shuffle(inplace=True).do("step") - self.agents_by_type[Wolf].shuffle(inplace=True).do("step") + self.agents_by_type[Sheep].shuffle_do("step") + self.agents_by_type[Wolf].shuffle_do("step") if __name__ == "__main__": diff --git a/mesa/experimental/devs/examples/epstein_civil_violence.py b/mesa/experimental/devs/examples/epstein_civil_violence.py index ce6b835e826..6f32e061356 100644 --- a/mesa/experimental/devs/examples/epstein_civil_violence.py +++ b/mesa/experimental/devs/examples/epstein_civil_violence.py @@ -293,7 +293,7 @@ def __init__( def step(self): """Run one step of the model.""" - self.active_agents.shuffle(inplace=True).do("step") + self.active_agents.shuffle_do("step") if __name__ == "__main__": diff --git a/mesa/experimental/devs/examples/wolf_sheep.py b/mesa/experimental/devs/examples/wolf_sheep.py index b76a35bf057..8d7d16d671a 100644 --- a/mesa/experimental/devs/examples/wolf_sheep.py +++ b/mesa/experimental/devs/examples/wolf_sheep.py @@ -230,8 +230,8 @@ def __init__( def step(self): """Perform one step of the model.""" - self.agents_by_type[Sheep].shuffle(inplace=True).do("step") - self.agents_by_type[Wolf].shuffle(inplace=True).do("step") + self.agents_by_type[Sheep].shuffle_do("step") + self.agents_by_type[Wolf].shuffle_do("step") if __name__ == "__main__":