Whale Shark Population

Whale Shark Population preview image

1 collaborator

Dscf1115 Pamela Bayona (Author)



Tagged by Pamela Bayona 2 months ago


Tagged by Pamela Bayona 2 months ago

population dynamics 

Tagged by Pamela Bayona 2 months ago

predator prey model 

Tagged by Pamela Bayona 2 months ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.4 • Viewed 27 times • Downloaded 0 times • Run 0 times
Download the 'Whale Shark Population' modelDownload this modelEmbed this model

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


This model explores the impact of illegal fishing and artificial plankton feeding for tourism on whaleshark populations. Such controversial practices have been linked to a decrease of 63% of whaleshark populations in the last decade, especially in tourist spots such as Oslob, Philippines, which I visited in October 2023.

Little is known in the scientific world about the mysterious whale shark, but what we do know is that they may soon be extinct due to human activities. Whale sharks are solitary fish with slow growth, late maturation, long lifespans and no known predators, and illegal fishing is the biggest cause of mortality for them.

Artificial plankton feeding at tourist spots, which is a more recent phenomenon, has been linked to reducing their nutrition, increasing their risk of baterial infections and abrasions from contact with boats, changing their behavior to swim towards instead of away from boats, and disrupting their migration patterns for breeding.


There are two main variations to this model.

In the first variation, the "no-artificial-plankton" version, whale sharks wander randomly and eat plankton, while illegal fishing boats appear and hunt them whenever a big enough group of whale sharks are spotted (when the whaleshark-threshold is reached). They also disappear when the whale shark population falls below the threshold.

The fishing boats chase the whalesharks that are near them. There is a maximum number of fishing boats that can be set. In turn, the whale sharks have a probality of fleeing when they are near the fishing boats.

Both the whale sharks and the fishing boats have energy, but use it differently. For whale sharks, each step costs energy, and the whale sharks must eat plankton to replenish energy. Fishing boats don't consume energy or need it to move, but gain energy (food) every time they successfully hunt a whale shark, leave when they have gained enough food (min-energy-to-leave).

The whale sharks have a probability of reproducing at each time step, and the plankton replenishes after a fixed amount of time.

In the second variation "artificial-plankton", we model the idea of artificial plankton feeding from tourist boats as an additional food source. When whale sharks come near the artificial plankton, they are attracted to the tourist boat and gorge on the plankton, even though they earn less energy from the lower nutritional content. Their reproductive rate is reduced for a defined time interval (shown by a temporary change in their color to YELLOW), and they temporarily swim towards fishing boats instead of fleeing from them.


  1. Set the model-version chooser to "artificial-plankton" to include artificial plankton feeding in the model, or to "no-artificial-plankton" to only include whale sharks, fishing boats and plankton.
  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: MODEL-VERSION: Whether we model "artificial-plankton" or "no-artificial-plankton" INITIAL-NUMBER-WHALESHARK: The initial size of whale shark population INITIAL-NUMBER-FISHINGBOATS: The initial number of fishing boats hunting whale sharks PLANKTON-REGROWTH-TIME: How long it takes for plankton to regrow once it is eaten SHOW-ENERGY?: Whether or not to show the energy of each whale shark or fishing boat as a number

WHALESHARK-GAIN-FROM-FOOD: The amount of energy whale sharks get for every plankton patch eaten WHALESHARK-REPRODUCE: The probability of a whaleshark reproducing at each time step REPRODUCTION-INTERVAL: The number of ticks before whale sharks reproduce again

FISHINGBOAT-GAIN-FROM-FOOD: The amount of energy fishing boats get for every whaleshark hunted MAX-FISHINGBOATS: The maximum number of fishing boats that can be deployed WHALESHARK-THRESHOLD: The minimum number of whalesharks needed for a boat to appear MIN-ENERGY-TO-LEAVE:The minimum food (energy) gathered needed for a fishing boat to leave

ARTIFICIAL-PLANKTON-INTERVAL: The number of ticks that artificial plankton effects work on whale sharks that have eaten it ATTRACTION-DISTANCE: The distance from the tourist boat at which whale sharks start being attracted to the artificial plankton

Notes: There are three monitors to show the populations of the whale sharks, plankton and fishing boats and a populations plot to display the population values over time.

If there are either too many whale sharks or if they become extinct, the model run stops.


There are different ways to arrange the variables in the model to see what could make whale sharks either extinct or grow in population.

  1. Increasing or decreasing the maximum number of fishing boats impacts the speed at which whale sharks become extinct.
  2. The fertility rate of the whale sharks also affects their survival.
  3. Ingesting the artificial plankton also impacts the mortality rate of the whale sharks.

Some variations may be stable while others are not.


