Cellular Automata

We can build interesting models even when all agents are stationary. Such models are called cellular automata (CA).

The CA Framework

The framework for most NetLogo CAs can be found in ca.nlogo.

Each patch has a state attribute:

patches-own [
   state
]

State can be anything: temperature, honesty, political affiliation, cultural preferences, etc.

Pressing the INIT button invokes:

to init-model
   ca ; clear all
   random-seed new-seed ; randomly seed random number generator
   init-globals
   ask patches [init-patch]
end

Pressing the UPDATE button iterates:

to update-model
   if finished?
   [
      print "Simulation halted"
      stop
   ]
   tick ; increment the tick counter
   update-globals
   ask patches [update-patch]
end

In this customization of update-patch we use the conformity rule: let my state be the same as one of my popular neighbors:

to update-patch
   let my-neighbors other patches with [distance myself <= radius]
   let nbhd-state [state] of my-neighbors
   set state one-of modes nbhd-state
   color-patch
end

The color-patch method maps the state space of the model into the NetLogo color space [0, 140).

Here's a screen shot after initialization:

Here's the screen after the update-model procedure has been iterated 54 times:

Notice how patches have merged into homogenous regions. There are many examples of this in sociology: cultural assimilation, dissemination of information, emergence of voting blocks, and segregation.

The economist Thomas Schelling first applied this idea to sociology when he speculated that people who lived in segregated neighborhoods weren't necessarily racists. In this case we might think of patches as homes. The state of a patch is the race of the occupant. The update-patch procedure can be interpreted to say that the occupant of a home simply wants the majority of his neighbors to be of the same race. In other words, the occupant will tolerate neighbors of different races. Never the less, when we randomly assign occupants to homes, then run the simulation, we notice that segregated neighborhoods develop.