Intermediate

The Grey Wolf Optimizer (GWO)

Grey Wolf Optimizer

Estimated duration
30 minutes
Related questions
12
Related algorithms
1
Status
Log in to track

Lesson objectives

  • Understanding the GWO equations.
  • Analysing the role of the coefficient a and the vectors A and C.
  • Evaluating GWO critically.

Explanation

GWO uses the three best solutions as leaders and updates the other solutions by averaging three moves towards them.

For each leader L∈{α,β,δ}: D=|C·X_L − X| and X_L' = X_L − A·D, then X(t+1) = the average of X_α', X_β' and X_δ'. a decreases linearly from 2 to 0, so A∈[−a,a]: when |A|>1 the wolf moves away (exploration), and when |A|<1 it moves closer (exploitation). C∈[0,2] adds constant randomness.

GWO has been used to train MLPs (Mirjalili 2015), for feature selection with binary versions, and for parameter tuning. On the other hand, critical studies (Camacho-Villalón et al. 2022) showed that GWO is very close to known PSO mechanisms, and that its good performance on functions whose optimum is at the origin is tied to a structural bias towards the centre of the coordinates. The recommendation: test it on shifted functions and compare it with strong baselines.

αβδω (the other wolves)X(t+1) = (X₁ + X₂ + X₃) / 3 where Xᵢ are guided by α, β and δ
The leadership hierarchy in GWO.

Mathematics

The equations

\vec D=|\vec C\cdot\vec X_p - \vec X|,\ \vec X(t+1)=\vec X_p - \vec A\cdot\vec D,\ \vec A=2a\vec r_1 - a,\ \vec C=2\vec r_2

Python code

# Full tested implementation on the GWO card.
a = lambda t, T: 2 - 2 * t / T
print([round(a(t, 10), 1) for t in range(0, 11, 5)])  # [2.0, 1.0, 0.0]

Simplified teaching code that works with NumPy only; for research experiments use a documented library and fix the random seed.

Practical exercise

Run GWO in the simulator on Rosenbrock, then compare it with PSO in comparison mode with ten seeds.

Common mistakes

  • Judging GWO by the Sphere function alone.
  • Claiming it is better than PSO without a statistical test.

Summary

GWO is simple and has few parameters, but evaluate it on shifted functions and with fair comparisons.

References

Related papers in the repository

Short quiz

5 questions are chosen at random from 12 questions linked to this lesson, and the quiz is graded on the server.

Links within the lab

Algorithms
Models
Optimization types
Related lessons
In the paths