Lectures 5&6
Flocks, Herds, Swarms & Schools: Distributed Models of
Behaviour
1. Flocking Behaviour
References:
Reynolds, C. "Flocks, Herds and Schools: A Distributed Behavioural Model"
Comp. Graph. Vol 21, No. 4 July 1987, (SIGGRAPH 87) p25-34.
Tu, X., Terzopoulos, D. "Artificial Fishes: Physics, Locomotion, Perception, Behaviour"
Comp. Graph. Proc. 1994, (SIGGRAPH 94) p43-50.
A swarm
of virtual blue flies.
Characteristics of flocking behaviour
- Aggregate, polarized, non-colliding motion of a group of animals
- Behaviour propagates rapidly through a large group
- Behaviour of the flock is independent of the number of members
- Complex behaviour (difficult to animate manually)
- Reduces the chance an individual may be singled out by a predator
Some Flocking Models

Girard, Eurythmy
SIGGRAPH 85
|
- Force-field model: an early model (seen in 'Eurythmy',
Michael Girard, SIGGRAPH 85) operated by constructing bound force-fields
around each static or mobile object. Paths are calculated incrementally
through these dynamic force fields.
- Follow the leader: one flock member is designated the leader.
The remainder adjust their velocity (magnitude and heading) to match
/ chase the leader. Due to different masses and turning ability of the
flock members, the flock members have a slight variation in their flight
paths.
- Central force model: flock members are drawn along by a force
towards some moving point.
|
A Distributed Flocking Model
Craig Reynolds presented the first distributed behavioural model of
flocking behaviour in which:
 |
