UphillTrailMarkerPath

UphillTrailMarkerPath 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 82 times • Downloaded 1 time • Run 0 times
Download the 'UphillTrailMarkerPath' 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
]

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
  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 one-of [5 10]
    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
    [fd 1
     uphill-trail-marker-path-to-food
    look-for-food
    return-to-nest-and-food]
ask leaders
  [initiate-trail]

  ask patches
  [recolor-patch ]
  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
            uphill-trail-marker-path-to-food
            fd 1
  ] ]
end 

to initiate-trail        ;; leader procedure
  if 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 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 10 0 30
  let nest-right nest-in-cone 10 30 30
  let nest-left nest-in-cone 10 -30 30

  let food-ahead food-in-cone 10 0 60
  let food-right food-in-cone 10 30 60
  let food-left food-in-cone 10 -30 60

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

  ASK FORAGERS WITH [COLOR = YELLOW]

  [ifelse (nest-in-cone 10 0 30 > 0 or nest-in-cone 10 30 30 > 0 or nest-in-cone 10 30 30 > 0) [rt 180]
  [ifelse (food-in-cone 10 0 60 > 0 or food-in-cone 10 60 30 > 0 or food-in-cone 10 -30 60 > 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 FD 1 ]
    [ lt 30 FD 1] ]
    ]
    [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 FD 1]
    [ lt 30 FD 1] ]
    ]

      [rt random 30 lt random 30 ]]]
  ]
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 

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

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.