The Schelling Segregation Model (SSM) was developed in 1978 by the Nobel Prize winning economist Thomas Schelling. It was one of the first applications of agent-based modeling to the social sciences. It demonstrated that patterns of segregation could emerge even if the inhabitants of an artificial society only had a mild preference to live near others of the same race or ethnicity.
In the NetLogo version of SSM, patches represent houses in a city. Each patch/house is either red, blue, or black. Red indicates that the patch is occupied by a member of the red race, blue by a member of the blue race, and black indicates that the patch is unoccupied. If a patch is occupied, then the inhabitant is either happy (i.e., happy with the racial balance of his neighbors) or not.
patches-own [happy?]
During even phases of the update-patch procedure an occupied patch determines if its occupant is happy or not. During odd phases the occupant moves if he is unhappy:
to update-patch
if pcolor != black
[
ifelse ticks mod 2 = 0
[
ifelse suitable?
[
set happy? true
]
[
set happy? false
]
]
[
if not happy? [move]
]
]
end
A patch is suitable if the ratio of like neighbors to neighbors is greater than or equal to the minimum acceptable ratio of like neighbors:
to-report suitable?
let my-race pcolor
let num-unoccupied count neighbors with
[pcolor = black]
let num-like-neighbors count neighbors
with [pcolor = my-race]
let denom 8 - num-unoccupied
let ratio 1
if denom > 0
[
set ratio num-like-neighbors / denom
]
report ratio > min-acceptable-ratio
end
Note:
Alternatively, we could have written:
let num-like-neighbors count neighbors with [pcolor = [pcolor] of myself]
In a move procedure, a suitable unoccupied patch is found and the occupant moves. If no suitable patch is found, then the occupant moves to a random unoccupied patch. If there are none, then the occupant moves to another city. Good riddance!
to move
let my-race pcolor
let alternative1 one-of other patches
with [suitable?]
let alternative2 one-of other patches
with [pcolor = black]
set pcolor black ; aidios
ifelse alternative1 != nobody
[
ask alternative1 [set pcolor my-race]
]
[
if alternative2 != nobody
[
ask alternative2 [set pcolor
my-race]
]
; else move to another city, cracker!
]
end
Here's the complete code:
Here's the model: