wolf sheep predation w/mid-level focusing

No preview image

1 collaborator

Image001 Sharona T Levy (Author)

Tags

ecosystem 

"topic"

Tagged by Sharona T Levy about 16 years ago

midlevel 

"tools to help view local events with some tools"

Tagged by Sharona T Levy about 16 years ago

negative feedback 

"complexity concept"

Tagged by Sharona T Levy about 16 years ago

oscillation 

"complexity evolution pattern"

Tagged by Sharona T Levy about 16 years ago

positive feedback 

"complexity concept"

Tagged by Sharona T Levy about 16 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 4.0.2 • Viewed 656 times • Downloaded 20 times • Run 3 times
Download the 'wolf sheep predation w/mid-level focusing' 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 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. (in press). Thinking like a Wolf, a Sheep or a Firefly: Learning Biology through Constructing and Testing Computational Theories -- an Embodied Modeling Approach. Cognition & Instruction.

To refer to this model in academic publications, please use: Wilensky, U. (1997). NetLogo Wolf Sheep Predation model. http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

In other publications, please use: Copyright 1997 Uri Wilensky. All rights reserved. See http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation for terms of use.

Comments and Questions

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

Click to Run Model

globals [ watched-one ]

;; 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]
breed [ flashes flash] ;; signifies a wolf eating a sheep

turtles-own [energy]       ;; both wolves and sheep have energy
patches-own [countdown]
flashes-own [ clock ]

to setup
  clear-all
  ask patches [ set pcolor green ]
  ;; 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-right"
  create-sheep initial-number-sheep  ;; create the sheep, then initialize their variables
  [
    set color white
    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
    if ( heading < 360 and heading >= 180 ) [ set shape "sheep-left"]
  ]
  set-default-shape wolves "wolf-right"
  create-wolves initial-number-wolves  ;; create the wolves, then initialize their variables
  [
    set color black
    set size 1.5  ;; easier to see
    set energy random (2 * wolf-gain-from-food)
    setxy random-xcor random-ycor
    if ( heading < 360 and heading >= 180 ) [ set shape "wolf-left"]
  ]
  set watched-one nobody
  if (watch-one != "none")
    [
      ifelse (watch-one = "sheep")
        [set watched-one one-of sheep ask watched-one [ watch-me]]
        [set watched-one one-of wolves ask watched-one [ watch-me]]      
    ]

  display-labels
  update-plot
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
    ]
    reproduce-sheep
    death
  ]
  ask wolves [
    move
    set energy energy - 1  ;; wolves lose energy as they move
    catch-sheep
    reproduce-wolves
    death
  ]
  if grass? [ ask patches [ grow-grass ] ]
  ask flashes [ if clock = 0 [ die ] set clock clock - 1 ]
  if (I-exterminate != "none") [ wack ]
  tick
  update-plot
  display-labels
  if (watch-one != "none" and watched-one = nobody)
    [
      ifelse (watch-one = "sheep")
        [if count sheep > 0 [ set watched-one one-of sheep ask watched-one [ watch-me]]]
        [if count wolves > 0 [ set watched-one one-of wolves ask watched-one [ watch-me]]]  
    ]
end 

to move  ;; turtle procedure
  rt random 20
  lt random 20
  if (breed = sheep )
   [ ifelse ( heading < 360 and heading >= 180 ) [ set shape "sheep-left"] [ set shape "sheep-right" ]]
   if (breed = wolves)
   [ ifelse ( heading < 360 and heading >= 180 ) [ set shape "wolf-left"] [ set shape "wolf-right" ]]
  fd 0.2
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
    if see-births? [ celebrate-sheep-birth ]
  ]
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 
    if see-births? [ celebrate-wolf-birth]]  ;; 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 [ if see-deaths? [make-sheep-ghosts ]
      observe
;      ask prey [ 
;      if (watch-one = "sheep"  and who = ([who] of watched-one)) [ make-sheep-ghosts-watch-one ]]
      die ]                          ;; kill it
      set energy energy + wolf-gain-from-food 
