Skip to content

Commit 8def52e

Browse files
rhttpike3
authored andcommitted
benchmark Schelling: Change import structure
1 parent 5e4f97b commit 8def52e

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

benchmarks/Schelling/schelling.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
from mesa import Agent, Model
2-
from mesa.space import SingleGrid
3-
from mesa.time import RandomActivation
1+
import mesa
42

53

6-
class SchellingAgent(Agent):
4+
class SchellingAgent(mesa.Agent):
75
"""
86
Schelling segregation agent
97
"""
@@ -34,7 +32,7 @@ def step(self):
3432
self.model.happy += 1
3533

3634

37-
class Schelling(Model):
35+
class Schelling(mesa.Model):
3836
"""
3937
Model class for the Schelling segregation model.
4038
"""
@@ -51,8 +49,8 @@ def __init__(
5149
self.homophily = homophily
5250
self.radius = radius
5351

54-
self.schedule = RandomActivation(self)
55-
self.grid = SingleGrid(height, width, torus=True)
52+
self.schedule = mesa.time.RandomActivation(self)
53+
self.grid = mesa.space.SingleGrid(height, width, torus=True)
5654

5755
self.happy = 0
5856

0 commit comments

Comments
 (0)