# Improved Whale Optimization Algorithm for Solving Constrained Optimization Problems

Authors: Gui-Ying Ning; Dun-Qian Cao
Journal: Discrete Dynamics in Nature and Society
 (2021)

---

## Abstract

In view of the shortcomings of the whale optimization algorithm (WOA), such as slow convergence speed, low accuracy, and easy to fall into local optimum, an improved whale optimization algorithm (IWOA) is proposed. First, the standard WOA is improved from the three aspects of initial population, convergence factor, and mutation operation. At the same time, Gaussian mutation is introduced. Then the nonfixed penalty function method is used to transform the constrained problem into an unconstrained problem. Finally, 13 benchmark problems were used to test the feasibility and effectiveness of the proposed method. Numerical results show that the proposed IWOA has obvious advantages such as stronger global search ability, better stability, faster convergence speed, and higher convergence accuracy; it can be used to effectively solve complex constrained optimization problems.


---

## Body

## 1. Introduction

The whale optimization algorithm (WOA) was proposed by Mirjalili and Lewis [1] in 2016. It is a new swarm intelligence optimization algorithm that simulates humpback whale hunting behavior. The main idea of the algorithm is to solve the target problem by imitating the whale’s predatory behavior [2]. Since its introduction, the  WOA has been favored by many scholars, and it has been widely used in optimal allocation of water resources [3], optimal control [4], and feature selection [5]. But as a swarm intelligence optimization algorithm, like DE, PSO, ACO, and other algorithms, they all have the shortcomings of slow convergence and easy to fall into local optimum. Therefore, in practical applications, various improvements have been made to the standard algorithms, such as [6–10]. Therefore, for the WOA algorithm, in recent years, many scholars have made a lot of improvements in improving algorithm convergence speed and optimization accuracy. For example, Abdel-Basset et al. [11] used Lévy flight and logical chaos mapping to replace and determine the coefficient vector C and switching probability P in the WOA, proposed an improved whale optimization algorithm (IWOA), and verified the effectiveness of the proposed algorithm through experiments. Long Wen et al. [12] coordinated the exploration, developed the algorithm by updating the formula of the convergence factor of the nonlinear change, proposed an IWOA, and used experiments to verify the effectiveness of the improved algorithm. He et al. [13] introduced the adaptive strategy into the whale position update formula and proposed an IWOA for solving function optimization problems. This method balanced the global exploration and local development capabilities of the algorithm and accelerated the convergence speed and optimization accuracy of the algorithm. The experiments proved its superiority. Wuet al. [14] initialized the population through the quasireverse learning method to improve the population diversity. At the same time, the linear convergence factor was modified to a nonlinear convergence factor. In order to improve the solution of complex function optimization problems, Liu and He [15] proposed an IWOA based on adaptive parameters and niche technology, in which the adaptive probability threshold coordination algorithm was introduced for global search and local development capabilities. Experiments show that the improved algorithm can effectively improve the ability to solve complex function optimization. WOA and its improved algorithms are all proposed for unconstrained optimization problems; there is no research on using this algorithm to solve constrained optimization problems. Therefore, this paper proposes an IWOA algorithm for solving constrained optimization problems.The remainder of this paper has been organized as follows: The related research work has been described in Section2, the introduction of the standard WOA and its improvement work has been described in Section 3, experimental results have been explained in Section 4, and the conclusion and future work have been explained in Section 5.


## 2. Related Research Work

Constrained optimization problems (Cops) are a type of nonlinear programming problems that often occur in the fields of daily life and engineering applications. There are usually two ways to solve this problem: deterministic algorithm and random algorithm [16]. Deterministic algorithms generally have high initial requirements, and they are generally unable to solve some problems that are not derivable, the feasible region is not connected, or there is no obvious mathematical expression. Even if some problems can be solved, the solutions obtained are mostly local optimal solutions [16]. The random algorithm is a swarm intelligence optimization algorithm that has emerged in recent years; it has obtained a lot of research in solving constrained optimization problems. Chen and Huo [17] proposed to use an improved GA to solve the Cops; this method used floating-point encoding; they also improved the genetic mutation operator and termination criterion. Long and Zhang [18] proposed an improved bat algorithm for solving Cops. This method used the good point set method to construct the initial population to maintain population diversity and also used inertial weights to improve the performance of the algorithm. An improved particle swarm optimization algorithm for solving Cops was proposed by Mi Yong and Gao [19]. This method used the penalty function method to treat constrained optimization problems as unconstrained optimization problems and used feasible basis rules to update individual and global extreme values. Lei et al. [20] proposed a new empire competition algorithm to solve the Cops and used the lexicographic method to simultaneously optimize the objective function of the problem and the degree of constraint violation. Long et al. [21] proposed the firefly algorithm to solve the constrained optimization problem. The algorithm used chaotic sequences to initialize the firefly position and introduced a dynamic random local search to speed up the convergence of the algorithm. Wang et al. [22] proposed an adaptive artificial bee colony algorithm to solve the Cops. The algorithm used an antilearning initialization method and an adaptive selection strategy. Mohamed et al. [23–25] proposed using an improved differential evolution algorithm to solve constrained optimization problems. This method is mainly to improve the mutation operator in standard differential evolution, and the experimental results verify the effectiveness of the improved algorithm. There are many outstanding constraint-handling techniques in the literature. However, we do not review the literature of the WOA algorithm on constrained optimization problems.Without loss of generality, the model of the Cops studied in this paper is as follows:(1)minfx,s.t.gjx≤0,j=1,2,…,p,hjx=0,j=p+1,p+2,…,mli≤xi≤ui,i=1,2,…,d,where fx is the objective function, gjx is the inequality constraint, hjx is the equality constraint, and li and ui are the upper and lower bounds of the variable xi, respectively.


## 3. The Introduction of the Standard WOA and Its Improvement

### 3.1. Standard WOA