- Each boid follows its own set of behavioural rules
(These are applied according to a bird's individual point of view, hence...)
- A boid can perceive only its immediate neighbours
- A boid is modelled visually as an oriented particle
|
A Boid's Behavioural Rules
In order of priority...
Craig Reynolds' website on the
original boids.
Adding Interesting Behaviours
|
- Migratory urge toward some point
- Steer to avoid static obstacle collisions
- Steer to avoid moving obstacles
- Eating food
- Mating
- Wandering
- Escaping
|
Real birds are believed to anticipate the movement of a wave being propagated
through the flock. This anticipation of the wave of turning birds allows accelerated
response to the flock's changing behaviour. The above model does not account
for such long-range perception.
What is an example of an activity you perform in which you anticipate the motion
of a wave of behaviour? (Hint: red; amber; green)
Applications

Reynolds,
Stanley and Stella in Breaking the Ice, 1987
|
- Schools of fish
- Herds of cattle
- Flocks of birds
- Swarms of insects
- Droplets of viscous fluid, traffic on a road...
|
Super-boids, Further Extensions to the Model
- Limit max./min. force applied by boids
- Include frictional drag
- Model gravity and lift
- Separate tangential thrust and lateral steering forces
- Our boids are becoming subjects for hydro/aero-dynamics!
The Internal Workings of an Artificial Fish
 |
 |
After Tu & Terzopoulos, SIGGRAPH 1994 |
Tu & Terzopoulos, SIGGRAPH 1994 |
Schooling Behaviour Routine
 |
 |
|
Tu & Terzopoulos, SIGGRAPH 1994 |
The External Workings of an Artificial Fishy
One fish two fish,
red fish, blue fish...
Physical model of the fish muscular & skeletal framework.
...this one has a little star.
Algorithmic Considerations
We would like to implement the algorithm so that it was independent of the
number of boids in the flock.
- We do not want an individual boid to examine the position and velocity of every
other bird in the flock:
|
Algorithm is of complexity O(n-squared) on a single processor.
In parallel (one processor per boid) the algorithm is still O(n). |
- Problem is the same as that encountered in collision detection.
Solutions to obtain approximately constant time algorithms are
many and varied, for example:
- Spatial subdivision
- Exploit coherence
- Bounding spheres / boxes
2. Swarm Intelligence
References:
Millonas M. "Swarms, Phase Transitions and Collective Intelligence"
Artificial Life III, (ed) Langton, Addison-Wesley, 1994, p417-445.
Deneubourg, J-L. et al "Swarm-Made Architectures"
Towards a Practice of Autonomous Systems, Proc. of the First European
Conf. on A. Life. (eds) Varela & Bourgine, MIT Press, 1992.
Hofstadter, D.R. "Ant Fugue",
in "Godel, Escher, Bach: An Eternal Golden Braid", Penguin Books, 1980, p311-336.
Swarm
The idea of swarm intelligence arose largely from observation of the
complex behaviour exhibited by the social insects (ie. bees, ants, wasps, termites).

|
|
|
A termite mound pinched from
somebody's happy-snaps for
your education.
|
A honey-comb pinched from
somebody's happy-snaps for
your education.
|
A wasp nest pinched from
somebody's happy-snaps for
your education.
|
Some complex behaviours exhibited by social insects include:
- trail-following
- foraging
- construction
- group defence
- gardening / farming (fungus/aphids)
A swarm is a set of mobile agents which may:
- communicate with one another directly or indirectly
- receive stimulii from the environment
- alter the environment
- perform collective / distributed problem solving
In biological swarms the agents are:
- usually non-homogeneous (different castes: drones, workers)
- dependent on the swarm as a whole for their survival
Global Behaviour from Local Rules
- Complex global behaviour of a swarm is somehow encoded in the individual organisms.
- Complex adaptive behaviour of a swarm is the result of the interactions between organisms as
distinct from behaviour that is a direct result of the actions of individual organisms.
Some Experimental Trail-Following Results
For discussion...
- Ants will choose the shortest of two paths of unequal length if the paths are presented
simultaneously.
- After the ants have chosen a path they are unable to switch to a new path.
- Ants will all choose one path in preference to half of them travelling a second path,
even if the paths are of equal length.
Describing a Swarm Member's Behaviour
Sequential algorithms
- Regulation of an agent's building activity is dependent on the current state
of the agent.
- Information is not transferred directly between agents.
- The agent does not respond automatically to local configurations unless
internal state criteria are met.
Stigmergic algorithms
- Regulation of an agent's (nest) building activity is dependent on the current state
of the (nest) environment.
- Information is not transferred directly between agents.
- The agent automatically responds to any local configuration.
Implementing the Model
- Can decompose a problem / structure into simple components and their local stopping
configurations.
- One type of behaviour proceeds until a local stopping configuration is reached,
triggering a new kind of behaviour.
- An action can be performed by an agent upon encountering a given environmental
configuration deterministically, stochastically etc.
- Different sets of rules can be applied according to a factor such as time
or the satisfaction of some other triggering condition.
- Sets of rules may be applied hierarchically depending on the success or failure
of some action.
- Can implement interesting social systems using Cellular Automata.
Some simple actions...
- Grasp a particle (if not grasping one)
- Drop a particle (if grasping one)
- Move
- Turn
- Release pheromone
Examples of behaviours which may be implemented using these (or similar) actions...
- Nest construction (wasps, termites, ants)
- Shortest path following (ants)
- Food foraging and retrieval (ants)
- Heap construction (ants) (eg. ant cemetaries)
Implementing a Nest-Building Algorithm
(from Deneubourg et al., Alife I, Europe)
- A wasp may act to fill (or not fill) an empty location in a grid.
- Only three possible configurations of filled cells surrounding
a wasp (in this model) stimulate the filling of the cell the
wasp is currently on.
- The probability a wasp will fill a cell given some surrounding
configuration is given by a probability: Ph1, Ph2, Pv.
The Sequential Algorithm
- The past activities/current state of the wasp determine its building activity.
(The local environment only 'authorizes' the wasp to fill a cell.)
- At a time t, a wasp may be in a state horiz-fill or vert-fill.
- After each filling action of the wasp there is a probability Pvh that it
will swap from vert to horiz-fill (or Phv that it will swap from horiz to
vert-fill).
The Stigmergic Algorithm
- The local environmental configuration determines the wasp's
building activity.
- At a time t, a wasp may execute a horiz1-fill, horiz2-fill
or vert-fill each of which may occur depending on a probability Ph1,
Ph2 or Pv depending on enviornmental conditions.
|
|
|
|
0 |
Sequential
Algorithm:
|
0 If
S=H
1 If S=V |
0 If
S=H
1 If S=V |
0 If
S=H
1 If S=V |
0 |
Stigmergic
Algorithm:
|
Pv |
Ph1 |
Ph2 |
0 |
|
|
- a. Solitary insect (N=1), seq. algorithm, Pvh=0.2, Phv=0.8
- b. Solitary insect (N=1), sti. algorithm, Pv=0.8, Ph1=0.2, Ph2=0.4
- c. Same as a. but with N=10
- d. Same as b. but with N=10
|
|
Some real wasps' nests of different species.
|
|
Animation Applications
- Interesting effects can be obtained but the computationally-expensive methods
are not frequently warranted.
- Best reserved for instances where the behaviour or effect of a swarm is
of particular interest.
Ie. don't bother to use a swarm model if you just want the effect of insects
milling around randomly (remember Dorin's
Razor)!
lecture notes | home
All material accessed from www.cs(se).monash.edu.au/~cema
is
© Copyright 1994-2008 Alan Dorin, Jon McCormack & Monash University except where noted.