Schelling's Model
Schelling's Model replicates the segregation that takes place in populations of differing backgrounds or opinions
Simulation
Agents (people) of different backgrounds/opinions are represented by circles of different colors. The world is initially populated with random agents placed at random positions. The simulation continues until all agents are happy. Unhappy agents have a square drawn around them (see description for more details).
Do not introduce too many species with high occupancy and low tolerance. Simulation WILL hang.
(Lower tolerance implies causes segregation)
Description
Every agent has 8 neighbours. In every step, a random agent is chosen and it's neighbourhood is analysed: \[ f = \frac{n_{different}}{n_{total}} \] \(n_{different}\) is the number of neighbours of a different species whereas \(n_{total}\) is the total number of neighbours present. If the above fraction \(f\) is greater than the tolerance value, then the agent is "unhappy" and therefore seeks to relocate to a spot where it will be happy amongst it's compatriots. This simple rule is enough to establish segregation. Lower the tolerance, greater the segregation. In the real world, these species may differ in their background (race, ethinicity, religion, language) or their opinion (politics, incompatible issues). This sort of segregation is observed in the animal kingdom too.
Note:
- The boundary condition is periodic
- Simulation may lag on lower-end devices
Developed by ChanRT | Fork me at GitHub