Questions
1. Describe in 4-5 sentences the utility of using a pattern oriented modeling approach for understanding the observed patterns of both species.
The utility of pattern oriented modeling approach is to better understand resulting patterns within interacting agents. The observation of patterns over time allows an observer to better understand agent behavior potentially leading to prediction. Pattern oriented modeling allows for the modeling of an agent/s reaction to a number of changes within the environment without making any real-world environmental changes.
2. For each movement model, describe how agent interactions lead to emergent patterns in both space and time.
Random Walk: With directed walk turned ON there is more separation over time that occurs between agents since the randomness of their movements is confined to 90°L or 90°R, when directed walk is turned OFF the random movement is subject to a full 360° and the separation between agents is lower over time.
Foraging: This movement is exactly the same as “Random Walk” with the exception that the turtles spawn on top of a green patch when their energy equals zero. With directed walk turned ON the agent’s resume a more direct path around their environment, since the dispersal is wider, more agents walk over green patches before their energy drops to zero; over time this results is a very dispersed pattern within the environment. With directed walk turned OFF, the turtles eventually spawn on top of green patches when their energy is equal to zero, the pattern that emerges are turtles being grouped around, and staying close to green patches.
Flocking: In the flocking movement the agents are influenced by their nearest neighbor, and the average heading of the other agents within the flock. Agents remain in the flock because of a defined coherence command. Directed walk is not applicable to this movement. Over time, the pattern that emerges are small flocks of agents interacting with each other rather than individual agents interacting with or within the environment. If one flock comes close to another each flock has a directional effect on the other, but eventually they both even out, and resume a steady path.
3. Which movement model best describes the patterns observed for species A? Why?
Species A is best represented by the RANDOM WALK movement with directed walk turned OFF. I feel this best represents species A because of the average distance between agents and their nearest neighbors fluctuates in a spatial and temporal patter that is similar to the example.
4. Which movement model best describes the patterns observed for species B? Why?
Species A is best represented by the FLOCKING movement because the agent pattern over time is clustered and the average distance of their nearest neighbor is fairly consistent over time.
5. How did a pattern oriented modeling approach allow you to determine the answers to 3 and 4?
Pattern oriented modeling allowed me to run multiple tests and produce visual comparisons against the data provided by the ecologist. These comparisons led to a hypothesis for the temporal and spatial patterns of each species and determine what types of movements were responsible for the patterns observed in the real-world.
Code
turtles-own[energy
flockmates
nearest-neighbor
nearest-neighbor-distance]
patches-own [food]
to setup
clear-all
setup-patches
setup-turtles
reset-ticks
end
to setup-patches
ask patches [set pcolor white]
ask n-of 5 patches
[set pcolor green]
end
to setup-turtles
crt 20
[set color blue
set size 1.5
setxy 0 0]
ask turtles [set energy 500]
end
to go
if agent-movement = “Random Walk” [random-walk]
if agent-movement = “Foraging” [forage]
if agent-movement = “Flocking” [flock]
tick
if ticks >= 101 [stop]
end
to random-walk
ask turtles
[ifelse (directed-walk?)
[rt random 90 lt random 90]
[rt random 360]
forward .25]
update-plot
end
to forage
ask turtles [
ifelse (directed-walk?)
[rt random 90 lt random 90]
[rt random 360]
forward .25
set energy energy – 1
if energy = 0 [move-to min-one-of patches
with [pcolor = green] [distance myself]]
if pcolor = green [set energy 500
set color blue]
if energy < 100 [set color red]
]
update-plot
end
to flock
ask turtles [ flocking ]
repeat 5 [ ask turtles [ fd 0.2 ] display ]
update-plot
end
to flocking
find-flockmates
if any? flockmates
[ find-nearest-neighbor
ifelse distance nearest-neighbor < 1
[ separate ]
[ align
cohere ]
]
end
to find-flockmates
set flockmates other turtles in-radius 3
end
to find-nearest-neighbor
set nearest-neighbor min-one-of flockmates [distance myself]
end
to separate
turn-away ([heading] of nearest-neighbor) 1.5
end
to align
turn-towards average-flockmate-heading 5
end
to-report average-flockmate-heading ;; turtle
;procedure
;; We can’t just average the heading variables here.
;; For example, the average of 1 and 359 should be 0,
;; not 180. So we have to use trigonometry.
let x-component sum [dx] of flockmates
let y-component sum [dy] of flockmates
ifelse x-component = 0 and y-component = 0
[ report heading ]
[ report atan x-component y-component ]
end
to cohere
turn-towards average-heading-towards-flockmates 3
end
to-report average-heading-towards-flockmates
let x-component mean [sin (towards myself + 180)] of flockmates
let y-component mean [cos (towards myself + 180)] of flockmates
ifelse x-component = 0 and y-component = 0
[ report heading ]
[ report atan x-component y-component ]
end
to turn-towards [new-heading max-turn]
turn-at-most (subtract-headings new-heading heading)
max-turn
end
to turn-away [new-heading max-turn]
turn-at-most (subtract-headings heading new-heading)
max-turn
end
to turn-at-most [turn max-turn]
ifelse abs turn > max-turn
[ ifelse turn > 0
[ rt max-turn ]
[ lt max-turn ] ]
[ rt turn ]
end
to update-plot
ask turtles [
let nd min-one-of other turtles [distance myself]
set nearest-neighbor-distance distance nd
]
end
to make-movie
user-message “First, save your new movie file (choose a name ending with .mpg)”
let path user-new-file
if not is-string? path [ stop ]
setup
movie-start path
movie-grab-view
while [ ticks < 100 ]
[go
movie-grab-view]
movie-close
user-message (word “Exported movie to ” path)
end