NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)


This project models the behaviour of two groups of turtles (red and green, red being the minority) in virtual world. Turtles prefer to live in the neighbourhood of turtles of the same colour. Whether they are happy at their current patches depends on the percentage of turtles of the same colour in their Moore neighbourhoods and on their individual tolerance thresholds: If `%-similar-seen` is greater or equal `%-similar-wanted`, they are happy. In this extended version of earlier models, the thresholds of the individual turtles can be different both within and between subpopulations, and they can change depending on the current neighbourhood. The "classical" version with identical and constant thresholds for all turtles and subpopulations of equal size can, of course, also be simulated.

This project was inspired by Thomas Schelling's writings about social systems (such as housing patterns in cities).


The SEARCH-MODE chooser tells the model whether each unhappy turtle moves to a random uninhabited patch or whether it moves only when it finds a patch where it would have a higher `%-similar-seen` than before.

The RANDOM-TOLERANCE? switch is only interesting for behaviour-space experiments, it overrides the %-SIMILAR-RED-MEAN and %-SIMILAR-GREEN-MEAN sliders.

The IDENTICAL-TOLERANCE? switch decides whether the two subpopulations have the same or different means of their) tolerance levels. It overrides the %-SIMILAR-GREEN-MEAN slider.

The RANDOM-DENSITY-AND-MINORITY? switch is only interesting in behaviour-space experiments. It controls the size of the minority and the density and hence overrides the PERCENTAGE-RED and NUMBER sliders.

The PERCENTAGE-RED slider controls the size of the minority and the majority.

The NUMBER slider controls the total number of turtles and hence the density of the overall population in this virtual world.

The ADAPTIVE-TOLERANCE? slider decides whether the individual tolerance levels remain the same over the complete simulation run or whether they change as a consequence of the experience the individual turtles have over time. In the latter case they adjust their individual tolerance level each time step according to `set my-%-similar-wanted my-%-similar-wanted * ( 1 - epsilon ) + epsilon * my-%-similar-seen`.

The four other sliders set the distribution of the tolerance levels within the two subpopulations (`%-similar-wanted-std-dev = 0` makes sure that all turtles have the same tolerance level within each subpopulation). `epsilon = 0` overrides the ADAPTIVE-TOLERANCE? slider.

Click the SETUP button to set up the turtles, and the world is filled with turtles at random patches, not more than one per patch.

Click GO to start the simulation. If turtles don't have enough same-colour neighbors, they jump elswewhere, either randomly or, in the case of the tolerance-related search, to a patch where the percentage of similar turtles is higher (if they don't find such a place, they stay in this round).


Three plots to the right of the virtual world show the history of the segregation index, of the overall and subpopulation-wise percentage of similar neighbours and of the overall and subpopulation-wise percentage of similar neighbours.

The three plots at the extreme right show the current distribution of the tolerance levels within the two subpopulations and the history of these distributions (the red and green curves show the mean and the mean plus/minus one standard deviation of either distribution).

The monitors below the plots show the current values of the output metrics shown in the plots.


Use the experiments prepared in the bebaviour space and extend them.


Nothing very special. But in contrast to many other implementations some calculations are outsourced into functions instead of procedures.


Schelling, T. (1978). Micromotives and Macrobehavior. New York: Norton.
Seee also a recent Atlantic article: Rauch, J. (2002). Seeing Around Corners; The Atlantic Monthly; April 2002;Volume 289, No. 4; 35-48.

Troitzsch, Klaus G. (2017). Axiomatic Theiry and Simulation: A Philosophy of Science Perspective in Schelling's Segregation Model. Journal of Artificial Societies and Social Simulation 20 (1) 10 doi:10.18564/jasss.3372

See the copyright notice at the end of the code.

(back to the NetLogo User Community Models)