Lab 10: cellular modeling

Introduction

This lab introduces the concept of cellular modeling. Cellular modeling is a modeling construct where the value of any once cell is a function of the surrounding cells.

Cellular Automata and Conway's Game of Life

The game of life is one of the more well-studied CA models. It's particularly interesting due to its simple rules and the amazingly complex structures that are generated by them.

The rules are:

In netscape, open up the page http://www.mindspring.org/~alanh/life. This will run a java applet that runs conways game of life. The applet is started by a button that has the title enjoy life.

When the applet is started, try drawing a straight vertical line. Hit go.. what is the resulting shape? What happens if there is a longer line? Or a shorter line? You can clear the slate between tries by hitting the clear button.

Next, try to create an oval by starting with a shorter line. If you can make one, try clicking a single cell on one corner. If you do it right, you can make 4 ovals. If you get the four oval pattern, then click one corner again. Occasionally, you will produce what's known as a glider, which is an emergent pattern that seems to be like a bird flying off in a diagonal direction. After some practice, you should be able to produce several.

There is a library of stable, oscilating, or emergent patterns available for experimentation with this program. They can be loaded by hitting the open button. Try the glider guns, spaceships, puffers, and billiard balls. They are all emergent patterns resulting from the same simple rules.

Cellular modeling and GIS data

    Next, we will experiment with some software, where we will try and implement rules at the cellular level, and watch as the process replicates itself across the landscape.
  1. create a new lab directory for lab 10. Open up a new arcview project, and set your working directory accordingly. Turn on Spatial Analyst.
  2. Open a grid file: /home/sanduku/classes/5930/lab10/veggy. Export this file as an ascii export file to your directory:
  3. For this next part, we will need to set some environment variables
  4. At this point, you should copy in the source code for the CA program.
  5. change directory in to plants. In this directory, you should be able to run the sample cellular modeling simulation plant. We can run the simulation to show the progress of the invasive plant over time.
  6. At the unix prompt:
  7. You should now be able to open up emacs (a text editor), and edit the required files.
  8. emacs is a text editor that is ideally suited for editing computer code. You can start it by typing at the command line:
  9. The command will start the emacs text editor, the dot (.) will open up the ``present directory'' in it, and the ampersand (&) will run the process in the background. If you are in your lab directory, you should see a number of files, including .libs, Cell.h, Cell.m, etc. The contents of the window are a listing of what's in your present directory (if you go to the terminal window, and type ls -l, you will see a similar output.).
  10. At this point, there is a setting to change, which will make your life easier. At the menu button at top of the emacs window, choose the option:
  11. At this point, all the files ending in ~ and .o should turn cyan color.
  12. All of the files that are visible in the window can now be viewed and edited at will. To open a file:
  13. to close the file
  14. to save your edits
  15. Open up the file Cell.m. This file has all the instructions that a Cell does at each time step. In this case, a cell is given two messages: step and update. The step method reads as such:
  16. That statement reads ``if there is a plant, tell it to grow''
  17. The next message, update in English, reads ``if there is a future plant flagged, if there is no plant here and the vegetation type is not 0, tell me (self) to create a plant''. This whole block can be thought of as the ability of the cell, with its land type, to be colonized by the plant.
  18. Here, make a modification to the code to disallow the plant to grow in vegetation type 3. This is equivalent to saying that vegetation type 3 is not suitable habitat for the plant.
  19. Now, open up the file Plant.m. This file has the instructions for everything that a plant does in this simulation. In case, the most important methods are the instructions for growing and colonizing neighbors. Let's examine the growth function first:
  20. scroll down to the function -grow. This is the method which describes the growth functions. The first line reads
  21. quantity *= 1.1;
  22. this line takes the size of the plant (quantity) and multiplies it by 1.1 This in effect makes the plant's biomass increase by 10% every time step.
  23. if you wish to alter the plant's growth function, this is the line to modify
  24. The next line reads age++. This increments the plants age. The line is the equivalent of age = age + 1
  25. The next line reads if (quantity > 1.5) [self colonize];. This line reads "if the quantity is greater than 1.5, I should colonize my neigbhoring cells".
  26. if you wish to alter the time at which a plant colonizes its neighbors, this is the line to modify
  27. Next, scroll down to the method that starts with -colonize. This is the method that defines how a plant colonizes its neighbors. The translation of this block into English is as such:
  28. This step describes the methods at which the plant is colonizing its neighbors. The line with the random number is defining how likely a neighboring cell will be colonized. If you were to change the number .1 to .5, you would be changing the likelyhood of colonization from 10% to 50%.
  29. if you wish to alter the aggressivenes of this plant in spreading, this is the line to modify.
  30. Let's try making a modification here. Change the number .1 to some other number (preferably between 0 and 1). Save your changes (File-> save buffer).
  31. Return to the terminal window. Type make.
  32. You will see a bunch of text fly by your window, but eventually see the phrase created plant. Now you can run the program plant again. Try the same steps that you tried before (placing a plant somewhere in the world), and see how the simulation changes.
  33. After the file has run, try writing the output to a GIS file.
Dr. Paul W. Box .