AI Glossary / Mathematics and optimization / Advanced
Fly algorithm
Definition
The Fly algorithm is an evolutionary optimization approach in which many simple candidate components cooperate to represent a solution. In its original stereo-vision setting, each artificial fly is a proposed point in three-dimensional space, and the population collectively approximates visible surfaces.
What it means
A fly is not an insect simulation or an entire reconstructed scene. It contributes one spatial hypothesis. Useful flies accumulate near locations supported by the camera images, while unsuitable hypotheses are replaced or moved.
This is a Parisian evolutionary approach: the population forms the answer collectively. That differs from a conventional evolutionary search in which every individual represents a complete competing solution. It also differs from the Firefly Algorithm and fruit-fly optimization, despite their similar names.
How it works
Start with calibrated stereo cameras and initialize points within their overlapping viewing region. Project each point into both images. Compare local image patches around those projections: agreement can support the hypothesis that both cameras observe the same physical surface point.
The original stereo formulation combines image agreement with local image-gradient information. Texture matters because a uniformly colored patch can resemble many other patches, creating ambiguous matches. Visibility, calibration and lighting also affect the evidence.
Selection retains useful hypotheses. Crossover combines parent coordinates; mutation perturbs positions; random immigration introduces fresh candidates. A sharing mechanism discourages excessive crowding, helping the population represent different scene regions. Repeating these operations produces an evolving collection of spatial points, not a guaranteed complete surface model.
Three practical examples
1. Robot perception: candidate points supported by two camera views indicate possible nearby surfaces. A separate navigation system must decide how to respond and how to handle missing observations.
2. Stereo research: an engineer varies the diversity mechanism to examine whether a population covers several objects or collapses onto one strongly textured object. Coverage and geometric accuracy require separate measurements.
3. Teaching cooperative search: students compare populations whose members encode single spatial points with populations whose members encode whole scenes. The exercise makes the distinction between component fitness and solution-level quality tangible.
Think of it this way
Imagine a group of surveyors placing tentative markers on a landscape. Each marker represents one proposed location. The emerging map depends on where all the markers settle, rather than on choosing a single winning marker as the entire map.
Worked example
Consider an idealized pair of rectified pinhole cameras. Their horizontal separation is 0.2 meters and focal length is 100 pixels. Use coordinates centered on each camera's principal point. For a world point with horizontal coordinate X and depth Z, the projections are u_left = 100X/Z and u_right = 100(X − 0.2)/Z.
Three flies share X = 0.4 meters but propose different depths:
At Z = 1 meter, their horizontal projections are 40 and 20 pixels.
At Z = 2 meters, the projections are 20 and 10 pixels.
At Z = 4 meters, the projections are 10 and 5 pixels.
Suppose corresponding image features occur at 20 pixels in the left image and 10 in the right. Under the stipulated geometry, the second fly agrees with those observations. Its disparity is 10 pixels, giving depth 100 × 0.2 / 10 = 2 meters.
For a simplified patch comparison, take left intensities [10, 30, 20] and a matching right patch [11, 29, 21]. Their squared differences sum to 1 + 1 + 1 = 3. A competing patch [20, 10, 30] gives 100 + 400 + 100 = 600. Smaller disagreement supports the first match in this illustration.
This patch score is deliberately simplified; it is not the original algorithm's complete fitness formula. Nor does one good fly reconstruct an object. Many supported, suitably distributed points are needed, and repeated textures can still produce misleading matches.
Illustrative case study
In a fictional warehouse experiment, a research team tests stereo reconstruction near shelving. Early populations cluster on printed box labels because those regions provide strong texture. The resulting point cloud looks convincing locally but leaves plain cabinet doors poorly represented.
The team compares diversity settings, records coverage by surface region and checks reconstructed depths against measured distances. It also marks areas with insufficient visual support. A separate obstacle-avoidance evaluation tests the whole perception-and-control chain.
The lesson is that attractive point clusters do not establish reliable scene coverage. A collective representation needs evaluation at both the individual-point level and the task level.
Common misconceptions and mistakes
A fly is not normally a complete solution in the original stereo formulation. Selecting one best fly would discard the collective representation.
High image similarity does not prove geometric correctness: repeated patterns, occlusion and calibration errors can mislead matching. Likewise, an area containing few flies is not automatically empty space.
More flies or more iterations do not guarantee globally correct reconstruction. Parameter settings, image quality and the representation itself limit results. Historical demonstrations should not be treated as current real-time performance guarantees.
Business use
The concept is relevant when assessing research prototypes that assemble useful structures from many cooperating hypotheses. Evaluation should connect point accuracy and surface coverage to the intended operational task, including processing cost and behavior when observations are weak.
For a procurement comparison, use identical scenes and independent geometric reference measurements. Report unsupported regions alongside successful reconstructions. A population-based method's appeal does not replace evidence that the resulting system meets the project's requirements.
People also ask
Is it the same as the Firefly Algorithm?
No. Similar naming does not imply the same representation, operators or objective.
Does it produce a finished 3D mesh?
Not inherently. Its stereo population supplies spatial hypotheses; building a mesh requires additional processing and assumptions.
Can a highly fit fly be wrong?
Yes. Image evidence can be ambiguous or corrupted, so fitness is not a certificate of physical truth.
Check your understanding
Why do many flies matter?
Answer: Their locations collectively represent scene structure.
In the worked geometry, what depth corresponds to disparity 5 pixels?
Answer: Four meters, because 100 × 0.2 / 5 = 4.
Does a low-density region prove that no obstacle exists?
Answer: No. Weak texture or visibility may prevent useful hypotheses there.
Related terms
- Cooperative coevolution
- Disparity
- Parisian evolution
- stereo vision
- evolutionary optimization
- population diversity
- point cloud
Learn next
Calculate how disparity changes with depth, then compare coverage and accuracy on textured and untextured surfaces. Study stereo calibration and occlusion before interpreting an evolved point population as a dependable scene representation.
More in Mathematics and optimization
- Absolute error loss - Absolute error loss measures a numerical prediction's error as the absolute difference between its predicted and reference values: L(y,y-hat)=|y-y-hat|.
- Active-set method - An active-set method is an optimization approach that works with a changing subset of constraints believed to be tight at the solution.
- Adjoint state method - The adjoint state method computes how a chosen objective changes when the parameters of a mathematical model change.
- Σ-algebra
- Algebraic connectivity - Algebraic connectivity is the second-smallest eigenvalue of a graph's Laplacian matrix.
- Algorithm IMED - Algorithm IMED, short for Indexed Minimum Empirical Divergence, is a method for choosing actions in a stochastic multi-armed bandit problem.
Sources
Olivier Pauplin, Jean Louchet, Evelyne Lutton and Michel Parent, Applying Evolutionary Optimisation to Robot Obstacle Avoidance, ISCIIA 2004, author manuscript: https://arxiv.org/pdf/cs/0510076
The camera calculations, simplified patch scores and warehouse case are original illustrations.
Previous: Fluid Communities Next: FM-index