Skip to content

Commit 4132e43

Browse files
vbv-shmVaibhav sharma
authored andcommitted
update homophily value in Schelling example
1 parent 393f6a0 commit 4132e43

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

.codespellignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@ inactivate
66
ue
77
fpr
88
falsy
9-
assertIn
10-
nD
9+
assertIn

benchmarks/configurations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"parameters": {
3636
"height": 40,
3737
"width": 40,
38-
"homophily": 3,
38+
"homophily": 0.4,
3939
"radius": 1,
4040
"density": 0.625,
4141
},
@@ -47,7 +47,7 @@
4747
"parameters": {
4848
"height": 100,
4949
"width": 100,
50-
"homophily": 8,
50+
"homophily": 0.8,
5151
"radius": 2,
5252
"density": 0.8,
5353
},

mesa/examples/basic/schelling/agents.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def step(self) -> None:
1919
self.pos, moore=True, radius=self.model.radius
2020
)
2121

22+
2223
# Count similar neighbors
2324
similar_neighbors = len([n for n in neighbors if n.type == self.type])
2425

mesa/examples/basic/schelling/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def agent_portrayal(agent):
2626
},
2727
"density": Slider("Agent density", 0.8, 0.1, 1.0, 0.1),
2828
"minority_pc": Slider("Fraction minority", 0.2, 0.0, 1.0, 0.05),
29-
"homophily": Slider("Homophily", 0.3, 0.0, 0.8, 0.1),
29+
"homophily": Slider("Homophily", 0.4, 0.0, 1, 0.1),
3030
"width": 20,
3131
"height": 20,
3232
}

mesa/examples/basic/schelling/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(
1313
width: int = 40,
1414
density: float = 0.8,
1515
minority_pc: float = 0.5,
16-
homophily: int = 3,
16+
homophily: float = 0.3,
1717
radius: int = 1,
1818
seed=None,
1919
):
@@ -24,7 +24,7 @@ def __init__(
2424
height: Height of the grid
2525
density: Initial chance for a cell to be populated (0-1)
2626
minority_pc: Chance for an agent to be in minority class (0-1)
27-
homophily: Minimum number of similar neighbors needed for happiness
27+
homophily_ratio: Ratio of similar neighbors to total neighbors needed for happiness
2828
radius: Search radius for checking neighbor similarity
2929
seed: Seed for reproducibility
3030
"""
@@ -35,7 +35,7 @@ def __init__(
3535
self.width = width
3636
self.density = density
3737
self.minority_pc = minority_pc
38-
self.homophily = homophily
38+
self.homophily_ratio = homophily
3939
self.radius = radius
4040

4141
# Initialize grid

0 commit comments

Comments
 (0)