Serendip is an independent site partnering with faculty at multiple colleges and universities around the world. Happy exploring!

Emergence 2009: Final Projects, VI


Biology 361 = Computer Science 361
Bryn Mawr College, Spring 2009


Back to index of models



Download/view: Selective.nlogo


This model demonstrates the evolutionary effects of selection pressure.

SETUP, STEP, and GO are standard.

ADD PREDATOR adds a single predator at a random location.

INITIAL-NUMBER-PREDATORS controls how many predators are included in SETUP.

TRAIT-VALUE-DISTRIBUTION controls the initial distribution of trait values within the prey population upon SETUP. RANDOM sets each to a random value from 0 to 9, SET TO SLIDER sets the value for all prey to the value set by the GREEN-TRAIT-VALUE slider. SET TO SLIDERS sets the value for half of the prey to the value set by GREEN-TRAIT-VALUE and sets the value for the other half to BLUE-TRAIT-VALUE (the second half also become blue).

The PREY-GENERATION monitor reports the average generation of prey. The MEAN monitors report the average trait value for each prey population (which is also shown in the MEAN TRAIT VALUES plot). The distribution of trait values is shown in the TRAIT VALUE DISTRIBUTION plot. The TRAIT DIVERSITY plot and monitors keep track of the diversity of trait values in the prey populations, calculated using Simpson's Diversity Index. A value of zero indicates that all prey (of that color) have the same trait value; a value of one indicates that trait values are exactly evenly distributed in the population.


Start out with no predators. This will show the same trends as in the Non-Selective version.

Now add a predator (or predators)- how do predators affect the mean and distribution of trait values? How do they affect diversity?

This demonstrates selection. Prey with higher trait values are more likely to survive long enough to reproduce. This creates a shift in the trait value distribution toward the higher end of the range and increases the mean value. It also creates a slight drop in diversity, as a disproportionate number of prey have high trait values.

Try again with more predators. Does selection happen faster? Using the TRAIT-VALUE-DISTRIBUTION chooser, set up two populations with different initial trait values. Is one favored? Do they evolve at the same rate?

Note that mean trait values never stabilize all the way at the maximum value, as you might expect. This is due to the right-wall effect (some offspring of prey with a trait value of 9 will die, as they will have trait values of more than nine, so turtles with a trait value of 9 will not be as strongly favored as they might otherwise be. As an extension of the model, you might try removing the right wall (or putting in on a switch) to see how high selection will push the mean trait value.

Each turtle has a variable that stores its trait value. Turtles get older with every tick, and when they have lived for forty ticks, they reproduce, making turtles with trait values distributed normally around their own trait value. They die after reproducing, and the number of offspring they produce is based on the number of living turtles, which keeps the population stable. Any turtle that is given a trait value outside the range from 0 to 9 (which happens when a turtle with a trait value of 0 or 9 reproduces) dies, producing the left- and right-wall effects. At each tick, turtles look ahead for predators. If there is a predator within a half-circle with a radius of the turtle's trait value, the turtle will turn around and move away from the predator. Otherwise, the turtle mill move randomly. THUS, PREY WITH HIGHER TRAIT VALUES ARE MORE LIKELY TO SEE AND AVOID PREDATORS, and hence more likely to survive long enough to reproduce. At each step, predators smell around themselves within a radius of 7. If there are any prey within this range, the predator jumps on whichever is closest and kills it; otherwise, it also moves randomly.


Models created using NetLogo.


Post new comment

The content of this field is kept private and will not be shown publicly.
To prevent automated spam submissions leave this field empty.
13 + 4 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.