🐺 The Grey Wolf Optimizer (GWO): The way of the wolf hunting
- Adisorn O.
- Oct 8
- 4 min read
Updated: Oct 10
1. Inspiration: Nature’s Hierarchy and Intelligence

The Grey Wolf Optimizer (GWO), proposed by Prof. Seyedali Mirjalili (2014), models the leadership hierarchy and hunting strategy of grey wolves in nature. Each wolf represents a candidate solution in the search space, while the pack cooperates to encircle an unseen prey — the unknown optimum of the problem.
The pack hierarchy consists of:
Alpha (α): the best solution, leader of the hunt.
Beta (β): the second-best, advisor to alpha.
Delta (δ): third-best, enforcer and stabilizer.
Omega (ω): the rest of the wolves, followers and explorers.
2. The Mathematical Core

The Grey Wolf Optimizer (GWO) explores the search space through a random yet coordinated walk of wolves, each representing a candidate solution. Among them, the top three individuals — α, β, and δ — are regarded as the pack leaders.
In Prof. Mirjalili’s original formulation, these leaders are assumed to have the best knowledge of the prey’s location — the prey symbolizing the global optimum. Thus, the prey is not an external point but an abstract representation of the best solutions found so far. In practice, the prey’s position is approximated by the three leaders, meaning that α, β, and δ collectively define the prey.
During the exploitation stage, all wolves update their positions by “encircling” these leaders — effectively circling around the best-known region of the search space. Since A = 2*r*a - a, the sign of A already determines whether the movement is toward or away from the leader.Therefore, D must represent only the distance magnitude.
Taking |C*X_prey - X| ensures that the direction of motion is governed solely by A, maintaining a coherent circling behavior around the prey rather than a chaotic mix of directions.
3. How It Works
Exploration phase:Large (|A|>1|) lets wolves roam the space, searching far from leaders.
Exploitation phase:Small (|A|<1|) forces wolves to close in, tightening the encirclement around α, β, δ.
Convergence:The pack gradually contracts — not by velocity addition like PSO, but by geometric averaging toward the best trio.
4. The Idea Behind the Hunter and Prey
One of the most fascinating ideas behind GWO is the duality of (X).Every (Xi) is a wolf (hunter) exploring the landscape, yet as the search progresses, the collective behavior of these wolves defines the location of the prey — the optimum itself.
In the final stage, α (the best wolf) is assumed at the position of the prey (Mirjalili et. al., 2020). The model is self-referential and self-consistent:
The hunters evolve until one of them embodies the prey.
This dual role elegantly mirrors engineering optimization — our trial designs hunt for the best configuration until one design is that optimum.
5. Why Engineers Love GWO
Parameter-free simplicity: only population and iteration count.
Stable convergence: natural balance between search and focus.
No gradient requirement: perfect for nonlinear, discontinuous, or black-box design problems.
Easy integration: compact MATLAB or Python code (often <40 lines).
6. Philosophical Reflection
GWO embodies a subtle truth of innovation and learning: We don’t always know the target (the “prey”) at the start. Through cooperation, exploration, and iteration, our best ideas (α, β, δ) begin to approximate it — until one day, the seeker becomes the sought.
That’s not only optimization; it’s the philosophy of progress.
7. Pseudocode (after Mirjalili, 2014)
1. Initialize a population of N wolves Xi (i = 1, 2, ..., N)
Each Xi is a d-dimensional vector within [Xmin, Xmax]
2. Evaluate fitness f(Xi) for all wolves
3. Identify the top three wolves:
Xα = best (lowest cost)
Xβ = second best
Xδ = third best
4. Set iteration counter t = 1
5. Repeat until t > T (max iteration):
a = 2 - 2 * (t / T) // linearly decreasing control parameter
For each wolf i = 1 to N:
For each dimension j = 1 to d:
Generate random numbers r1, r2 ∈ [0, 1]
A1 = 2*a*r1 - a
C1 = 2*r2
Dα = |C1 * Xα(j) - Xi(j)|
X1(j) = Xα(j) - A1 * Dα
Generate new r1, r2 for β
A2 = 2*a*r1 - a
C2 = 2*r2
Dβ = |C2 * Xβ(j) - Xi(j)|
X2(j) = Xβ(j) - A2 * Dβ
Generate new r1, r2 for δ
A3 = 2*a*r1 - a
C3 = 2*r2
Dδ = |C3 * Xδ(j) - Xi(j)|
X3(j) = Xδ(j) - A3 * Dδ
// Update position by averaging three leader influences
Xi_new(j) = (X1(j) + X2(j) + X3(j)) / 3
End For
Enforce bounds: Xi_new ∈ [Xmin, Xmax]
End For
Evaluate all f(Xi_new)
Update Xα, Xβ, Xδ based on new fitnesses
t = t + 1
6. Return Xα and f(Xα)
References
Mirjalili, S. (2014). Grey Wolf Optimizer. Advances in Engineering Software, 69, 46–61.DOI: 10.1016/j.advengsoft.2013.12.007
Mirjalili, S., Aljarah I., Mafarja M., Heidari AA, and Faris H., Grey Wolf Optimizer : Theory, Literature Review, and Application in Computational Fluid Dynamics Problems, Springer Nature Switzerland AG


