What you just saw
Agents with mild preferences about their neighbors produce extreme segregation. Even at a similarity threshold of 0.3 — wanting only 30% of your neighbors to be like you — the grid self-sorts into clean neighborhoods within a few dozen steps. The individual rule is tolerant; the aggregate outcome is not.
The science behind it
Thomas Schelling introduced this model in 1971 to show that segregation can emerge even when no individual prefers it. The model is agent-based: each cell is a person with a type and a rule. At every step, unhappy agents (those with too few same-type neighbors) relocate to random empty cells. The rule is local; the segregation index — average same-type-neighbor fraction — is the emergent measurable. The model is the conceptual foundation of computational social science.
Try these experiments
1. Tolerance floor
Settings: similarity_threshold = 0.25
What to look for: The grid stays mostly mixed. A modest same-type preference does not force segregation if it is below the tipping threshold.
2. Tipping point
Settings: similarity_threshold = 0.35
What to look for: Clear neighborhoods form within ~50 steps. The segregation index climbs from ~0.5 to ~0.8.
3. Sharp segregation
Settings: similarity_threshold = 0.6
What to look for: Complete neighborhood separation. Agents cluster quickly and segregation index approaches 1.0.
4. Paralysis
Settings: similarity_threshold = 0.9
What to look for: Almost no one is ever satisfied. The system thrashes — many moves per step and high unhappiness.
Run this at 100x scale
Schelling segregation runs in your browser up to 6,400 agents. With SimLab, the same model runs on GPU at 10M+, with ensemble parameter sweeps and publication-ready output.
from scirouter import SciRouter
client = SciRouter(api_key="sk-sci-...")
result = client.simulation.run(
model="schelling",
params={
"grid_size": 500,
"density": 0.9,
"similarity_threshold": 0.35,
},
steps=500,
seed=42,
)
print(result.metrics["segregation_index"])Related simulations
Voter Model Simulator
Binary opinion dynamics on a network. See how zealots, media influence, and network structure drive consensus vs. polarization.
Sugarscape Wealth Simulator
The Epstein–Axtell economy. Heterogeneous agents harvest sugar under lookup rules; watch Pareto wealth distribution emerge.
Spatial Cooperation Simulator
Prisoner's dilemma on a 2D lattice. Nudge the temptation parameter past 1.50 and watch defection sweep a sea of cooperators.
Conway's Game of Life
Conway's 1970 cellular automaton. Drop gliders, guns, and spaceships on the grid, or draw your own and watch them evolve.
Frequently asked questions
What does the similarity threshold actually represent?›
It is the minimum fraction of an agent's neighbors (Moore 8-neighborhood) that must be the same type for the agent to be happy. Below this fraction, the agent moves to a random empty cell on the next step.
Is this a legitimate model of housing segregation?›
It is a conceptual model, not a housing market simulation. Real segregation is driven by many more factors — income, policy, discrimination, school districts. What Schelling established is that segregation does not require any of those. Individual mild preference is sufficient.
Why does the simulation converge?›
Once every agent is happy, no more moves occur and the state is stable. At high thresholds (>0.7) convergence can fail — the system lacks enough empty cells to satisfy everyone and the simulation runs for its full step budget.