Dynamic spiral updating whale optimization algorithm for solving optimal power flow problem

To address the problems of slow convergence of the traditional whale optimization algorithm and the tendency to fall into local optimal solutions, an improved algorithm based on a combination of elite disturbance opposition-based learning and dynamic spiral updating (OWOA) is proposed, which improves the convergence speed of the algorithm and increases the probability of the algorithm jumping out of the local optimum to find the global optimum. First, an elite disturbance opposition-based learning strategy is used to initialize the whale population to ensure diversity of the population, and then, random perturbation of the elite whales increases the exploratory capacity of the population to avoid falling into local optimal solutions. Secondly, a dynamic spiral update strategy is used to dynamically adjust the shape of the spiral with the number of iterations, avoiding the algorithm from falling into a local optimum at the beginning of the iteration and improving the convergence speed of the algorithm at a later stage, which improves the ability of the algorithm to find the global optimum. The experimental results show that the OWOA algorithm, due to the introduction of the lite disturbance opposition-based learning strategy and dynamic spiral updating strategy, has higher convergence speed and accuracy on single-peak functions, multi-peak functions and multi-dimensional functions compared to other algorithms. Furthermore, good results have been obtained in the practical application of OPF. This shows that our improvements are effective.


Introduction
Optimum power flow (OPF) is one of the most critical issues of concern to researchers and power companies for the economic and safe operation of power systems.The objective of it is to optimize the size of a given objective function by changing the magnitude of the values of the control variables under the given constraints (equation constraints as well as inequality constraints).In the past many years, there have been many experts and scholars to solve the OPF problem.Such as the very first traditional methods (linear programming methods [1,2], nonlinear programming methods [3,4], quadratic programming methods [5], interior point methods [6], Newton-based techniques [7,8].Because the OPF is a highly nonlinear multimodal optimization problem, all these methods have limitations in solving the OPF problem.In practical problems, it is often the case that power plants with multiple forms of energy supply the power network together, which makes the calculation of optimal tides even more important and fundamental [9,10].In addition, the high consumption of fossil energy inevitably results in large amounts of carbon dioxide emissions, which in turn cause further problems of environmental degradation [11,12].The study of OPF issues appears necessary from all sides.In recent years, metaheuristic optimization algorithms have emerged to overcome the drawbacks of the traditional approach, which does not require a linear approximation of the nonlinear objective as traditional methods [13].Duman S et al. [14] proposed a method for finding the optimal solution to the optimal tide problem for power systems using the gravitational search algorithm (GSA) and compared it with other metaheuristic algorithms, and the results showed that GSA provides an effective and robust high-quality solution to the OPF problem.Adaryani M R et al. [15] proposed a method that uses the artificial bee colony (ABC) algorithm as the main optimizer for the optimal tuning of control variables in the power system of the OPF problem to solve the OPF problem in terms of fuel cost, emission cost, etc. Besides, in the process of solving for the optimal solution of the objective function, there is a plethora of excellent and practical algorithms that scholars will propose [16][17][18][19].As practical situations become more complex and single objective functions sometimes fail to solve them, many scholars have also applied the algorithms to multi-objective algorithms [20].Swarm intelligence optimization algorithm has received more and more attention and has been successfully applied to various fields [21][22][23][24].
In the practical application of wind speed prediction, many scholars have improved different optimization algorithms (such as PSO, SSA and other algorithms) to optimize the hyper-parameters of the prediction network structure and achieved better results [25][26][27][28][29]. Tian et al. [25] proposed an improved particle swarm optimization algorithm and applied it to a wind speed prediction model considering multiple disturbance factors to further improve the accuracy of wind speed prediction.Based on the idea of [25,26] made some progress in wind speed prediction using particle swarm optimization algorithm to optimize the parameters of the hybrid prediction model.Then, in [28], the authors proposed a novel prediction model by using an empirical mode decomposition and improved 1 3 Dynamic spiral updating whale optimization algorithm for… sparrow search algorithm optimized reinforced long short-term memory neural network.Optimization of the hyper-parameters of the LSTM network by an improved SSA algorithm has greatly improved the accuracy of short-term wind speed prediction.The literature [29] uses the permutation entropy algorithm to reconstruct the wind speed time series, followed by using five cross-validations to improve the reliability of the regularized limit learning machine model by stumbling on each series, which has higher reliability at the same confidence level.In terms of target tracking, Nenavath et al. [30] proposed a hybrid sinusoidal and cosine differential evolution algorithm, which improves the optimization performance through SCA global search and DE local search and is applied to target tracking.Zhang et al. [31] used Levy flight to improve grasshopper algorithm.Levy flight can increase the diversity of population and enhance the ability to jump out of local optimum.It effectively improves the exploration and development performance of grasshoppers and gains obvious advantages in target tracking.In optimizing the structure to improve the service life of the equipment, Cao et al. [32] proposed an improved chaotic whale optimization algorithm, which used sinusoidal chaotic mapping in the initial stage to improve the convergence speed of the algorithm.It is applied to the improvement of proton exchange membrane fuel cell to enhance the lifetime of the proton exchange membrane fuel cells (PEMFC).In terms of surrogate-assisted evaluation algorithms, Tian et al. [33] proposed a particle swarm optimization based on a variable agent model and applied it to surrogate-assisted evaluation algorithms (SAEAs) with experiments ranging from 30 to 200, and the proposed algorithms all showed satisfactory results.In photovoltaic power generation, Guo et al. [34] proposed an improved moth-flame optimization algorithm, which introduced inertia weighting strategy and the Cauchy mutation operator to improve the photovoltaic power generation prediction of support vector machine and improve the prediction accuracy of photovoltaic power generation.In addition, many other algorithms have been applied in various fields, such as genetic algorithm [35], artificial bee colony algorithm [36], grey wolf optimization algorithm [37] and moth-flame optimization algorithm [38].Although these algorithms have achieved good results, the algorithms need further improvement.Swarm intelligence optimization algorithm is an algorithm that solves optimization problems with empirical methods by simulating and utilizing the behavior of organisms or natural phenomena in nature.Representative intelligent optimization algorithms include particle swarm optimization (PSO) [39], which simulates the foraging behavior of birds; ant colony algorithm (ACO) [40], which simulates the foraging behavior of ants through path construction and pheromone updating in nature; artificial fish swarm algorithm (AFSA) [41], which simulates the foraging behavior of fish in nature, including hunting, clustering, chasing, random walking and moving; firefly algorithm (FA) [42], which simulates fireflies to blink to attract other members; and salp swarm algorithm [43].In recent years, many scholars have proposed many new algorithms, such as the Mirjalili S et al. [37] proposed gray wolf optimization algorithm, which is a pack intelligence optimization algorithm that simulates the hierarchy and hunting behavior of gray wolves in nature, with simple operation, few adjustment parameters and easy implementation of programming.
Mirjalili S et al. [43] proposed the salp swarm optimization algorithm, which is a relatively novel swarm intelligence optimization algorithm that simulates the group behavior of the salp chain.Combined with the Levi's flight behavior of some birds and fruit flies, Yang et al. [44] proposed the cuckoo optimization algorithm based on the specialized larval parasitic behavior of some cuckoos.In 2016, Australian scholar Seyedali Mirjalili first proposed a novel metaheuristic algorithm named whale optimization algorithm (WOA), which simulates the hunting behavior of humpback whales [45].The WOA has the advantages of simple structure, easy to program and few parameters to be set.However, the WOA also has some defects.Firstly, the location update of the WOA depends on random distribution, but the random distribution strategy may lead to the situation that the selected model is not optimal, which can easily fall into the local optimal solution and weaken the global search ability of the algorithm [46,47].At the same time, the spiral coefficient in the spiral updating mechanism is constant, which will lead to a single whale's spiral movement mode when searching for prey, and affect the convergence accuracy of the algorithm [48,49].Although all of these algorithms have some advantages in terms of the ability to find the best, from the literature [46,50,51], the WOA seems to perform better than the algorithms proposed.This is because that the WOA has a simple structure, small number of parameters, and strong local development capability.In recent years, WOA deserves further research although many optimization algorithms have been proposed.In addition, some potential advantages of the WOA are worthy of continued discussion.For these problems of traditional whale algorithm, scholars have conducted in-depth research on it and put forward many improved methods and some practical applications.Li et al. [52] used segmented logistic chaotic mapping strategy to initialize the population to enhance the diversity of the original population and avoid falling into local optimum.Shang et al. [53] added the nonuniform mutation strategy, and the search step size could be adjusted adaptively in the iterative process, which improved the global search ability of the algorithm.Chen et al. [54] proposed a random spare strategy, in which the position vector in the current dimension of the optimal individual was used to replace the position vector in the nth dimension of the current individual, so as to improve the convergence speed of the algorithm.Zhong et al. [55] introduced nonlinear distance control parameter to improve the accuracy and efficiency of WOA.Jadoun et al. [56] proposed and implemented an exponentially varying WOA (EVWOA) method, which improves the performance of WOA in terms of convergence.It maintains a balance between global exploration and exploitation in the whole search process and improves its efficiency.Tang et al. [57] introduced cubic mapping chaos operator into whale algorithm to improve initial population and enhanced population diversity by the randomness and regularity of chaos operator.Liu et al. [58] introduced an inertial weight factor on the basis of the original whale algorithm and made the algorithm converge to the optimal solution quickly by adjusting the weight value.Although the above improvement strategies have improved the performance of WOA to a certain extent, there are still some shortcomings such as easy to fall into local optimum and slow convergence speed, which require continuous improvement and innovation.In addition, a new 1 3 Dynamic spiral updating whale optimization algorithm for… decomposition-based combined wind speed prediction model was proposed in the literature [59], which used a vibrational model decomposition algorithm and optimized its parameters using the WOA to obtain a more accurate wind speed prediction model.Opposition-based learning (OBL) [60] is originally introduced by Tizhoosh in 2005.Tizhoosh points out that many swarm intelligence algorithms adopt stochastic operators to realize evolution in the iterative process, which will lead to slow convergence speed.Therefore, they put forward the concept of opposite point and replace random search with oppositional search to improve search efficiency.This is a successful concept in computational intelligence.It improves searching ability of traditional population-based optimization techniques in solving nonlinear optimization problems.The main concept of OBL is to consider the opposite side of a problem and compare it with the original problem to find a solution faster.By introducing OBL, the WOA search range can be extended and there is some chance of solving the problem that the original algorithm tends to fall into local optima.The OPF is a nonlinear, non-convex, constrained optimization problem that primarily aims to minimize the fitness function by satisfying the equality and inequality constraints of the system.OPF is to find the optimal settings of a given power system network that optimize a selected objective function such as total generation cost, system loss, bus voltage deviation or social welfare while satisfying its power flow equations and equipment operating limits.Since each case corresponds to a different state of the device, this allows multiple suitable solutions to exist under the same objective function, which is the reason for the complexity of the OPF problem.The WOA suffers from a tendency to fall into local optima, and the OPF problem has many locally optimal solutions within the search range.The improved method proposed in this paper can better improve the problem that the original algorithm tends to fall into local optimum, and thus, it is appropriate to use the OPF problem to test the performance of the improved algorithm.In view of the problems of slow convergence speed and easy to fall into local optimal solution in traditional WOA, this paper proposed an improved algorithm combining elite disturbance opposition-based learning and dynamic spiral updating (OWOA), which makes a significant improvement in the performance of the algorithm.The main contributions of this paper are as follows: (1) This paper proposes an elite disturbance opposition-based learning strategy that uses the concept of opposing points to replace the random strategy for expand the search range of the initial population and then disturbs the elite whales for increase the probability of the algorithm jumping out of the local optimum, which lays the foundation for fast convergence of the algorithm in the next step.(2) The proposed dynamic spiral update strategy makes the spiral update strategy converge nonlinearly as the number of iterations increases, making it easier to find the global optimal solution by balancing the exploration phase and the exploration phase of the algorithm in the exploration phase with larger step sizes and the development phase with smaller step sizes.(3)The experimental results show the effectiveness of the OWOA algorithm by simulating 12 benchmark test functions and standard test sets IEEE CEC2014 and CEC2017.In addition, the proposed algorithm achieves better results in practical applications of the OPF problem, which shows that the improved algorithm has a strong ability to jump out of the local optimum when dealing with problems where multiple local optima exist.The structure of this paper is organized as follows.Section 2 presents the mathematical model of the basic WOA.A detailed description of three enhancement strategies and the proposed OWOA is provided in Sect.3. In Sect.4, we conduct a series of simulation experiments to evaluate the performance of OWOA and discuss the obtained results.In Sect.5, we evaluate the performance of the algorithm in a real application (optimum power flow problem) and obtain the results.Finally, the conclusion of this paper and future research direction are shown in Sect.6.

Whale optimization algorithm
The whale optimization algorithm (WOA) was inspired by the hunting behavior of humpback whales [45], a foraging behavior known as bubble net feeding, which is accomplished by randomly walking to find and locate prey by generating unique bubbles along a circular or "9" shaped path, as shown in Fig. 1.Two bubble-related movements have since been identified and named "upward spiral" and "double loop."In the former maneuver, the humpback whale dives downward about 12 ms and then begins to form a spiral of bubbles around its prey and travels upward toward the surface.The latter maneuver consists of three different phases, which are later named algorithm: encircling prey, bubble-net attacking method and search for prey.

Encircling prey
Assuming that the current whale population size is n, whales can identify the location of prey and surround it in the process of hunting for prey.WOA assumes that the Dynamic spiral updating whale optimization algorithm for… optimal position in the current population is prey, and the whale population moves to the optimal individual in the iterative process, so that whales keep approaching prey.This behavior can be described by the following formula: where ⃗ D denotes the distance between the prey and the t th whale in the current itera- tion, t represents the current iteration number and �⃗ X(t) represents the current whale position.�⃗ X * (t) represents the position of the best individual whale in the current population.A and C are coefficient vectors, and r is random numbers in the interval [0,1].a is the convergence factor, and its value decreases linearly from 2 to 0 with the increase of the number of iterations.The formula of convergence factor is: where Max_iter is the maximum number of iterations, a(t) is linearly decreased from 2 to 0 over the course of iterations (in both exploration and exploitation phases).

Bubble-net attacking method
In the stage of bubble net attack, WOA will move upward in a spiral motion way and gradually reduce the range to attack prey.These two behaviors are synchronous, so as to simulate the humpback whale's bubble net attack behavior.
Shrinking encirclement mechanism: This behavior is realized by reducing the convergence factor a, where the value of a changes linearly from 2 to 0 and the value of coefficient vector A is [−a, a].When −1 < A < 1 , the whale individual will approach the whale with the best current position and implement the encirclement strategy.
Spiral updating mechanism: It simulates the spiral movement of humpback whales in a spiral way between individual whales and prey, and its mathematical model is: where b is a constant, used to define the shape of the helix, l is a random number between [−1,1] and ��� ⃗ D ′ is the distance between the current individual and the prey (the current optimal solution). (1) In the hunting process, the shrinking encirclement and spiral updating of whales are carried out at the same time.In order to simulate this behavior, the algorithm generates a random number p in [0, 1].When p < 0.5 , whales are subjected to con- traction encirclement mechanism, and when p ≥ 0.5 , they are subjected to spiral updating mechanism.The mathematical model is

Search for prey
When the whale searches for prey, if the vector A ≥ 1 and p < 0.5 , the whale will search by random walk, which makes the algorithm have a certain global search ability.Its mathematical model can be expressed as follows: where �⃗ X rand (t) denotes a random position vector.

Elite disturbance opposition-based learning
In swarm intelligence optimization algorithm, the initial population quality greatly affects the speed of the algorithm convergence.In WOA, the whale population is initialized with the method of random distribution.Although the method is simple, the random selection of whales has certain blindness, the randomly selected whales may be close to the target or far away from the target.Therefore, this paper adopts the elite disturbance opposition-based learning strategy, that is, the current individual is generated and its opposite individual is generated at the same time, and the better individual is selected as the next generation of new individuals by comparing the fitness value, so as to better guide the whale population to find the global optimal solution [61].At the same time, random disturbance is carried out to the current optimal individual, which affects the whale individuals around and avoids falling into local optimal solution.Figure 2 shows the position information of the whale population after opposition-based learning.Opposition-based learning (OBL) is a new concept in the field of computational intelligence proposed by Tizhoosh.It is novel to apply opposition-based learning to optimization, which can increase population diversity.The principle of the algorithm is to calculate the feasible solution and its opposite solution at the same time and keep better individuals as the next generation of new individuals.
Dynamic spiral updating whale optimization algorithm for… Definition 1 Opposition-based learning.A feasible solution in the D -dimensional space is x = (x 1 , x 2 , ..., x D ) , and x i ∈ [ub, lb] , i = 1, 2, ..., D .Then, the reverse solu- tion x ′ of x is defined as: Definition 2 Elite disturbance opposition-based learning.A random disturbance is generated near the selected optimal solution.The formula is as follows: where x best is the optimal individual whale after disturbance, randn() is a random number generating normal distribution and randn(1, D) is a matrix returning a ran- dom term of 1 * D which disturbs the optimal position to avoid falling into local optimal solution.is the control coefficient, which determines the influence of random matrix generated by normal distribution on the optimal whale.If the value of is too large, it will cause great interference to the optimal position, resulting in optimization failure.Therefore, the value in this paper should take a smaller value to interfere with the optimal value, and = 0.001 is finally selected.
Figure 2 is the location update distribution map of whale population after opposite learning, in which the black dot is the coordinate position of the target in space, WOA (the blue circle) represents the randomly generated position of 100 whale populations in space, and WOA (red dots) represents an opposition-based learning of 100 whale populations, comparing the positions of the original populations with those of the reverse populations, and selecting 100 whale populations that are closer to the target.As can be seen from the figure, the position of the whale corresponding to the red dot has better position information, which can (11) greatly improve the search efficiency of the algorithm.When elite individuals is found, random perturbation is carried out to avoid premature convergence.

Dynamic spiral updating
In the spiral updating stage of traditional WOA, whales will attack prey in logarithmic spiral mode.In spiral updating model, parameter b is a constant to control spiral; although it can make the whale population converge quickly in the later stage, it will lead to a single trajectory of whale movement, which is easy to fall into the local optimal solution and reduce the optimization accuracy of the algorithm.
In order to solve this problem, a dynamic spiral searching method is introduced, which makes the whale searching process change dynamically with the change of iteration times, thus improving the global search performance of the algorithm.The dynamic spiral updating formula is as follows: On the basis of the original algorithm, the number of iterations is introduced into the spiral change, and the spiral shape is dynamically adjusted according to the change of the number of iterations.This sine function can search around according to the current iteration point, which improves the global search ability and local search accuracy of the algorithm [62].So, this paper selects sine function to improve the algorithm, and in the improvement of the spiral coefficient b, the whale optimization algorithm should search globally in a larger spiral shape in the early stage of iteration to speed up convergence.In the later stage of iteration, with the increasing number of iterations, the value of b should be gradually reduced, and the target should be searched in a smaller spiral shape to improve the optimization accuracy of the algorithm.
In Eq. ( 13), controls the size of b value, and different values have different convergence accuracy on the algorithm.Figure 3 shows the trajectory of whales after position update with different values and traditional WOA.It can be seen from the figure that when = 7 and = 9 , there is a big fluctuation in the iterative process, which shows that the algorithm has weak ability to jump out of the local optimal solution, and is far from the zero point of the optimal value, and the convergence accuracy is low.When = 1 , the algorithm converges too fast in the early iteration, which will lead to the algorithm easily falling into the local optimal solution in the iteration, so it is excluded.When = 3 , although the convergence accuracy of the algorithm is improved, the position fluctuates greatly in the iteration process, which leads to the risk of falling into local optimum, so it is excluded.When = 5 , it can quickly return to the vicinity of the optimal solution after generating fluctuations in the iteration, which shows that it has strong stability, and the convergence accuracy is better than the original algorithm, so = 5 is selected in this paper.
1 3 Dynamic spiral updating whale optimization algorithm for…

Steps to improve the algorithm
Aiming at overcoming the shortcomings of traditional WOA, a whale optimization algorithm based on elite disturbance opposition-based learning and dynamic spiral updating is proposed in this paper.First, the whale population close to the target is selected by the opposition-based learning, and the elite individual is perturbed by the random disturbed to avoid falling into the local optimal solution.Then a dynamic spiral updating strategy is adopted to make the spiral updating mechanism change with the number of iterations to ensure the convergence accuracy of the algorithm.The flowchart of population updating mechanism of the improved WOA is shown in Fig. 4.

Parameter adjustment and analysis
Parameter selection is usually a key factor in optimization algorithms.In the process of parameter adjustment, the convergence speed and accuracy of the algorithm should be considered simultaneously.In WOA, the number of population and the number of iterations are mainly considered.If the number of population is too small, the algorithm will fall into the local optimal solution, while if the number of population is too large, the convergence speed will be affected.However, if the number of iterations is too small, the convergence accuracy will not reach the standard, whereas if the number is too large, a lot of time will be wasted.Figure 5 shows the As can be seen from Fig. 5, when the population size is too small or the number of iterations is too small, the convergence accuracy effect is not good.When N = 100 and Max_iter = 1000 , the whale optimization algorithm has the best effect, which ensures both the convergence accuracy and the convergence speed.Therefore, N = 100 and Max_iter = 1000 are selected in this paper.

Complexity analysis
The complexity of an algorithm can be analyzed in two terms of time complexity and space complexity.The space complexity is related to the amount of memory occupied by the algorithm, and the time complexity is related to the length of the iteration of the algorithm.Define the complexity of the algorithm to solve the problem as F. The complexity time complexity of the original algorithm is O(N * D * Max_iter * F) .The introduced elite disturbance opposition-based learn- ing strategy and dynamic spiral updating strategy, which does not increase the complexity of the algorithm.Therefore, compared to the original algorithm, the proposed OWOA algorithm has no change in time complexity.Furthermore, as the proposed algorithm does not add variables, the space complexity of the algorithm does not increase.

Parameter settings
Set the population size as 100, D = 30 dimensions, and the maximum number of iterations is 1000.The experimental environment of this paper is Windows 10 system with 16 G memory and MATLAB R2019a.
Table 1 summarizes the parameter settings of these four algorithms.These parameters are within the range recommended by the developer, which provides the best performance for each algorithm.
Among the 12 benchmark test functions, f1-f5 are unimodal functions, which only have global optimal and are suitable for evaluating the local search ability and convergence speed of the algorithm.f6-f9 are multimodal functions with a large number of local optimums, which are suitable for evaluating the ability of the algorithm to jump out of local optimums and avoid premature convergence.f10-f12 are multichannel low-dimensional functions with a small number of local minima.The different types of benchmark functions are described in Table 2.
In order to ensure the fairness and rationality of the experiment, these six optimization algorithms were run independently for 30 times, and their mean values and mean square deviations were recorded and compared.Table 3 shows the mean value and standard deviation of each algorithm after 30 experiments.Mark the data with the best experimental results in red, and the data with the second best experimental results in blue.Figure 6 is the convergence accuracy curve of the algorithm corresponding to each function.
It can be seen from Table 3 that compared with WOA, MFO, SCA, GOA and OBCWOA algorithms, OWOA algorithm shows better results in 12 test functions.Therefore, the algorithm has good experimental results in the global solution.
For the multimodal function f6, the functions OWOA, WOA, SCA and OBC-WOA all reach the optimal values, while MFO and GOA get the poor values.Although the multimodal functions f7, f8 and f9 do not reach the optimal value numerically, compared with the traditional WOA, the improved OWOA algorithm has higher accuracy and significantly improved its performance.Therefore, the OWOA algorithm proposed in this paper also has a good ability to jump out of the local optimal solution.
For multichannel low-dimensional functions f10, f11 and f12, the mean value and standard deviation of the improved OWOA algorithm are better than the other five optimization algorithms, which indicates that the proposed algorithm outperforms other comparative algorithms, especially when compared to the original algorithm on multichannel low-dimensional functions.
Dynamic spiral updating whale optimization algorithm for… In addition, the optimization time of the proposed algorithm is not significantly different from the original algorithm, indicating that the time complexity of the algorithm is essentially unchanged.However, the proposed algorithm achieves more satisfactory results on these 12 basis functions, indicating that the improvements are effective.
In summary, the proposed OWOA algorithm, due to the introduction of the elite disturbance opposition-based learning strategy and dynamic spiral updating [ − 5.12, 5.12] 0  Dynamic spiral updating whale optimization algorithm for… strategy, results in a greater improvement in convergence accuracy, especially when compared with the original algorithm.
Figure 6 shows the convergence curves of OWOA algorithm, WOA, MFO, SCA, GOA and OBCWOA on the 30-dimensional test function.It can be seen from the figure that OWOA has obvious advantages in functions f1, f2, f3, f6, f7 and f10, the convergence curve drops faster than other algorithms, and the convergence accuracy is also improved obviously.For functions f4, f8 and f9, MFO algorithm can reach the optimal value, but the convergence speed of WOA is obviously improved after improvement.For function f5, it can be seen from the figure that OWOA curve  finally converges after many twists and turns, which shows that there are cases of jumping out of the local optimal solution in the iterative process, and the convergence accuracy is higher than other algorithms.For functions f11 and f12, convergence speed and convergence accuracy are very close.To sum up, the improved whale optimization algorithm (OWOA) has better stability and stronger ability to jump out of local optimum.

Analysis of CEC2014 experimental results
In order to further illustrate the efficiency of the improved OWOA algorithm, experimental verification is performed on 10 dimensions of CEC2014 [66] test functions, and different types of CEC 2014 benchmark test functions are described in Table 4.
Comparing OWOA algorithm with WOA, MFO, SCA, GOA and OBCWOA algorithm, the number of iterations is set to 1000, and the population size is set to 100.Table 6 shows the average and standard deviation of each algorithm after repeating 30 experiments.Mark the data with the best experimental results in red and the data with the second best experimental results in blue.
Table 6 shows that OWOA has obtained the best average value in functions C2, C4, C5, C7, C11, C12, C14, C16, C18, C20, C23, C26, C27 and C28.Among the functions C1, C3, C10, C13, C15, C17, C19, C21 and C22, the algorithm OWOA achieved the second best in average value, and all of them were superior to the traditional WOA.The OWOA algorithm proposed in this paper has improved the convergence speed of the algorithm on single-peaked functions, enhanced the ability of the algorithm to jump out of the local optimum in multipeaked functions and improved the overall performance in other functions due to the introduction of a learning strategy based on elite perturbation oppositionbased learning strategy and the dynamic spiral update strategy.Generally speaking, the improved OWOA algorithm has strong competitiveness compared with other algorithms and can solve complex optimization problems later.

Analysis and discussion of experimental results of CEC2017 test set
In order to verify the effectiveness of the OWOA algorithm in different dimensions, we added comparative experiments of D = 10 , D = 30 and D = 50 in dif- ferent dimensions to the test set CEC2017, and abandoned the GOA algorithm with poor effect and added a new algorithm for comparison, Seagull optimization algorithm (SOA) [67] and Tunicate swarm algorithm (TSA) [68].
CEC2017 test set consists of 30 functions, of which F2 function has been excluded due to instability [69].Therefore, among the 29 test functions, F1 and F3 are unimodal functions, F4 − F10 are multimodal functions, F11 − F20 are hybrid functions, and F21 − F30 are composite functions.
Tables 7, 8 and 9, respectively, show the mean value and standard deviation of each algorithm after repeated 30 experiments for D = 10 , D = 30 and D = 50 .Mark the data with the best experimental results in red, and the data with the second best experimental results in blue.

Dynamic spiral updating whale optimization algorithm for…
As can be seen from Tables 7, 8 and 9, OWOA algorithm shows strong advantages in different dimensions.In the case of D = 10 , the experimental data have stronger performance in unimodal functions and hybrid functions, especially in unimodal functions F1 − F3 , OWOA adopts elite disturbance opposition-based learning mechanism, which makes the algorithm have a certain improvement in convergence speed.In the case of D = 30 , the performance of the experimental data in the multimodal functions are gradually enhanced, which show that the convergence accuracy of OWOA algorithm is improved after adding the dynamic spiral updating strategy.In the case of D = 50 , it can be seen that OWOA algo- rithm has strong advantages in unimodal function, multimodal function, hybrid function and composite function.To sum up, the elite disturbance oppositionbased learning and dynamic spiral updating strategy proposed in OWOA algorithm can effectively improve the performance of the algorithm, and with the increase of dimensions, the effectiveness of OWOA algorithm gradually increases.

Constraints on the OPF problem
In this paper, the proposed algorithm is applied to the optimal power flow calculation problem.Optimal power flow calculations are usually based on objective functions such as minimum operating cost, maximum stability or minimum pollution, given a defined grid structure and load, voltage magnitude, transformer tap limits, shunt reactive power compensation limits, etc. (model specific values see Sect.5.3).The preconditions can be expressed as equation and inequality constraints Eqs. ( 15)- (20) in the model.This paper presents a comparative study with four objective functions, as shown in Sect.5.3.1.The mathematical modeling can be expressed by the following mathematical Eq. ( 14).
where x is the control variable, which usually includes the active power of the generator, the terminal voltage, the transformer ratio and the reactive power compensation capacity.y is the state variable, including PQ node voltage, generator reactive power, etc. f is the objective function, such as generation cost, network loss, etc. g is the constraint of the nodal tidal equation.h represents inequality constraints, such as generation power constraint and voltage magnitude constraint.
In the process of calculating the OPF, the most basic should obey the active and reactive power balance so that a number of unknown quantities can be calculated.The expressions are given in Eqs. ( 15) and ( 16). ( 14) where N is the total number of nodes; P G i is the active input of node i; Q G i is the reactive input of node i; P D i is the active load of node i; Q D i is the reactive load of nodei; V i and V j are the voltages of nodes i and j; and G i j and B i j are the conduction and susceptance between nodes i and j.
The inequality constraints of the OPF problem are mainly determined by the design of the electrical equipment itself as well as the practical application process to make it more user-friendly, which mainly include generator constraint, transformer constraint, shunt capacitor compensator constraint and safety constraint.They are represented by Eqs. ( 17), ( 18), ( 19) and (20). where indicate the upper voltage limit, the upper active power output limit and the upper reactive power output limit of the generator node i.
and V lower G i are the lower voltage limit, the lower active power limit and the lower reactive power limit of the generator node i. NG indicates the number of generators.
Dynamic spiral updating whale optimization algorithm for…

Steps of OWOA algorithm for solve the OPF
The OWOA algorithm solves for the optimal tide in the following steps: Step 1 Power system initialization.Enter the node and line parameters of the system, the active output of the generator, the node voltage amplitude, the transformer variation ratio and upper and lower power limits of the reactive power compensator.
Step 2 The nonlinear optimal tidal planning problem with inequality constraints is transformed into an unconstrained planning problem as shown in Eq. ( 21); the equation constraint satisfies the basic tidal equation.
Step 3 The algorithm is initialized by setting the number of iterations is 300 and the number of populations is 30.The dimension D of the algorithm is set according to the number of control variables and the upper and lower bounds are set.
Step 4 The proposed dynamic spiral updating strategy is used in the search, surround prey phase, as in Eqs.(1), ( 2), ( 9), ( 10) and ( 13).The population position matrix is updated through continuous iterations, the fitness value is calculated each time and the optimal solution is selected.Step 5 In the process of iteration, the global optimum of the four objective functions is obtained for the optimal solution of each iteration and by comparing the fitness values before and after the search.
Step 6 Outputs the specific results for each control variable at the global optimum.

Simulation of OPF problem
Figure 7 shows the electrical wiring diagram for the IEEE 30-bus test system.Six generators are installed on buses 1, 2, 5, 8, 11 and 13 and four transformers on lines 6-9, 6-10, 4-12 and 28-27.The branch, bus and generator data were find from MATPOWER [70].The minimum and maximum limits for transformer taps were adjusted to 0.9 and 1.1 p.u.The lower and upper limits for shunt VAR compensation were 0.0 and 0.05 p.u.For all generator buses, the lower and upper voltage limits were adjusted to 0.95 and 1.1 p.u, respectively.In the experiment, the number of iterations was 300 and the population size was 30.

Case-1 Cost minimization with quadratic cost function
The main focus of this paper is an economic problem, specifically the minimization of generator costs for electricity production.The total generator cost is represented by a single objective function, as shown in Eq. ( 21): where a i , b i and c i denote the generator cost coefficients (specific data can be obtained from the literature [71]).

Case-2 Emission minimization
Given that air pollution is a severe problem and thermal power generation is the primary source, the power generation industry must prioritize the reduction of sulfides and nitrides emissions.The modeling of these emissions can be expressed as Eq. ( 22).where Et is the total emissions (t/h) and A i , B i , C i , D i and E i are the emissions from the generators (specific data can be obtained from the literature [71]).

Case-3 Cost minimization with quadratic cost function
In reality, generating units often use multiple fuels, with coal, oil and natural gas being the most common.These different fuels result in varying costs for generating electricity, which is why the cost equation for such a unit is described by a segmented cost function, as shown in Eq. ( 23): where a ik , b ik and c ik stand for cost coefficients (specific data can be obtained from the literature [71]).
Case-4 Cost minimization with quadratic cost function This section discusses the design of node voltages on the load bus and the objective of cost minimization.These two objectives can be combined by using an appropriate weighting factor.In this case, we have chosen a weighting of = 1000.The specific expression for the objective function is shown in Eq. ( 24):

Simulation results
In this section, we test the performance of the improved algorithm with the standard IEEE 30-bus test system and compare it with the original algorithm, GSA [14] and ABC [15].The data are shown in Table 5.
Table 5 shows the comparative results of the four algorithms for the four cases cost minimization with quadratic cost function, emission minimization, cost minimization with piecewise cost function and enhancement of voltage profile along with cost minimization, respectively.The proposed OWOA algorithm achieves optimal values in Case-2, Case-3 and Case-4 and sub-optimal values in Case-1, which indicates that the proposed OWOA algorithm is competitive in solving practical OPF problems.The ability of the OWOA algorithm to jump out of the local optimum is improved compared to the original algorithm.The superior performance of the search capability compared to other algorithms demonstrates the feasibility of the proposed OWOA algorithm in solving the OPF problem.
From Table 5, Case-1 represents the relationship between fuel cost ($∕h) and generation capacity (MW) based on Eq. ( 21), approximated by a quadratic function, where is the total cost of generation ($∕h) .The proposed algorithm increases by 1.78 $∕h compared to GSA but decreases by 1.34 $∕h compared to the original algorithm.Case-2 represents the case where the least pollutants are produced by a generator based on the 22 formula.Case-3 represents the relationship between fuel cost ($∕h) and generation capacity (MW) based on Eq. ( 23), approximated as a segmented function.Case-4 represents the simultaneous minimization of fuel  24).Several other cases were optimal, with reductions of 0.002, 4.65 and 0.092, respectively.OPF is a practical problem in a power system with a large number of control parameters, inequalities and nonlinear constraints.As can be seen from Table 5, the proposed algorithm achieves optimality in several cases, except for the case where it achieves sub-optimality in Case-1, which indicates that the ability of the proposed algorithm to jump out of the local optimum is improved with the introduction of the elite perturbation opposition-based learning strategy and the dynamic spiral update strategy and in addition has some significance in practical applications.

