Detail of Algorithm
These pages document each metaheuristic in this library in depth: the idea it is built on, the equations it implements, pseudocode matching the actual source, its parameters, and the literature it comes from.
| Algorithm | Domain | Search style | Detail page |
|---|---|---|---|
| Ant Colony Optimization (ACO-R) | continuous | population + solution archive | ACO-R |
| Binary Ant Colony Optimization | binary / subsets | population + pheromone per bit | Binary ACO |
| Artificial Bee Colony | continuous | population + abandonment | ABC |
| Bacterial Foraging Optimization | continuous | population + three timescales | BFO |
| Bat Algorithm | continuous | population + echolocation | Bat |
| Bees Algorithm | continuous | population + site recruitment | Bees |
| Camel Algorithm | continuous | population + endurance/supply + restarts | Camel |
| Cat Swarm Optimization | continuous | population + two behaviour modes | CSO |
| Clonal Selection Algorithm | continuous | population + affinity-proportional cloning | CLONALG |
| Coral Reefs Optimization | continuous | reef substrate + settlement | CRO |
| Cuckoo Search | continuous | population + Levy flights | Cuckoo |
| Differential Evolution | continuous | population + difference vectors | DE |
| Firefly Algorithm | continuous | population + distance-faded attraction | Firefly |
| Fireworks Algorithm | continuous | population + quality-coupled explosions | FWA |
| Fish School Search | continuous | population + weights + school contraction | FSS |
| Flower Pollination Algorithm | continuous | two rules switched per flower | FPA |
| Forest Optimization Algorithm | continuous | age-gated seeding + recycled discards | FOA |
| Genetic Algorithm | continuous | population + recombination | GA |
| Grasshopper Optimisation Algorithm | continuous | repulsion + attraction with a comfort zone | GOA |
| Gravitational Search Algorithm | continuous | population + mass-based attraction | GSA |
| Grey Wolf Optimizer | continuous | three-leader hierarchy | GWO |
| Harmony Search | continuous | memory + whole-memory recombination | HS |
| Harris Hawks Optimization | continuous | six moves gated by prey energy | HHO |
| Hybrid Bat Algorithm | continuous | Bat Algorithm + a DE local search | HBA |
| Hybrid Self-Adaptive Bat Algorithm | continuous | Hybrid Bat + jDE self-adaptation | HSABA |
| Komodo Mlipir Algorithm | continuous | three role groups + adaptive population | KMA |
| Krill Herd Algorithm | continuous | three motions with inertia + food centre | KH |
| Lion Optimization Algorithm | continuous | prides and nomads + seven operators | LOA |
| Monarch Butterfly Optimization | continuous | two lands + per-coordinate recombination | MBO |
| Monkey King Evolution | continuous | clone group around the incumbent | MKE |
| Moth-Flame Optimization | continuous | logarithmic spiral + shrinking flame count | MFO |
| Particle Swarm Optimization | continuous | velocity + two attractors | PSO |
| Random Search | continuous, binary | uniform sampling, no memory | Random Search |
| Self-Adaptive Differential Evolution | continuous | DE + parameters carried by selection | jDE |
| Simulated Annealing | continuous | single solution + cooling | SA |
| Sine Cosine Algorithm | continuous | trigonometric swing toward the best | SCA |
| Whale Optimization Algorithm | continuous | encircle or spiral, by a coin flip | WOA |
Shared structure
Every algorithm subclasses Algorithm and implements two methods, so
the pseudocode on each page slots into one shared loop:
state = algorithm.init_population(task) # build the initial solutions
while not task.stopping_condition(): # budget: max_evals / max_iters
state = algorithm.run_iteration(task, state)
task.next_iter()
return task.result() # (best_x, best_fitness)
task.eval(x) scores a solution, counts the evaluation, and tracks the
best solution ever seen; task.repair(x) clips a solution back inside
the bounds. Because the budget check happens in the shared loop, every
algorithm respects max_evals exactly.
Benchmark comparison
All thirty-six on the standard benchmarks (10 dimensions, 20,000 evaluations, mean over 3 seeds — lower is better). The last row is not a competitor: it is Random Search, the score of spending the same budget without searching at all, and every number above it should be read as a distance from it:
| Algorithm | Sphere | Ackley | Rastrigin |
|---|---|---|---|
| Fireworks Algorithm | 3e-88 | 2e-15 | 0 |
| Firefly Algorithm | 7e-57 | 2e-15 | 6.0 |
| Differential Evolution | 2e-41 | 5e-15 | 2.0 |
| Gravitational Search | 7e-24 | 2e-11 | 3.8 |
| Grasshopper Optimisation | 2e-08 | 1e-03 | 18.2 |
| ACO-R | 9e-25 | 1e-12 | 31.0 |
| Artificial Bee Colony | 6e-15 | 5e-06 | 2e-08 |
| Cat Swarm Optimization | 1e-05 | 0.031 | 2.3 |
| Fish School Search | 7e-05 | 0.057 | 2.7 |
| Simulated Annealing | 8e-13 | 8e-06 | 26.9 |
| Komodo Mlipir Algorithm | 1e-21 | 1e-06 | 16.9 |
| Bees Algorithm | 5e-14 | 5e-06 | 22.9 |
| Bat Algorithm | 4e-05 | 0.045 | 31.5 |
| Genetic Algorithm | 1.7e-04 | 0.124 | 3.0 |
| Bacterial Foraging | 4e-06 | 0.017 | 18.9 |
| Camel Algorithm | 1e-09 | 4e-04 | 4.4 |
| Cuckoo Search | 4e-10 | 3e-04 | 6.8 |
| Clonal Selection | 4e-08 | 1e-03 | 8.6 |
| Coral Reefs Optimization | 3e-07 | 3e-03 | 3.0 |
| Forest Optimization* | 2e-08 | 1e-03 | 9e-06 |
| Flower Pollination | 3e-30 | 2e-13 | 7.3 |
| Grey Wolf Optimizer** | 4e-88 | 4e-16 | 0 |
| Harmony Search* | 5e-08 | 3e-03 | 0.018 |
| Harris Hawks Optimization | 2e-88 | 4e-16 | 0 |
| Hybrid Bat Algorithm | 1e-04 | 1.9 | 4.1 |
| Hybrid Self-Adaptive Bat | 2e-06 | 1.3 | 4.1 |
| Krill Herd | 4e-09 | 4e-04 | 3.0 |
| Lion Optimization*** | 2e-13 | 0.39 | 2.4 |
| Monarch Butterfly* | 2e-07 | 9e-04 | 3e-04 |
| Monkey King Evolution | 5e-08 | 4e-03 | 2.7 |
| Moth-Flame Optimization | 2e-17 | 2e-07 | 9.3 |
| Particle Swarm Optimization | 1e-28 | 2e-13 | 3.0 |
| Self-Adaptive DE (jDE) | 2e-36 | 4e-15 | 0 |
| Sine Cosine Algorithm**** | 9e-26 | 5e-10 | 4e-11 |
| Whale Optimization** | 2e-62 | 3e-15 | 0 |
| Random Search (baseline) | 11.4 | 16.7 | 64.5 |
* Forest Optimization, Harmony Search, and Monarch Butterfly all build solutions one coordinate at a time, so their Rastrigin scores are largely artefacts of this benchmark suite — see the caveat below, the FOA page, the HS page, and the MBO page. Monarch Butterfly is the extreme case: rotating Rastrigin moves it from 3e-04 to 39.6.
** Grey Wolf's whole row is inflated by an origin bias: all three optima sit at \(x = 0\), and shifting them costs GWO 82 orders of magnitude on Sphere. The Fireworks Algorithm shares this bias, and Whale Optimization has a partial version of it — half its moves are translation-invariant and half are not, which is why a shift costs it much less than it costs Grey Wolf. See the GWO and WOA pages.
**** Sine Cosine is the extreme case of the same problem: the origin is an exact fixed point of its update rule, reached whatever the objective. Shifting the optimum by just 0.1 costs twenty-four orders of magnitude, and off the origin it beats random search only by a factor of two to six. Its entire row is an artefact — see the SCA page.
*** Lion Optimization's Ackley result is bimodal — most runs reach ~1e-06, a minority stall near 1.2. Its mean of 0.39 describes no actual run; the median is 0.011. See the LOA page.
Three lessons for students in this table. First, no algorithm wins everywhere (the "no free lunch" theorem in miniature): the Firefly Algorithm and DE dominate the smooth landscapes, while ABC is untouchable on the highly multimodal Rastrigin, with CSO, DE, and GA close behind. Second, the ranking depends on the landscape, not on how fashionable the metaphor is — always benchmark on a problem resembling yours.
Third, and most easily missed: these three benchmarks share two properties that flatter particular algorithms, and both are invisible unless you go looking.
They are all separable — each coordinate can be optimized independently — which flatters anything that searches one coordinate at a time. Forest Optimization is exactly that case: it looks like a near-winner above, but rotating Rastrigin so the coordinates couple sends it from 9e-06 to 27.
They also all place their optimum at exactly \(x = 0\), which flatters algorithms whose update rule is not translation-invariant. Grey Wolf loses 82 orders of magnitude on Sphere from nothing but moving the optimum.
The two transformations test different things, and a rotation alone does not test both. Rotating a function turns it about the origin, so an optimum sitting at zero stays at zero — a rotated benchmark still tells you nothing about origin bias. To separate the effects you need all four variants:
| Variant | Tests for |
|---|---|
| plain | — |
| rotated | reliance on separability |
| shifted | origin bias |
| rotated and shifted | both at once |
Run that way, the picture changes. Harmony Search is untroubled by a shift (0.075) but collapses under rotation (26.3); Grey Wolf degrades under either; Harris Hawks and Krill Herd hold up under both, which is why their rows above can be taken at face value while others cannot.
Krill Herd is the clearest illustration of why that is worth checking. Its Rastrigin score of 3.0 is beaten by eight algorithms in the table, yet it varies by under 15% across all four variants, because every coupling in it uses position differences and normalized fitness gaps rather than absolute coordinates. On a real problem — neither axis-aligned nor centred on zero — it will deliver roughly what the table says, which several higher-scoring rows will not.
A benchmark table measures the pairing of algorithm and problem, never the algorithm alone.