EWOA-OPF: Effective Whale Optimization Algorithm to Solve Optimal Power Flow Problem

The optimal power flow (OPF) is a vital tool for optimizing the control parameters of a power system by considering the desired objective functions subject to system constraints. Metaheuristic algorithms have been proven to be well-suited for solving complex optimization problems. The whale optimization algorithm (WOA) is one of the well-regarded metaheuristics that is widely used to solve different optimization problems. Despite the use of WOA in different fields of application as OPF, its effectiveness is decreased as the dimension size of the test system is increased. Therefore, in this paper, an effective whale optimization algorithm for solving optimal power flow problems (EWOA-OPF) is proposed. The main goal of this enhancement is to improve the exploration ability and maintain a proper balance between the exploration and exploitation of the canonical WOA. In the proposed algorithm, the movement strategy of whales is enhanced by introducing two new movement strategies: (1) encircling the prey using Levy motion and (2) searching for prey using Brownian motion that cooperate with canonical bubble-net attacking. To validate the proposed EWOA-OPF algorithm, a comparison among six well-known optimization algorithms is established to solve the OPF problem. All algorithms are used to optimize singleand multi-objective functions of the OPF under the system constraints. Standard IEEE 6-bus, IEEE 14-bus, IEEE 30-bus, and IEEE 118-bus test systems are used to evaluate the proposed EWOA-OPF and comparative algorithms for solving the OPF problem in diverse power system scale sizes. The comparison of results proves that the EWOA-OPF is able to solve singleand multi-objective OPF problems with better solutions than other comparative algorithms.


