Abstract
In this paper, a whale optimization algorithm based on adaptive inertia weight and variable spiral position updating strategy is proposed. The improved algorithm is used to solve the problem that the whale optimization algorithm is more dependent on the randomness of the parameters, so that the algorithm’s convergence accuracy and convergence speed are insufficient. The adaptive inertia weight, which varies with the fitness of individual whales, is used to balance the algorithm’s global search ability and local exploitation ability. The variable spiral position update strategy based on the collaborative convergence mechanism is used to dynamically adjust the search range and search accuracy of the algorithm. The effective combination of the two can make the improved whale optimization algorithm converge to the optimal solution faster. It had been used 18 international standard test functions, including unimodal function, multimodal function, and fixed-dimensional function to test the improved whale optimization algorithm in this paper. The test results show that the improved algorithm has faster convergence speed and higher algorithm accuracy than the original algorithm and several classic algorithms. The algorithm can quickly converge to near the optimal value in the early stage, and then effectively jump out of the local optimal through adaptive adjustment, and has a certain ability to solve large-scale optimization problems.
Keywords
Introduction
In recent years, artificial intelligence technology has developed rapidly, and random search methods based on biological intelligence or physical phenomena, namely intelligent optimization algorithms, have begun to be proposed in large numbers. The intelligent optimization algorithm is also called the “MetaHeuristic Algorithm.” Most of the products of the combination of this random algorithm and the local search algorithm solve the optimization problem by simulating the natural behavior of organisms.
According to categories, meta-heuristic algorithms can be divided into three categories: 1. Nature-inspired meta-heuristic. This type of algorithm solve the problem by simulating the evolutionary behavior of nature. Among the common ones are genetic algorithm GA [1], differential evolution algorithm DE [2] and evolution strategy ES [3]. 2. Physics-based algorithms. This type of algorithm are proposed by scholars after studying the laws of physics in nature. The common ones are simulated annealing algorithm SA [4], gravitational search algorithm GSA [5], Moth-flame optimization algorithm MFO [6], and bat Algorithm BA [7]. 3. Swarm-based algorithm. This type of algorithm simulate the group behavior of animals in nature. For example, the particle swarm algorithm PSO [8] proposed after learning the swarm behavior of birds, and the gray wolf optimization algorithm GWO [9], which is inspired by the hunting behavior of wolves. In addition, similar algorithms include dragonfly algorithm DA [10], ant lion algorithm ALO [11], salp swarm algorithm SSA [12].
Compared with traditional gradient methods, meta-heuristic algorithms are more scalable, so they are widely used in test scheduling of SOC [13, 14], robot path planning [15, 16], radar imaging [17], image segmentation [18] and other optimization scheduling problems and engineering applications.
Whale Optimization Algorithm (WOA) [19] is a new swarm-based intelligence optimization algorithm proposed by Australian scholars Mirjalili and Lewis in 2016. It simulates the unique bubble-net predation behavior of humpback whales. Compared with some classic algorithms, WOA has a simple structure, easy to implement, strong search ability, and strong robustness. However, with the deepening of research, WOA also exposed the problem of insufficient convergence accuracy and easily fell into local optimum. In order to solve these problems, scholars have launched a series of studies. Gaganpreet Kaur [20] used chaotic maps for the population initialization of WOA. This approach allows the algorithm to obtain a more uniform initial population, which effectively accelerates the convergence speed of WOA. Ying Ling et al. [21] introduced Levy flight strategy into WOA to help each individual obtain a broader search space. Simulation experiments show that LWOA embedded with random walking strategy has stronger exploration capabilities. However, none of these methods can help WOA quickly jump out of the local optimum. Generally speaking, the methods to make WOA escape the trap of local optima can be divided into two categories: 1. Combine with other algorithms. Jun Luo et al. [22] combined the improved DE with WOA, and replaced the probabilistic selection with a lifespan mechanism. Experiments show that the improved MDE-WOA has higher convergence accuracy and stronger optimization ability; Mahmoud M. Saafan [23] combined SSA with WOA, and helped the new algorithm better allocate the search phase by modifying the original switch parameters in WOA, thereby effectively avoiding the local optimum; Xinming Zhang et al. [24] proposed HWOAG, which integrates multiple strategies. They combine the improved WOA with GWO, and the newly proposed algorithm not only has a more balanced performance, but also can effectively solve some high-dimensional problems. 2. Collaboration between multiple strategies. Zheping Yan [25] combined the ranking-based mutation strategy with the Levy flight strategy to help WOA achieve complementary advantages. The improved EWOA can quickly approach the target area and has higher convergence accuracy; Lei Ma [26] embeds the mutation strategy and the diversity-based inertial weight strategy into the MFO. The improved MFO has richer diversity and can obtain better results; Ruiye Jiang [27] starts from the perspective of whales, proposed a WOA based on armed strategy. They used the newly proposed inertial weights to strengthen the spiral update phase of WOA, thereby effectively improving the algorithm’s optimization ability. By comparing the above methods, we find that compared to the combination of algorithms, the inertial weight strategy can significantly improve the performance of the algorithm with a small amount of computational complexity. It can be seen that a suitable inertial weight strategy is efficient and convenient for the improvement of the algorithm. At the same time, although most methods can overcome some shortcomings in WOA, they still face the problem of insufficient convergence accuracy when solving some typical non-convex problems. This is because few studies have noticed the problems of the parameters in WOA and the limitations of the search range. Therefore, we propose a WOA based on the variable spiral position update strategy and the inertia weight strategy. The newly proposed strategies can not only strengthen the search ability of the algorithm, but also adjust the parameters of the algorithm itself, thereby dynamically optimizing the overall performance of WOA.
Because of the whale optimization algorithm’s slow convergence speed and insufficient convergence accuracy, a whale optimization algorithm based on adaptive inertia weight and variable spiral position updating strategy is proposed (AVWOA). By introducing the inertial weight factor affected by the fitness of the individual whale into the WOA position update formula to balance the local development ability and the global search ability of WOA, and combining the variable spiral position update strategy to optimize the search range and search accuracy of the individual whale, To improve the performance of the algorithm effectively.
Basic whale optimization algorithm
Humpback whales are tropical marine creatures with a body length of 13 to 15 meters. They are well-known for their unique posture and voice. Besides, it also has exceptional hunting and predation method. This foraging behavior is called the bubble-net feeding method. Humpback whales like to forage near the coast, so their group predation behavior is quickly analyzed and studied by observers. According to reports, this foraging is accomplished by creating unique bubbles on a circular or similar number “9”-shaped path. With the help of tag sensors, the researchers captured 300 bubble-net feeding events from 9 humpback whales, discovered two bubble-related strategies, and named them upward-spirals and double loops. After thoroughly studying and summarizing the predation characteristics of humpback whales, Mirjalili of Griffith University in Australia proposed a whale optimization algorithm (WOA) in 2016. The algorithm is divided into three stages: shrink encirclement, bubble-net attack, and search. In the shrink encirclement stage, the whale population will shrink towards the prey according to the position of the optimal individual and continuously update its position; in the bubble net attack stage, the whale population will spirally update its position to capture the prey; in the search phase, the whale population will conduct an extensive search based on the location of random individuals.
WOA algorithm principle
Shrink and encircling phase
According to the foraging characteristics of humpback whales, when hunting, the prey must first be surrounded. Assuming that the number of whale populations participating in predation is N and the dimension is d, since the actual target is unknown, the algorithm assumes that the current optimal position (that is, the position where the search agent is located) is the target position. As the iteration progresses, The location will be updated continuously to simulate real whale hunting behavior. In the shrinking and encircling stage, the mathematical formula for a position update is:
At this stage, the humpback whale needs to move in a spiral motion to approach the prey and then initiate an attack. The mathematical model is as follows:
At this phase, the whale population will randomly change leaders, change the original predation area, and conduct extensive searches to find better prey. Therefore, we only need to make small changes to Equations (1) and (2), the mathematical model of this phase can be obtained:
The algorithm flow is strictly following the humpback whale hunting steps. First, the basic experimental parameters must be initialized, such as the population size N and the number of iterations Tmax, the dimension dim of the test, etc. Then the individual fitness needs to be compared to select the best individual As a search agent and record its location as the basis for updating the location of the whale population, then update the location according to the above formula. The specific flow chart is as Fig. 1.