WOA is a swarm intelligence optimization algorithm that simulates whale predation behavior. The algorithm simulates the unique bubble-net foraging method of whales [26] as shown in Figure 1.Figure 1
[26] Schematic diagram of whale bubble-net foraging.The principle of the whale’s bubble-net foraging is as follows: after the whale finds its prey, it creates a bubble net along the spiral path and moves upstream to prey. This predation behavior is divided into three stages: surrounding prey, bubble-net attack, and hunting prey.


#### 3.1.1. Surrounding Prey Stage

In the WOA algorithm, the whale first recognizes the location of the prey and then surrounds it, but in fact, the whale cannot know the location of the prey in advance. Therefore, assuming that the current optimal position is the target prey, the other individuals in the group all move to the optimal position. The enclosing stage can be expressed by the following mathematical model:(2)Xt+1=X∗t−A⋅D,D=C⋅X∗t−Xt,where t is the current number of iterations, X∗t is the prey position vector (current optimal solution), Xt is the prey position vector, A⋅D is the surrounding step size, and(3)A=2a⋅rand−a,C=2⋅rand.In the above formula, rand is a random number between [0, 1],a is a control parameter, and it decreases linearly from 2 to 0 with increasing of the iterations. The expression is as follows:(4)a=2−2tTmax,where Tmax is the maximum number of iterations.


#### 3.1.2. Bubble-Net Attack Stage

The humpback whale’s bubble-net foraging method is to move along the spiral path toward the prey in the constricted encirclement. Therefore, in WOA, two methods are designed to describe the predation behavior of whales: shrinking and surrounding mechanism and spiral update position, respectively.Shrinking and surrounding mechanism: it is achieved by reducing the convergence factora in equations (3) and (4).Spiral update position: first calculate the distance between the individual whale and the current optimal position, and then simulate the whale to capture food in a spiral. The mathematical model can be expressed as follows:(5)Xt+1=D′⋅ebl⋅cos2πl+X∗t,D′=X∗t−Xt,where D′ is the distance between the ith whale and the current optimal position, b is a constant coefficient used to define the logarithmic spiral form, and l takes the random number of [−1, 1]. In the predation process, the whale also needs to shrink the enclosure while spiraling to surround the prey. Therefore, in order to achieve this synchronous model, spiral envelopment and contraction envelopment are performed with the same probability.


#### 3.1.3. Hunting Prey Stage

IfA≥1, randomly select the whale to replace the current optimal solution; it can keep the whale away from the current reference target and enhance the algorithm’s global exploration capabilities and also need to find a better prey to replace the current reference whale. The mathematical model is(6)Xt+1=Xrand−A⋅D,D=C⋅Xrand−Xt,where Xrand means randomly selecting the position vector of the whale.Figure2 shows the flowchart of the WOA.Figure 2
Flowchart of standard WOA.


### 3.2. Improvement of WOA

The WOA has the disadvantages of slow convergence and easy localization; this paper introduces three improved strategies and proposes an IWOA for solving constrained optimization problems.


#### 3.2.1. Generating Initial Population with Good Point Set Method

For swarm intelligence optimization algorithms, the quality of the initial population directly affects the accuracy and speed of the algorithm [27]. The better the diversity of the initial population, the stronger the algorithm’s global search ability. But for optimization problem, in the absence of any prior knowledge, it is necessary to use the information of the initial population. It is hoped that the diversity of the initial population will be used to fully reflect the basic information of the individual. The good point set method is an effective method that can reduce the number of trials. Experiments show that when the same number of points is taken, the good point set sequence is more uniformly distributed than the point sequence selected by the general random method, and it is closer to the integrate curve [28]. And the accuracy of the good point set method has nothing to do with the dimension; it can overcome the shortcomings of the random method. Take a good point set of M points in s-dimensional space:(7)ri=ei1≤i≤M,aki=r1∗i,r2∗i,…,rM∗i,i=1,2,…,M,k=1,2,…,s,where rk∗i means taking the decimal part of rk∗i.In order to explain the difference between the initial population generated by the good point set and the general random method, take the two dimensions as an example, where the value range of the variable is [−80, 80] and the population size is 100. Figures3 and 4 show the population distribution map generated by the random method and the good point set method, respectively.Figure 3
Initial solution generated by good point set.Figure 4
Initial solution generated by random.As you can see from the abovementioned figures, the distribution of the initial population of individuals generated by the good point set method is more uniform and the diversity is better than that generated by the random method.


#### 3.2.2. Nonlinear Convergence Factor

In the standard WOA, the global search ability and local development ability of the algorithm mainly depend on the parameter A, and the value of A mainly depends on the convergence factora; therefore, the convergence factor is critical to the algorithm’s ability to seek optimization. Literature [1] pointed out that a larger convergence factor a has better global search ability, to avoid the algorithm falling into local optimum; the smaller convergence factor a has stronger local search ability, to speed up the convergence of the algorithm. But in the standard WOA algorithm, the convergence factor a decreases linearly from 2 to 0 with the increasing of iteration. However, the linear reduction strategy of convergence factor a makes the algorithm have better global search ability in the early stage but the convergence speed is slow, and the convergence speed in the later stage is fast, but it is easy to fall into the local optimal, and it is especially obvious when solving multipeak function problems. Therefore, in the evolutionary search process of WOA, the linear decreasing strategy of convergence factor a with the number of iterations cannot fully reflect the actual optimization search process [29]. Therefore, this paper proposes that, in the early stage of evolution, the convergence factor slowly decreases exponentially, to ensure a strong global search capability in the early stage of the search while maintaining a fast convergence speed; later in the search, the convergence factor decreases linearly, in order to ensure that the algorithm has a faster convergence speed and avoid the algorithm falling into the local optimal. The updated formula of the convergence factor is(8)a=21−t/T,ift<0.7∗T,a=2−2tT,ift≥0.7∗T.Here,t is the current number of iterations and T is the maximum number of iterations.


#### 3.2.3. Improvement of Mutation Operation