Introduction
Over the past decades, metaheuristic algorithms (MAs) have become more prevalent in solving optimization problems in various fields of industry and science [1]. The widespread usage of MAs for solving different optimization problems verified their ability for solving complex problems with difficulties such as non-linear constraints, multi-modality
Swarm intelligence algorithms mimic the collective behavior of creatures in nature such as birds, fishes, wolves, and ants. The main principle of these algorithms is to deal with a population of particles that can interact with each other. Eberhart and Kennedy proposed the particle swarm optimization (PSO) [11] method, which simulates bird flocks' foraging and navigation behavior. It is derived from basic laws of interaction amongst birds, which prefer to retain their flight direction considering their current direction, the local best position gained so far, and the global best position that the swarm has discovered thus far. The PSO algorithm concurrently directs the particles to the best optimum solutions by each individual and the swarm. The krill herd (KH) [13] algorithm is a population-based metaheuristic algorithm based on the krill individual herding behavior modeling. The KH algorithm repeats the three motions and searches in the same direction until it finds the optimum answer. Other krill-induced movements, foraging activity, and random diffusion all have an impact on the position. Another well-known swarm intelligence algorithm is the grey wolf optimizer (GWO) [14], which is inspired by grey wolves in nature that look for the best approach to pursue prey. In nature, the GWO algorithm uses the same method, following the pack hierarchy to organize the wolves' pack's various responsibilities. GWO divides pack members into four divisions depending on each wolf's involvement in the hunting process. The four groups are alpha, beta, delta, and omega, with alpha being the finest hunting solution yet discovered. The salp swarm algorithm (SSA) [16] is another recent optimizer that is based on natural salp swarm behavior. As a result, it creates and develops a set of random individuals within the problem's search space. Following that, the chain's leader and followers must update their location vectors. The leader salp will assault in the direction of a food supply, while the rest of the salps can advance towards it. The Aquila optimizer (AO) [18] is one of the latest proposed algorithms in the swarm intelligence category that simulates the prey-catching behavior of Aquila in nature. In AO, four methods were used to emulate this behavior consisting of selecting the search space by a high soar with a vertical stoop, exploring within a diverge search space by contour flight with short glide attack, exploiting within a converge search space by low flight with slow descent attack, and swooping by walk and grab prey.
Regardless of the nature of the algorithm, the majority of the metaheuristics, especially the population-based algorithms, have two standard contrary criteria in the search process: the exploration of the search space and the exploitation of the gained best solutions. In exploitation, the promising regions are explored more thoroughly for generating similar solutions to improve the previously obtained solution. In exploration, non-explored regions must be visited to be sure that all regions of the search space are evenly explored and that the search is not only limited to a reduced number of regions. Excessive exploitation decreases diversity and leads to premature convergence, whereas excessive exploration leads to gradual convergence [83]. Thus, metaheuristic algorithms try to balance between the exploration and exploitation that has a crucial impact on the performance of the algorithm and the gained solution [84]. Furthermore, real-world problems require achieving several objectives that are in conflict with one another such as minimizing risks, maximizing reliability, and minimizing cost. There is only one objective function to be optimized and only one global solution to be found in a single-objective problem. However, in multiobjective problems, as there is no single best solution, the aim is to find a set of solutions representing the trade-offs among the different objectives [85].
Although metaheuristic algorithms have several merits over classical optimization algorithms, such as the simple structure, independence to the problem, the gradient-free nature, and finding near-global solutions [14], they may encounter premature convergence, local optima entrapment, and the loss of diversity. In this regard, improved variants of these algorithms have been proposed, each of which adapted to tackle such weaknesses [86][87][88]. Additionally, the significant growth of metaheuristic algorithms has resulted in a trend of solving OPF problems by using population-based metaheuristic algorithms. In the literature, the OPF was solved by using black hole (BO) [89], teaching-learning based optimization (TLBO) [90] algorithms, the krill herd (KH) algorithm [91], the equilibrium optimizer (EO) algorithm [92], and the slime mould algorithm (SMA) [93]. Additionally, some studies used the modified and enhanced version of the canonical swarm intelligence algorithms for solving OPF with different test systems such as the modified shuffle frog leaping algorithm (MSLFA) for multi-objective optimal power flow [94] that added a mutation strategy to overcome the problem of being trapped in local optima.
Another work proposed an improved grey wolf optimizer (I-GWO) [95] to improve the GWO search strategy with a dimension learning-based hunting search strategy to deal with exploration and exploitation imbalances and premature convergence weaknesses. In [96], quasi-oppositional teaching-learning based optimization (QOTLBO) proposed to improve the convergence speed and quality of obtained solutions by using quasi-oppositional based learning (QOBL). In [97], particle swarm optimization with an aging leader and challengers (ALC-PSO) algorithm was applied to solve the OPF problem by using the concept of the leader's age and lifespan. The aging mechanism can avoid the premature convergence of PSO and result in better convergence. An improved artificial bee colony optimization algorithm was based on orthogonal learning (IABC) [98] to adjust exploration and exploitation. In [99], the modified sine-cosine algorithm (MSCA) was aimed to reduce the computational time with sufficient improvement in finding the optimal solution and feasibility. The MSCA benefits from using Levy flights cooperated by the strategy of the canonical sine-cosine algorithm to avoid local optima. In the high-performance social spider optimization algorithm (NISSO) [100], the canonical SSO algorithm was modified by using two new movement strategies that resulted in faster convergence to the optimal solution and finding better solutions in comparison to comparative algorithms.

OPF Problem Formulation and Objective Functions
The optimal power flow (OPF) is regarded as a fundamental tool for the effective design and operation of the power networks. The main aim of OPF is to find the optimum values of control variables for different objective functions while satisfying the system equality and inequality constraints within the permitted boundaries. The mathematical formulation and description of OPF single-and multi-objective functions are presented in detail as follows.

OPF Problem Formulation
The OPF is a non-linear and non-convex optimization problem that aims to find the best set of the power system's control variables and satisfy the desired objective function. The OPF problem is mathematically formulated [101] as shown in Equation (1): where F is the objective function to be minimized, x is the vector of dependent (state) variables, u is the vector of independent (control) variables, and g and h represent equality and inequality constraints, respectively. Accordingly, vector x, which consists of slack bus power P G1 , load bus voltage V L , generator reactive power output Q G , and transmission line loading S l, is presented by Equation (2), where NL, NG, and NTL are the number of load buses, number of generators, and number of transmission lines, respectively. u is the vector of control variables, consisting of generator active power outputs P G (except at the slack bus P G1 ), generator voltages V G , transformer tap settings T, and shunt VAR compensations Q C , which is presented as Equation (3), where NT and NC are the number of the regulating transformer and VAR compensator units, respectively.

