Wolf Sheep Predation Model - BehaviorSearch

Wolf Sheep Predation Model - BehaviorSearch preview image

1 collaborator

20160405_001940000_ios Hendra Kusumah (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.3.0 • Viewed 192 times • Downloaded 9 times • Run 0 times
Download the 'Wolf Sheep Predation Model - BehaviorSearch' modelDownload this modelEmbed this model

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


NOTE

This is the BehaviorSearch benchmarking version of the classic NetLogo Wolf Sheep Predation model.

Reference: Stonedahl, F. Doctoral Thesis. [Genetic Algorithms for the Exploration of Parameter Spaces in Agent Based Models] (http://forrest.stonedahl.com/thesis/forreststonedahlthesis.pdf). Northwestern University.

MODIFICATIONS

December 2022:

  1. Converted to NetLogo 6.3.0 format.
  2. Removed "visuals?" on-off switch.

March 2011:

  1. Added "visuals?" on-off switch, for increased speed. (doesn't affect model behavior).
  2. Added "calibrate" reporter to measure correlation with Isle Royale data (doesn't affect model behavior).
  3. Added additional TICKS-PER-YEAR slider, for use with calibrating simulation time to real-world historical time from the Isle Royale dataset. (doesn't affect model behavior).

WHAT IS IT?

This model explores the stability of predator-prey ecosystems. Such a system is called unstable if it tends to result in extinction for one or more species involved. In contrast, a system is stable if it tends to maintain itself over time, despite fluctuations in population sizes.

HOW IT WORKS

There are two main variations to this model.

In the first variation, wolves and sheep wander randomly around the landscape, while the wolves look for sheep to prey on. Each step costs the wolves energy, and they must eat sheep in order to replenish their energy - when they run out of energy they die. To allow the population to continue, each wolf or sheep has a fixed probability of reproducing at each time step. This variation produces interesting population dynamics, but is ultimately unstable.

The second variation includes grass (green) in addition to wolves and sheep. The behavior of the wolves is identical to the first variation, however this time the sheep must eat grass in order to maintain their energy - when they run out of energy they die. Once grass is eaten it will only regrow after a fixed amount of time. This variation is more complex than the first, but it is generally stable.

The construction of this model is described in two papers by Wilensky & Reisman referenced below.

HOW TO USE IT

  1. Set the GRASS? switch to TRUE to include grass in the model, or to FALSE to only include wolves (red) and sheep (white).
  2. Adjust the slider parameters (see below), or use the default settings.
  3. Press the SETUP button.
  4. Press the GO button to begin the simulation.
  5. Look at the monitors to see the current population sizes
  6. Look at the POPULATIONS plot to watch the populations fluctuate over time

Parameters: INITIAL-NUMBER-SHEEP: The initial size of sheep population INITIAL-NUMBER-WOLVES: The initial size of wolf population SHEEP-GAIN-FROM-FOOD: The amount of energy sheep get for every grass patch eaten WOLF-GAIN-FROM-FOOD: The amount of energy wolves get for every sheep eaten SHEEP-REPRODUCE: The probability of a sheep reproducing at each time step WOLF-REPRODUCE: The probability of a wolf reproducing at each time step GRASS?: Whether or not to include grass in the model GRASS-REGROWTH-TIME: How long it takes for grass to regrow once it is eaten SHOW-ENERGY?: Whether or not to show the energy of each animal as a number

Notes:

  • one unit of energy is deducted for every step a wolf takes
  • when grass is included, one unit of energy is deducted for every step a sheep takes

THINGS TO NOTICE

When grass is not included, watch as the sheep and wolf populations fluctuate. Notice that increases and decreases in the sizes of each population are related. In what way are they related? What eventually happens?

Once grass is added, notice the green line added to the population plot representing fluctuations in the amount of grass. How do the sizes of the three populations appear to relate now? What is the explanation for this?

Why do you suppose that some variations of the model might be stable while others are not?

THINGS TO TRY

Try adjusting the parameters under various settings. How sensitive is the stability of the model to the particular parameters?

Can you find any parameters that generate a stable ecosystem that includes only wolves and sheep?

Try setting GRASS? to TRUE, but setting INITIAL-NUMBER-WOLVES to 0. This gives a stable ecosystem with only sheep and grass. Why might this be stable while the variation with only sheep and wolves is not?

Notice that under stable settings, the populations tend to fluctuate at a predictable pace. Can you find any parameters that will speed this up or slow it down?

Try changing the reproduction rules -- for example, what would happen if reproduction depended on energy rather than being determined by a fixed probability?

EXTENDING THE MODEL

There are a number ways to alter the model so that it will be stable with only wolves and sheep (no grass). Some will require new elements to be coded in or existing behaviors to be changed. Can you develop such a version?

NETLOGO FEATURES

Note the use of breeds to model two different kinds of "turtles": wolves and sheep. Note the use of patches to model grass.

Note use of the ONE-OF agentset reporter to select a random sheep to be eaten by a wolf.

RELATED MODELS

Look at Rabbits Grass Weeds for another model of interacting populations with different rules.

CREDITS AND REFERENCES

Wilensky, U. & Reisman, K. (1999). Connected Science: Learning Biology through Constructing and Testing Computational Theories -- an Embodied Modeling Approach. International Journal of Complex Systems, M. 234, pp. 1 - 12. (This model is a slightly extended version of the model described in the paper.)

Wilensky, U. & Reisman, K. (2006). Thinking like a Wolf, a Sheep or a Firefly: Learning Biology through Constructing and Testing Computational Theories -- an Embodied Modeling Approach. Cognition & Instruction, 24(2), pp. 171-209. http://ccl.northwestern.edu/papers/wolfsheep.pdf

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:

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, 2000.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [grass glob_str]  ;; keep track of how much grass there is
;; Sheep and wolves are both breeds of turtle.
breed [sheep a-sheep]  ;; sheep is its own plural, so we use "a-sheep" as the singular.
breed [wolves wolf]
turtles-own [energy]       ;; both wolves and sheep have energy
patches-own [countdown]
sheep-own [value sheep_str]

to-report calibrate
  let real-wolf-history [20 22 22 23 20 26 28 26 22 22 17 18 20 23 24 31 41 44 34 40 43 50 30 14 23 24 22 20 16 12 12 15 12 12 13 17 16 22 24 14 25 29 19 17 19 29 30 30 21 23]
  let real-moose-history [563 610 628 639 663 707 733 765 912 1042 1268 1295 1439 1493 1435 1467 1355 1282 1143 1001 1028 910 863 872 932 1038 1115 1192 1268 1335 1397 1216 1313 1590 1879 1770 2422 1163 500 699 750 850 900 1100 900 750 540 450 385 650]
  let sheep-pop-list []
  let wolf-pop-list []

  setup
  set sheep-pop-list fput (count sheep) sheep-pop-list
  set wolf-pop-list fput (count wolves) wolf-pop-list

  while [ ticks < 49 * ticks-per-year and (count turtles < 10000) ]
  [
    ifelse (not any? turtles)
      [ tick ]
      [ go ]
    if ((ticks mod ticks-per-year) = 0)
    [
      set sheep-pop-list fput (count sheep) sheep-pop-list
      set wolf-pop-list fput (count wolves) wolf-pop-list
    ]
  ]
  if (count turtles >= 10000) ;; if sheep population is exploding, need to bail out...
  [ report -2 ]
  report (corr-coeff (reverse sheep-pop-list) real-moose-history) + (corr-coeff (reverse wolf-pop-list) real-wolf-history)
end 

to-report corr-coeff [ list1 list2 ]
  let mean1 mean list1
  let mean2 mean list2
  let numerator sum (map [[?1 ?2] -> (?1 - mean1) * (?2 - mean2) ] list1 list2)
  let denominator (((length list1) - 1) * (standard-deviation list1) * (standard-deviation list2))
  ifelse (denominator = 0)
   [ report 0 ]
   [ report numerator / denominator ]
end 

to setup
  clear-all
  ask patches [ set pcolor green ]
  set glob_str "global"
  ;; check GRASS? switch.
  ;; if it is true, then grass grows and the sheep eat it
  ;; if it false, then the sheep don't need to eat
  if grass? [
    ask patches [
      set countdown random grass-regrowth-time ;; initialize grass grow clocks randomly
      set pcolor one-of [green brown]
    ]
  ]
  set-default-shape sheep "sheep"
  create-sheep initial-number-sheep  ;; create the sheep, then initialize their variables
  [
    set color white
    set sheep_str "sheep"
    set size 1.5  ;; easier to see
    set label-color blue - 2
    set energy random (2 * sheep-gain-from-food)
    setxy random-xcor random-ycor
  ]
  set-default-shape wolves "wolf"
  create-wolves initial-number-wolves  ;; create the wolves, then initialize their variables
  [
    set color black
    set size 2  ;; easier to see
    set energy random (2 * wolf-gain-from-food)
    setxy random-xcor random-ycor
  ]
  display-labels
  set grass count patches with [pcolor = green]
  reset-ticks
end 

to go
  if not any? turtles [ stop ]
  ask sheep [
    move
    if grass? [
      set energy energy - 1  ;; deduct energy for sheep only if grass? switch is on
      eat-grass
    ]
    death
    reproduce-sheep
  ]
  ask wolves [
    move
    set energy energy - 1  ;; wolves lose energy as they move
    catch-sheep
    death
    reproduce-wolves
  ]
  if grass? [
    ask patches [ grow-grass ]
  ]

  set grass count patches with [pcolor = green]
  tick
  display-labels
end 

to move  ;; turtle procedure
  rt random 50
  lt random 50
  fd 1
end 

to eat-grass  ;; sheep procedure
  ;; sheep eat grass, turn the patch brown
  if pcolor = green [
    set pcolor brown
    set energy energy + sheep-gain-from-food  ;; sheep gain energy by eating
  ]
end 

to reproduce-sheep  ;; sheep procedure
  if random-float 100 < sheep-reproduce [  ;; throw "dice" to see if you will reproduce
    set energy (energy / 2)                ;; divide energy between parent and offspring
    hatch 1 [ rt random-float 360 fd 1 ]   ;; hatch an offspring and move it forward 1 step
  ]
end 

to reproduce-wolves  ;; wolf procedure
  if random-float 100 < wolf-reproduce [  ;; throw "dice" to see if you will reproduce
    set energy (energy / 2)               ;; divide energy between parent and offspring
    hatch 1 [ rt random-float 360 fd 1 ]  ;; hatch an offspring and move it forward 1 step
  ]
end 

to catch-sheep  ;; wolf procedure
  let prey one-of sheep-here                    ;; grab a random sheep
  if prey != nobody                             ;; did we get one?  if so,
    [ ask prey [ die ]                          ;; kill it
      set energy energy + wolf-gain-from-food ] ;; get energy from eating
end 

to death  ;; turtle procedure
  ;; when energy dips below zero, die
  if energy < 0 [ die ]
end 

to grow-grass  ;; patch procedure
  ;; countdown on brown patches: if reach 0, grow some grass
  if pcolor = brown [
    ifelse countdown <= 0
      [ set pcolor green
        set countdown grass-regrowth-time ]
      [ set countdown countdown - 1 ]
  ]
end 

to display-labels
  ask turtles [ set label "" ]
  if show-energy? [
    ask wolves [ set label round energy ]
    if grass? [ ask sheep [ set label round energy ] ]
  ]
end 

to-report count-grass
  if grass? [report grass]
end 



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

There is only one version of this model, created over 1 year ago by Hendra Kusumah.

Attached files

File Type Description Last updated
Wolf Sheep Predation Model - BehaviorSearch.png preview Preview for 'Wolf Sheep Predation Model - BehaviorSearch' over 1 year ago, by Hendra Kusumah Download

This model does not have any ancestors.

This model does not have any descendants.