Similar to other swarm intelligence algorithms, in the late evolution of the WOA, the group gathers closer to the optimal solution, diversity decreases, and it is easy to fall into local optimum. Secondly, in the evolution update formula of the standard WOA, the evolution information of the current generation is less used. According to previous research on differential evolution algorithm [30], in the evolution process, making full use of current generation information can ensure the global search ability and local search ability of the algorithm; inspired by this, this paper also introduces the current generation information in the update formula of the WOA, set as follows:Randomly generate probabilityp between [0, 1]; if p<0.5 and |A| ≥ 1, then update according to (9):(9)Xt+1=1−tT⋅Xrand−A⋅D.If |A| < 1, update according to (10):(10)Xt+1=tTX∗t−A⋅D.If the probabilityp≥0.5, update according to (11):(11)Xt+1=D′⋅ebl⋅cos2πl+tTX∗t.Here,b = 1, l=−2−t/T⋅rand+1, and rand is a random number between [0, 1]; at the same time, in order to increase the diversity of the population and avoid premature convergence, Gaussian mutation is implemented on the individuals after the mutation, which takes the midpoint of the current individual and the optimal individual as the mean and the distance between the optimal individual and the current individual as the variance; the variation formula is as follows:(12)Xt+1=N0.5∗X∗t+Xt,X∗t−Xt.


#### 3.2.4. Constraint Processing Technology

In the constrained optimization problem, there are usually two methods for dealing with constraints. One is to transform into a multiobjective function, and the other is a penalty function method. This paper uses the penalty function method. The basic idea of the penalty function method is to take the violation of constraints as a kind of punishment for the minimum value and incorporate constraints into the objective function to obtain an unconstrained optimization problem and then use the optimization algorithm to optimize the unconstrained optimization problem and make the algorithm find the optimal solution of the problem under the action of the penalty [31]. Therefore, the objective function constructed in question (1) in this paper is as follows:(13)Fx=fx+δtQx,where fx is the original objective function, δ (t) Q (x) is the penalty term, δ (t) is the penalty force, and Q (x) is the penalty factor. In the above formula, if δ (t) is fixed, it is called the fixed penalty function method; otherwise, it is called the nonfixed penalty function method. In the nonfixed penalty function method, δ (t) changes with the number of iterations. This paper uses the nonfixed multisegment mapping penalty function method proposed by Parsopoulos and Vrahatis [32]; the expression is as follows:(14)Qx=∑i=1mθrixrixα.Andrix=max0,gjx,j=1,2,⋯,p,maxhix−ε,0,i=p+1,⋯,m(15)θrix=10,rix<0.01,50,0.01≤rix<0.1,100,0.1≤rix<1,300,rix≥1,α=1,rix<1,2,rix≥1,δt=tt.


### 3.3. Out-of-Bound Processing Method

During the evolution of swarm intelligence algorithm, it is a common problem that the new solutions generated exceed the prescribed boundaries. How to deal with individual solutions beyond boundaries is also critical. There are two common processing methods: one is to take the boundary value when beyond the boundary, and the other is to regenerate a new solution within the value range. This paper takes the first method.The specific steps of the IWOA are as follows:(i)
Step 1. Set the population size M and the maximum number of iterations T and generate the initial population with the point set method.(ii)
Step 2. Calculate the fitness of the population and keep the current optimal solution.(iii)
Step 3. Update parameters A,a,C,l.(iv)
Step 4. Generate a random number p between [0, 1]; if p<0.5 and A ≥ 1, mutate according to equation (9); otherwise, update according to equation (10), if p ≥ 5, and then according to (11).(v)
Step 5. Perform Gaussian mutation to the individuals in step 4 according to formula (12).(vi)
Step 6. Perform boundary treatment on the individual after step 5 mutation and calculate the fitness of the new individuals, keeping the current optimal solution.(vii)
Step 7. Determine whether the termination condition is satisfied. If yes, output the current optimal solution; otherwise, t=t+1 and return to step 2.


## 3.1. Standard WOA

WOA is a swarm intelligence optimization algorithm that simulates whale predation behavior. The algorithm simulates the unique bubble-net foraging method of whales [26] as shown in Figure 1.Figure 1
[26] Schematic diagram of whale bubble-net foraging.The principle of the whale’s bubble-net foraging is as follows: after the whale finds its prey, it creates a bubble net along the spiral path and moves upstream to prey. This predation behavior is divided into three stages: surrounding prey, bubble-net attack, and hunting prey.


### 3.1.1. Surrounding Prey Stage

In the WOA algorithm, the whale first recognizes the location of the prey and then surrounds it, but in fact, the whale cannot know the location of the prey in advance. Therefore, assuming that the current optimal position is the target prey, the other individuals in the group all move to the optimal position. The enclosing stage can be expressed by the following mathematical model:(2)Xt+1=X∗t−A⋅D,D=C⋅X∗t−Xt,where t is the current number of iterations, X∗t is the prey position vector (current optimal solution), Xt is the prey position vector, A⋅D is the surrounding step size, and(3)A=2a⋅rand−a,C=2⋅rand.In the above formula, rand is a random number between [0, 1],a is a control parameter, and it decreases linearly from 2 to 0 with increasing of the iterations. The expression is as follows:(4)a=2−2tTmax,where Tmax is the maximum number of iterations.


### 3.1.2. Bubble-Net Attack Stage

The humpback whale’s bubble-net foraging method is to move along the spiral path toward the prey in the constricted encirclement. Therefore, in WOA, two methods are designed to describe the predation behavior of whales: shrinking and surrounding mechanism and spiral update position, respectively.Shrinking and surrounding mechanism: it is achieved by reducing the convergence factora in equations (3) and (4).Spiral update position: first calculate the distance between the individual whale and the current optimal position, and then simulate the whale to capture food in a spiral. The mathematical model can be expressed as follows:(5)Xt+1=D′⋅ebl⋅cos2πl+X∗t,D′=X∗t−Xt,where D′ is the distance between the ith whale and the current optimal position, b is a constant coefficient used to define the logarithmic spiral form, and l takes the random number of [−1, 1]. In the predation process, the whale also needs to shrink the enclosure while spiraling to surround the prey. Therefore, in order to achieve this synchronous model, spiral envelopment and contraction envelopment are performed with the same probability.


