EES 4760/5760

Agent-Based & Individual-Based Computational Modeling

Jonathan Gilligan

Class #19: Thursday Mar. 22 2018

Wild Dog Model

Breeds of Turtles

Breeds of Turtles

breed [dogs dog]
breed [cats cat]

globals []




Breeds and Contexts

  • All breeds are evaluated in turtle context.
to go
  ask turtles [ set age age + 1 ]
  ask dogs [ if has-ball? [ fetch ] ]
  ask cats [ if has-scratching-post? [ scratch ] ]
  ask turtles [
    ; this will make an error
    if has-scratching-post? [ scratch ]
  • Common error: Ask one breed (wolf) to do another breed’s (sheep’s) function.

Checking for Errors:

Good idea: Check that the right breed is calling the function:

to do-cat-stuff
  if not is-cat? self 
    print (word "Error: turtle " self " is not a cat.")
  if has-scratching-post? [ scratch ]

Or, if you’re using jg-tif.nls, you can do this:

to do-cat-stuff
  test-that (word "do-cat-stuff: turtle " self " should be a cat.")
  expect-that is-cat? self is-true
  if has-scratching-post? [ scratch ]

Turtles vs. Breeds

  • If you have breeds, there will still always be turtles.

  • ask turtles [...] will ask all breeds of turtle.

  • ask dogs [...] will only ask the dogs.

  • Many turtles- commands have a breed-specific version:

    if any? turtles-here
      ask turtles-here [forward 10]
    if any? dogs-on neighbors and any? cats in-radius 5 
      ask dogs-on neighbors
      chase min-one-of cats [distance myself]

More about Breeds

  • You can change the breed of a turtle or link with set-breed:

    ask one-of cats [ set breed dog ]
    ask one-of friendships [ set undirected-link-breed enmities ]
  • You can specify the default shape of new individuals of a breed (doesn’t affect any already created)

    set-default-shape turtles "circle"
    create-cats 1 ; default turtle shape
    set-default-shape cats "cat"
    set-sefault-shape dogs "dog"
    create-cats 1 ; has "cat" shape
    ask one-of cats [ set breed dogs ] ; cat becomes a dog and changes shape to "dog"
  • Note: some shapes, like “cat” and “dog” must be imported into the model from the shapes library, using the shapes editor

Wild Dog Model

Wild Dog Model

  • Adapted from Markus Gusset et al., “Dogs on the Catwalk: Modelling Re-Introduction and Translocation of Endangered Wild Dogs in South Africa.” Biological Conservation 142, 2774–81 (2009).

Survival of endangered wild dogs (Lycaon pictus)
in South African nature reserves.

  • Dogs form packs
  • Dogs in packs have social structure:
    • Alpha: One male, one female
    • Subordinate adults
    • yearling (1–2 years old)
    • pup (<1 year old)
  • When juvenile dogs reach adulthood, if they can’t be dominant (alpha): decide whether to
    • leave pack (disperse), either alone or with adult siblings of same sex,
    • or stay and hope to become alpha one day.
  • Disperser groups are single-sex.
    • When opposite-sex disperser groups meet, if they are not from same birth-pack, they may join and form a new pack.
  • Disperser dogs have very high mortality rates.

Detailed rules:

  • Dispersal:
    • Two or more subordinates of same sex: always disperse
    • One subordinate of its sex: 50% probability to disperse
  • Mortality (probability of dying each tick)
Status Mortality
Pup 12%
Yearling 25%
Subordinate or alpha 20%
Disperser 44%

Management Options

  • Increase size of park:
    • Larger park has greater carrying capacity
    • Larger park makes it harder for disperser groups to meet.
  • Decrease mortality of dispersers.

Characteristics of Dogs

  • Frequency of breeding depends on ratio of population to carrying capacity:

  • When population is 50% of carrying capacity, probability of breeding is 50%
  • When population is 100% of carrying capacity, probability of breeding is 10%

Programming aspects

  • Lots of things to keep track of.
  • At end of each tick:
    • Social status must match age
    • A pack can have at most one alpha of each sex
    • A pack can’t have subordinates without an alpha of that sex (they would become alpha)
    • A pack can’t have more than one subordinate of each sex (they would disperse)
    • All dogs in disperser packs have status “disperser”
  • Good to implement consistency checks to make sure packs and dogs follow these rules.

Calculating Probability of Extinction within 100 years

to go
  if ticks >= years-to-simulate or not any? dogs
    if ticks < years-to-simulate
      set time-to-extinction ticks
      set extinct? true
  step ; "step" does all the work of mating, aging, dispersing, dying, etc.

to get-p-extinct [ n-runs ]
  let n-extinct 0
  repeat n-runs 
    while [ticks < years-to-simulate and not extinct?] [ go ]
    if extinct? [ set n-extinct n-extinct + 1 ]
  set p-extinction n-extinct / n-runs

Behaviorspace Experiments

Vary Initial Conditions

Vary Initial Conditions

Mean time to extinction

Mean time to extinction

Vary Disperser Group Meeting Rate

Vary Disperser Group Meeting Rate