- Introduced by
- Seyedali Mirjalili & Andrew Lewis
- Year
- 2016
- Type
- Swarm-based metaheuristic
What does it do?
The Whale Optimization Algorithm (WOA) is a swarm-based metaheuristic for continuous optimisation, introduced by Seyedali Mirjalili and Andrew Lewis in 2016.
It is modelled on the bubble-net feeding behaviour of humpback whales, in which the animals herd prey by releasing bubbles in a spiral while narrowing their encirclement. WOA has few control parameters and is applied mainly to black-box problems where gradient information is unavailable.
The intuition behind the method
Picture a group of humpback whales circling below a school of fish and releasing bubbles in a tightening upward spiral. In the algorithm, each whale is a candidate solution, and the best solution found so far plays the role of the prey. At each iteration a whale either moves toward the leader along a shrinking encirclement, or follows a logarithmic spiral around the leader. A separate coefficient decides whether a whale moves toward the leader or toward a randomly chosen peer; when that coefficient is large, whales are pushed apart and the group searches wider. As the run proceeds the coefficient shrinks, so the group gradually shifts from wide searching to close refinement around the best position.
History
Seyedali Mirjalili and Andrew Lewis proposed the Whale Optimization Algorithm in 2016 in Advances in Engineering Software. The algorithm draws on the bubble-net feeding behaviour of humpback whales, in which spiral paths of rising bubbles concentrate fish. The original paper compared WOA with Particle Swarm Optimisation, the Gravitational Search Algorithm, and Differential Evolution on 29 benchmark functions and six structural engineering problems. Later work has modified the spiral update, combined WOA with other metaheuristics, and extended it to other problem types.
When to use it
Choose WOA for continuous optimisation problems in which the objective is expensive to evaluate, noisy, or has no usable analytical gradient, such as some engineering design and hyperparameter tuning tasks. It makes no normality assumption and needs no gradient information, so it can be applied directly to a black-box objective. It is a reasonable choice when a broad search of the space should precede local refinement. Do not choose WOA when the decision variables are discrete or combinatorial without a dedicated binary or permutation encoding, because the standard position-update equations are defined for continuous variables. Do not choose it when an exact or provably global optimum is required, since it is a heuristic with no such guarantee.
Limitations and considerations
- As a population-based heuristic, WOA gives no guarantee of finding the global optimum.
- On highly multimodal landscapes, premature convergence can occur when the population is small or the iteration budget is short, because the coefficient has not yet decreased enough for the search to refine effectively.
- The standard position-update equations are defined for continuous variables; discrete or combinatorial problems require a problem-specific encoding and neighbourhood operators.
- The spiral constant b is held fixed during a run. Its value affects convergence behaviour, but the available guidance on choosing it is limited.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Few control parameters: population size, iteration budget, and the spiral constant b. This keeps the configuration space small compared with many other metaheuristics.
- The coefficient that decreases from 2 to 0 moves the search from wide, peer-directed exploration to leader-directed exploitation without a separately tuned balance parameter.
- Requires no gradient information and no normality assumption, so it applies directly to black-box objective functions.
- Mirjalili and Lewis (2016) reported competitive results on benchmark functions against several established methods, including Particle Swarm Optimisation, the Gravitational Search Algorithm, and Differential Evolution.
Applications
- Structural engineering design problems of the kind used in the original evaluation, such as minimising the weight or cost of a structure under stress or deflection constraints.
- Hyperparameter tuning for machine-learning models, where exhaustive grid search is costly and the parameters are continuous.
- Feature selection, using a binary adaptation of the algorithm, to choose a compact subset of input variables.
- Location selection for electric vehicle charging stations, using an improved WOA based on a hybrid strategy (Li, Pei and Zhang, 2022b).
- Software defect prediction, where a WOA enhanced with natural selection operators has been reported to perform better (Hassouneh et al., 2021).
How it works
How it works
A population of candidate solutions (whales) is placed at random positions within the lower and upper bounds of the search space. Each position is a complete candidate solution, for example a vector of design variables. Population size and the maximum number of iterations are set before the run begins and are the main user controls.
Each whale's position is passed to the objective function and scored. The best-scoring whale found so far is stored as the leader. This evaluation is repeated after all positions have moved in an iteration, so the leader is updated from the new positions.
Each whale moves by one of two alternative rules, chosen once per iteration by a random draw. In shrinking encirclement, the whale moves toward the leader with a step size that reduces as the coefficient decreases, narrowing the search around the best position. In spiral update, the whale moves along a logarithmic spiral toward the leader, with the spiral shape set by the constant b. Together these rules model the bubble-net attack.
A uniformly drawn random number decides which rule is applied: below 0.5 the shrinking encirclement is used, otherwise the spiral update. Separately, a coefficient A, whose magnitude is controlled by a parameter a that decreases linearly from 2 to 0 over the run, decides the target. When the magnitude of A is at least 1, the whale moves toward a randomly selected peer, which drives wide exploration in the early phase. When it is below 1, the whale moves toward the leader.
The loop stops when the maximum number of iterations is reached or a convergence criterion is met. The position of the best-scoring whale at that point is returned. Because WOA is stochastic, results from a single run should not be treated as definitive; repeated independent runs with different random seeds are needed to judge reliability.
Common pitfalls
- Using too few iterations: the coefficient that controls the switch from exploration to exploitation falls from 2 to 0 over the run, so a short budget can end before the search has moved into the refinement phase.
- Using a very small population increases the risk of premature convergence. A larger population reduces this risk but raises the number of objective evaluations per iteration.
- Reporting a single run as the result. Because WOA is stochastic, results should be summarised over several independent runs with different seeds.
- Applying the continuous algorithm directly to integer or discrete problems without adapting the update rules. Rounding positions to integers can distort the search and degrade solution quality.
Frequently asked questions
How does WOA differ from Particle Swarm Optimisation (PSO)?
Both are swarm-based and move candidate solutions relative to the best solution found so far. WOA uses a spiral trajectory and an encirclement mechanism inspired by whale hunting, and it switches between leader-directed and peer-directed moves through a coefficient that shrinks over the run. PSO instead keeps a velocity memory for each particle, which WOA does not use. Mirjalili and Lewis (2016) reported WOA outperforming PSO on several benchmark functions, but relative performance depends on the problem.
What are the key parameters and how should they be set?
The main parameters are population size, the maximum number of iterations, and the spiral constant b. Population size should be chosen with reference to the experimental setting in the original paper: a larger population lowers the risk of premature convergence but increases the number of objective evaluations per iteration. The iteration budget should be set according to the cost of one objective evaluation, and should be long enough for the search to reach the refinement phase, since the parameter a falls from 2 to 0 over the run. The parameter a is not set by hand. The spiral constant b is held fixed during a run; take its value from the original paper and test how sensitive the results are to it. If premature convergence is suspected, increasing population size is the first option to test.
Can WOA handle multi-objective problems?
The algorithm as published in 2016 is single-objective. Multi-objective extensions have been proposed in later work, typically by adding an external archive of non-dominated solutions and a diversity mechanism for selection. These are extensions, not part of the original algorithm.
How many runs are needed for a reliable result?
Because WOA is stochastic, one run may not represent typical behaviour. Report several independent runs with different random seeds, together with the best, worst, mean, and standard deviation of the objective values. The number of runs should be large enough for these summary statistics to be stable for the problem at hand.
Related methods
Sources
Mirjalili, S. & Lewis, A. (2016). The Whale Optimization Algorithm. Advances in Engineering Software, 95, 51-67.
Open DOI referenceChakraborty, S. et al. (2023). A Comprehensive Review of the Whale Optimization Algorithm: Modifications, Variants, and Applications. Artificial Intelligence Review.
Open publication referenceinfor545, p. 20
Intelligent-and-Fuzzy-Systems, p. 200