Bug Hunt Drift

Bug Hunt Drift preview image

2 collaborators

Uri_dolphin3 Uri Wilensky (Author)
Default-person Michael Novak (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 345 times • Downloaded 80 times • Run 0 times
Download the 'Bug Hunt Drift' 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 is a genetic drift model that shows how gene frequencies change in a population due to purely random events. The effect of random selection of certain individuals in a population (either through death or through reproduction), results in the loss or gains of an allele. Over multiple generations this shift in gene distribution leads to alleles becoming more rare or more common (or disappearing completely) in a population. This effect is called genetic drift.

This mechanism of random selection is different than natural selection (where individual traits and genes are selected for the advantages they confer on the survival and reproduction of individuals). Random selection, however, is one of the primary mechanisms which drives evolution. It is also believed to be one of the primary mechanisms which leads to speciation.

The models supports the ability to contrast the outcome of intentional selection (e.g. selective breeding) vs. unintentional random selection.

HOW IT WORKS

You assume the role of random selection mechanism (e.g. a predator or a a mate) amongst a population of bugs. To begin your selection, press SETUP to create a population of bugs, determined by six times the INITIAL-BUGS-EACH-VARIATION slider. These bugs that are created are randomly distributed around the world, each with one of the 6 possible variation they may be assigned.

When you press GO the bugs begin to move around. When the VARIATION-VISUALIZATION is set to "color" or "number" you can see the different variation of the bugs as either a color or number for each bug.

As they move around, try to click on a bug to select it. When you select the bug one of two things will happen:

If the SELECTION-MECHANISM chooser is set to "user selects which bug has offspring", then the bug that is clicked on will produce an offspring that has an identical variation to the parent bug you selected. At the same time, one bug will be randomly removed from the remaining population of bugs, to keep the population of bugs constant.

If the SELECTION-MECHANISM chooser is set to "user selects which bug to remove", then the bug that is clicked on will be removed from the population. At the same time, one bug will be randomly removed from the remaining population to produce an offspring of the parent bug that is identical to it, to keep the population of bugs constant.

Initially there are equal distributions of variations in the population (e.g. eight bugs at each of the 6 variations). Over time, however, as you eat bugs, the distribution of the bugs will change as shown in the "Number of bugs" histogram. In the histogram, you might see the distribution shift to the left (showing that more slow bugs are surviving) or to the right (showing that more fast bugs are surviving). Sometimes one sub-population of a single speed of bug will be exterminated. At this point, no other bugs of this speed can be created in the population.

To make this effect happen even more dramatically through "random selection", you as the user, can't really know or see what you are selecting. Therefore, run the model again, with the VARIATION-VISUALIZATION chooser set to "none" to hide the visible color characteristic from you as select the bugs. In this way, you will be selecting individuals to remove and replace in the population with a particular gene or trait, without you realizing which ones you are selecting.

Alternatively, you can press the button RANDOMLY REMOVE & REPLACE to have the model do both a random selection of which bug to remove and which bug will reproduce to make an offspring that is identical to it. Or, if you wish to have this process further automated, you can change the SELECTION-MECHANISM chooser to "keep randomly selecting" and the model will repeat the process of randomly removing and replacing every .25 seconds.

HOW TO USE IT

INITIAL-BUGS-EACH-COLOR is the number of bugs you start with in each of the six sub-populations. The overall population of bugs is determined by multiplying this value by 6.

VARIATION-VISUALIZATION chooser switch help you visualize or hide the variation in the population of the bugs. When set to "colors", each variation is assigned a color, when set to "number", each variation displays a number as its label, and when set to "none" the variation is not visible.

OFFSPRING BORN is a monitor showing the number of offspring created. It should always be equal to the number of bugs removed, since with every selection of a bug removed and new bug is born.

TOTAL BUGS is a monitor reporting the total number of bugs in the population. It should remain constant.

CURRENT BUG POPULATION is a histogram showing the distribution of bugs at different speeds.

BUGS REMOVED is a histogram showing the historical record of the distribution of bugs caught at different speeds. A monitor of the same name is also included.

NUMBER BUGS VS. TIME is a graph showing the total number of each variation of bug vs. time.

SELECTION MECHANISM (see above)

If you are having trouble catching any bugs, because they move too fast. Then try clicking and holding the mouse button down and with the mouse button down, run your cursor into a bug. This will also select the bug. But after selecting one you will have to click and hold down the mouse button again to select another bug. If the bugs still are moving too fast for you to select them, try adjusting the speed slider by moving it to the left at the top of the model to make the model run slightly slower.

THINGS TO NOTICE

When you the VARIATION-VISUALIZATION chooser is set to "none" and you can't see the trait variations you are selecting, the CURRENT BUG POPULATION histogram shifts over time. As one trait or gene begins to dominate, it becomes the more likely one to end up as the only trait or gene in the populations.

Both selecting individuals out of the population and selecting individuals to reproduce result in this loss of diversity in the gene pool of the population, eventually leading to a single gene or trait in the population.

Sub-populations of bugs of each color fluctuate up and down when they are selected randomly for removal or reproduction.

THINGS TO TRY

Try intentionally selecting a particular color to remove (or reproduce) and keep selecting to see how many selections it takes to remove all other color variants from the population. Compare this approach to random selection. Change the VARIATION-VISUALIZATION to "none" and start the model over. See how many selections it now takes to remove all but one color variant form the population.

Alternately, select the bugs by closing your eyes and randomly clicking and holding the mouse button down for a couple seconds. Then click and hold down again. Clicking and holding the mouse button down will remove the first bug that runs into your cursor. But you need to repeat this process to remove another bug. Alternatively, press the RANDOMLY REMOVE & SELECT ONE. Or, change the SELECTION-MECHANISM to "keep randomly selecting" and the computer will start selecting the bugs randomly to remove and replace from the population.

Try changing the number of INITIAL-BUGS-EACH-VARIATION to compare how population size affects how fast genetic drift occurs and how fast variants are removed from the population.

EXTENDING THE MODEL

Add a second or third trait to add to the population.

Add a mechanism of sexual reproduction and genetic recombination to the population.

Add walls to geographically isolate portions of the population from one another.

RELATED MODELS

GenDrift models in the Genetic Drift folder, under Biology

CREDITS AND REFERENCES

This model is a part of the BEAGLE curriculum (http://ccl.northwestern.edu/simevolution/beagle.shtml)

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:

  • Novak, M. and Wilensky, U. (2009). NetLogo Bug Hunt Drift model. http://ccl.northwestern.edu/netlogo/models/BugHuntDrift. 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 2009 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.

Comments and Questions

Click to Run Model

breed [predators predator]
breed [bugs bug]
breed [wings wing]

bugs-own [color-variation] ;; either 1, 2, 3, 4, 5, or 6


globals [
    total-type-6-removed         ;; keeps track of the number of bugs caught with color-variation of 6
    total-type-5-removed         ;; keeps track of the number of bugs caught with color-variation of 5
    total-type-4-removed         ;; keeps track of the number of bugs caught with color-variation of 4
    total-type-3-removed         ;; keeps track of the number of bugs caught with color-variation of 3
    total-type-2-removed         ;; keeps track of the number of bugs caught with color-variation of 2
    total-type-1-removed         ;; keeps track of the number of bugs caught with color-variation of 1
    total-removed                ;; keeps track of total number of bugs removed
    total-offspring              ;; keeps track of total offspring
    mouse-event
    ]

;;

to setup
  clear-all
  set mouse-event ""
  set total-offspring 0
  set total-removed 0
  set   total-type-6-removed 0
  set   total-type-5-removed 0
  set   total-type-4-removed 0
  set   total-type-3-removed 0
  set   total-type-2-removed 0
  set   total-type-1-removed 0

  set-default-shape bugs "bug"
  set-default-shape predators "x"

  ask patches [ set pcolor white ]   ;; white background
  foreach [1 2 3 4 5 6] [
    create-bugs initial-bugs-each-variation [ set color-variation ? ]
  ]
  ask bugs [
    setxy random-xcor random-ycor
    show-variations
  ]
  ;; the predator breed contains one turtle that is used to represent
  ;; a predator of the bugs (a bird)
  create-predators 1 [
    set shape "bird"
    set color gray - 3
    set size 1.5
    set heading 315
    hide-turtle
  ]
  reset-ticks
end 

to go
  ;; use EVERY to limit the overall color-variation of the model

  ifelse selection-mechanism = "keep randomly selecting"
  [every 0.25 [auto-select]]
  [every 0.03 [check-removed]]


  every 0.03 [
    move-predator
    ;; recolor the bugs in case the user changed color-variation-COLOR-MAP
    ask bugs [ show-variations move-bugs]
    ;; advance the clock
    tick
  ]
end 

;;;;;;;;;;;;;;;;;;;;;
;; Runtime Procedures
;;;;;;;;;;;;;;;;;;;;;

to move-bugs
    let candidate-predator nobody
    let target-heading 0

    ask bugs [
       right (random-float 5 - random-float 5)
       fd 1 * 0.005

     ]
end 

to move-predator
  ask predators [
    setxy mouse-xcor mouse-ycor
    set hidden? not mouse-inside? or (selection-mechanism != "user selects bug to remove" and   ;; show predator if mouse pointer inside view
           selection-mechanism != "user selects which bug has offspring")
    if selection-mechanism = "user selects bug to remove" [
       set shape "x"
       set color gray - 3
    ]
        if selection-mechanism = "user selects which bug has offspring" [
       set shape "star"
       set color yellow - 1
    ]
  ]
end 

to update-totals-removed
    if color-variation = 6 [ set total-type-6-removed total-type-6-removed + 1 ]
    if color-variation = 5 [ set total-type-5-removed total-type-5-removed + 1 ]
    if color-variation = 4 [ set total-type-4-removed total-type-4-removed + 1 ]
    if color-variation = 3 [ set total-type-3-removed total-type-3-removed + 1 ]
    if color-variation = 2 [ set total-type-2-removed total-type-2-removed + 1 ]
    if color-variation = 1 [ set total-type-1-removed total-type-1-removed + 1 ]
    set total-removed total-removed + 1
end 

to check-removed
  if not mouse-down? or not mouse-inside? [
    set mouse-event "" stop ]
  let prey [bugs in-radius (size / 2)] of one-of predators
  let bug-to-die nobody
  let bug-to-reproduce nobody
    if not any? prey [
      stop ]       ;; no prey here? oh well
    if mouse-event != "selected" [
      ask one-of prey [            ;; eat only one of the bugs at the mouse location
        if selection-mechanism = "user selects bug to remove" [
         set bug-to-die self
         set bug-to-reproduce one-of bugs with [self != bug-to-die]
         set mouse-event "selected"

    ]
        if selection-mechanism = "user selects which bug has offspring" [
         set bug-to-reproduce self
         set bug-to-die one-of bugs with [self != bug-to-reproduce]
         set mouse-event "selected"
    ]                               ;; replace the eaten bug with a random offspring from the remaining population
  ask bug-to-reproduce  [
    hatch 1 [ rt random 360 ]
     set total-offspring total-offspring + 1]
  ask bug-to-die [
    update-totals-removed die]
    ]

  ]
end 

to auto-select
  let bug-to-die nobody
  let bug-to-reproduce nobody
  set bug-to-reproduce one-of bugs
  set bug-to-die one-of bugs with [self != bug-to-reproduce]
  set mouse-event "selected"

  ;; replace the eaten bug with a random offspring from the remaining population
  ask bug-to-reproduce  [
    hatch 1 [ rt 30 + random 300 ]
    set total-offspring total-offspring + 1
    ]
  ask bug-to-die [
    update-totals-removed die]
end 

to show-variations
   set color gray - 1 set label ""
  if variation-visualization = "color" [
    set color item (color-variation - 1) [violet blue green brown orange red] ]
  if  variation-visualization = "number" [
    set label-color item (color-variation - 1) [violet blue green brown orange red] set label word  color-variation "   " ]
end 


; Copyright 2009 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 Bug Hunt Drift Download this version

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.