Flow chart of WOA.
The specific operations of each link are shown in Table 1 below. In the Table 1, fitness is a function value of a specific objective function.
Procedure of WOA
Aiming at the problems of the original WOA convergence speed and insufficient convergence accuracy, by introducing inertial weights affected by whales’ fitness, the whale population’s optimization ability is dynamically adjusted to effectively balance the local development ability and the global search ability of the whale population. The variable spiral position updating strategy is then adapted to dynamically adjust the shape of the logarithmic spiral to change the search range and search precision of individual whales to improve the convergence speed and precision of the algorithm global dynamic adjustment.
Adaptive inertia weight strategy
In the original whale optimization algorithm, whether the whale group is spirally updated or encircled by shrinkage depends entirely on the size of |A|.when |A| ≥ 1, the whale group will be forced to stay away from the current optimal solution, which is the prey, because the search agent is randomly designated. To perform a comprehensive search to avoid falling into the local optimum; when |A| < 1, it will shrink the encirclement and approach the prey, thereby increasing the algorithm’s local development capability. From Equations (3) (4) and (5), it can be seen that the value of a determines the fluctuation range of A, a can vary linearly with the number of iterations, but the relational expression of A contains random values. In addition to A, the Equations (9) and (10) in WOA’s location update formula also include a coefficient C determined by a random value and a randomly selected search agent. A large number of random values will make the algorithm too random, which will slow down the convergence speed and reduce the accuracy of the algorithm.A small amount of random values will cause the algorithm to gather near the optimal value during the iteration process, and the algorithm will stop converging prematurely and fall into a local optimum. Therefore, this paper proposes an adaptive inertial weight that changes with the individual fitness of the whale, dynamically adjusts it according to the fitness of the individual whale, and gives a new whale position update formula, to properly balance the WOA’s global search and local development capabilities.
Variable spiral position update strategy
In the whale optimization algorithm, b in Equation (6) determines the shape of the logarithmic spiral and determines the whale individual’s spiral motion range during the bubble-net attack stage. In previous studies, the value of b is generally fixed. Most researchers take b as 1 to keep it consistent with the original WOA. In our opinion, a specific value of b will fix the optimal range of individual whales in different optimization stages, thus reducing the optimization accuracy of whales. In contrast, a fixed logarithmic spiral route will make the optimization results of the algorithm have substantial limitations. A variable spiral position update strategy was proposed in this paper, which dynamically adjusts the shape of the logarithmic spiral so that the search range of the whale individual keeps changing with the number of iterations. Based on this scheme, we first assume a logarithmic spiral to simulate the spiral motion of individual whales:

Comparison of whale spiral motion trajectories under different b1.
The four different stages in the figure approximately simulate the dynamic change process of the position of the whale population during the spiral movement. The dynamic b1 combined with the appropriate value of a can continuously adjust the shape of the logarithmic spiral to change the search range of individual whales, effectively improving the search accuracy of the whale populations and preventing it from falling into the local optimum, which brings better optimization results for the algorithm.
In changing the search range, we hope that the value of b can oscillate within an appropriate range to avoid the situation that the randomness is too strong and the result is immeasurable. Therefore, the sine function has been chosen as the main body of the transformation and imposes certain restrictions on its upper and lower limits. At the same time, In order to weaken the limitation of random number l, we adjust l to the random number in [-2,1] to respond to the dynamic change of b value. The specific formula is as follows:
The new b brings about the dynamic change of the whale’s individual search range during the spiral update position. As the number of iterations changes, the whale will dynamically adjust the range of its position update. It is worth noting that the premise of the whale population being judged to enter this search behavior is |A| < 1, that is, a must be in the range of [0,1]. In the description of the original WOA, a is linearly reduced from 2 to 0, and the change of a is very stable. In this case, blindly changing the value of b will complicate the optimization process to a certain extent. Therefore, it is necessary to adjust and update the change of a, and let a and b change in coordination, so as to conform to the original intention of the algorithm’s adaptive dynamic adjustment. In the process of designing a, the problem of probability cannot be ignored. The linear change of the value of a not only makes the optimization process of the original WOA easy to understand, but also makes the whale population enter the two different stages of the extensive search corresponding to |A| ≥ 1 and the local development corresponding to with equal probability. Grasping this premise, we can start to consider the specific value of a, and its specific expression is as follows:
As shown in the Fig. 3, the expression of a is similar to the expression of b. The body of the expression is a cosine function. After a simple translation, its value range is kept in sync with the original b. In this way, the algorithm can enter the two search phases with equal probability, and can also achieve that when the whale population is in the spiral update phase, a is restricted to change within a smaller value range. In other words, a can converge while cooperating with b to adjust the position. The variable spiral position update strategy is based on this to achieve collaboration and mutual influence, which can effectively improve the performance of the algorithm.