Try adjusting the parameters to see under which settings the whale sharks will have a sustainable population, or else overrun the ocean, or else become extinct.


The reproduction effect could be made more complex to more closely match the breeding behavior of whale sharks.

the artificial plankton effects could be tweaked to add tourists and model their impact on the whale sharks.

The behavior of the whale sharks could be made more complex so that their movements follow seasonal or migratory patterns.


*This model is originally based on the sheep-wolves-grass model of predator-prey ecosystems. The model is far from perfect and greatly simplifies these behaviors, but it can be the starting point for more complex modelling.

Comments and Questions

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

Click to Run Model

globals [ max-whaleshark artificial-plankton artificial-plankton-threshold]

  ; whaleshark and fishingboats are both breeds of turtle.
breed [ whaleshark one-whaleshark ]
breed [ fishingboats fishingboat ]
breed [ touristboats touristboat ]

turtles-own [ energy      ; both fishingboats and whaleshark have energy
              eaten-artificial-plankton ; Added for whalesharks to indicate if they have eaten artificial plankton
              artificial-plankton-timer; Counter for ticks since eating artificial plankton
              time-on-artificial-plankton  ; New variable to track time on artificial plankton patch
              artificial-plankton-consumed  ; New variable to track amount of artificial plankton consumed

patches-own [ countdown ]

to setup
  ifelse netlogo-web? [set max-whaleshark 10000] [set max-whaleshark 20000]

  set artificial-plankton-threshold 50  ; Example value

  ask patches [
      set pcolor one-of [ cyan sky ]
      ifelse pcolor = cyan
        [ set countdown plankton-regrowth-time ]
      [ set countdown random plankton-regrowth-time ] ; initialize plankton regrowth clocks randomly for sky patches
    set artificial-plankton false  ; Initially, no patch has artificial plankton

  create-whaleshark initial-number-whaleshark  ; create the whaleshark, then initialize their variables
    set shape  "whale shark"
    set color gray
    set size 2  ; easier to see
    set label-color sky - 2
    set energy random (2 * whaleshark-gain-from-food)
    setxy random-xcor random-ycor
    set eaten-artificial-plankton false
    set artificial-plankton-timer -1  ; Initialize with -1 to indicate not consumed artificial plankton
    set time-on-artificial-plankton 0
    set artificial-plankton-consumed 0
    set ticks-since-last-reproduction 50  ; Start with 50 so they can reproduce immediately

  create-fishingboats initial-number-fishingboats  ; create the fishingboats, then initialize their variables
    set shape "boat"
    set color orange
    set size 3  ; easier to see
    set energy random (2 * fishingboat-gain-from-food)
    setxy random-xcor random-ycor

    ; Create a single touristboat only if model-version is "artificial plankton"
  if model-version = "artificial-plankton" [
    create-touristboats 1 [
      set shape "boat"
      set color red  ; or any color that distinguishes it
      set size 5
      setxy random-xcor random-ycor


to go
  ; stop the simulation if no fishingboats or whaleshark
  if not any? turtles [ stop ]
  ; stop the model if there are no fishingboats and the number of whaleshark gets very large
  if count whaleshark > max-whaleshark [ user-message "The whale sharks have inherited the ocean." stop ]
  if not any? whaleshark [ user-message "Oh no! The whale sharks are extinct!" stop ]

  if count whaleshark > whaleshark-threshold and count fishingboats < max-fishingboats [
    create-fishingboats 1 [ initialize-fishingboat ]

   ; Whaleshark behavior
  ask whaleshark [
    if pcolor = yellow [  ; Check if whaleshark is on an artificial plankton patch
      set time-on-artificial-plankton time-on-artificial-plankton + 1
    ] if pcolor != yellow [
      set time-on-artificial-plankton 0  ; Reset the counter if not on artificial plankton
    set energy energy - 1
    set ticks-since-last-reproduction ticks-since-last-reproduction + 1  ; Increment reproduction timer
    set eaten-artificial-plankton false  ; Reset at the end of each tick


  ask fishingboats [
    chase-whaleshark ;; fishingboats chase whalesharks
    eat-whaleshark ; fishingboats eat a whaleshark on their patch
    check-energy-and-leave ; fishingboats leave if out of energy

  ask touristboats [
    dispense-artificial-plankton  ; Ensure this is being called
    ; Other touristboat behaviors

  ; always grow plankton
  ask patches [ grow-plankton ]

  update-color-after-artificial-plankton  ; Include this call in your simulation loop


to initialize-fishingboat  ; Initialize new fishingboat
  set shape "boat"
  set color orange
  set size 3  ; easier to see
  setxy random-xcor random-ycor
  set energy 10  ; Initialize energy to 0

to dispense-artificial-plankton
  ask patches in-radius 2 [  ; Assuming a radius around the tourist boat
    set artificial-plankton true
    set pcolor yellow

to chase-whaleshark
  let target one-of whaleshark in-cone 10 180  ; 10 is the radius, 180 is the angle
  if target != nobody [
    face target  ; Turn towards the whaleshark
    fd 1  ; Move forward towards the whaleshark
  ] if target = nobody [
    move  ; Call a procedure for random movement
  if energy <= 0 [ die ]  ; Check energy level

to check-energy-and-leave  ; Check energy level of fishingboats
  if energy >= min-energy-to-leave [ die ]  ; Leave if minimum energy is reached

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

to eat-plankton  ; whaleshark procedure
  ; whaleshark eat plankton, turn the patch sky
  if pcolor = cyan [
    set pcolor sky
    set energy energy + whaleshark-gain-from-food  ; whaleshark gain energy by eating
  if pcolor = yellow [
    set energy energy + (whaleshark-gain-from-food * 0.5)
    set artificial-plankton-consumed artificial-plankton-consumed + 1
    set color yellow
    set pcolor sky
    set artificial-plankton-timer 0  ; Start the timer

to reproduce-whaleshark
  let reproduction-chance whaleshark-reproduce
  if model-version = "artificial-plankton" [
  if artificial-plankton-timer >= 0 and artificial-plankton-timer < artificial-plankton-interval [
    set reproduction-chance reproduction-chance * 0.5  ; Halve the chance if within the effect window
  if ticks-since-last-reproduction >= reproduction-interval [  ; Check if it's time to reproduce
    if random-float 1 < reproduction-chance [  ; Chance to reproduce
     set energy (energy / 2)
      hatch 1 [
        set ticks-since-last-reproduction 0  ; Reset timer for offspring
        rt random-float 360
        fd 1
      set ticks-since-last-reproduction 0  ; Reset timer for parent

to eat-whaleshark  ; fishingboat procedure
  let prey one-of whaleshark-here                    ; grab a random whaleshark
  if prey != nobody  [                          ; did we get one?  if so,
    ask prey [ die ]                            ; kill it, and...
    set energy energy + fishingboat-gain-from-food     ; get energy from eating

to death  ; turtle procedure (i.e. both fishingboat nd whaleshark procedure)
  ; when energy dips below zero, die
  if energy < 0 [ die ]

to grow-plankton  ; patch procedure
  ; countdown on sky patches: if reach 0, grow some plankton
  if pcolor = sky [
    ifelse countdown <= 0
      [ set pcolor cyan
        set countdown plankton-regrowth-time ]
      [ set countdown countdown - 1 ]

to-report plankton
    report patches with [pcolor = cyan]

to update-color-after-artificial-plankton
  ask whaleshark [
    if artificial-plankton-timer >= 0 [  ; Check if the timer is active
      if artificial-plankton-timer < artificial-plankton-interval [
        set artificial-plankton-timer artificial-plankton-timer + 1
      if artificial-plankton-timer = artificial-plankton-interval [
        set color gray  ; Revert color to gray
        set eaten-artificial-plankton false  ; Reset the effect on reproduction
        set artificial-plankton-timer -1  ; Reset the timer

to flee-from-fishingboats
  let nearest-fishingboat min-one-of fishingboats [distance myself]
  if nearest-fishingboat != nobody [
    if (artificial-plankton-timer >= 0) and (artificial-plankton-timer < artificial-plankton-interval) [  ; Check if under the influence of artificial plankton
      face nearest-fishingboat  ; Move towards the fishing boat
      fd 1
    if (artificial-plankton-timer < 0) or (artificial-plankton-timer >= artificial-plankton-interval) [
       if random-float 1 < 0.2 [  ; flee-probability is the chance of fleeing
      face nearest-fishingboat
      rt 180
      fd 1

to move-towards-touristboats
  if artificial-plankton-consumed < artificial-plankton-threshold [  ; Only move towards if under the threshold
    let nearest-touristboat min-one-of touristboats [distance myself]
    if nearest-touristboat != nobody and distance nearest-touristboat < attraction-distance [
      face nearest-touristboat
      fd 1

to display-labels
  ask turtles [ set label "" ]
  if show-energy? [
    ask fishingboats [ set label round energy ]
    ask whaleshark [ set label round energy ]

There is only one version of this model, created 2 months ago by Pamela Bayona.

Attached files

File Type Description Last updated
Whale Shark Population.png preview Preview for 'Whale Shark Population' 2 months ago, by Pamela Bayona Download

This model does not have any ancestors.

This model does not have any descendants.