### 3.1.3. Hunting Prey Stage

IfA≥1, randomly select the whale to replace the current optimal solution; it can keep the whale away from the current reference target and enhance the algorithm’s global exploration capabilities and also need to find a better prey to replace the current reference whale. The mathematical model is(6)Xt+1=Xrand−A⋅D,D=C⋅Xrand−Xt,where Xrand means randomly selecting the position vector of the whale.Figure2 shows the flowchart of the WOA.Figure 2
Flowchart of standard WOA.


## 3.1.1. Surrounding Prey Stage

In the WOA algorithm, the whale first recognizes the location of the prey and then surrounds it, but in fact, the whale cannot know the location of the prey in advance. Therefore, assuming that the current optimal position is the target prey, the other individuals in the group all move to the optimal position. The enclosing stage can be expressed by the following mathematical model:(2)Xt+1=X∗t−A⋅D,D=C⋅X∗t−Xt,where t is the current number of iterations, X∗t is the prey position vector (current optimal solution), Xt is the prey position vector, A⋅D is the surrounding step size, and(3)A=2a⋅rand−a,C=2⋅rand.In the above formula, rand is a random number between [0, 1],a is a control parameter, and it decreases linearly from 2 to 0 with increasing of the iterations. The expression is as follows:(4)a=2−2tTmax,where Tmax is the maximum number of iterations.


## 3.1.2. Bubble-Net Attack Stage

The humpback whale’s bubble-net foraging method is to move along the spiral path toward the prey in the constricted encirclement. Therefore, in WOA, two methods are designed to describe the predation behavior of whales: shrinking and surrounding mechanism and spiral update position, respectively.Shrinking and surrounding mechanism: it is achieved by reducing the convergence factora in equations (3) and (4).Spiral update position: first calculate the distance between the individual whale and the current optimal position, and then simulate the whale to capture food in a spiral. The mathematical model can be expressed as follows:(5)Xt+1=D′⋅ebl⋅cos2πl+X∗t,D′=X∗t−Xt,where D′ is the distance between the ith whale and the current optimal position, b is a constant coefficient used to define the logarithmic spiral form, and l takes the random number of [−1, 1]. In the predation process, the whale also needs to shrink the enclosure while spiraling to surround the prey. Therefore, in order to achieve this synchronous model, spiral envelopment and contraction envelopment are performed with the same probability.


## 3.1.3. Hunting Prey Stage

IfA≥1, randomly select the whale to replace the current optimal solution; it can keep the whale away from the current reference target and enhance the algorithm’s global exploration capabilities and also need to find a better prey to replace the current reference whale. The mathematical model is(6)Xt+1=Xrand−A⋅D,D=C⋅Xrand−Xt,where Xrand means randomly selecting the position vector of the whale.Figure2 shows the flowchart of the WOA.Figure 2
Flowchart of standard WOA.


## 3.2. Improvement of WOA

The WOA has the disadvantages of slow convergence and easy localization; this paper introduces three improved strategies and proposes an IWOA for solving constrained optimization problems.


### 3.2.1. Generating Initial Population with Good Point Set Method

For swarm intelligence optimization algorithms, the quality of the initial population directly affects the accuracy and speed of the algorithm [27]. The better the diversity of the initial population, the stronger the algorithm’s global search ability. But for optimization problem, in the absence of any prior knowledge, it is necessary to use the information of the initial population. It is hoped that the diversity of the initial population will be used to fully reflect the basic information of the individual. The good point set method is an effective method that can reduce the number of trials. Experiments show that when the same number of points is taken, the good point set sequence is more uniformly distributed than the point sequence selected by the general random method, and it is closer to the integrate curve [28]. And the accuracy of the good point set method has nothing to do with the dimension; it can overcome the shortcomings of the random method. Take a good point set of M points in s-dimensional space:(7)ri=ei1≤i≤M,aki=r1∗i,r2∗i,…,rM∗i,i=1,2,…,M,k=1,2,…,s,where rk∗i means taking the decimal part of rk∗i.In order to explain the difference between the initial population generated by the good point set and the general random method, take the two dimensions as an example, where the value range of the variable is [−80, 80] and the population size is 100. Figures3 and 4 show the population distribution map generated by the random method and the good point set method, respectively.Figure 3
Initial solution generated by good point set.Figure 4
Initial solution generated by random.As you can see from the abovementioned figures, the distribution of the initial population of individuals generated by the good point set method is more uniform and the diversity is better than that generated by the random method.


### 3.2.2. Nonlinear Convergence Factor

In the standard WOA, the global search ability and local development ability of the algorithm mainly depend on the parameter A, and the value of A mainly depends on the convergence factora; therefore, the convergence factor is critical to the algorithm’s ability to seek optimization. Literature [1] pointed out that a larger convergence factor a has better global search ability, to avoid the algorithm falling into local optimum; the smaller convergence factor a has stronger local search ability, to speed up the convergence of the algorithm. But in the standard WOA algorithm, the convergence factor a decreases linearly from 2 to 0 with the increasing of iteration. However, the linear reduction strategy of convergence factor a makes the algorithm have better global search ability in the early stage but the convergence speed is slow, and the convergence speed in the later stage is fast, but it is easy to fall into the local optimal, and it is especially obvious when solving multipeak function problems. Therefore, in the evolutionary search process of WOA, the linear decreasing strategy of convergence factor a with the number of iterations cannot fully reflect the actual optimization search process [29]. Therefore, this paper proposes that, in the early stage of evolution, the convergence factor slowly decreases exponentially, to ensure a strong global search capability in the early stage of the search while maintaining a fast convergence speed; later in the search, the convergence factor decreases linearly, in order to ensure that the algorithm has a faster convergence speed and avoid the algorithm falling into the local optimal. The updated formula of the convergence factor is(8)a=21−t/T,ift<0.7∗T,a=2−2tT,ift≥0.7∗T.Here,t is the current number of iterations and T is the maximum number of iterations.