OPF Objective Functions
In this paper, two objectives are considered to deal with the OPF problem: an economical issue, the total fuel cost minimization of power generation, and a technical issue, which is a voltage profile improvement.
Case 1: Total fuel cost minimization.
The total fuel cost minimization is considered as the single-objective function for the OPF problem, which is a quadratic function of real power generations of generators in a system. The minimization of the overall fuel cost of a power generator is considered and calculated by Equation (4), The purpose of this multi-objective function is to minimize the fuel cost and improve the voltage profile by minimizing the load bus voltage deviations from 1.0 p.u. The objective function is calculated as shown in Equation (5), where the weighting factor W v = 200. Notice that Equation (5) merges two objectives with a weight in a single equation to properly handle the multi-objective problem.

The Whale Optimization Algorithm (WOA)
The whale optimization algorithm (WOA) [15] is inspired by the hunting behavior used by humpback whales in nature. The humpback whales use the bubble-net hunting technique to encircle and catch their prey that are in groups of small fishes. In WOA, the best whale position is considered as prey position X* and the other whales update their position according to the X*. In WOA, three behaviors of whales are encircling prey, bubble-net attacking (exploitation), and searching for prey (exploration), modeled as in the following definitions.
Encircling prey: The first step in the whales' hunting process is surrounding the prey. Whales can detect the position of the prey and begin to surround them. Therefore, in WOA, the current best whale X* is considered as prey or being close to the prey. All other whales update their position according to the X* by Equations (6) and (7): where t is the iteration counter and D is the calculated distance between the prey X * (t) and the whale X(t). A and C are coefficient vectors that are calculated by Equations (8) and (9): where the value of a is linearly decreased from 2 to 0 over the course of the iterations, and r is a random number in [0, 1]. Bubble-net attacking: Whales spin around the prey within a shrinking encircling technique or spiral updating position. This behavior is modeled by Equation (10), where p is a random number in [0,1] and shows the probability of updating whales' positions based on a shrinking encircling technique (if p < 0.5) or a spiral updating position (if p > 0.5). A is a random value in [−a, a] where a is linearly decreased from 2 to 0 over the course of the iterations. In the spiral updating position, D' represents the distance between the current whale X and the prey X*, b represents a constant used to define the spiral movement shape, and l is a random number in [−1, 1]. Searching for prey: In order to find new prey, whales conduct a global search through the search space. This is completed when the absolute value of vector A value is greater or equal to 1, and it will be an exploration, else it will be exploitation. In the exploration phase, the whales update their position concerning a random whale X rand instead of the best whale X*, which is calculated using Equations (11) and (12): where X rand is a randomly selected whale from the current population.

