Super detailed | Principle and implementation of whale optimization algorithm (Matlab/Python)

The whale optimization algorithm (WOA) is a new group intelligence optimization search method proposed by Mirjalili and Lewis [1] in 2016. It is derived from the simulation of the hunting behavior of humpback whale groups in nature. The entire algorithm The process includes three stages: search and foraging, shrinking and surrounding, and spiral updating of position.

The three population update mechanisms of the whale optimization algorithm are independent of each other, so the global exploration and local development processes in the optimization phase can be run and controlled separately. In addition, the whale optimization algorithm does not require artificial setting of various control parameter values, which improves the efficiency of the algorithm and reduces the difficulty of application. Compared with other swarm intelligence optimization algorithms, the WOA algorithm has a novel structure and fewer control parameters. It has shown better optimization performance in solving many numerical optimization and engineering problems, and is better than intelligent optimization algorithms such as ant colony algorithm and particle swarm algorithm. [1-2].

The following is a detailed explanation of its principle and its programming implementation. (ps: I have also been learning Python recently, so in the programming implementation, I added Python implementation. Please forgive me for not writing well. I hope it will be helpful to my friends)

00 Catalog

1 Principle of whale optimization algorithm
2 Code directory
3 Algorithm performance
4 Source code acquisition

01 Principle of whale optimization algorithm

The whale optimization algorithm simulates the bubble net feeding behavior of whales. This attack is accomplished by forming unique bubbles along a spiral path when humpback whales surround their prey [3], as shown in Figure 1.

Insert image description here

Figure 1 Bubble net feeding behavior of whales

Based on the above-mentioned whale's bubble net foraging behavior, Mirjalili and Lewis derived a whale optimization algorithm.

The WOA algorithm assumes that the prey captured by the whale is the optimal solution and the location of the whale is the potential solution. In each iteration, the position update strategy of each whale is determined through the value of the random number p and the module of the coefficient vector A (the update strategy is three update mechanisms). As the iteration proceeds, the whale population continues to move closer to the optimal solution. Among the three population update mechanisms of the WOA algorithm,

The mathematical definition of the search and foraging mechanism is:
Insert image description here

In the formula: X⃗ rand(t) is a whale individual position vector randomly selected from the current whale group, The distance vector between an individual and a randomly selected whale individual, the coefficient vectors A⃗ and C⃗ are defined as:Insert image description here

In the formula, the control parameter vector ⃗a linearly decreases from 2 to 0 as the number of iterations increases, and ⃗r is a random vector distributed between [0, 1].

The mathematical model of the shrinkage surrounding mechanism is defined as follows:

Insert image description here

In the formula: X⃗ best(t) is the position vector of the whale individual with the optimal objective function value in the current whale group; A⃗ |C⃗ The whale's swimming steps are smaller.

The mathematical model of the spiral update position stage can be expressed as:

Insert image description here

In the formula: |X⃗ best(t) − is an ordinary logarithmic spiral, and l is a random number between [−1, 1]. In the WOA algorithm, each component of the individual whale position vector X⃗ (t) is performed independently during population update.

To sum up, the basic WOA algorithm flow chart is as follows:

Insert image description here

Figure 2 WOA flow chart

02 Code directory

Insert image description here

MATLAB
Insert image description here

Python
Insert image description here

Contains MATLAB and Python programs, garbled code solutions, and a reference document

Considering that many students have garbled characters after obtaining the code (matlab version problem), you can change the matlab version to 2020 or 2021, or use garbled characters to solve the txt file in the folder.

Part of the code:

MATLAB:
Insert image description here

Python:

Insert image description here

03 Algorithm performance

CEC's test function F10 is used to preliminarily test its optimization performance. The mathematical expression of F10 is as follows:

Insert image description here

The results of executing the program in MATLAB are as follows:
Insert image description here

The results of executing the program in Python are as follows:

Insert image description here

04 Source code acquisition

Reply on the public account ( KAU’s cloud experimental platform ): WOA (capital letters)

The whale algorithm also has many targeted improvement methods, which the author will introduce and implement later.

references

[1]MIRJALILI S,LEWIS A. The whale optimization algorithm[J].Advances in Engineering Software,2016,95:51一 67.

[2] BUI D T,ABDULLAHI M M,GHAREH S,et al. Fine-tuning of neural computing using whale optimization algorithm for predicting compressive strength of concrete[J]. Engineering with Computers,2021,37(1):701- 712.

[3] Watkins W A, Schevill WE.Aerial observation of feeding behavior in four baleen whales: Eubalaena glacialis,Balaenoptera borealis,Megaptera novaeangliae,and Balaenoptera physalus[J]. Journal of Mammalogy,1979,60(1): 155-163.

Another note: If anyone has optimization problems to be solved (in any field), you can send them to me, and I will selectively update articles that use optimization algorithms to solve these problems.

If this article is helpful or inspiring to you, you can click Like/Reading (ง •̀_•́)ง (you don’t have to click) in the lower right corner. Your encouragement is the motivation for me to persevere! If you have customization needs, you can send a private message to the author.

Guess you like

Origin blog.csdn.net/sfejojno/article/details/133624149