### 3.2.3. Improvement of Mutation Operation

Similar to other swarm intelligence algorithms, in the late evolution of the WOA, the group gathers closer to the optimal solution, diversity decreases, and it is easy to fall into local optimum. Secondly, in the evolution update formula of the standard WOA, the evolution information of the current generation is less used. According to previous research on differential evolution algorithm [30], in the evolution process, making full use of current generation information can ensure the global search ability and local search ability of the algorithm; inspired by this, this paper also introduces the current generation information in the update formula of the WOA, set as follows:Randomly generate probabilityp between [0, 1]; if p<0.5 and |A| ≥ 1, then update according to (9):(9)Xt+1=1−tT⋅Xrand−A⋅D.If |A| < 1, update according to (10):(10)Xt+1=tTX∗t−A⋅D.If the probabilityp≥0.5, update according to (11):(11)Xt+1=D′⋅ebl⋅cos2πl+tTX∗t.Here,b = 1, l=−2−t/T⋅rand+1, and rand is a random number between [0, 1]; at the same time, in order to increase the diversity of the population and avoid premature convergence, Gaussian mutation is implemented on the individuals after the mutation, which takes the midpoint of the current individual and the optimal individual as the mean and the distance between the optimal individual and the current individual as the variance; the variation formula is as follows:(12)Xt+1=N0.5∗X∗t+Xt,X∗t−Xt.


### 3.2.4. Constraint Processing Technology

In the constrained optimization problem, there are usually two methods for dealing with constraints. One is to transform into a multiobjective function, and the other is a penalty function method. This paper uses the penalty function method. The basic idea of the penalty function method is to take the violation of constraints as a kind of punishment for the minimum value and incorporate constraints into the objective function to obtain an unconstrained optimization problem and then use the optimization algorithm to optimize the unconstrained optimization problem and make the algorithm find the optimal solution of the problem under the action of the penalty [31]. Therefore, the objective function constructed in question (1) in this paper is as follows:(13)Fx=fx+δtQx,where fx is the original objective function, δ (t) Q (x) is the penalty term, δ (t) is the penalty force, and Q (x) is the penalty factor. In the above formula, if δ (t) is fixed, it is called the fixed penalty function method; otherwise, it is called the nonfixed penalty function method. In the nonfixed penalty function method, δ (t) changes with the number of iterations. This paper uses the nonfixed multisegment mapping penalty function method proposed by Parsopoulos and Vrahatis [32]; the expression is as follows:(14)Qx=∑i=1mθrixrixα.Andrix=max0,gjx,j=1,2,⋯,p,maxhix−ε,0,i=p+1,⋯,m(15)θrix=10,rix<0.01,50,0.01≤rix<0.1,100,0.1≤rix<1,300,rix≥1,α=1,rix<1,2,rix≥1,δt=tt.


## 3.2.1. Generating Initial Population with Good Point Set Method

For swarm intelligence optimization algorithms, the quality of the initial population directly affects the accuracy and speed of the algorithm [27]. The better the diversity of the initial population, the stronger the algorithm’s global search ability. But for optimization problem, in the absence of any prior knowledge, it is necessary to use the information of the initial population. It is hoped that the diversity of the initial population will be used to fully reflect the basic information of the individual. The good point set method is an effective method that can reduce the number of trials. Experiments show that when the same number of points is taken, the good point set sequence is more uniformly distributed than the point sequence selected by the general random method, and it is closer to the integrate curve [28]. And the accuracy of the good point set method has nothing to do with the dimension; it can overcome the shortcomings of the random method. Take a good point set of M points in s-dimensional space:(7)ri=ei1≤i≤M,aki=r1∗i,r2∗i,…,rM∗i,i=1,2,…,M,k=1,2,…,s,where rk∗i means taking the decimal part of rk∗i.In order to explain the difference between the initial population generated by the good point set and the general random method, take the two dimensions as an example, where the value range of the variable is [−80, 80] and the population size is 100. Figures3 and 4 show the population distribution map generated by the random method and the good point set method, respectively.Figure 3
Initial solution generated by good point set.Figure 4
Initial solution generated by random.As you can see from the abovementioned figures, the distribution of the initial population of individuals generated by the good point set method is more uniform and the diversity is better than that generated by the random method.


## 3.2.2. Nonlinear Convergence Factor

In the standard WOA, the global search ability and local development ability of the algorithm mainly depend on the parameter A, and the value of A mainly depends on the convergence factora; therefore, the convergence factor is critical to the algorithm’s ability to seek optimization. Literature [1] pointed out that a larger convergence factor a has better global search ability, to avoid the algorithm falling into local optimum; the smaller convergence factor a has stronger local search ability, to speed up the convergence of the algorithm. But in the standard WOA algorithm, the convergence factor a decreases linearly from 2 to 0 with the increasing of iteration. However, the linear reduction strategy of convergence factor a makes the algorithm have better global search ability in the early stage but the convergence speed is slow, and the convergence speed in the later stage is fast, but it is easy to fall into the local optimal, and it is especially obvious when solving multipeak function problems. Therefore, in the evolutionary search process of WOA, the linear decreasing strategy of convergence factor a with the number of iterations cannot fully reflect the actual optimization search process [29]. Therefore, this paper proposes that, in the early stage of evolution, the convergence factor slowly decreases exponentially, to ensure a strong global search capability in the early stage of the search while maintaining a fast convergence speed; later in the search, the convergence factor decreases linearly, in order to ensure that the algorithm has a faster convergence speed and avoid the algorithm falling into the local optimal. The updated formula of the convergence factor is(8)a=21−t/T,ift<0.7∗T,a=2−2tT,ift≥0.7∗T.Here,t is the current number of iterations and T is the maximum number of iterations.


## 3.2.3. Improvement of Mutation Operation