Convergence curves comparison of a of different algorithms.
In general, the inertia weights proposed in most studies are based on the initial inertia weight and the final inertia weight as the main body of the new weight expression, and then appropriate parameters are added for improvement. In this process, no consideration is given to adding individual fitness to better dynamically adjust ω, that is, letting the optimal whale individual fitness that changes with the number of iterations affect the search process of the algorithm. Taking this into consideration, this article adds individual fitness and average fitness to the inertia weight to intervene in the value of ω. The specific formula is as follows:
The formula of Whale optimization algorithm based on adaptive inertial weight and variable spiral position update strategy (AVWOA) after adding Equation (14) is as follows:
Same as WOA, AVWOA first initializes the whale population randomly, records the individual positions of the whales and determines the location of the search agent, sorts the fitness functions, determines the best fitness and the worst fitness, and then passes Equation (1) to (14) to update the location of whale populations, the operation flowchart of AVWOA is as Fig. 4. The specific steps of the algorithm are implemented as shown in Table 2.

Flow chart of AVWOA.
Pseudo-code of AVWOA
Benchmark test function and evaluation criteria
To verify the improved whale optimization algorithm according to adaptive inertial weight and variable spiral position update strategy (AVWOA), this experiment was carried out using 18 international standard test functions. These 18 test functions include unimodal functions, multimodal functions, and fixed-dimensional functions. The data is derived from literature [19], and all test functions are minimization problems. Among them, the unimodal function can test the convergence speed and accuracy of the improved algorithm; and the function of the multimodal function is to test the global search capability of the improved algorithm.
The 18 test functions selected by reference [28–31] this time consist of 7 unimodal functions, 6 multimodal functions, and 5 fixed-dimensional functions. Among them, the theoretical optimal value fmin of F1-F13 is 0 except for F8. The details are shown in Table 3,4,5,6, and the 3D model of the test function is shown in Fig. 5.
Details of 18 benchmark functions
Details of 18 benchmark functions
Description of unimodal benchmark functions
Description of multimodal benchmark functions
Description of fixed dimension benchmark functions