Effective Whale Optimization Algorithm to Solve Optimal Power Flow (EWOA-OPF)
While WOA is easy to implement and applicable for solving a wide range of optimization problems, it has insufficient performance to solve complex problems. The algorithm suffers from premature convergence to local optima and an insufficient balance between exploration and exploitation. Such problems lead to inadequate performance of the WOA when used to solve complex problems. Motivated by these considerations, an enhanced version of the WOA algorithm named the effective whale optimization algorithm (EWOA-OPF) is proposed for solving the optimal power flow problem. Since maintaining an appropriate balance between exploration and exploitation can prevent premature convergence and control the global search ability of the algorithm, the canonical WOA's strategies, encircling the prey and searching for prey, are replaced by two new movement strategies. This modification aims to enhance the exploitative and explorative capabilities of WOA which leads to obtaining accurate solutions when solving problems. In the following, the proposed EWOA-OPF is explained in detail.
Initializing step: N whales are randomly generated and distributed in the search space within the predefined range [LB, UB] using Equation (13).
where X ij is the position of the i-th whale in the j-th dimension, LB j and UB j are the lower and upper bound of the j-th dimension, and the rand is a uniformly distributed random variable between 0 and 1, respectively. The fitness value of whale X i in the t-th iteration is calculated by the fitness function f (X i (t)), and the whale with better fitness is considered as X*, which is the best solution obtained. Encircling prey using Levy motion: Whales update their position by considering the position of X* and the Levy-based pace scale PS L by Equation (14), Electronics 2021, 10, 2975 where X j *(t) is the j-th dimension of the best whale, C is a linearly decreased coefficient from 1 to 0 over the course of iterations, and PS L i,j is the j-th dimension of the i-th row of pace scale calculated by Equation (15).
M L i,j is a randomly generated number based on Levy movement, which is calculated by Equation (16), where u and v follow the Gaussian distribution which is calculated by Equations (17) and (18), where Γ is a Gamma function and β = 1.5. Bubble-net attacking: Whales spin around the prey within a shrinking encircling technique and spiral updating position. This behavior is as same as canonical WOA and calculated by Equations (19) and (20), where D' is the distance between the current whale X and the prey X*, b represents a constant used to define the spiral movement shape by the whales, and l is a random number in [−1, 1]. Searching for prey using Brownian motion: Whales update their position by considering the position of X* and the Brownian-based pace scale PS B by Equation (21), where A is a decreasing coefficient calculated by Equation (8), rand is a random number, and PS B is Brownian-based pace scale which is calculated by Equation (22), where M B i,j is a random number based on normal distribution representing the Brownian motion. After determining the new position of the whales, their fitness is calculated and the prey position X* is updated. The search process is iterated until the predefined number of iterations (MaxIter) is reached. The pseudo-code of the proposed EWOA-OPF is shown in Algorithm 1. For i = 1: N 7: Caculating coefficients a, A, C, and l.

Experimental Evaluation
In this section, the performance evaluation of the proposed EWOA-OPF was assessed over two cases based on three IEEE bus systems. The obtained results are compared with four state-of-the-art algorithms consisting of particle swarm optimization (PSO) [11], krill herd (KH) [13], the grey wolf optimizer (GWO) [14], the whale optimization algorithm (WOA) [15], and two recently proposed algorithms, the salp swarm algorithm (SSA) [16] and the Aquila optimizer (AO) [18] algorithm.

Experimental Environment
The performance of the proposed EWOA-OPF was evaluated using the IEEE 6-bus, IEEE 14-bus, IEEE 30-bus, and IEEE 118-bus test systems and the gained results were compared with six state-of-the-art and recently proposed swarm intelligence algorithms. The proposed algorithm and all the comparative algorithms implemented in MATLA R2018a and all the experiments were run on a CPU, Intel Core(TM) i7-6500U 2.50 GHz and 16.00 GB RAM. The parameters of the comparative algorithms in all experiments were the same as the recommended settings in their original works, as shown in Table 1.

Algorithms
Parameters Value The algorithms were run 20 times in all experiments, and the population size (N) and the maximum number of iterations (MaxIter) were set to 50 and 200, respectively. The experimental results are reported based on the optimal values of decision variables (DVs) and objective variables for each bus system in Tables 2-9. Moreover, the last three rows of each table indicate the total cost ($/h), power losses (MW), and voltage deviation (p.u.) of each algorithm for Case 1 and Case 2.

IEEE 6-Bus Test System
This test system contains seven control variables: two generator voltages, two transformers tap changing, two VAR shunt injection capacitances, and one active generator power of the PV bus, as shown in Figure 1.

Experimental Environment
The performance of the proposed EWOA-OPF was evaluated using the IEEE 6-bus, IEEE 14-bus, IEEE 30-bus, and IEEE 118-bus test systems and the gained results were compared with six state-of-the-art and recently proposed swarm intelligence algorithms. The proposed algorithm and all the comparative algorithms implemented in MATLA R2018a and all the experiments were run on a CPU, Intel Core(TM) i7-6500U 2.50GHz and 16.00 GB RAM. The parameters of the comparative algorithms in all experiments were the same as the recommended settings in their original works, as shown in Table 1.

