HONR 300/CMSC 491: Producer—Consumer Lab / Chaos Exploration AssignmentWed3/7/12 (Due Wed 3/14/12)

You may do the lab and/orthe Exploration assignment individually or in pairs. If you work in pairs on either or both parts of the assignment, you only need to turn in one shared solution, with both of your names on the assignment.

In-Lab Activity (HONR – 50 points; CMSC – 25 points):

You should turn in your answers to the underlined questions. These are just meant to be “lab notes” and don’t need to be carefully typed and edited, but of course you may feel free to carefully type and edit them if you wish (or if you think I won’t be able to read your handwriting!).

Getting Started

  • Start NetLogo.
  • Open the Wolf-Sheep Predation model: File -> Models Library -> Biology -> Wolf Sheep Predation.
  • Watch and learn: Marie will give a short demo of the Wolf-Sheep Predation model and show some of the basic parameters and behaviors of the system.
  • If at any point, you want to return to the initial system configuration, you can either re-open the model, or you can manually set the parameters to their original settings: grass? off, show-energy? off, grass-regrowth-time = 30, initial-number-sheep = 100, sheep-gain-from-food = 4, sheep-reproduce = 4%, initial-number-wolves = 50, wolf-gain-from-food = 20, wolf-reproduce = 5%.

Exploring the Model

  • Experiment with the model. Start out with the “Grass” switch turned off and vary each parameter independently (i.e., one at a time) to see how each parameter affects the overall behavior of the system.Write a sentence or two about each parameter: What value does it control, and in general, what effect does increasing or decreasing that parameter have on the system behavior? As you experiment with local changes, are there parameters to which the system seems to be more sensitive than others?
  • Turn the “Grass” switch on, but set the initial wolf population to 0. Again, experiment with the parameter settings to explore the space of behaviors that this family of (predator-free) models exhibits. Is this situation – grass dependency, but no predators – generally more or less stable than the no-grass situation with predators? Do the other parameters affect the system in the same way as in the previous exploration (predators but no grass)?
  • Set the wolf population to a non-zero value (try the default value, 50), with the “Grass” switch still turned on, and find a set of parameter values that tend to lead to stable system behavior. (Hint: the grass regrowth rate is very important to avoid letting the sheep population get out of control.)Did you successfully find stable settings? If so, what were they? If you get frustrated and give up, ask Dr. dJ for some settings to try. What is the general relationship, over time, between the wolf, sheep, and grass population?

Wolf-Sheep Predation Refuge Variation

  • Now you’ll look at a variation of the Wolf Sheep Predation Model that delineates “refuge” areas for the sheep, into which the wolves can’t enter. These refuge areas act as a “safe haven” for sheep and can (but don’t always!) have a stabilizing effect on the system.
  • Download(onto the desktop) the Wolf Sheep Predation Refuge model from the “Download Wolf Sheep Predation Refuge” link on the user community model page:
    Sheep Predation Refuge
    and load it into NetLogo (using File… Open). Don’t worry if it gives you a NetLogo version warning; the model seems to run just fine in the current version of NetLogo.
  • Note: The “user community model” section of the NetLogo website has a huge number of user-developed models, some of which may give you an inspiration for your own NetLogo project! HONR 300 students may use any real-world models from this archive for their “experiment with a model” projects; CMSC 491 students may want to explore some of these models to get ideas for their “build a model from scratch” projects.
  • Run the model with the default parameters by clicking Setup, then Go.
  • It’s a bit hard to tell where the refuge boundaries are – it’s the area that the wolves don’t enter, along the left and right borders of the region. Let’s make it more visible with a bit of NetLogo programming. Go to the Procedures tab, and in the first (setup) procedure, just after the line that saysset-default-shape sheep "sheep", enter the following code:
    ask patches [
    if abs pxcor < max-pxcor - (max-pxcor * refuge-size / 100) [
    set pcolor violet
    ]
    ]
    This code will turn the refuge area purple when you click “Setup,” so you can see the refuge clearly.
  • Experiment with different parameter settings, as you did with the standard Wolf Sheep Predation Model. Do the parameters generally have the same effect here as they did in the basic model? Try the “stable parameter settings” that you discovered in the first section. Do those parameter settings still lead to a stable system? If not, can you find a way to “tune” the parameters to generate stability in the refuge variation? If the system remains stable (or you find a stable configuration in the refuge variation), how would you characterize the relative behaviors of the populations (of wolf, sheep, and grass)?
  • Experiment with the refuge size. What happens to the relationship between wolf, sheep, and grass populations as you make the refuge larger or smaller?

