Peppered Moths

Peppered Moths preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

biology 

Tagged by Reuven M. Lerner over 11 years ago

evolution 

Tagged by Reuven M. Lerner over 11 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 1336 times • Downloaded 103 times • Run 1 time
Download the 'Peppered Moths' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

This project models a classic example of natural selection - the peppered moths of Manchester, England. The peppered moths use their coloration as camouflage from the birds that would eat them. (Note that in this model, the birds act invisibly.) Historically, light-colored moths predominated because they blended in well against the white bark of the trees they rested on.

However, due to the intense pollution caused by the Industrial Revolution, Manchester's trees became discolored with soot, and the light-colored moths began to stick out, while the dark-colored moths blended in. Consequently, the darker moths began to predominate.

Now, in the past few decades, pollution controls have helped clean up the environment, and the trees are returning to their original color. Hence, the lighter moths are once again thriving at expense of their darker cousins.

HOW IT WORKS

This model simulates these environmental changes, and how a population of moths, initially of all different colors, changes under the pressures of natural selection.

HOW TO USE IT

The NUM-MOTHS slider controls how many moths are initially present in the world. Their coloration is randomly distributed over the possible colors of the world (white to black). Simply select how many moths you'd like to begin with (around 200 is good), and press the SETUP button. Then press the GO button to begin the simulation.

The MUTATION slider controls the rate of mutation at birth. For the purposes of the simulation, the mutation rate is much higher than it might be in real life. When MUTATION is set to 0, moths are exactly the same as the parent that hatched them. When it is set to 100, there is no correlation between a parent's color and the color of its children. (Best results are seen when MUTATION is set to around 10 or 15, but experiment with the rate and watch what happens.)

The SELECTION slider determines how moths are harvested by the birds that feed on them. SELECTION wraps up nicely many factors that determine the survivability of a species - how many birds there are, how hungry they are, and just how important camouflage is to escaping predation. SELECTION provides a probabilistic window - the lower the level of the slider, the wider this window. At 0, a moth's color ceases to matter. At 100, a moth needs to be perfectly camouflaged to avoid being seen (and thus devoured). You might first try running the model with SELECTION set to around 50.

The POLLUTE and CLEAN UP once-buttons, along with the CYCLE-POLLUTION? switch, control the pollution levels in the environment. To watch the cycle described above - from clean environment to industrial revolution to pollution control - set CYCLE-POLLUTION? to on. To directly manipulate the pollution levels in the environment, set CYCLE-POLLUTION? to off, and use the POLLUTE and CLEAN UP buttons to add and remove pollution from the environment.

The SPEED slider controls just how rapidly pollution levels change. As you might guess, 1 is slow, and 100 is fast. A good speed to start with is 10.

Finally, there are six monitors, all of which are straightforward. TICKS reports how much time has elapsed. TOTAL MOTHS displays how many moths are present in the world. LIGHT MOTHS, MEDIUM MOTHS, and DARK MOTHS report the total numbers of moths with each color gradation. The moth population is just divided into thirds over the range of colors. POLLUTION reports the pollution level in the environment on a scale from 0% (no pollution) to 100% (maximum pollution).

THINGS TO NOTICE

The most important thing to watch is how the entire set of moths seems to change color over time. Let the model run by itself the first time - watch the world change from white to black back to white. Then see how manipulating the sliders effects the populations of moths.

Notice that during the first few initial time-steps, the moth population booms. You might then see the moth population fluctuate between different levels, some of which are quite large. The moths give birth to many offspring, but the world in which they live is finite --- it has finite space and resources. If the population exceeds the available resources (carrying capacity), the moths tend die a lot faster than they would otherwise. Under normal circumstances, the average population will tend to stay constant, at a level dependent on the speed and selection rates.

Watch what happens when a drastic change in the environment occurs. (You can force this with the POLLUTE-WORLD and CLEAN-UP-WORLD buttons.) Can you kill off all of the moths in a matter of a few time-steps?

You can watch the ratios between the types of moths change either in the monitors, or graphically in the plot. The yellow line represents the lighter-colored moths, the green line represents the intermediate moths, and the blue line represents the darker-colored moths.

THINGS TO TRY

How do different levels of mutation and selection change the population? How does the speed of the model effect the rate at which the moths change? Is there a speed at which the moths can't keep up, i.e. the world changes faster than small pockets of discolored moths or mutants can help keep the population up to size?

The upper-bound for the moth population is defined as a global variable, upper-bound. It is initially set to 4 * the moth population, but you can change it and watch what happens.

EXTENDING THE MODEL

'Peppered Moths' is a nice introduction into modeling genetic and evolutionary phenomena. The code is fairly simple, and divided up into several small procedures that handle the different stages of each generation. This makes it easy for other extensions to be added to the model.

Each moth has one gene that effectively determines its survivability under current conditions. This is a turtle variable, simply the turtle's color. Add the concept of the recessive gene to 'Peppered Moths'- each moth might have two color genes (additional turtle variables), that together determine its color. Moths will then need to seek out mates, and use sexual reproduction as opposed to the unnatural asexual reproduction we see here.

NETLOGO FEATURES

Note that all of the commands given to the moths are in a block of code that begins ask moths. This is because each moth is given a breed, moths. This makes the code far easier to modify, especially if you want to add a different kind of animal, say, the birds that eat the moths. You would then add a new breed, birds, and put all code that birds are to execute in the body of ask birds.

CREDITS AND REFERENCES