Similar to other swarm intelligence algorithms, in the late evolution of the WOA, the group gathers closer to the optimal solution, diversity decreases, and it is easy to fall into local optimum. Secondly, in the evolution update formula of the standard WOA, the evolution information of the current generation is less used. According to previous research on differential evolution algorithm [30], in the evolution process, making full use of current generation information can ensure the global search ability and local search ability of the algorithm; inspired by this, this paper also introduces the current generation information in the update formula of the WOA, set as follows:Randomly generate probabilityp between [0, 1]; if p<0.5 and |A| ≥ 1, then update according to (9):(9)Xt+1=1−tT⋅Xrand−A⋅D.If |A| < 1, update according to (10):(10)Xt+1=tTX∗t−A⋅D.If the probabilityp≥0.5, update according to (11):(11)Xt+1=D′⋅ebl⋅cos2πl+tTX∗t.Here,b = 1, l=−2−t/T⋅rand+1, and rand is a random number between [0, 1]; at the same time, in order to increase the diversity of the population and avoid premature convergence, Gaussian mutation is implemented on the individuals after the mutation, which takes the midpoint of the current individual and the optimal individual as the mean and the distance between the optimal individual and the current individual as the variance; the variation formula is as follows:(12)Xt+1=N0.5∗X∗t+Xt,X∗t−Xt.


## 3.2.4. Constraint Processing Technology

In the constrained optimization problem, there are usually two methods for dealing with constraints. One is to transform into a multiobjective function, and the other is a penalty function method. This paper uses the penalty function method. The basic idea of the penalty function method is to take the violation of constraints as a kind of punishment for the minimum value and incorporate constraints into the objective function to obtain an unconstrained optimization problem and then use the optimization algorithm to optimize the unconstrained optimization problem and make the algorithm find the optimal solution of the problem under the action of the penalty [31]. Therefore, the objective function constructed in question (1) in this paper is as follows:(13)Fx=fx+δtQx,where fx is the original objective function, δ (t) Q (x) is the penalty term, δ (t) is the penalty force, and Q (x) is the penalty factor. In the above formula, if δ (t) is fixed, it is called the fixed penalty function method; otherwise, it is called the nonfixed penalty function method. In the nonfixed penalty function method, δ (t) changes with the number of iterations. This paper uses the nonfixed multisegment mapping penalty function method proposed by Parsopoulos and Vrahatis [32]; the expression is as follows:(14)Qx=∑i=1mθrixrixα.Andrix=max0,gjx,j=1,2,⋯,p,maxhix−ε,0,i=p+1,⋯,m(15)θrix=10,rix<0.01,50,0.01≤rix<0.1,100,0.1≤rix<1,300,rix≥1,α=1,rix<1,2,rix≥1,δt=tt.


## 3.3. Out-of-Bound Processing Method

During the evolution of swarm intelligence algorithm, it is a common problem that the new solutions generated exceed the prescribed boundaries. How to deal with individual solutions beyond boundaries is also critical. There are two common processing methods: one is to take the boundary value when beyond the boundary, and the other is to regenerate a new solution within the value range. This paper takes the first method.The specific steps of the IWOA are as follows:(i)
Step 1. Set the population size M and the maximum number of iterations T and generate the initial population with the point set method.(ii)
Step 2. Calculate the fitness of the population and keep the current optimal solution.(iii)
Step 3. Update parameters A,a,C,l.(iv)
Step 4. Generate a random number p between [0, 1]; if p<0.5 and A ≥ 1, mutate according to equation (9); otherwise, update according to equation (10), if p ≥ 5, and then according to (11).(v)
Step 5. Perform Gaussian mutation to the individuals in step 4 according to formula (12).(vi)
Step 6. Perform boundary treatment on the individual after step 5 mutation and calculate the fitness of the new individuals, keeping the current optimal solution.(vii)
Step 7. Determine whether the termination condition is satisfied. If yes, output the current optimal solution; otherwise, t=t+1 and return to step 2.


## 4. Simulation Experiment

