GroupRecruitmentJacob

GroupRecruitmentJacob preview image

1 collaborator

Emily_warsavage Emily Warsavage (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 9 times • Downloaded 0 times • Run 0 times
Download the 'GroupRecruitmentJacob' 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?

A model of T. immigrans (pavement ant) recruitment to a food source, beginning with group-recruitment and transitioning to mass-recruitment.

HOW IT WORKS

The foragers randomly explore the world while scenting for food. The first forager to reach the food becomes a leader, returning to the nest and rapidly bringing back a follower ant with it. The follower ants then release high amounts of chemical, which the foragers follow to the food. Each ant that reaches the food reduces the food by some amount, causing the yellow foragers to become orange, and the brown followers to become purple. Followers respond to leader pheromone.

(what rules the agents use to create the overall behavior of the model)

HOW TO USE IT

The population slider controls the number of ants, while the diffusion-rate and evaporation-rate control the length of time chemical remains in the world. The food-quality slider controls how ants respond to the food, depending on whether it is low quality (below 0.6) or high-quality (above 0.6).

(how to use the model, including a description of each of the items in the Interface tab)

THINGS TO NOTICE

How do the ants respond to the white leader vs the purple followers? (suggested things for the user to notice while running the model)

THINGS TO TRY

Try modifying the evaporation-rate and diffusion-rate. Do the ants still respond effectively when chemical evaporates quickly? (suggested things for the user to try to do (move sliders, switches, etc.) with the model)

EXTENDING THE MODEL

Monitor the food level and plot food-level vs time. (suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

NETLOGO FEATURES

Different breeds - types of ants (by default in Netlogo, turtles)

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

RELATED MODELS

The Ants model by Uri Wilensky and Ant Lines model by Uri Wilensky. (models in the NetLogo Models Library and elsewhere which are of related interest)

CREDITS AND REFERENCES

Wilensky, U. (1997). NetLogo Ants model. http://ccl.northwestern.edu/netlogo/models/Ants. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL. Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.

Thanks to Jen B of StackOverflow for help with various aspects of the code, especially the leader breed transformation, and Wade Schuette of the Netlogo Users Group, for help with the reporter for the tick corresponding to the first food reduction. Also thanks to Aaron Brandes, a CCL software developer from the Netlogo Users Group, for help with the reporter for the group-recruitment-initiation reporter. Most of all, thanks to Dr. Michael Greene of UC Denver, who directed this project.

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

Comments and Questions

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

Click to Run Model

breed [foragers forager]
breed [leaders leader]
breed [followers follower]
breed [trail-markers trail-marker]

patches-own
[ nest?
  nest-scent
  nest-x nest-y
  food-source-center-x
  food-source-center-y
  food
  chemical
]

globals
[old-sum
  sum-change-tick
  first-follower-food-tick
  first-leader-tick
  food-consumption-tick
  mass-recruitment-tick

]

to setup
  clear-all
  set-default-shape turtles "bug"
  set-default-shape trail-markers "line half"
  create-foragers 10
  [set color yellow
    set size 2.25
    setxy 36 16]
  setup-patches

  set first-follower-food-tick -1
  update-first-follower-food-tick
  set first-leader-tick -1
  update-first-leader-tick
  set food-consumption-tick -1
  update-food-consumption-tick
  set mass-recruitment-tick -1
  update-mass-recruitment-tick

  reset-ticks
end 

to setup-patches
ask patches
  [setup-nest
  setup-food
  setup-food-quality]
end 

to setup-nest
    ;; set nest? variable to true inside the nest, false elsewhere
  set nest? (distancexy 36 16) < 2
  ;; spread a nest-scent over the whole world -- stronger near the nest
  set nest-scent 200 - distancexy 36 16
  set nest-x 36
  set nest-y 16
  if nest?
  [set pcolor brown]
end 

to setup-food
  if (distancexy (0.8 * min-pxcor) (0.8 * min-pycor)) < 5
  [set food 5
    if food > 0
    [set pcolor cyan]]
  set food-source-center-x -36
  set food-source-center-y -20
end 

to setup-food-quality  ;; patch procedure
  if food > 0
  [set food-quality one-of [0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]] ;; controllable with slider
end 

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

to go
  ask foragers
    [wiggle
    fd 1
    look-for-food
    return-to-nest-and-food]
ask leaders
      [wiggle
          lead
  initiate-trail
  mass-recruit-leaders]
ask followers
  [follow-leaders
    find-food
  transition-to-mass-recruitment
  return-to-nest-mass-recruitment-transition
  mass-recruit
  complete-mass-recruitment]

  ask patches
  [ set chemical chemical * (100 - evaporation-rate) / 100  ;; slowly evaporate chemical
    recolor-patch ]

  update-first-follower-food-tick
  print word "first-follower-food-tick " first-follower-food-tick
  update-first-leader-tick
  update-food-consumption-tick
  update-mass-recruitment-tick

  tick
  if sum [food] of patches with [pcolor = cyan] = 0 and ticks > 0
  [if not any? foragers with [color = orange] [ask trail-markers [die]]
   ask foragers [if (distancexy nest-x nest-y <= 2) [die]]
    if count foragers = 0 and ticks > 1000 [stop]]
end 

to look-for-food  ;; forager procedure
  let potential-leaders foragers-on (patch-set patch -38 -16 patch -37 -16 patch -36 -16 patch -35 -16 patch -34 -16 patch -39 -17 patch -38 -17 patch -37 -17 patch -36 -17 patch -35 -17 patch -34 -17 patch -33 -17 patch -40 -18 patch -39 -18 patch -38 -18 patch -37 -18 patch -36 -18 patch -35 -18 patch -34 -18 patch -33 -18 patch -32 -18 patch -40 -19 patch -39 -19 patch -38 -19 patch -37 -19 patch -36 -19 patch -35 -19 patch -34 -19 patch -33 -19 patch -32 -19 patch -40 -20 patch -39 -20 patch -38 -20 patch -37 -20 patch -36 -20 patch -35 -20 patch -34 -20 patch -33 -20 patch -32 -20 patch -40 -21 patch -39 -21 patch -38 -21 patch -37 -21 patch -36 -21 patch -35 -21 patch -34 -21 patch -33 -21 patch -32 -21 patch -40 -22 patch -39 -22 patch -38 -22 patch -37 -22 patch -36 -22 patch -35 -22 patch -34 -22 patch -33 -22 patch -32 -22 patch -39 -23 patch -38 -23 patch -37 -23 patch -36 -23 patch -35 -23 patch -34 -23 patch -33 -23 patch -38 -24 patch -37 -24 patch -36 -24 patch -35 -24 patch -34 -24)
  if food > 0 and food-quality > 0
  [ifelse (not any? leaders) and (any? potential-leaders) and (count foragers <= 10)  ;; checks if any leaders exist and if object = true food
  [ ask one-of potential-leaders
    [ set breed leaders
    set color magenta]]  ;; transforms first forager to find food into the leader
    [set color orange]] ;; outside of one-of potential leaders brackets --> applies to asked agents (all foragers)
end 

to return-to-nest-and-food  ;; forager procedure
  if color = orange  ;; directs movement of foragers who have found food
        [set food food - 1          ;; pickup food
          if count trail-markers > 800
            [hatch-trail-markers 1       ;; reinforce trail
            [set size 1.0]]
          uphill-nest-scent           ;; directly returns to nest via dead reckoning

        if distancexy nest-x nest-y <= 2
        [set color yellow
            hatch-foragers 1
            [wiggle
              fd 1]
            uphill-trail-marker-path-to-food
            fd 1
  ] ]
end 

to lead  ;; leader procedure
  if color = magenta
    [fd 2              ;; walks quickly ahead of followers
      uphill-nest-scent ;; dead-reckons
      if (distancexy nest-x nest-y) <= 2
      [set color white
      if food-quality > 0.8
        [if count followers < 16 and (not any? followers with [color = violet + 1]) and (count foragers < 40) ;; hatch n followers, dependent on food-quality
          [hatch-followers 1
            [set color brown
        IF count followers = 2
              [fd 1.5]
        IF count followers = 3
              [fd 1.25]
        IF count followers = 4
              [fd 1]
        if count followers = 5
              [fd .9]
        if count followers = 6
              [fd .8]
         if count followers = 7
              [fd .7]
        if count followers >= 8
              [fd .6]  ]]
        ]
        if (food-quality > 0.6) and (food-quality < 0.9) and (count followers < 8) and (not any? followers with [color = violet + 1]) and (count foragers < 28)
          [hatch-followers 1
            [set color brown
        IF count followers = 2
              [fd 1.5]
        IF count followers = 3
              [fd 1.25]
        IF count followers = 4
              [fd 1]
              if count followers = 5
              [fd .9]
        if count followers = 6
              [fd .8]
         if count followers = 7
              [fd .7]
        if count followers = 8
              [fd .6]  ]]

        if (food-quality > 0.4) and (food-quality < 0.7) and (count followers < 4) and (not any? followers with [color = violet + 1]) and (count foragers < 20)
        [hatch-followers 1
            [set color brown
        IF count followers = 2
              [fd 1.5]
        IF count followers = 3
              [fd 1.25]
        IF count followers = 4
              [fd 1]
        ]]
        if (food-quality > 0.2) and (food-quality < 0.5) and (count followers < 2) and (not any? followers with [color = violet + 1]) and (count foragers < 14)
        [hatch-followers 1
            [set color brown
        IF count followers = 2
              [fd 1.5]
        ]]
        if (food-quality > 0) and (food-quality < 0.3) and (count followers < 1) and (not any? followers with [color = violet + 1]) and (count foragers < 12)
         [hatch-followers 1
            [set color brown]]
  ]]

  if color = white
      [wiggle
        fd 2
        facexy food-source-center-x food-source-center-y
        if food > 0
        [set color magenta] ]
  if not can-move? 1 [rt 180]
end 

to mass-recruit-leaders
  if (not any? followers with [color = brown]) and (count foragers >= 12) and (distancexy nest-x nest-y <= 2)   ;; transforms leaders into foragers during mass-recruitment
[set breed foragers
    set color yellow
    hatch-foragers 1]
end 

to follow-leaders
  if color = brown
[face one-of leaders
    fd 1.75]
end 

to find-food
  if (food > 0) and (count followers = 1) [set size 1.75]
end 

to initiate-trail        ;; leader procedure
  if any? followers and color = magenta
  [ifelse (distancexy food-source-center-x food-source-center-y) < 10
            [hatch-trail-markers 60
              [set color blue
            set size 3.0]]
            [hatch-trail-markers 10
              [set color blue
            set size 1.0]]
      ]
end 

to complete-mass-recruitment
  if (count followers <= 1) and (food-quality < 0.3) and (count foragers > 13) and (distancexy food-source-center-x food-source-center-y) <= 4
  [set color violet + 1]

  if (count followers <= 2) and (food-quality < 0.5) and (food-quality > 0.2) and (count foragers > 13) and (distancexy food-source-center-x food-source-center-y) <= 4
  [set color violet + 1]

  if (count followers <= 4) and (food-quality < 0.7) and (food-quality > 0.4) and (count foragers > 25) and (distancexy food-source-center-x food-source-center-y) <= 4
  [set color violet + 1]

  if (count followers <= 8) and (food-quality < 0.9) and (food-quality > 0.6) and (count foragers > 25) and (distancexy food-source-center-x food-source-center-y) <= 4
  [set color violet + 1]

  if (count followers <= 16) and (food-quality > 0.8) and (count foragers > 25) and (distancexy food-source-center-x food-source-center-y) <= 4
  [set color violet + 1]
end 

to transition-to-mass-recruitment  ;; follower procedure that makes them independent of leaders
  if (distancexy food-source-center-x food-source-center-y) <= 4 and (count followers >= 1) and (food-quality < 0.3) ;; once group-recruitment has finished (max number of followers for that food-quality reached)
  [set color violet + 1]

  if (distancexy food-source-center-x food-source-center-y) <= 4 and (count followers >= 2) and (food-quality > 0.2) and (food-quality < 0.5)
  [set color violet + 1]

  if (distancexy food-source-center-x food-source-center-y) <= 4 and (count followers >= 4) and (food-quality > 0.4) and (food-quality < 0.7)
  [set color violet + 1]

  if (distancexy food-source-center-x food-source-center-y) <= 4 and (count followers >= 8) and (food-quality > 0.6) and (food-quality < 0.9)
  [set color violet + 1]

  if (distancexy food-source-center-x food-source-center-y) <= 4 and (count followers >= 16) and (food-quality > 0.8)
  [set color violet + 1]
end 

to return-to-nest-mass-recruitment-transition
  if color = violet + 1
  [if food > 0
    [set food food - 1]
    wiggle
    fd 1
    uphill-nest-scent]
end 

to mass-recruit ;; follower procedure for transforming into foragers during mass-recruitment
  if (distancexy nest-x nest-y) <= 2 and (color = violet + 1)
  [set breed foragers
    set color yellow
  hatch-foragers 1]
end 

to recolor-patch  ;; patch procedure
  ;; give color to nest and food sources
  ifelse nest?                          ;; nest? true --> color brown
  [ set pcolor brown ]
  [ ifelse food > 0                     ;; not nest, but has food
    [  set pcolor cyan ]
    [set pcolor black ] ]      ;; food/nest pheromone default to 0
end 

to wiggle
  rt random 45
  lt random 45
  if not can-move? 1 [ rt 180 ]
end 

to uphill-nest-scent  ;; turtle procedure
  let scent-ahead nest-scent-at-angle   0
  let scent-right nest-scent-at-angle  45
  let scent-left  nest-scent-at-angle -45
  if (scent-right > scent-ahead) or (scent-left > scent-ahead)
  [ ifelse scent-right > scent-left
    [ rt 45 ]
    [ lt 45 ] ]
end 

to uphill-trail-marker-path-to-food

  let nest-ahead nest-in-cone 20 0 30
  let nest-right nest-in-cone 20 30 30
  let nest-left nest-in-cone 20 -30 30

  let food-ahead food-in-cone 20 0 30
  let food-right food-in-cone 20 30 30
  let food-left food-in-cone 20 -30 30

  let scent-ahead total-trail-markers-in-cone 20 0 30
  let scent-right total-trail-markers-in-cone 20 30 30
  let scent-left total-trail-markers-in-cone 20 -30 30

  ifelse (nest-in-cone 20 0 30 > 0 or nest-in-cone 20 30 30 > 0 or nest-in-cone 20 30 30 > 0) [rt 180]
  [ifelse (food-in-cone 20 0 30 > 0 or food-in-cone 20 30 30 > 0 or food-in-cone 20 -30 30 > 0)
    [if (food-right > food-ahead) or (food-left > food-ahead)
  [ ifelse food-right > food-left                             ;; no food-ahead --> just keep going in the current direction
    [ rt 30 ]
    [ lt 30 ] ]
    ]
    [ifelse (scent-ahead > 0 or scent-right > 0 or scent-left > 0)
      [if (scent-right > scent-ahead) or (scent-left > scent-ahead)
  [ ifelse scent-right > scent-left                                 ;; no trail-markers-ahead --> just keep going in the current direction
    [ rt 30 ]
    [ lt 30 ] ]
    ]

      [rt random 30 lt random 30]]]
end 

to update-first-leader-tick
  if first-leader-tick < 0
  [show count leaders
    if any? leaders
    [ set first-leader-tick ticks ]
  ]
end 

to update-first-follower-food-tick
  let potential-recruiters followers with [size = 1.75]
  if first-follower-food-tick < 0
    [show count potential-recruiters
    if any? potential-recruiters
    [ set first-follower-food-tick ticks ]
  ]
end 

to update-food-consumption-tick
  let food-level sum [food] of patches with [pcolor = cyan]
  if food-consumption-tick < 0
  [show food-level
    if food-level < 1
    [ set food-consumption-tick ticks ]
  ]
end 

to update-mass-recruitment-tick
  if mass-recruitment-tick < 0
  [show count followers
    if not any? followers and count foragers > 20
      [set mass-recruitment-tick ticks]
  ]
end 

to-report nest-scent-at-angle [angle]
  let p patch-right-and-ahead angle 1
  if p = nobody [ report 0 ]
  report [nest-scent] of p
end 

to-report total-trail-markers-in-cone [cone-distance angle angle-width ] ; ant procedure - reports the total amount of trail-markers in cone
  rt angle
  let p count trail-markers in-cone cone-distance angle-width
  ;ask p [ show chemical ]
  lt angle
  report (p)
  if not any? p [report 0]
end 

to-report nest-in-cone [cone-distance angle angle-width ] ; ant procedure - reports the mean amount of nest-scent in cone
  rt angle
  let p patches in-cone cone-distance angle-width
  let n (count (p with [nest?] ) );; count patches with nest
  lt angle
  report n
end 

to-report food-in-cone [cone-distance angle angle-width ] ; ant procedure - reports the mean amount of nest-scent in cone
  rt angle
  let p patches with [pcolor = cyan] in-cone cone-distance angle-width
  lt angle
  report (count p)
end 

to-report leader-presence
  ifelse any? leaders
  [report first-leader-tick]
  [report -1]
end 

to-report group-recruitment-initiation
  let recruited-ant followers with [size = 1.75]
ifelse any? recruited-ant
  [ report first-follower-food-tick ]
  [ report -1]
end 

to-report leader-food-follower-difference
  ifelse first-leader-tick != -1 and first-follower-food-tick !=  -1
  [ report first-follower-food-tick - first-leader-tick]
  [ report -1 ]
end 

to-report mass-recruitment-initiation
  ifelse not any? followers
  [report mass-recruitment-tick]
  [report -1]
end 

to-report food-consumption
  ifelse (sum [food] of patches with [pcolor = cyan] < 1 )
  [report food-consumption-tick]
  [report -1]
end 

There is only one version of this model, created 5 days ago by Emily Warsavage.

Attached files

File Type Description Last updated
GroupRecruitmentJacob.png preview Preview for 'GroupRecruitmentJacob' 5 days ago, by Emily Warsavage Download

This model does not have any ancestors.

This model does not have any descendants.