Skip to content

Commit

Permalink
Added homophily ratio in basic schelling example (#2520)
Browse files Browse the repository at this point in the history
* Fix why agent not getting happy in run before reset. Update homophily to 0.4

* Update homophily value in configurations.py file

* Small fixes in Schelling example

---------

Co-authored-by: Vaibhav sharma <vaibhav.8june.com>
Co-authored-by: Jan Kwakkel <j.h.kwakkel@tudelft.nl>
  • Loading branch information
vbv-shm and quaquel authored Dec 28, 2024
1 parent dd77c0a commit 938e3ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions benchmarks/configurations.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"parameters": {
"height": 40,
"width": 40,
"homophily": 3,
"homophily": 0.4,
"radius": 1,
"density": 0.625,
},
Expand All @@ -47,7 +47,7 @@
"parameters": {
"height": 100,
"width": 100,
"homophily": 8,
"homophily": 1,
"radius": 2,
"density": 0.8,
},
Expand Down
2 changes: 1 addition & 1 deletion mesa/examples/basic/schelling/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def agent_portrayal(agent):
},
"density": Slider("Agent density", 0.8, 0.1, 1.0, 0.1),
"minority_pc": Slider("Fraction minority", 0.2, 0.0, 1.0, 0.05),
"homophily": Slider("Homophily", 0.3, 0.0, 0.8, 0.1),
"homophily": Slider("Homophily", 0.4, 0.0, 1.0, 0.125),
"width": 20,
"height": 20,
}
Expand Down
6 changes: 3 additions & 3 deletions mesa/examples/basic/schelling/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class Schelling(Model):

def __init__(
self,
height: int = 40,
width: int = 40,
height: int = 20,
width: int = 20,
density: float = 0.8,
minority_pc: float = 0.5,
homophily: int = 3,
homophily: float = 0.4,
radius: int = 1,
seed=None,
):
Expand Down

0 comments on commit 938e3ca

Please sign in to comment.