Fish Schooling For Predator Avoidance
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This is a model of fish that exhibit schooling behavior, with the aim of exploring research on predator avoidance of schooling fish. It is a simplified version of the phenomenon, in order to test the "many eyes hypothesis."
HOW IT WORKS
Prey will stick together in school, predators will wander and attack when they come near prey. Prey will flee a predator within their vision cone (270 degrees) and afterwards will try to get behind the preddator. If schooling is turned on (align and/or cohere above 0), the prey will follow each other's lead in direction and speed, leading to cooperative avoidance. Predators have a “burst” in which they will rapidly increase speed for short periods of time to catch prey.
HOW TO USE IT
The main sliders to vary are cohere-coefficient and align-coefficient. 33 align and 13 cohere were measured to be near ideal for prey survivorship, but interesting things happen with different settings. 13 cohere and 0 align is a particularly interesting configuration.
THINGS TO NOTICE
Prey turn red when they directly see and flee a predator. Blue prey follow the red prey based on the schooling rules, which produces emergent cooperative avoidance of predators. Schooling prey populations avoid predators and survive better than non-schooling populations. Also key to the avoidance is the regrouping of prey fish after a predator attack.
THINGS TO TRY
Varying the population sliders also alters the dynamics of the model. Playing with settings of the prey and predator speeds produces different results, as well as prey and predator vision lengths.
EXTENDING THE MODEL
It would be interesting to test out different predator strategies for hunting the school of fish. Strategies could be more intelligent, more cooperative, etc. It would be also interesting to add different predators. This model was based on marlin as a predator, which is a relatively small fast attacking predator. There are different potential predators with different movement physics out in the wild such as dolphins, whales, birds, etc.
NETLOGO FEATURES
Uses turtle-set to make a union of the agentsets of prey on the predators patch and prey on neighbors
Bug-workaround- Subtract-headings complains when the two turtles in question are on the exact same coordinate position down to a certain precision, so I added a line that kills off a prey if they end up at the same position
RELATED MODELS
Flocking model - a basic implementation of the BOIDs paper (Reynolds)
CREDITS AND REFERENCES
Reynolds, C. W. (1987) Flocks, Herds, and Schools: A Distributed Behavioral Model, in Computer Graphics.
"Shoaling and Schooling." Wikipedia. Wikimedia Foundation, 07 June 2018. Web. 08 June 2018.
Wilensky, U. 1999. NetLogo. http:ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University. Evanston, IL.
Comments and Questions
breed [ prey a-prey ] breed [ predators predator ] prey-own [ schoolmates ;; agentset of nearby prey fish nearest-neighbor ;; closest one of schoolmates speed ;; distance to travel on tick ] predators-own [ prey-in-vision ;; prey within vision radius nearest-prey ;; shortest distance prey prey-in-front ;; prey within 30 degree vision cone (used to determine bursting) target ;; nearest prey within a 30 degree vision cone speed ;; distance to travel on tick burst-energy ;; energy for predators charging at burst speed, negative if recharging bursting? ;; boolean of whether or not predator is bursting towards prey ] to setup ca ask patches [ set pcolor sky + 1 ] create-prey prey-population [ set color blue set shape "fish" rt random 360 fd (random 5) + 1 ;; distribute randomly in a cluster facexy 0 15 set speed 1 ] create-predators predator-population [ set color white set shape "fish" set size 2 setxy random-xcor random-ycor ;; distribute fully randomly set speed 1.6 set burst-energy predator-burst-energy ] reset-ticks end to go ask prey [ school ] ask predators [ set prey-in-vision prey in-radius predator-vision ifelse any? prey-in-vision [ chase-nearest-prey ] ;; point towards nearest prey [ wander ] ;; wander if no prey in sight adjust-predator-speed ;; predator will speed up when making an attack scare-prey ;; prey fleeing starts at predator because of control flow (scare-right, scare-left) eat ;; eat prey if within neighbors ] ask turtles [ fd speed ] tick end to eat ;; predator procedure let nearby (turtle-set prey-here prey-on neighbors) if any? nearby and burst-energy > 0 [ ;; if there is a catch, stop to eat the fish (cannot eat again until burst recharges) set burst-energy 0 set color black ask one-of nearby [ die ] ] end to adjust-predator-speed ;; predator procedure set prey-in-front prey in-cone predator-vision 90 ;; find prey in front of predator ifelse any? prey-in-front and burst-energy > 0 ;; burst if there is a target and have energy [ set bursting? true ] [ set bursting? false ] ifelse bursting? [ if speed <= max-predator-speed [ set speed speed + .3 set burst-energy burst-energy - 1 ] set color white ] [ ;; else set speed min-predator-speed if burst-energy = 0 [ set burst-energy -1 - burst-recharge-time ] ;; energy set to negative recharge time if burst-energy < 0 [ set burst-energy burst-energy + 1 ] ;; recharge burst if burst-energy = -1 [ set burst-energy predator-burst-energy ] ;; reset burst energy ] end to scare-prey ;; predator procedure rt 90 scare-right ;; prey on right side will flee right rt 180 scare-left ;; prey on left side will flee left rt 90 end to scare-right ;; prey on right side will flee right ask prey in-cone prey-vision 180 [ if any? predators in-cone prey-vision 270 [ rt (flee-coefficient / 100) * (subtract-headings (towards myself - 90) heading) set speed max-prey-speed set color red ] ] end to scare-left ;; prey on left side will flee left ask prey in-cone prey-vision 180 [ if any? predators in-cone prey-vision 270 [ rt (flee-coefficient / 100) * (subtract-headings (towards myself + 90) heading) set speed max-prey-speed set color red ] ] end to chase-nearest-prey ;; predator procedure set nearest-prey min-one-of prey-in-vision [distance myself] rt (predator-turn-coefficient / 100) * (subtract-headings (towards nearest-prey) heading) end to wander ;; only predators use rt (random 30) - 15 end to school ;; prey procedure find-schoolmates if any? schoolmates [ find-nearest-neighbor if distance nearest-neighbor = 0.000 [ die ] ;; bug patch- removes duplicates to fix crash due to same point netlogo error ifelse distance nearest-neighbor < minimum-separation ;; see BOIDS paper for schooling basics (separate, align, cohere) [ separate ] [ cohere align ] adjust-prey-speed ;; adjust speed to stay in a school, can be though of as part of "cohere" ] end to adjust-prey-speed ;; prey procedure ifelse max [speed] of schoolmates > speed + .1 [ set speed speed + .1 ] ;; speed up if any schoolmate is moving faster (potentially scared by a predator) [ if speed > min-prey-speed [ set speed speed - .2 set color blue] ] ;; else slow down (this eventually slows the school to min-speed, sort of its own emergent phenomena) end to find-schoolmates ;; prey procedure set schoolmates other prey in-radius prey-vision end to find-nearest-neighbor ;; prey procedure set nearest-neighbor min-one-of schoolmates [distance myself] end ;;; SEPARATE to separate ;; turtle procedure ifelse member? nearest-neighbor schoolmates in-cone minimum-separation 60 ;; if nearest is in front, slow down, else turn to avoid [ if speed > min-prey-speed [ set speed speed - .1 ] ] [ rt (separate-coefficient / 100) * (subtract-headings heading (towards nearest-neighbor)) ;; turns a fraction towards the direction facing directly away from nearest neighbor ] end ;;; ALIGN to align ;; turtle procedure rt (align-coefficient / 100) * (subtract-headings average-schoolmate-heading heading) ;; asmpytotic approach to perfect alignment end to-report average-schoolmate-heading ;; prey procedure, borrowed from orignal flocking model, used for align let x-component sum [dx] of schoolmates let y-component sum [dy] of schoolmates ifelse x-component = 0 and y-component = 0 [ report heading ] [ report atan x-component y-component ] end ;;; COHERE to cohere ;; prey procedure rt (cohere-coefficient / 100) * (subtract-headings average-heading-towards-schoolmates heading) ;; asmptotic approach to center of pack, will never reach because of separate end to-report average-heading-towards-schoolmates ;; prey procedure, borrowed from original flocking model, used for cohere let x-component mean [sin (towards myself + 180)] of schoolmates let y-component mean [cos (towards myself + 180)] of schoolmates ifelse x-component = 0 and y-component = 0 [ report heading ] [ report atan x-component y-component ] end
There is only one version of this model, created about 7 years ago by Sebastian Dobon.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.
Felipe Carrillo
Fish Schooling For Predator Avoidance (Question)
I am trying to download this model but the .zip file gives me an error message when trying to unzip it. Is it possible to download this or other models to run them locally on a personal laptop? Thanks
Posted almost 3 years ago