;      if see-ghosts? [hatch 1 [set breed flashes set shape "ghost" set color yellow set size 1 set clock 2 ]
    ]
        ;; get energy from eating
end 

to death  ;; turtle procedure
  ;; when energy dips below zero, die
  if energy < 0 [ 
;                  if ((breed = sheep) and watch-one = "sheep"  and who = ([who] of watched-one)) [ make-sheep-ghosts-watch-one ]
;                  if ((breed = wolves) and watch-one = "wolf"  and who = ([who] of watched-one)) [ make-wolf-ghosts-watch-one ]
                  if see-deaths? [
                  ifelse (breed = sheep )
                    [ make-sheep-ghosts] [ make-wolf-ghosts ]]          
                   observe
                   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 wack
    if mouse-down? and mouse-inside? [
    ifelse (I-exterminate = "sheep")
      [ ask patch mouse-xcor mouse-ycor [ ask sheep in-radius exterminate-radius [ die ]]]
      [ifelse (I-exterminate = "wolves")
      [ask patch mouse-xcor mouse-ycor [ ask wolves in-radius exterminate-radius [ die ]] ]          
      [ask patch mouse-xcor mouse-ycor [ ask patches in-radius exterminate-radius [ set pcolor brown ]]]]]
end 

to observe
    if (
    (watched-one = nobody) and 
    (watch-one != "none"))
      [ ifelse ( watch-one = "sheep")
        [if count sheep > 0 [ set watched-one one-of sheep ask watched-one [ watch-me]] ]
        [if count wolves > 0 [ set watched-one one-of wolves ask watched-one [ watch-me]] ]
      ]
end 

to make-sheep-ghosts
  hatch 1 [set breed flashes set shape "ghost" 
      set color yellow set size 2 set clock 2 ]
end 

to make-wolf-ghosts
  hatch 1 [set breed flashes set shape "ghost" 
           set color red - 1 set size 2 set clock 2 ]
end 

to make-sheep-ghosts-watch-one
  hatch 1 [set breed flashes set shape "ghost" 
      set color yellow  set size 3 set clock 4 ]
end 

to make-wolf-ghosts-watch-one
  hatch 1 [set breed flashes set shape "ghost" 
      set color yellow set size 3 set clock 4 ]
end 

to celebrate-sheep-birth
  hatch 1 [set breed flashes set shape "circle 3"
           set color pink + 1 set size 2.5 set clock 3 ]
end 

to celebrate-wolf-birth
  hatch 1 [set breed flashes set shape "circle 3"
           set color cyan + 1 set size 2.5 set clock 3 ]
end 

to update-plot
  set-current-plot "populations"
  set-current-plot-pen "sheep"
  plot count sheep
  set-current-plot-pen "wolves"
  plot count wolves
  if grass? [
    set-current-plot-pen "grass / 4"
    plot count patches with [pcolor = green] / 4  ;; divide by four to keep it within similar
                                                  ;; range as wolf and sheep populations
  ]
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 


; *** NetLogo 4.0.2 Model Copyright Notice ***
;
; 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.
;
; Copyright 1997 by Uri Wilensky.  All rights reserved.
;
; Permission to use, modify or redistribute this model is hereby granted,
; provided that both of the following requirements are followed:
; a) this copyright notice is included.
; b) this model will not be redistributed for profit without permission
;    from Uri Wilensky.
; Contact Uri Wilensky for appropriate licenses for redistribution for
; profit.
;
; 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.
;
; To refer to this model in academic publications, please use:
; Wilensky, U. (1997).  NetLogo Wolf Sheep Predation model.
; http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation.
; Center for Connected Learning and Computer-Based Modeling,
; Northwestern University, Evanston, IL.
;
; In other publications, please use:
; Copyright 1997 Uri Wilensky.  All rights reserved.
; See http://ccl.northwestern.edu/netlogo/models/WolfSheepPredation
; for terms of use.
;
; *** End of NetLogo 4.0.2 Model Copyright Notice ***

There is only one version of this model, created over 14 years ago by Sharona T Levy.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.