NetLogo Models Library:
## WHAT IS IT?
This is an adaptation of the Flocking model to produce V-like formations in artificial flocks. Not all birds produce V-like formations when they flock, but they are often observed in large birds traveling together distances (e.g. migrating Canada geese). This model demonstrates simple rules that cause V-formations to occur.
## HOW IT WORKS
Each bird starts out with a random position and heading in the world. If the bird cannot see any other birds in its limited vision range, it will continue to fly straight at its normal base speed. If it can see another bird, it follows four basic rules, given by this order of precedence.
1. If it is too far away (that is, further than the distance for getting an updraft benefit) from the nearest visible bird, it will turn toward that bird and speed up to get near it.
2. Once it is near enough to another bird, it will move randomly to one side or another until its view is no longer obstructed.
3. If it gets too close to another bird, it will slow down.
4. Once the three conditions above are met (the bird has an unobstructed view and is sufficiently close but not too close to another bird), the bird will set both its speed and its heading that of its closest visible neighbor.
## HOW TO USE IT
NUMBER-OF-BIRDS sets the number of birds in the world.
Use SETUP to populate the world with birds, and GO to run the model.
VISION-DISTANCE and VISION-CONE defines the radius and angle span, respectively, of the area within which a bird can see another bird. A VISION-CONE of 120 means that the bird can see up to 60 degrees to its right and 60 degrees to its left. OBSTRUCTION-CONE defines the angle span for which a bird considers its vision to be obstructed by another bird.
BASE-SPEED defines the speed that birds will fly if they are not speeding up to catch another bird that they see, or slowing down to avoid colliding with a bird.
SPEED-CHANGE-FACTOR is the factor by which birds increase or decrease their speed, given as a fraction of their base speed. A BASE-SPEED of 1 with a SPEED-CHANGE-FACTOR of 0.25 means that birds will travel at speeds of 0.75 (slow speed), 1.0 (normal speed), or 1.25 (fast speed).
UPDRAFT-DISTANCE defines how near to another bird one must be to take advantage of its upwash.
TOO-CLOSE defines how close one bird can be to another bird before slowing down to avoid collision.
MAX-TURN sets the maximum number of degrees that a bird can turn during a single tick.
If SHOW-UNHAPPY? is switched ON, birds that have not satisfied the conditions outlined in the HOW IT WORKS section are colored red, and all the birds that have are colored white. If SHOW-UNHAPPY? is OFF, birds are colored varying shades of yellow.
## THINGS TO NOTICE
After forming a vee-flock for a while, birds tend to drift apart from one another.
Birds following these rules may form flock formations other than a balanced V. These include asymmetrical (unbalanced) V shapes, echelons (diagonal lines), or inverted V shapes. In fact, imperfect formations such as these are more commonly observed than balanced vees in nature too.
## THINGS TO TRY
Play with the sliders to see if you can get tighter flocks, looser flocks, fewer flocks, more flocks, more or less splitting and joining of flocks, more or less rearranging of birds within flocks, etc.
Does having lots of birds make it more or less likely to form good V shapes?
Can you set parameters such that running the model for a long time produces a single static flock? Or will the birds never settle down to a fixed formation?
## EXTENDING THE MODEL
What would happen if you put walls around the edges of the world that the birds can't fly through?
What would happen if you gave birds limited energy levels, so that flying fast would make them expend more energy and eventually become exhausted. Flying slowly, or within another bird's updraft, could allow them to recoup some energy.
Try making a 3D version of this model. What additional considerations have to be taken into account in three dimensions?
## NETLOGO FEATURES
Birds use `in-cone` to find neighbors and determine whether their view is obstructed.
The `subtract-headings` primitive is also useful, for turning gradually (only partway) toward some new heading.
## RELATED MODELS
## CREDITS AND REFERENCES
This model is loosely based on rules introduced in the paper:
Nathan, A. & Barbosa, V. C. (2008). V-like formations in flocks of artificial birds. Artificial Life, 14(2), pp. 179-188. (available at http://arxiv.org/pdf/cs/0611032.pdf)
## HOW TO CITE
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
* Wilkerson-Jerde, M., Stonedahl, F. and Wilensky, U. (2009). NetLogo Flocking Vee Formations model. http://ccl.northwestern.edu/netlogo/models/FlockingVeeFormations. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
Please cite the NetLogo software as:
* Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
## COPYRIGHT AND LICENSE
Copyright 2009 Uri Wilensky.
![CC BY-NC-SA 3.0](http://ccl.northwestern.edu/images/creativecommons/byncsa.png)
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at firstname.lastname@example.org.