3-D representation of sample benchmark functions.
The performance test of the algorithm is carried out according to the two standards of average and standard deviation.
(1) Mean Value Test (MV), which characterizes the convergence accuracy and optimization ability of the algorithm by presenting the mean value of the data set, is a common method to judge the performance of the algorithm.
(2) Standard Deviation (SD), which reflects the stability of the improved algorithm by presenting the standard deviation of the data set, is also an excellent way to test the performance of the algorithm.
Based on the above test standards, the experimental tests were run independently 30 times, and the average value and standard deviation were taken in turn to record. In order to increase the credibility of the experiment, the PSO [8], GSA [5], and the original WOA test data are all derived from the first publication of the whale optimization algorithm [18]. In the experimental test process, the four algorithms maintain the same experimental parameters: the population size N is set to 30, the maximum number of iterations Tmax is set to 500, and the F1-F13 dimensions are 30. The experimental test environment is Intel(R) core(TM) i5-6300HQ CPU @2.30GHz 2.30GHZ processor, 8G memory. The MATLAB version is MATLAB (2019b).
The optimization results of the four algorithms are compared in Table 7 below. The black and bold data indicate the best experimental results of the group.
Comparison of optimization results of four optimization algorithms
Comparison of optimization results of four optimization algorithms
Combining Table 7, it is not difficult to see that AVWOA is the best performer among the four optimization algorithms. Among the 18 test functions, 17 of AVWOA have reached the best level, showing strong competitiveness. For unimodal functions F1, F2, F3, F4, and multimodal functions F9, F11, AVWOA directly converge to the theoretical value 0, which the other three algorithms cannot achieve. The unimodal function F5 is a typical non-convex function, which can effectively measure the pros and cons of the algorithm. Compared to the data results, the average value of F5 has improved to two decimal places, showing the advantages of the improved algorithm. The multi-peak test function F8, which has many local optimal values, is a big test for whether the detection algorithm can jump out of the local optimal. It can be seen from the data that the result of the improved whale optimization algorithm is the data size of the original algorithm. It is more than twice as much as that of the WOA test result and even reached four times the GSA test result. It can be seen that AVWOA’s ability to jump out of the local optimum has a significant improvement compared to the original algorithm. For the fixed dimension function F14, F15, F16, F17 and F18, AVWOA is very close to the theoretical value. In order to further analyze and observe the performance of the algorithm, the convergence speed will be used as a new metric to compare the pros and cons of the four algorithms. Figs. 6, 7, and 8 shows the comparison of the convergence curves of the four algorithms under the tests of unimodal functions F1, F2, F4, F5, F7, multimodal functions F8, F9, F10, F11, F12, F13, and fixed-dimensional functions F15, F16.

Convergence comparison curves of unimodal functions.

Convergence comparison curves of multimodal functions.