In order to test the performance of the IWOA, firstly select 8 benchmark functions [33] for testing as shown in Table 1. The selected functions include single-modal functions and complex nonlinear multimodal functions. The single-modal function tests the local exploitation ability of the algorithm, and the multimodal function tests the global exploration ability of the algorithm. The dimension of all tested functions is set to 30. And compared with the standard WOA, Table 2 shows the mean values and the standard deviations of the two algorithms running 30 times.Table 1
[33] Main characteristics of 8 benchmark functions.
FunctionExpressionRangeTheoretical optimal solutionSphereF1=∑i=0nxi2[−100, 100]0Schwefel2.22F2=∑i=1nxi+∏i=1nxi[−10, 10]0Schwefel1.2F3=∑i=1n∑j=1ixi2[−100, 100]0RosenbrockF4=∑i=1n−1100xi+1−xi22+xi−12[−30, 30]0SumsquareF5=∑i=1nixi2[−10, 10]0RastriginF6=∑i=1nxi2−10cos2πxi+10[−5.12, 5.12]0GriewankF7=1/4000∑i=1nxi2−∏i=1ncosxi/i+1[−600, 600]0AlpineF8=∑i=1nxi⋅sinxi+0.1⋅xi[−10, 10]0Table 2
Performance comparison with standard WOA.
FunctionsEvaluation indexWOAIWOAF1Mean1.23E − 1011.29E − 137Std.2.5117E − 1011.8965E − 137F2Mean2.89E − 601.34E − 77Std.6.3447E − 602.24328E − 77F3Mean1.94E + 049.27E − 100Std.6.894E + 031.2311E − 99F4Mean26.0516342325.47650265Std.0.4483163470.265685577F5Mean4.37E − 995.30E − 140Std.1.07959E − 985.7842E − 140F6Mean00Std.00F7Mean00Std.00F8Mean3.22E − 616.15E − 78Std.5.09486E − 616.91291E − 78It can be seen from Table2 that, for multimodal functions F6 and F7, both algorithms can find the optimal solution. But F8 is better than the standard WOA. For single-mode functions F1, F2, F3, F4, and F5, the mean and std. are significantly better than the standard WOA, especially F3; the advantage of the IWOA is particularly obvious. This shows that the IWOA algorithm is superior to the standard WOA in both global search and local search capabilities.Figure5 shows the function evolution curves.Figure 5
The evolution curve of finding the optimal solution of equation F1–F8.It can also be seen from the evolution curve that the IWOA algorithm converges fast; the tested functions can converge to the optimal solution or close to the optimal solution.To further evaluate the performance of the improved algorithm to solve constrained optimization problems, in this paper, 13 benchmark constrained optimization problems in [34] are selected for testing. All functions are transformed into unconstrained optimization problems according to (13). In fact, it is similar to function optimization after conversion. The maximum evolutionary generation is 800. When the variable dimension n<10, the population size is set to 80; 10≤n, the population size is set to 100. Other parameter settings are the same as mentioned earlier. The WOA and IWOA algorithms are coded and realized in MATLAB. For each problem, 20 independent runs are performed and statistical results are provided including the maximum number of function evaluations (FEs), the best, mean values, and standard deviations. Table 3 shows the calculation results and comparison with other algorithms.Table 3
Comparison of IWOA with other algorithms.
Function/optimalMethodsBestMeanStd.FEsg01/−15.000IPES−14.999−14.999—240000IFOA−15−150164111COMDE−15−157.4E − 01130000ICA−15−150200000IWOA−15−14.9981.97E − 1380000g02/−0.803619IPES−0.803607−0.792771—240000IFOA−0.803603−0.8036172.4E − 06553916COMDE−0.803619−0.8012385.0E − 03200000ICA−0.803619−0.7919065.1E − 02200000IWOA−0.803576−0.8013956.9E − 0380000g03/−1.000IPES−1−1—240000IFOA−1.00052− 1.000529.9E − 16434916COMDE−1.0000−1.00003.03E − 08150000ICA−1.0005−1.00046.2E − 05200000IWOA−1.0001−0.99733.9E − 0380000g04/−30665.539IPES−30665.539−30665.539—240000IFOA−30665.538−30665.5382.2E − 11134756COMDE−30665.539−30665.539050000ICA−30665.539−30665.5390200000IWOA−30665.539−30664.7711.7E − 0164000g05/5126.498IPES5126.4985139.003—240000IFOA5126.4955126.4952.5E − 08786696COMDE5126.4985126.4980200000ICA5126.4985126.4983.8E − 01200000IWOA5126.4985126.8043.5E + 0064000g06/−6961.814IPES−6961.814−6961.814—240000IFOA−6961.814−6961.8141.8E − 12129950COMDE−6961.814−6961.814012000ICA−6961.814−6961.8140200000IWOA−6961.814−6952.5939.9E + 0064000g07/24.306IPES24.30724.316—240000IFOA24.306824.30641.29E − 04695875COMDE24.306224.30624.7E − 07200000ICA24.30624.37043.2E − 01200000IWOA24.305624.37052.4E − 0280000g08/−0.095825IPES−0.095825−0.095825—240000IFOA−0.095825−0.0958258.33E − 1710331COMDE−0.095825−0.0958259.0E − 184000ICA−0.095825−0.0958250200000IWOA−0.095825−0.0958234.8E − 0664000g09/680.630IPES680.630680.630—240000IFOA680.632680.6472.02E − 08559717COMDE680.632680.6304.07E − 1370000ICA680.630679.4294.5E − 02200000IWOA680.630680.6169.1E − 0264000g10/7049.331IPES7051.3417210.360—240000IFOA7049.28447049.26076.4E − 03883825COMDE7049.2487049.2481.5E − 04200000ICA7049.2487053.7211.7E + 02200000IWOA7049.3317046.6273.1E + 0164000g11/0.7499IPES0.750.75—240000IFOA0.750.752.7E − 11372647COMDE0.74990.7499050000ICA0.749900.749950200000IWOA0.74990.74952.9E − 0664000g12/−1.000IPES−1.000−1.000—240000IFOA−1.000−1.00004505COMDE−1−106000ICA−1−10200000IWOA−1.000−0.9982.3E − 0364000g13/0.05395IPES0.0539500.0514626—240000IFOA0.05430030.05395886.98E − 05904975COMDE0.05394150.05394151.4E − 17150000ICA————IWOA0.053950.053943.4E − 0564000It can be seen from Table3 that the IWOA algorithm can find the optimal solution or very close to the optimal solution. Among them, g01, g04, g05, g06, g08, g9, g10, g11, g12, and g13 have the best results, and all find the theoretical optimal solutions. And the solutions of g02, g03, and g07 are very close to the global optimal solutions. It can also be seen from the standard deviations that the stability of the IWOA is improved and has better robustness.Further analysis found that, for g01, g04, g06, g08, g09, g10, and g12 with inequality constraints, g11 and g13 with equality constraints, and g05 with both equality and inequality constraints, the optimal solutions found by the IWOA algorithm are equivalent to ICA [20]. For g01, g08, g09, and g011, IWOA and ICA have almost the same stability, but for g02, g07, and g10, IWOA is more stable than ICA. The COMDE [23] algorithm shows good stability, although the standard deviations of the IWOA are less than that of COMDE, but for g01, g02, g03, g05, g07, g09, g10, and g13, their FEs are less than that of COMDE, indicating that the calculation cost of IWOA is less than that of COMDE. The NDE [24] is able to find the global optimal solution consistently in 12 out of 13 comparison functions with the exception of g02, but their FEs are set to 240,000. Compared with IPES [35], the IWOA algorithm finds more optimal solutions, and there are better mean values on g01, g02, g05, g10, and g13. For g03, g08, g11, and g12, the mean values of the two are equivalent. For g01 and g13, IWOA and IFOA [36] have almost the same mean values and standard deviations. On the whole, IFOA has strong stability, but its ability to find the best solutions is poor.Figures6–8 show the convergence graphs of log10 (f (x) −f (x∗)) over FEs with 20 runs, where f (x∗) is the known optimal solution. Following the previous rule, the dimension of g01, g02, g03, and g07 is greater than 10, so the FEs are set to 80,000, and the others are set to 64,000.Figure 6
Convergence graph for g01–g03 and g07.Figure 7
Convergence graph for g04–g06 and g08.Figure 8
Convergence graph for g09–g13.As shown in Table3, IWOA is able to find the global optimal solution consistently in 10 out of 13 test functions over 20 runs with the exception of test functions (g02, g03, and g07).In order to test the effect of various parameters on IWOA, we compared the methods before and after the improvement. Among them, the initial population produced without a good point set method is called IWOA-1, the method without nonlinear convergence factor is called IWOA-2, the method without improved mutation operation is called IWOA-3, the method without constraint processing technology is called IWOA-4, and the method without out-of-bound processing is called IWOA-5. Each algorithm runs 20 times under the same conditions. Table4 shows the best, mean values, and standard deviations.Table 4
Statistical features of the results obtained by various versions of IWOA.
ProblemFeaturesIWOAIWOA-1IWOA-2IWOA-3IWOA-4IWOA-5g01Best−15−14.998−14.999−15−14.998−14.999Mean−14.998−14.998−14.991−14.997−14.994−14.998Std.1.97E − 133.24E − 049.85E − 037.46E − 045.27E − 032.13E − 04g02Best−0.803572−0.8038−0.7997−0.8034−0.8017−0.8038Mean−0.801395−0.8006−0.8076−0.8012−0.8007−0.8023Std.6.9E − 037.05E − 031.65E − 026.67E − 037.69E − 026.5E − 03g03Best−1.0001−0.9997−0.9958−1.0001−0.9979−0.9999Mean−0.9973−0.9956−0.9842−1.0034−0.9528−0.9921Std.3.9E − 032.62E − 034.8E − 033.6E − 035.3E − 035.3E − 03g04Best−30665.539−30664.66−30664.41−30665.88−30664.32−30665.51Mean−30664.771−30663.86−30664.02−30664.85−30661.36−30664.72Std.1.7E − 013.5E − 012.1E − 022.4E − 018.6E − 012.6E − 01g05Best5126.4985126.6975124.0715126.4215125.5355125.386Mean5126.8045126.0225129.9485126.9775127.8115125.846Std.3.5E + 004.5E + 006.2E + 005.4E + 007.4E + 001.2E + 00g06Best−6961.814−6961.814−6958.081−6961.814−6959.795−6961.814Mean−6952.593−6959.795−6950.981−6951.057−6953.327−6950.333Std.9.9E + 006.0E + 007.3E + 0010E + 004.6E + 0011E + 00g07Best24.305624.303724.342124.318424.322824.3106Mean24.370524.367424.406524.343624.378824.3428Std.2.4E − 021.3E − 015.2E + 002.7E − 011.3E + 002.2E − 02g08Best−0.095825−0.095825−0.095802−0.095824−0.095822−0.095825Mean−0.095823−0.095820−0.095822−0.095821−0.095820−0.095821Std.4.8E − 062.7E − 053.2E − 046.5E − 065.2E − 056.7E − 06g09Best680.630680.638682.241680.630680.633680.630Mean680.616680.882687.076681.300683.533680.605Std.9.1E − 020.4993.9420.2912.4388.6E − 01g010Best7049.3317047.4057058.0887050.0387056.5347049.148Mean7046.6277043.3267051.0387041.3977042.5727047.406Std.3.1E + 015.2E + 026.3E + 023.7E + 012.7E + 021.8E + 01g011Best0.74990.74990.75010.74990.74990.7499Mean0.74950.74870.74160.74990.74940.7491Std.2.9E − 063.5E − 064.3E − 053.1E − 062.5E − 067.4E − 06g012Best−1.000−1.000−0.997−1.000−1.000−0.999Mean−0.998−0.996−0.991−0.997−0.993−0.995Std.2.3E − 035.3E − 033.5E − 022.6E − 039.2E − 036.3E − 03g013Best0.053950.053960.053980.053960.053930.05395Mean0.053940.053930.053880.053920.053900.05391Std.3.4E − 052.5E − 041.7E − 034.2E − 054.8E − 043.7E − 05It can be seen from Table4 that the IWOA-2 without nonlinear convergence factor is the worst. It shows that, in the IOWA algorithm, the linear convergence factor has an obvious influence on it. For g01, g04, g05, g07, and g10 with many constraints, IWOA-5 without out-of-bound processing is not ideal, indicating that the more the constraints, the more sensitive the boundary. For IWOA-4, it can be seen that the experimental results are not as good as those with constraint processing technology, indicating that the constraint processing technology adopted in this paper is effective. For g01, g02, g03, g04, g07, g09, g10, and g13 with more variables, the effect of using the good point set method to generate the initial solutions is obviously better than the IWOA-1 without the good point set method. It shows that increasing the population diversity can improve the optimization ability. At the same time, it can be seen that the mutation operation that adds evolution information is better than IWOA-3. On the whole, the most obvious impact on the algorithm is the processing of nonlinear convergence factor and the processing of constraint technology.In summary, the test results of 13 benchmark constrained optimization problems show that the IWOA algorithm has high accuracy and strong stability, and it is competitive in constrained optimization problems.


## 5. Conclusion and Future Work

Like other swarm intelligence algorithms, the WOA algorithm also has the disadvantages of slow convergence and easy to fall into local optimum. According to the characteristics of the function optimization problem, this paper improves the standard WOA from three aspects: (i) initial population, (ii) convergence factor, and (iii) mutation operation. An IWOA is proposed. At the same time, in order to solve the constraint optimization problem, the dynamic penalty function method is introduced to transform the constrained optimization problem into an unconstrained optimization problem. The test of 8 benchmark functions shows that the IWOA algorithm has improved global exploration ability and local exploitation ability. Then 13 benchmark constrained optimization problems were tested, and compared with other algorithms in many aspects, the experimental results can show that the IWOA algorithm is competitive.WOA is a new type of swarm intelligence algorithm; the next work is to further improve the algorithm, so that it can be applied in more fields and solve more constrained optimization problems.



---

*Source: 8832251-2021-02-09.xml*