This project is a StarLogo adaptation of the Visual Basic program on which A.I. Memo No. 1512, "Cooperative physics of fly swarms: an emergent behavior" by M. Poggio and T. Poggio, was based (this publication can be retrieved by anonymous ftp to publications.ai.mit.edu). If anything in the following description is unclear please refer to the above paper which explains the project in greater detail.
Male and female flies fixate - that is fly towards - small contrasted patterns and track moving objects. A simple mathematical model developed by Reichardt and Poggio describes this behavior. Each fly in this simulation uses this simple mathematical function to fixate, or chase, the other flies it sees. The angle between the chasing fly's direction of flight and the direction of the chased fly is calculated. This angle represents the position of the chased fly in the 360 degree visual field of the chasing fly. Each fly then uses this error angle to generate a torque value in order to correct its direction of flight. In each step each fly calculates an error angle and then a torque for all the flies it sees. Once all the torques corresponding to all the seen flies are calculated then they are added up and translated into an angular velocity value. However, the absolute value of the torque produced by the fly cannot exceed an upper limit. Therefore before calculating the angular velocity a saturation function is applied to the total torque. For one fly to see another fly, the latter fly has to be within the sight range of the former. This range can be altered on the slider marked "dist". The flies are all assumed to travel at a constant velocity. It is also important to note that the flies in our simulation are simply points on a screen and can pass through each other, unlike real flies.
Although the model is clearly an oversimplification, these simulations suggest that the interaction of very simple control systems may account for some of the complex behaviors observed in real swarms of flies or mosquitoes.
-- The "flynum" slider --
This slider has a range of 2 to 100. It controls the total
number of flies in the simulation.
-- The "dist" slider --
This slider has a range of 1 to 100. It sets the maximum
distance at which one fly is visible to another fly. The
units of distance are patches.
-- The "step" slider --
This slider sets the size of the time step of the
simulation. In other words it sets what fraction of a
patch the flies travel in one iteration. Its range is
from 1 to 100. When the slider is set to 1, each fly
moves 1/100 of a patch in one time step. When set to 100,
each fly moves 1 patch per time step. It is usually
preferable to increase the size of the time step when
working with large numbers of flies so that the simulation
does not run too slowly.
-- The "lin-non" slider --
There are two inputs to this slider: either 0 or 1. When
set to 0, a linear function is used to calculate torque from
error angle values. This means that the value of the torque
increases in direct proportion with the value of the error
angle. When the slider is set to 1, a non-linear function
is used to generate torque. For error angles up to + or -
20 degrees this function generates a torque directly
proportional to the error angle like the linear function.
However, when the error angle exceeds + or - 20 degrees the
slope of the function changes from positive to negative.
This means that as the error angle gets larger and larger
beyond + or - 20 degrees the torque generated decreases
proportionally. This function is somewhat more realistic
than the linear function because it gives less importance to
flies which are behind the chasing fly and more importance
to those directly infront of it.
-- The "blind" slider --
This slider has a range form 0 to 100. It sets the number
of "blind" flies in the simulation. A "blind" fly is a fly
which does not see any other flies and thus does not chase
any other flies. It simply randomly changes its direction
by up to + or - 20 degrees per step. "Blind" flies are
useful for adding noise to a simulation since "non-blind"
flies see and attempt to chase "blind" flies when they are
within their sight range.
-- The "trails" slider --
There are two inputs to this slider: either 0 or 1. When
set to 0, the flies do not leave any trails of their path.
When set to 1 the flies do leave trails. This slider can be
changed while the simulation is running and is useful for
observing the precise flight paths of flies and keeping the
screen from getting cluttered.
After setting the sliders to the desired positions click the "setup" button and the "go" button to start the simulation. All sliders can be changed while the simulation is running except the "flynum" slider. Changing this slider while the simulation is running yields faulty results.
Although swarms of many flies may seem to be the most interesting behavior to observe, do not overlook the behavior of 2 or 3 flies chasing each other.
* Play around with the settings when there are only 2 or 3 flies in the simulation (the "step" slider will have to be set very low for such a small number of flies). Set the "trails" slider to 1 and look for "weaving" behaviors and "flower-like" attractors.
* Play around with all the settings. Use your imagination. There are countless combinations to explore.
Project by M. Poggio
Special thanks to Prof. Heinrich Blthoff and The Max Planck Institut fr Biologische Kybernetik for supporting this project.
For more information see:
A.I. Memo No. 1512, "Cooperative physics of fly swarms: an emergent behavior" by M. Poggio and T. Poggio
(ftp://publications.ai.mit.edu/ai-publications/1500-1999/ AIM-1512ps.Z)