Introduction to Complex Systems


Practical Problem 3: The Schelling Model

In class we briefly discussed the Schelling Model and investigated the model with the explorable T. Schelling plays Go. Have a look at the explorable again and understand the concepts, before you start implementing it here.

In this excersize you will implement the Schelling Model for two types of species, let’s call them A and B.

This will be a patches only netlogo implementation. So each patch in the model can have three different states

  1. “A”
  2. “B”
  3. “empty”

You can use the patches-own command to define a patch specific variable state like so:

patches-own [state]

The model has two parameters

  • the initial density $C$ of non-empty patches which should be implemented as a slider with a range between 0 and 1.

  • the tolerance parameter $T$ which should be implemented as a slider with a range between 0 and 1.

setup

Write a setup function that initialized the patches such that the a fraction $C$ of patches are nonempty. Of those non-empty site 50% should be of type A and 50% should be of type B.

simulation

At every simulation tick iterated over all patches (ask all patches [...]) and implement the rule that defines the Schelling Model.

  • count how many neighbors of the calling patch have a type different from the calling type.

  • divide that number by 8, so you have the fraction of different types in the neighborhood

  • if that fraction is larger than the tolerance parameter do the following

    1. turn a randomly chosen empty site into a type identical to the type of the calling patch

    2. set the type of the calling patch to “empty”

This last step simulates a “move” of the calling patch to another, randomly chosen empty site.

intolerably lonely

Write a new version of the Schelling model in which patches “move” also if the neighboring sites are either of a different type or empty.