Algorithms
Parameters Value PSO c1 = c2 = 2 KH Vf = 0.02, D max = 0.005, N max = 0.01 GWO a was linearly decreased from 2 to 0 WOA a = [20] The algorithms were run 20 times in all experiments, and the population size (N) and the maximum number of iterations (MaxIter) were set to 50 and 200, respectively. The experimental results are reported based on the optimal values of decision variables (DVs) and objective variables for each bus system in Tables 2-9. Moreover, the last three rows of each table indicate the total cost ($/h), power losses (MW), and voltage deviation (p.u.) of each algorithm for Case 1 and Case 2.

IEEE 6-Bus Test System
This test system contains seven control variables: two generator voltages, two transformers tap changing, two VAR shunt injection capacitances, and one active generator power of the PV bus, as shown in Figure 1. The obtained optimal value of design variables and the optimized value of the total fuel cost of the system under Case 1 and Case 2 are shown in Tables 2 and 3. Additionally, the convergence curves of the obtained fitness for all algorithms are illustrated in Figure  2. It is seen that the total fuel cost decreased to 403.536 ($/h) by WOA and EWOA-OPF. It The obtained optimal value of design variables and the optimized value of the total fuel cost of the system under Case 1 and Case 2 are shown in Tables 2 and 3. Additionally, the convergence curves of the obtained fitness for all algorithms are illustrated in Figure 2. It is seen that the total fuel cost decreased to 403.536 ($/h) by WOA and EWOA-OPF. It can be seen that the OPF results in Case 2 obtained by both WOA and EWOA-OPF are better than other algorithms in terms of the total cost.

IEEE 14-Bus Test System
The IEEE 14-bus test system is shown in Figure 3, and contains five generation (PV) buses, while nine of those are defined as load (PQ) buses. The detailed results of the objective functions, active and reactive power outputs of generator units, transmission losses, and convergence times of the system are given in Tables 4 and 5 on Case 1 and Case 2 to make an effective comparison. Furthermore, the convergence of the obtained

IEEE 14-Bus Test System
The IEEE 14-bus test system is shown in Figure 3, and contains five generation (PV) buses, while nine of those are defined as load (PQ) buses. The detailed results of the objective functions, active and reactive power outputs of generator units, transmission losses, and convergence times of the system are given in Tables 4 and 5 on Case 1 and Case 2 to make an effective comparison. Furthermore, the convergence of the obtained fitness of OPF for EWOA-OPF and comparative algorithms on the IEEE 14 bus standard test system over the curse of iterations is shown in Figure 4. The objective function values for EWOA-OPF are reported as 8079.957 and 8083.308 ($/h). It is evident that the EWOA-OPF provides smaller values in terms of the total generation cost of generator units than those found by other comparative algorithms.

IEEE 30-Bus Test System
The single line diagram of the IEEE 30-bus test system is shown in Figure 5. The system consists of six generators at buses 1, 2, 5, 8, 11, and 13, four transformers in lines 6-9, 6-10, 4-12, and 27-28, and nine shunt VAR compensation buses. The lower and upper bounds of the transformer tap are set to 0.9 and 1.1 p.u. The minimum and maximum values of the shunt VAR compensations are 0.0 and 0.05 p.u. The lower and upper limit values of the voltages for all generator buses are set to be 0.95 and 1.1 p.u. The optimal settings of control variables, total fuel cost, power loss, and voltage deviations for Cases 1 and 2 are shown in Tables 6 and 7. The variation of the gained fitness are illustrated in Figure 6 for all algorithms under both cases. In Case 1, it is observed that the system total fuel cost is greatly reduced as an initial state to 799.210 ($/h) using EWOA-OPF. In Case 2, a comparison demonstrates the superiority of EWOA-OPF to achieve a better solution with a total fuel cost of 805.545 ($/h).

IEEE 30-Bus Test System
The single line diagram of the IEEE 30-bus test system is shown in Figure 5.  Figure 6 for all algorithms under both cases. In Case 1, it is observed that the system total fuel cost is greatly reduced as an initial state to 799.210 ($/h) using EWOA-OPF. In Case 2, a comparison demonstrates the superiority of EWOA-OPF to achieve a better solution with a total fuel cost of 805.545 ($/h).        Figure 6. Curves for all test systems on Cases 1 and 2. Figure 6. Curves for all test systems on Cases 1 and 2.

