Schelling's Model of Segregation
The Schelling model is a simple agent-based model that demonstrates how individuals’ relocation decisions can generate residential segregation in cities. In this model, agents belong to one of two groups and occupy cells of rectangular space. A cell can be occupied by a single agent only. Agents are able to relocate according to the fraction of friends (i.e., agents of their own group) within a neighbourhood around their location.
Here is a brief method for implementing a Schelling model with
parameters Cells
, threshold
,
vacancy
, and mix
:
-
Initialize the square grid with
Reset
. You can change the number ofCells
, where each cell can be occupied by an agent of one of two groups, with ratiomix
, or be vacant with probabilityvacancy
. - For each agent, calculate the number of friends within its neighbourhood.
-
If the number of friends is below the
threshold
, the agent is unhappy and will relocate to a random vacant cell. (Each cell has at most 8 neighbours) -
Press
Step
to run one iteration,Run
to run the simulation, andStop
to end.(Some settings will lead to choas and never end!) - The simulation runs until no more unhappy agents exist.
This is just one way to implement a Schelling model with these parameters. There are many variations and extensions to this basic model that you can explore.