Convergence comparison curves of fixed-dimensional functions.
It can be seen from Fig. 6. that AVWOA has obvious advantages in the unimodal function test group. It can quickly approximate the optimal value at the beginning of the iteration and converge to the theoretical value most of the time. In the test function F5 (Rosenbrock function), the test result of the algorithm did not reach the theoretical value 0. However, it can be seen from this set of curves that AVWOA still maintained a good convergence rate in the early stage, and smoothly jumped out of the local optimum after a short search. In the test function F7, AVWOA has quickly converged to near the theoretical value of 0. Compared with the other three algorithms, the convergence speed has increased significantly. It can be seen that AVWOA can achieve rapid convergence in the early and mid-term of optimization, with better final results and higher algorithm accuracy.
It is not difficult to see from Fig. 7. that AVWOA still maintains a good convergence rate under the test of the multimodal function, which is particularly obvious in the test functions F8, F9, F10 and F11. The algorithm quickly drops to near the optimal value at the beginning of the iteration, and then successfully jumps out of the local optimum through its own adaptive adjustment.
Among the fixed-dimensional functions Branin and Kowalik, AVWOA has better convergence accuracy. It can fall at a faster speed to obtain a better objective function value. In the test of the Michalewicz function, the number of iterations of AVWOA is significantly reduced, and the algorithm is faster.
In general, combining the chart data and the convergence image, the whale optimization algorithm, after introducing the inertia weight and variable spiral position update strategy, performed the best among the four algorithms in 18 benchmark test functions, with both convergence speed and convergence accuracy. The global search ability is more robust.
In order to effectively test the ability of AVWOA to solve large-scale dimensional optimization problems, we chose three sets of unimodal functions: F1 (Sphere function), F3 (Schwefel 2.22 function), and F4 (Schwefel 1.2 function) to test the convergence speed and accuracy of the algorithm in high-dimensional situations; select three sets of multimodal functions F9 (Rastrigin function), F10 (Ackley function) and F11 (Griewank function) to test the algorithm Global search capability. In order to ensure the fairness of the experiment, we used the same experimental parameters to conduct a comparative test between the improved whale optimization algorithm AVWOA and the original whale optimization algorithm WOA: the population size N is set to 30, the maximum number of iterations Tmax is set to 500, and the dimension dim Set it to 200, 500 and 1000 in turn. The experimental test environment is Intel(R) core(TM) i5-6300HQ CPU @2.30GHz 2.30GHZ processor, 8G memory. The MATLAB version is MATLAB (2019b). It can be seen from Table 8 that in the case of high dimensions, the improved whale optimization algorithm AVWOA can still maintain good performance, the convergence speed and convergence accuracy are significantly better than the original WOA, and the global search ability is also more vital. For F1, F3, and F10, as the dimensionality increases, the average value of the actual WOA algorithm optimization results is also increasing, and there is a dimensionality disaster phenomenon, but this situation does not exist in AVWOA. From F1 to F11, AVWOA has reached the theoretical value of 0 under all tests, and the result is very stable, and it is not affected by dimensional changes.
Comparison of optimization results in high-dimensional situations
Comparison of optimization results in high-dimensional situations
In order to test the rapidity and convergence speed of the algorithm, we will compare AVWOA with AIWWOA (WOA with adaptive inertia weight), original WOA[19] and SSA[12] under the same experimental parameter conditions: the population size N is set to 30, the maximum number of iterations Tmax is set to 500 times. The experimental test environment is Intel(R) core(TM) i5-6300HQ CPU @2.30GHz 2.30GHZ processor, 8G memory. The MATLAB version is MATLAB (2019b). We choose F1-F11, including unimodal function and multimodal function as the test function to test the three algorithms, and record and compare the number of iterations that reach the optimal value of the algorithm in the process of running each algorithm independently for 30 times.
The comparison of the number of iterations of the optimization of the three algorithms is shown in Table 8 below. The black and bold data indicate the best experimental results of this group. Combined with the results in Table 9, it can be seen that among the 11 test functions, the test results of 10 sets of test functions of AVWOA are better than the original WOA, and both the convergence speed and the convergence accuracy have been significantly improved. For SSA, AVWOA has 9 sets of test functions to run the test results better than it, especially the unimodal function F5-F7 and multimodal function F8-F11. The number of iterations of AVWOA is significantly reduced, of which F8, F9, F10, and F11, the number of iterations of running the test is less than 100 times and can even be reduced to single digits, which is impossible for WOA and SSA; For AIWWOA,the two have comparable performance,but in each test function, AVWOA is better because of the addition of the variable spiral position update strategy. It shows the faster speed of optimization. In summary, the improved whale optimization algorithm has a more vital optimizing ability and faster algorithm convergence.
Comparison of the number of iterations of the three algorithms
Comparison of the number of iterations of the three algorithms
To improve the slow convergence speed and low convergence accuracy of WOA in the actual operation process, an improved algorithm based on adaptive inertia weight and variable spiral position update strategy was proposed in this paper. Firstly, the reasons for the insufficient convergence accuracy and speed caused by the extreme random values in the original WOA and the single search range of individual whales are analyzed, and the limitations of the single logarithmic spiral shape on the search range and accuracy are also analyzed. Subsequently, 18 sets of international benchmark functions were used to test the performance of the algorithm. By comparing the optimization performance of PSO, GSA, and original WOA under the same experimental parameter environment, it was verified that AVWOA’s better convergence speed in low-dimensional conditions and global search capability; Three sets of single-peak test functions and three sets of multi-peak test functions are selected to perform a high-dimensional test on the algorithm. Compared with the original WOA, it can be seen that AVWOA has no dimensionality disaster phenomenon and has a particular ability to solve large-scale optimization problems. Finally, we selected 11 sets of benchmark test functions to test the number of iterations of AVWOA and compared them with WOA, AIWWOA, and SSA. The comparison results further show that AVWOA has better convergence speed and convergence accuracy. Through the above research and simulation verification, the effectiveness of this improved scheme is proved.
Footnotes
Acknowledgments
This work was supported by the National Natural Science Foundation of China (No.61603127). The authors would like to thank all the anonymous referees for their valuable comments and suggestions to further improve the quality of this work.
