Mongoose

Mongoose preview image

1 collaborator

Default-person Josh Zettel (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.2.0 • Viewed 251 times • Downloaded 28 times • Run 0 times
Download the 'Mongoose' 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 rats-mongooses-hawks predation model.

The goal of this model is to explore the stability of predator-prey ecosystems.

This model borrowed the building blocks from the wolf-sheep-predation model, and according to the wolf-sheep-predation model, a predation model is where "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."

I wanted to examine these fluctuations even further and see if I could reach stability with three species, therefore I wrote into the code three species dynamics of two predators, mongooseses, hawks and a species they both feed on, which is rats.

The reason I choose the rat, mongoose and hawk is to try to simulate what is happening in some of the Hawaiian islands where the mongoose is an invasive species that was introduced to some of the Hawaiian Islands. They were imported by the sugar industry as an effort to control rats in the sugar cane fields. However, one forgotten fact about the mongoose Hawaiians didn’t realize is that mongooses are active during the day and sleep at night in burrows while rats are primarily the opposite and more active during the night. Thus, the theory of the mongoose controlling the rat population was an epic failure! Now mongooses are ubiquitous among some of the Hawaiian Islands. Yet, mongoose will eat rats when they come upon them, therefore, I thought it would be interesting to model how successful it could have been if the sleep patterns of mongooses and rats lined up and the mongoose also has a predator to eat them, which is a hawk.

Overall, this model will to try to understand how quickly a system coud collapse if there were a variety of predators. Or to see if they could reach an equilibrium with another predator involved.

HOW IT WORKS

The first model-version, the "rats-mongooses-hawks" model-version, mongooses, rats and hawks either wander randomly or use the targeted walks to move around the landscape, while the mongooses and hawks look for rats to prey on or the hawk preys on both rats and mongooses or you can set it up to where the mongooses only prey on rats, or the hawk only preys on rats. It depends which code you use that will be listed in the things to try section below. There are also blue patches where the species will die if they move over them. The blue patches were added to observe if setting traps could change the outcome. When running this model-version each step costs the mongooses energy, and they must eat rats in order to replenish their energy, also the hawks use up energy and must eat rats or mongooses or both. When mongooses, hawks or rats run out of energy they die. To allow the population to continue, each mongoose, hawk or rat has a fixed probability of reproducing at each time step. In this variation, I model the sugarcane as "infinite" so that rats always have enough to eat, and I don't explicitly model the eating or growing of sugarcane. As such, rats don't either gain or lose energy by eating or moving. This variation produces interesting population dynamics, it seems diffucult to maintain and can be ultimately unstable. This variation of the model is particularly well-suited to try to understand the balance of the interacting species of mongooses and hawks where rats could be a limited resource, yet an abundant resource.

The second model-version, the "rats-mongooses-sugarcane" version explictly models sugarcane (green) in addition to mongooses and rats. The behavior of the mongooses is identical to the first variation, however this time the rats must eat sugarcane in order to maintain their energy - when they run out of energy they die. Once sugarcane is eaten it will only regrow after a fixed amount of time. This variation is a little more complex than the first, rats can easily overtake everything but you can almost get some stability if the mongooses are eating enough rats. Hawks can also be added to this variation by using the sliders.There are also blue patches where the species will die if they move over them. There are also blue patches in this model where the species will die if they move over them.The blue patches were added to observe if setting traps could change the outcome.

Bonus Third model-version "sheep-bears" A bonus thing to add, since I built this using the wolf-sheep-predation model I wanted to see if I understood how to write the code or if I could write code that did the same thing but written slightly different. By trying to write a different code, but mimicking wolf-sheep-predation, I came up with something similar, yet different.. I wrote a code that just has bears eating sheep and all of the resources and leaving the patches brown. I added the “sheep-bears” code to the model-version tab in this model.

HOW TO USE IT

How to use the "rats-mongooses-sugarcane" and the "rats-mongooses-hawks" models.

  1. Set the model-version chooser to "rats-mongooses-sugarcane" to include sugarcane eating and growth in the model, or to "rats-mongooses-hawks" to run the model of rats, mongoose and hawks..
  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.

How to use the bonus model "bears-sheep"

  1. Set the model-version to "bears-sheep."
  2. Adjust the slider parameters from the other models to zero. Since it is separate from the mongoose model. If you don't set the sliders to zero from the other models, mongooses, hawks and rats will show up, and they are not part of that model.
  3. Press the SETUP button.
  4. Press the GO button to begin the simulation.
  5. This model is not plotted, you only see bears eating everything. However, there is a wait time added to the code, so you might notice the speed is slower than other models.

Parameters: MODEL-VERSION: Whether I model rats mongooses/hawks and sugarcane or just rats, hawks and mongooses INITIAL-NUMBER-RATS: The initial size of rat population INITIAL-NUMBER-MONGOOSES: The initial size of mongoose population INITIAL-NUMBER-HAWKS: The initial size of the hawk population RATS-GAIN-FROM-FOOD: The amount of energy rats get for every sugarcane patch eaten (Note this is not used in the rats-mongooses-hawks model version) MONGOOSES-GAIN-FROM-FOOD: The amount of energy mongooses get for every rat eaten HAWKS-GAIN-FROM-FOOD: The amount of energy hawks get for every rat/mongoose eaten (depends which target-walk) RATS-REPRODUCE: The probability of a rat reproducing at each time step MONGOOSE-REPRODUCE: The probability of a mongoose reproducing at each time step HAWKS-REPRODUCE: The probability of hawks reproducing at each time step SUGARCANE-REGROWTH-TIME: How long it takes for sugarcane to regrow once it is eaten (Note this is not used in the rats-mongooses-hawks model version) 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 mongoose or hawk takes - when running the rats-mongooses-sugarcane model version, one unit of energy is deducted for every step a rat takes

There are four monitors to show the populations of the rats, mongooses, hawks and sugarcane, also a populations plot to display the population values over time.

If there are no mongooses or hawks left and too many rats, the model run stops.

THINGS TO NOTICE

When running the rats-mongooses-hawks model variation, watch as the rats, mongooses and hawks populations fluctuate. Notice that increases and decreases in the sizes of each population are related. For some moments in time they have a balance. In what way are they related? What eventually happens?

When running the rats-mongooses-sugarcane model or the rats-mongooses-hawks model, notice the random blue patches (traps). Having these traps can sometimes really impact the population growth, it can depend on hpw many random traps were set. Some times the random blue patches prevents the rats from completely dying off and just continuing in an up and down cycle.

When running the rats-mongooses-sugarcane model or the rats-mongooses-hawks model, notice the patches can turn grey or yellow depending on the targeted walk.(this is listed in things to try)

In the rats-mongooses-sugarcane model variation, notice the green line added to the population plot representing fluctuations in the amount of sugarcane.

THINGS TO TRY

For the "rats-mongooses-sugarcane" and the "rats-mongooses-hawks" models.

In the rats-mongooses-sugarcane model or the rats-mongooses-hawks model I coded in target walks. Try going into the code and either code-in or code-out the different walks (to code-in or code-out remove the semicolon (;) in front of the code). Notice how quckly or not so quickly the mongooses and hawks target rats etc. and how the patches can change color depending on the targeted-walk. You can either have mongoose target rats or hawks target mongooses.

Try using the pen-down code in the targeted-walks to see how long of a trail it can leave.

try adjusting the world wraps settings to see if the species stay within an area or if they wonder off.

Try adjusting the sliders/parameters under various settings. Can there be a stabilty?

Try running the rats-mongooses-sugarcane model variation, but setting INITIAL-NUMBER-MONGOOSES to 0. This gives an ecosystem with only rats and sugarcane.

Try coding out the blue patches (traps) and see if the mice die out when running only the mice, or see what happens to rest of the model without the patches.

THINGS TO TRY

For the "bears-sheep" bonus model, it's pretty simple without any sliders.

Try changing the times on the "wait" section and see if it gets faster.

Try coding out the blue patches.

Try changing patch colors to see if the bear still eats everything. Get creative, there are ways to change or add to it.

EXTENDING THE MODEL

There are a number ways to alter the model so that it will be stable with only one species or all of the mongooses, hawks and rats.

I could change things such the radius of where mongooses eat or use only a specific walk where hawks only eat rats etc.

Maybe I could add other plants that are fighting for space with the sugarcane.

I could change the reproduction rules to specifically match each species, instead of using sliders. Possibly change reproduction to depend on energy rather than being determined by a fixed probability?

I could create storage where maybe rats could slow feeding if they put thier energy/goods into storage.

RELATED MODELS

Other models I looked at for this project.

"Rabbits-Grass-Weeds" for interacting populations with different rules. "Wall-following" model to see how I could possibly put up a wall or set a fixed movement. "Traffic-base-adaptive" to see about ebb and flow movement. "Ants-adaptation" to see how ants moved across patches.

CREDITS AND REFERENCES

The wolf-sheep-predation model says

"If you mention this model or the NetLogo software in a publication, we ask that you include the citations below."

So here are the citations below...

For the model itself:

Please cite the NetLogo software as:

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 https://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 [ max-rats ]  ; don't let the rat population grow too large

; rat, mongoose and hawks are all breeds of turtles
breed [ rats rat ]
breed [ mongooses mongoose ]
breed [ hawks hawk ] ;I added a hawks to the model in order to add a 3rd  entity to the food web to target rats and mongooses.

; I also wrote a seperate different model included on the "model-version" tab of "sheep-bears"where bears just eat everything including grass.
; However, look at the "sheep-bears" model after observing my Mongooses and hawks" original model for this assignement.
;I wrote the add on model because wanted to see the dynamic of one predator eating everything. Basically a Tragedy of the commoms.


extensions [ Rnd ] ; I tried adding an extension to a random walk to see if I could get it to work.

turtles-own [ energy ]       ;  rats, mongooses and hawks have energy

patches-own [ countdown ]    ; this is for the rats-mongooses-sugarcane "model-version"

to setup
  clear-all

  ifelse netlogo-web? [ set max-rats 10000 ] [ set max-rats 30000 ]

  ; Check model-version switch
  ; if we're not modeling sugarcane, then the rats don't need to eat to survive
  ; otherwise each 'sugarcane' state of growth and growing logic need to be set up
  ifelse model-version = "rats-mongooses-sugarcane" [
    ask patches [
      set pcolor one-of [ green brown ]
      ifelse pcolor = green
        [ set countdown sugarcane-regrowth-time ]
      [ set countdown random sugarcane-regrowth-time ] ; initialize sugarcane regrowth, clocks randomly for brown patches
    ]
  ]
  [
    ask patches [ set pcolor green ]

    ;
    ;ask patches with [pxcor = 8 ] [set pcolor white] ;here is where I could set up a wall
    ;ask patches with [pycor = -11 ] [set pcolor white]
  ]



  ; The sheep-bears model-version below is different than the "rats-mongooses-hawks" "model-version."
  ; This is where I setup and wrote a completly different model and code to see if I could write a different code setup. I wrote this as a "sheep-bears" only and added it to the "model-version" slider.
  ; To get this "sheep-bears" model to work, you need to set the model version to "sheep-bears" and turn off all the other sliders realated to the "rats-mongooses-hawks" model (set them to zero).

   if model-version = "sheep-bears" [ ; where I created a new code and a model-version
     ask patches [
      set pcolor 66]
  create-turtles 5
  [set shape "footprint other"
    set energy 0
    set size 2
    set color yellow
    setxy random-xcor random-ycor]
  create-turtles 100
  [set shape "sheep"
    set size 2
    set color 52
      setxy random-xcor random-ycor  ;If you run the full code it has multiple turtles and eats everything, However if you use one of the lines of code below it will only eat a-sheep.

     ; ask turtles with [count turtles-here > 1] [ die ]        ;this where the bears hunt a-sheep until the bear catches the sheep, the bear won't die

  ]]






   ; This where the "rats-mongooses-hawks" "model-version" begins, I create the rats, then initialize their variables for the model-versions of  "rats-mongooses-sugarcane" and "rats-mongooses-hawks."

    create-rats  initial-number-rats
  [
    set shape  "rats"
    set color white
    set size 1.5  ; easier to see
    set label-color blue - 2
    set energy random (2 * rats-gain-from-food)
    setxy random-xcor random-ycor
]

  create-mongooses initial-number-mongooses  ; create the rats, then initialize their variables
  [
    set shape "mongoose"
    set color red
    set size 2  ; easier to see
    set energy random (2 * mongooses-gain-from-food)
    setxy random-xcor random-ycor
  ]

  create-hawks initial-number-hawks ; Here is where I added an extra carnivore to the food web. (Hawks)
  [
    set shape "hawk"
    set color black
    set size 2  ; easier to see
    set energy random (2 * hawk-gain-from-food)
    setxy random-xcor random-ycor
  ]

  ;I wanted to set some traps or create some walls that if any of the animals came across it theyt would die..... Maybe that is where a hunter would be?

  ask n-of 13 patches with [pxcor = random 13 ] [set pcolor blue] ; Where I made random blue patches for rats, mongooses and hawks to die off if they run into them.


  display-labels
  reset-ticks
end 

to go
  if not any? turtles [ stop ] ; stop the model if there are no rats, mongooses, hawks.

  if not any? mongooses and count rats > max-rats [ user-message "The rats have ate all of the sugar" stop ]
  ask rats [
    move


    ; in this version, rats eat sugarcane, sugarcane grows, and it costs rats energy to move
    if model-version = "rats-mongooses-sugarcane" [
      set energy energy - 1  ; deduct energy for rats only if running "rats-mongooses-sugarcane" "model-version."
      eat-sugarcane  ; rats eat sugarcane only if running the "rats-mongooses-sugarcane" "model-version."
      death ; rats die from starvation only if running the "rats-mongooses-sugarcane" "model-version."
    ]

    reproduce-rats  ; rats reproduce at a random rate governed by a slider.
  ]

  ask mongooses [
    move
    set energy energy - 1  ; mongooses lose energy as they move.
    eat-rats ; mongooses eat a rat on their patch.
    death ; mongooses die if they run out of energy.
    reproduce-mongooses ; mongooses reproduce at a random rate governed by a slider.
  ]

  ; Here is where I added the Hawks and had them focusing on eating mongooses and doing different target walks in order to see if the mongooses and rats can keep up with the hawks or vice versus.

  ask hawks [
    target-walk ;wait 1                            ; I added this in order to specifically target rats or mongooses in order to see how fast hawks target prey.

    ;weighted-random-walk                          ; I wanted to see the difference between weighted-random-walk and target walk. I can't run them both at the same time, so I turn the semicolon off and on.

    move
    set energy energy - 1  ; hawks lose energy as they move


    eat-mongooses                                   ; eat-mongooses ; hawks eat mongooses and turn patches grey. I have the patches turn grey where hawks eat,(further-down in the code) I did that in order to possibly target a mongoose den and know where they are at.
    death                                           ; hawks die if they run out of energy.
    reproduce-hawks                                 ; hawks reproduce at a random rate governed by a slider
  ]



  if model-version = "rats-mongooses-sugarcane" [ ask patches [ grow-sugarcane ] ]
 ; if model-version = "rats-mongooses-hawks" [ ask rats [ reproduce-rats ] ]






  ; Run this seperately from the "rats-mongooses-hawks" model-version" This is the "sheep-bears" "model-version" only.
  ;Here I wrote a "Sheep-Bears" seperate and compleletly different code for a model version of specifically Bears eating everything that includes the grass, I wanted to understand how the sheep could withstand it.
  ;For the "Sheep-Bears" model to work you have to set the model version to "sheep-bears" and move all of the sliders to zero!     Move the intial-number-sheep, initial-number-wolves, intial-number-bears to 0, before running the "sheep-bears" model
  ;The "sheep-bears' model version moves slower because I set the wait time and the bears are eating all resources within the area. This can be a tragedy of the commons, where all the resources are used up

  if model-version = "sheep-bears" [ ask turtles with [shape = "footprint other"] [if pcolor = 66 [ set pcolor 33]]
if count turtles with [ shape = "sheep"] = 0 [stop]
ask turtles with [ shape = "footprint other" ] [if any? turtles with [ shape = "sheep"] in-radius 1
[set energy energy + 10]]
ask turtles with [ shape = "footprint other" ] [if any? turtles with [ shape = "sheep"] in-radius 1
    [ask turtles with [ shape = "sheep"] in-radius 1 [die]]]
    ask turtles with [shape = "footprint other"] [ forward 1
    rt random 50
    lt random 50]
  ]

wait .1 ; This controls the speed of the bears, I could set the "wait" to a bigger number and the bears will move faster

  ask turtles with [shape = "sheep"] [rt random 50
  lt random 50
  fd 1
  ]
  tick
  display-labels
end 


; This is the continuation of the "rats-mongooses-hawks" "model-version"

to move  ; turtle procedure
  if [pcolor] of patch-here = blue [die] ; here is where the trutles rats-mongooses-hawks traps are set and run into the random blue patches and die.
  rt random 50
  lt random 50
  fd 1
end 

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

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

to reproduce-mongooses  ; mongooses procedure           ; reproduce-mongooses, is the same procedure as rats reproducing.
  if random-float 100 < mongooses-reproduce [
    set energy (energy / 2)
    hatch 1 [ rt random-float 360 fd 1 ]
  ]
end 

to reproduce-hawks    ; hawks procedure                  ; reproduce-hawks, is the same as rats and mongooses reproducing, this is how we get the 3rd predator/entity in order to keep up with the other animals that are reproducing.
  if random-float 100 < hawks-reproduce [
    set energy (energy / 2)
    hatch 1 [ rt random-float 360 fd 1 ]
  ]
end 

to eat-rats  ; mongooses procedure
  let prey one-of rats ;rats-here                          ; This is where it can be hawks eating rats or mongooses eating rats, just need to add or remove the semicolon to decide on who gets the energy.
  if prey != nobody  [                                     ; did we get one? if so,
    ask prey [ die ]                                       ; kill it, and...
    ;set energy energy + mongoose-gain-from-food           ; get energy from eating
    set energy energy + hawk-gain-from-food
  ]
end 

to eat-mongooses                                  ; This where I added only hawks eating mongooses.
  let prey one-of mongooses-here
  if prey != nobody  [
    ask prey [ die ]
   set energy energy + hawk-gain-from-food
  ]
end 


;I wrote several different target walks. My different target walks are my things to try part of the "info" tab.
; I wrote a target walk for a hawk to target rats and one for mongooses. You can add the pen down to see the movement

to target-walk                          ; Here you can see the hawks latch onto the mongoose.
 ; pen-down  ; Here is a pen down to track the movement of the target walk if you want to see it...it leaves lots of trails.

                                        ; I want hawks to eat mongoose
ask hawks  [                                    ; I added a monitor to observe the rats, mongooses and hawks numbers.
     let target Rnd:weighted-one-of mongooses with
  [color = red] in-radius 1 [distance myself]
  ifelse target != nobody [
    move-to target
    ask patch-here [set pcolor grey]   ; Here I can track where the hawks are eating mongooses. Maybe to pinpoint mongooses dens.
  ][
    set heading random 360

   fd 1

  ]
]
end 

; Here Is the same code as above, but with hawks targeting rats and turning the patches to yellow. Here you could also change the movement patterns for a different movement pattern and a different radius,
                                                                                                                      ; I wanted to see if changing the Radius and walk slowed/sped up the process.

;to target-walk
;;pen-down
;  ask hawks [
;    let target rnd:weighted-one-of rats with
;    [color = white ] in-radius 1 [distance myself]
;   ; [energy]
;    ifelse target != nobody [
;      move-to target
;      ask patch-here [set pcolor yellow]
;    ][
;    set heading random 360
;    fd 1
;    ]
;  ]
;end

; Here is a target walk for a hawks to specifically target rats. I wanted to see if the rats could die off before the mongooses when the hawks are only eating mongooses.

;to target-walk                                  ; I wanted hawks to target and eat mongooses.
;ask hawks  [
;  let target min-one-of mongooses with
;  [color = red] in-radius 0 [distance myself]
;  ifelse target != nobody [
;    move-to target
;    ;ask patch-here [set pcolor grey]
;  ][
;    set heading random 360
;   fd 1
;  ]
;]
;end

to death  ; turtle procedure (i.e. both mongoose and rats procedure)
  ; when energy dips below zero, die
  if energy < 0 [ die ]
end 

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

to-report sugarcane
  ifelse model-version = "rats-mongooses-sugarcane" [
    report patches with [pcolor = green]
  ]
  [ report 0 ]
end 

to display-labels
  ask turtles [ set label "" ]
  if show-energy? [
    ask mongooses [ set label round energy ]
    if model-version = "rats-mongooses-sugarcane" [ ask rats [ set label round energy ] ]
  ]
end 


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

There is only one version of this model, created over 3 years ago by Josh Zettel.

Attached files

File Type Description Last updated
Mongoose.png preview Preview for 'Mongoose' over 3 years ago, by Josh Zettel Download

This model does not have any ancestors.

This model does not have any descendants.