Swarm of Searchers
A flock of little searchers hunts for the highest hill. Each one remembers its own best spot and listens to the flock.
Brighter spots are higher. Press Run! Each searcher is pulled to its own best spot and to the flock's best spot.
The landscape
Challenges
Good hill: find a spot that is 90% as high as the true top.
Trapped: watch the whole swarm huddle together on a hill lower than 97% of the top.
The real top: find a spot 98% as high (bigger swarm or New landscape helps).
Lone wolves: set Flock pull to 0 and run 60 steps. The swarm never gathers.
What just happened?
- Each searcher knows only its own height. It remembers its own best spot and hears about the flock's best spot.
- Every step it mixes three pulls: keep going (inertia), go back to my best, go to the flock's best.
- With a strong flock pull the group huddles fast, often on the first decent hill. With a weak one it explores but never agrees.
- The narrow tall peak is easy to miss, so a small swarm gets trapped on a lower hill. A bigger swarm usually does better.
- No guarantee: it is a clever guess, not a proof.
How it works
- Scatter searchers at random on the map.
- Remember the highest spot each one has visited, and the highest spot the whole flock has seen.
- Update speed:
inertia × old speed + pull to own best + pull to flock best, each pull with a random strength. - Move, then measure the new height.
- Repeat until the flock has settled.
For grown-ups: what's really going on
Particle swarm optimisation (Kennedy and Eberhart, 1995) is a population method. Update for particle i: v ← w·v + c₁·r₁·(pbest − x) + c₂·r₂·(gbest − x), x ← x + v, where r₁, r₂ are fresh uniform random numbers.
wis the inertia;c₁the cognitive coefficient (own memory);c₂the social coefficient (global best). Speed here is capped, and particles stop at the walls.- Too little exploration gives premature convergence: all particles collapse onto the same local peak. High inertia and weak social pull keep exploring but slow convergence.
- The landscape is the maximum of 14 Gaussian bumps plus small ripples, with one tall narrow bump as the global optimum. It is a multimodal function, hard for gradient methods because gradients only point to the nearest bump.
- PSO needs only function values, no gradients, so it also works on non-differentiable problems, for example tuning model settings.
Further reading: Kennedy and Eberhart, Particle Swarm Optimization (1995) · Clerc and Kennedy (2002) on stability.