The peppered moths of Manchester, England as a case study in natural selection were originally studied by British scientist H. B. D. Kettlewell.

In 1998, Michael Majerus of the University of Cambridge re-examined Kettlewell's work and found that though his experimental design was questionable in some respects, his conclusions were likely correct nonetheless. In any case, the mechanism of natural selection illustrated by this model is not in doubt.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Wilensky, U. (1997). NetLogo Peppered Moths model. http://ccl.northwestern.edu/netlogo/models/PepperedMoths. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

COPYRIGHT AND LICENSE

Copyright 1997 Uri Wilensky.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2001.

Comments and Questions

NetLogo Features (Question)

Hi, I'm trying to do the NetLogo Feature for this model, have you ever try it? Do you have any model that realizes the NetLogo Feature with the birds etc

Posted over 7 years ago

Click to Run Model

breed [moths moth] ;; might extend the model with other breeds: birds, bugs, etc.

moths-own [
  age               ;; moth's age: 0, 1 = young (can't reproduce), 2, 3 = mature (can reproduce), > 3 = old (can't reproduce)
]

globals [
  light-moths       ;; number of moths in the lightest third of possible colors
  medium-moths      ;; number of moths in the medium third of possible colors
  dark-moths        ;; number of moths in the darkest third of possible colors
  darkness          ;; darkness (pollution) level in the world
  darkening?        ;; is the world getting darker (more polluted)?
]

;; reports color value that reflects current pollution level.
;; 1 = black. 9 = white. color = white - darkness. darkness range: 0 - 8. color range: 1 - 9.

to-report env-color
  report 9 - darkness
end 

;; reports numerical color change value that reflects user's speed % choice.

to-report delta-env
  report (speed / 100)
end 

;; generates random color integers in black-white range (1-9)

to-report random-color
  report ((random 9) + 1)
end 

;; reports maximum moth population for a given environment

to-report upper-bound
  report (4 * num-moths)
end 

to setup
  clear-all
  setup-world
  setup-moths
  update-monitors
  reset-ticks
end 

to setup-world
  set darkness 0
  set darkening? true ;; world starts out clean - can only get polluted
  ask patches [ set pcolor env-color ]
end 

to setup-moths
  create-moths num-moths
  [
    set color random-color
    moths-pick-shape
    set age (random 3) ;; start out with random ages
    setxy random-xcor random-ycor
  ]
end 

to go
  ask moths [
    moths-mate
    moths-grim-reaper
    moths-get-eaten
    moths-age
  ]
  if cycle-pollution? [
    cycle-pollution
  ]
  tick
  update-monitors
end 

;; asexual reproduction - moths just hatch other moths

to moths-mate ;; moth procedure
  if (age = 2 or age = 3) [
    hatch 2 [
      if (random-float 100.0 < mutation) [
    ifelse ((random 2 = 0)) [ ;; flip a coin -- darker or lighter?
      set color (round (color + ((random-float mutation) / 12.5)))
      if (color >= 9) [
        set color 9
      ]
    ][
      set color (round (color - ((random-float mutation) / 12.5 )))
      if (color <= 1) or (color >= 130) [  ;; to prevent color from wrapping
        set color 1
      ]
    ]
      ]
      moths-pick-shape
      set age 0
      rt random-float 360.0
      fd 1 ;; move away from your parent so you can be seen
    ]
  ]
end 

;; we have a range of 'well-camouflaged-ness', dependent on the rate of selection

to moths-get-eaten ;; moth procedure
  if (random-float 1000.0 < ((selection * (abs (env-color - color))) + 200)) [
    die
  ]
end 

;; disease, children, entomologists, etc...
;; the moth's world is a cruel place.

to moths-grim-reaper ;; moth procedure
  if ((random 13) = 0) [
    die
  ]

  ;; population overshoot / resource scarcity
  if ((count moths) > upper-bound) [
    if ((random 2) = 0) [
      die
    ]
  ]
end 

to moths-age ;; moth procedure
  set age (age + 1)
end 

to moths-pick-shape ;; moth procedure
  ifelse (color < 5 ) [
    set shape "moth dark"
  ][
    set shape "moth light"
  ]
end 

to update-monitors
  ;; colors range from 1 - 9. dark moths = 1-3. medium moths = 4-6. light moths = 7-9.
  set light-moths (count moths with [color >= 7])
  set dark-moths (count moths with [color <= 3])
  set medium-moths (count moths - (light-moths + dark-moths))
end 


;; single pollution step. called by cycle-pollution. can also be invoked by "pollute" button.

to pollute-world
  ifelse (darkness <= (8 - delta-env)) [ ;; can the environment get more polluted?
    set darkness (darkness + delta-env)
    ask patches [ set pcolor env-color ]
  ][
    set darkening? false
  ]
end 

;; single de-pollution step. called by cycle-pollution. can also be invoked by "clean up" button.

to clean-up-world
  ifelse (darkness >= (0 + delta-env)) [ ;; can the environment get cleaner?
    set darkness (darkness - delta-env)
    ask patches [ set pcolor env-color ]
  ][
    set darkening? true
  ]
end 


;; world dims, then lightens, all in lockstep
;; a monochrome world is best for this, because otherwise it'd be very
;; difficult to tell what is a moth and what is a patch

to cycle-pollution
  ifelse (darkening? = true) [
    pollute-world
  ][
    clean-up-world
  ]
end 


; Copyright 1997 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Peppered Moths Download this version

Attached files

File Type Description Last updated
Peppered Moths.png preview Preview for 'Peppered Moths' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.