Conclusion
To address the shortcomings of the traditional WOA of slow convergence and easy falling into local optima, an improved algorithm OWOA combining elite perturbation opposition learning and dynamic spiral update is proposed.First, the opposition-based learning method is used to make the whale population move toward the optimal solution, which improves the stability of convergence to the global optimal solution.Perturbation learning is applied to the optimal whale to avoid falling into a local optimum.Then the dynamic spiral update method is used instead of the logarithmic spiral search method to improve the optimization accuracy of the algorithm.At the end, using 12 test functions, the CEC2014 test function and an engineering application (OPF), the results show that OWOA has certain advantages over other optimization algorithms, especially compared to the traditional WOA.
However, OWOA has some problems, such as it can only find optimal values in certain functions and other performance metrics are unstable.In future, we can continue to improve the WOA in the next step, so as to better solve the problems of slow convergence and low accuracy of the traditional WOA, in addition to the problem of algorithm stability also needs to be further improved.Applying the WOA to multi-objective optimization and constrained optimization is also an important task.
Appendix A: Experimental data about CEC2014 and CEC2017

Fig. 2
Fig. 2 Individual position update after opposition-based learning

C18 Hybrid function 2 (
the lower and upper limits of the transformer ratio at the branch i, NT indicates the number of transformer block adjustments.where Q upper C i and Q lower C i indicate the maximum and minimum reactive power compensation capacity that can be injected by node i and NC indicates the number of reactive power supply.where V upper B i and V lower B i denote the upper and lower limits of the voltage at PQ node i. S upper L i denotes the maximum transmission capacity allowed for line i, NBindicates the number of reactive power supply and NLindicates the number of cable routes.

Fig. 7
Fig. 7 Single line diagram of IEEE 30-bus test system

|
+ b ik * P Gi + c ik * P 2 Gi ) + Ng ∑ i=3 (a i + b i * P Gi + c i * P 2 Gi ) V i − 1.0 |costs and voltage deviations based on Eq. (

Table 2
Unconstrained test functions

Table 3
Comparison of optimization results of six algorithms on 12 test functions Fig. 6 Convergence curves of 12 test functions 1 3

Table 4
Test function of CEC2014

Table 7
Comparison of optimization results between OWOA and other algorithms on the CEC2017 test set (D=10)

Table 8
Comparison of optimization results between OWOA and other algorithms on the CEC2017 test set (D=30)

Table 9
Comparison of optimization results between OWOA and other algorithms on the CEC2017 test set (D = 50) Dynamic spiral updating whale optimization algorithm for…