Modifying the Model (optional if you have time in the lab)

  • Try changing the rules in reproduce-sheep and reproduce-wolves so that reproduction only occurs if the animal’s energy level is above a particular level. First,add two sliders to the interface to define two new parameters (say, wolf-reproduce-level and sheep-reproduce-level). Pick some initial default value (try 16) when you create the slider. Now, in the Procedures tab, change the conditions to the respective “if” statements in “to reproduce-sheep” and “to reproduce-wolves” to add “and energy > sheep-reproduce-level “ (or “and energy > wolf-reproduce-level”). What happens to the relationship between wolf, sheep, and grass populations as you change the minimum energy level for reproduction?

Chaos Exploration Assignment(HONR – 50 points; CMSC - 75 points)

For this assignment, feel free to use the book and online sources about the logistic map, Lorenz attractor, or other map to identify parameter settings that seem to lead to interesting behavior.

Logistic Map (HONR – 30 points; CMSC – 15 points)

I’ve written a very simple NetLogo model to generate logistic map visualizations. Download the model (LogisticMap.nlogo) from the course website.

The model stops when it detects a limit cycle (i.e., visits an exact value that it’s seen before), and prints the length of the limit cycle (i.e., how many iterations between two appearances of that value). Experiment with different values of the r parameter to generate limit cycles of different lengths.

  1. How many “bifurcations” (different length limit cycles) were you able to generate at the “edge of chaos,” given the resolution of the logistic map?
  2. Try increasing the resolution for the r parameter by right clicking (shift clicking on a Mac) the r slider, and changing the increment to (say) .001. Are you now able to generate more bifurcations? How many bifurcations can you find now? (Warning: It may be hard to tell how long your limit cycle actually is! See next question…)
  3. Does the NetLogo model always detect a limit cycle when it should? Why or why not? Is the length of the limit cycle always correctly detected? If it isn’t, why do you think it’s making a mistake?
  4. Can you generate any limit cycles in the “midst of chaos,” i.e., after the first bifurcation? Where are they?

Create Your Own Map (CMSC students only – 50 points)

Modify the logistic map NetLogo model to use one of these alternative maps (functions), or create or find a different map:

  • Sine map: Xn+1 = A sin(πXn) . (Note that the “sin” function in NetLogo requires its input to be in degrees, not radians, so you’ll need to convert this standard equation accordingly. Note also that unlike r in the logistic map, the A parameter here ranges from 0 to 1. You can either change the range of the slider, or just divide r by 4 to get a reasonable value for A. Of course, you can always feel free to try values for A or any other parameter that are outside the normal range and see what happens!)
  • Tent map: Xn+1 = A min (Xn, 1 - Xn). (A ranges from 1 to 2.)
  • General symmetric map: Xn+1 = A (1 – |2Xn – 1|). (is a parameter of the system: =1 produces the tent map; =2 gives the logistic map; can you discover what type of shape is produced by other values of  ?)
  • Binary shift map: Xn+1 = 2Xn (mod 1). (Note that “mod” here is a non-integer mod, so you are taking the fractional part of 2Xn.)

You should be able to generate any of these maps just by modifying the “logistic” function, which in my implementation computes the next value in the logistic map sequence. (That is, you shouldn’t have to learn too much NetLogo to do this assignment if you haven’t quite gotten the hang of the NetLogo language yet.)

Write a short discussion of the behavior of your map, including any challenges you ran into while implementing it, the different regimes that you discovered (including a couple of screenshots), and how it behaves similarly to, or differently from, the logistic map. You do not need to submit the model itself, but if you generate something really interesting and would like me to see it, you can email me your model as an attachment.

Lorenz Attractor (HONR – 20 points; CMSC – 10 points)

Download and install NetLogo 3D (from the NetLogo website, . Also download the collection of models NetLogoTut.zip from . Unzip this file, start NetLogo 3D, and load the “Lorenz Attractor” model from the NetLogoTut directory.

Experiment with the parameters in this model to discover at least three qualitatively different sets of trajectories, including at least one stable (non-chaotic) regime. (By qualitatively different, I mean trajectories that generate visibly different patterns in the state space.) Export the plots of these trajectories and include them in your assignment, indicating the parameter settings that you used for each regime, and briefly discuss the different patterns that you see in these three regimes.