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 behavior of two types of agents (here turtles) in an imaginary city. The red agents and green agents compute their level of happiness through an utility function that depends on the ratio s of similar neighbors among the agents of their neighborhood. Each agent wants to make sure that he lives in a neighborhood where his utility is maximalized. The agents are thus allowed to move in order to satisfy their wishes. The simulation shows how the individual preferences of the agent can lead to large-scale patterns, given the chosen dynamic rule. The different dynamic rules proposed here enhance the consequences of the introduction of coordination between the agents.

This project is inspired by Thomas Schelling's writings about social systems (such as housing patterns in cities) and by the work of J. Zhang whose models (which roughly correspond to our 'without coordination' dynamic rule) inspired the framework of our own.


Click the SETUP button to set up the simulation. The amount of agents and the proportion of green agents among them can be chosen by the NUMBER and %-GREEN sliders. Three chooser allow to choose an initial configuration of the city and the utility functions of the red and green agents. You also have to choose the size of the neighborhood the agents consider to compute their utility and the size of the coproperties. All these choices only take effect the next time you click SETUP.

Click GO to start the simulation. The agents will begin to move according to the dynamic rules (see below). You can control the number of move performed each tick by choosing a MOBILITY-RATE. The simulation stops itself after NUM-TICKS-MAX ticks. At this point, you can choose a higher NUM-TICKS-MAX and click again on GO to keep the simulation running.


At each iteration, an agent and a vacant cell are picked at random. The probability that the agent move to this vacant cell thus depends on the dynamic rule chosen with the COORDINATION chooser.

In the case WITHOUT COORDINATION, the probability is determined by 1/(1+exp(-Du/T_1)), where Du is the gain in utility the picked agent would realize if he was to move and T_1 can be seen as either as a temperature or as the amount of noises the agent is subject to when he takes his decision to move or not. In particular, this form of probability implies that the agents sometimes make mistakes and take utility-decreasing moves. It can be argued that this case corresponds for T_1 -> 0 to Schelling's model.

The three cases COPRO-QUALIFIED-VOTE, COPRO-PONDERED-VOTE and COPRO+MOVER-SUM correspond to three rules in which the effect of the potential move on the utilities of the picked agent's potential new coproprietors is taken into account. In the 'vote' cases, the above probability is multiplied by the probability that these coproprietors accept the arrival of the picked agent (see the code in the procedures panel and commentaries therein). Note that the temperature T-copro-vote that intervenes in the probability of acceptance can be chosen equal to T_1 or indenpendently through the parameter T_2. In the 'sum' case, the potential mover and his potential new coproprietors are put on equal footing: the probability that the move happen is chosen as 1/(1+exp(-[Du + Dv]/T_1), where Dv is the sum of the gains in utility of the coproprietors.

Finally, in the GLOBAL case, the probability is determined by 1/(1+exp(-DU/T_1)), where U is collective utility (sum of all the agents' utilities) and DU the gain in utility the collectivity as a whole would realize if the move was to take place.


On the right side of the interface screen, you can see two graphics interface: the top one give the time evolution of the collective utility (normalized by the number of agents) and the bottom one the time evolution of the level of segregation. This index of segregation is taken as 1 - p/<p> where 'p' is the number of pairs of red-green neighbors on the current configuration, and <p> is the expectation of the same value computed according to the demographic parameters (number of red and green agents, of vacant cells, size of the neighborhood). A highly segregated configuration will have an index near 1, a highly integrated configuration a negative index of segregation.

Just under the view of the city, 4 monitors give the mean and the standard deviation of the collective utility and segregation index computed over the LENGTH-WINDOW-ANALIZE last ticks. These allow you to characterize the stationary behaviours our the city.

Finally, a graphic interface allows you to follow the time evolution of the percentage of successful moves.


Choose the 'asym-peaked' utility function for both the red and the green agents. At fixed T_1, try the different dynamic rules. For high values of T_1 (1), the noise is preponderant and the results don't depends on the chosen dynamic rule. For low values of T_1 (<0.1), the choice of the dynamic rule matters. Without coordination, you can observe a high level of segregation and a mild level of collective utility (in the absence of coordination, the segregated states are very stable because no agent has any interest to go from a segregated area where is utility is around 0.5 to an area populated by the other group of agent where his utility would be around 0. The lack of coordination thus keep the city from getting out of segregated states, even if at the end almost nobody is fully happy). When you introduce coordination, the formation of mixed areas is stimulated by the influence of the coproprietors.

Check the robustness of the introduction of coordination by varying the vacance rate, the sizes of neighborhood and of coproperties, etc...

Play around!


For a given set of parameters, the city always converges towards a certain kind of configuration, whatever the initial configuration is. The convergence towards the stationary states may take some time, particularly for low values of T_1 (<0.05).


Schelling, T. (1978). Micromotives and Macrobehavior. New York: Norton.
Zhang, S (2004). Residential segregation in an all-integrationist world, Journal of Economic Behavior and Organization 54, 533-550.

See for an example of the basic Schelling's model of segregation.

To refer to this model in publications, please use: Grauwin, S. (2008). NetLogo Segregation vs Coordination model.



(back to the NetLogo User Community Models)