IEEE 118-Bus Test System
The IEEE 118-bus test system is used to evaluate the efficiency of the proposed EWOA-OPF in solving a larger power system. As shown in Figure 7, this bus test system has 54 generators, 186 branches, 9 transformers, 2 reactors, and 12 capacitors. It has 129 control variables considered for 54 generator active powers and bus voltages, 9 transformer tap settings, and 12 shunt capacitor reactive power injections. All buses have voltage limitations between 0.94 and 1.06 p.u. Within the range of 0.90-1.10 p.u., the transformer tap settings are evaluated. Shunt capacitors have available reactive powers ranging from 0 to 30 MVAR. Because of having too many design variables for Cases 1 and 2 in this experiment, the detailed results are shown in Tables A1 and A2 in the Appendix A and the final results  are compared in Tables 8 and 9. The convergence curves of the obtained fitness for all algorithms is also illustrated in Figure 8. that the proposed EWOA-OPF has the ability to converge to a better-quality solution. The total fuel cost obtained by EWOA-OPF is reduced to 142756.67 $/h, which is less than the canonical WOA and other comparative algorithms. Table 9 compares solutions found by EWOA-OPF and other algorithms for Case 2. In this case, numerical results confirm the superiority of EWOA-OPF where it reaches the minimum fuel cost 140175.80 $/h. The final results demonstrate that the proposed EWOA-OPF algorithm can be effectively used to solve both single-and multi-objective large-scale OPF problems.

Conclusions and Future Work
This paper proposes an effective whale optimization algorithm for solving optimal power flow problems (EWOA-OPF). The OPF is a non-linear and non-convex problem that is considered a vital tool for the effective design and operation of power systems. Despite the applicability of the whale optimization algorithm (WOA) in solving complex In Case 1 of this experiment, the comparison of results tabulated in Table 8 reveals that the proposed EWOA-OPF has the ability to converge to a better-quality solution. The total fuel cost obtained by EWOA-OPF is reduced to 142,756.67 $/h, which is less than the canonical WOA and other comparative algorithms. Table 9 compares solutions found by EWOA-OPF and other algorithms for Case 2. In this case, numerical results confirm the superiority of EWOA-OPF where it reaches the minimum fuel cost 140,175.80 $/h. The final results demonstrate that the proposed EWOA-OPF algorithm can be effectively used to solve both single-and multi-objective large-scale OPF problems.

Conclusions and Future Work
This paper proposes an effective whale optimization algorithm for solving optimal power flow problems (EWOA-OPF). The OPF is a non-linear and non-convex problem that is considered a vital tool for the effective design and operation of power systems. Despite the applicability of the whale optimization algorithm (WOA) in solving complex problems, its performance is degraded when the dimension size of the OPF's test system is increased. In this regard, the movement strategy of whales is modified by introducing two new movement strategies: (1) encircling the prey using Levy motion and (2) searching for prey using Brownian motion that cooperate with canonical bubble-net attacking. The main purpose of EWOA-OPF is to improve explorative capability and maintain a proper balance between the exploration and exploitation of the canonical WOA. The effectiveness and scalability of the proposed EWOA-OPF algorithm were experimentally evaluated using standard IEEE 6-bus, IEEE 14-bus, IEEE 30-bus, and IEEE 118-bus test systems to optimize single-and multi-objective functions of the OPF under the system constraints. To validate the gained results, a comparison among six well-known optimization algorithms is established. The comparison of results proves that the EWOA-OPF can solve single-and multi-objective OPF problems with better solutions than other comparative algorithms as well as large-dimensional OPF problems. In future work, the EWOA-OPF can be used to solve many-objective (more than three objective functions) OPF problems.

Conflicts of Interest:
The authors declare no conflict of interest.

Appendix A
The detailed results for Cases 1 and 2 on the IEEE-118 bus test system including the decision variables (DVs) value and the final results of the total fuel cost (cost), power losses (ploss), and voltage deviation (VD) are shown in Tables A1 and A2.