Comparison of Particle Swarm and Whale Optimization Algorithms for Optimal Power Flow Solution

DOI : 10.17577/IJERTV11IS120005

Download Full-Text PDF Cite this Publication

Text Only Version

Comparison of Particle Swarm and Whale Optimization Algorithms for Optimal Power Flow Solution

Ahmed S. Menesy

dept. of Electrical Engineering King Fahd University of Petroleum

& Minerals Dhahran, Saudi Arabia

  1. O. Habiballah

    dept. of Electrical Engineering King Fahd University of Petroleum

    & Minerals Dhahran, Saudi Arabia

    Hamdy M. Sultan

    dept. of Electrical Engineering Minia University

    Minia, Egypt

    Abstract Optimal power flow (OPF) solution is considered a vital tool for sensitive planning, energy management and operation analysis of the electrical power systems. The analysis of OPF seeks to accurately estimate the best solution of the power system nonlinear algebraic equations while satisfying the constraints of power system operation. In this paper, two reliable metaheuristic optimization techniques, namely, particle swarm optimization (PSO) and whale optimization algorithm (WOA), are used to solve the problem of OPF in electrical power systems. Minimizing the total cost of generation units is considered the main cost function in this study. The presented OPF formulation includes precise generator constraints such as active and reactive power generation limits, as well as the impacts of valve point loading. MATLAB software is used to implement the simulation process. To validate the accuracy of the proposed algorithms, PSO and WOA algorithms are tested on the standard system which called IEEE 30-bus system. The results of simulation obtained by PSO and WOA techniques are comprehensively compared with each other. According to the simulation results, the proposed WOA technique has the optimal performance compared with PSO technique in terms of locating lower-cost values and it has successfully proved itself as a robust competitor to PSO for tackling the problem of OPF solution.

    Keywords optimal power flow; Optimization; PSO; whale optimization algorithm; Metaheuristic; valve point loading


      The OPF is a nonlinear and difficult optimization issue in power systems that is utilized for the processes of planning and operation of the power system [1]. OPF is critical for enhancing and improving the efficiency of existing power systems, and efficient development of the future systems [2] . OPF is an essential tool for improving the electrical efficiency of power system, voltage distribution, stability indicator, and reducing gas emissions especially for thermal plants [3]. OPF manages both discrete and continuous control variables for maximizing a certain objective function while meeting the operational restrictions, namely equality and inequality constraints [4, 5]. The goal objective of OPF issue might be to reduce overall cost of generating units or to decrease transmission line (TL) losses [6]. The generator active powers, except on the slack bus, the generator bus voltages, transformer tap ratios, and shunt VAR compensation units are all control variables in the OPF problem. The equality constraints are represented as power balance equations,

      meanwhile the inequality constraints can be represented by the bounds of the control variables and state variables.

      Many conventional techniques are utilized to solve the OPF problem, including linear programming [7, 8], nonlinear programming [9], quadratic programming [10], the interior point method [11], lambda iteration approach, gradient technique [12] and Newton-based strategies [13]. Despite these methods are successfully developed to solve the studied OPF issue and their dependability, each of these algorithms has various limitations, including algorithmic complexity, unsettled convergence, piecewise quadratic cost approximation, inability to handle nonlinear functions, and falling in the local optima. It should be noted that the shortcomings of previous approaches are caused by linearizing the objective function and system restrictions around an operating point utilizing derivatives and gradients. These limitations are overcome by meta-heuristic optimization algorithms, which avoid linearizing the objective function by selecting a set of random solutions, which are then updated around the best solution in an iterative process until the algorithm converges and the optimal solution is obtained. Metaheuristic optimization approaches offer the advantage of producing better results and consuming less computational time.

      The widely used meta-heuristic optimization methods to solve the problem of optimal power flow are as genetic algorithm (GA) [14, 15], gravitational search algorithm (GSA) [16], shuffle frog leaping algorithm (SFLA) [17], differential evolution (DE) algorithm [18], artificial bee colony (ABC) [19, 20], particle swarm optimization (PSO) [21, 22], differential search algorithm (DSA) [23], salp swarm algorithm (SSA) [24], firefly algorithm (FFA) [25], and krill herd algorithm (KHA) [26]. These approaches are adaptable and capable of locating global solutions by directing solutions toward different sections of the search space through rapid and abrupt changes. In [27], based on newton second order (NSO), GA is combined with active power flow (APF) and produced a new hybrid technique called (HGA) due to GA's slow convergence. In [28], a grey wolf optimizer (GWO) based on an adaptive operator and random mutation is devised to solve the OPF issue. According to the "no free lunch" theory [29], which states that no single optimization strategy can solve all problems, this motivates researchers to develop new optimization strategies.

      The main purpose of this study is to apply two different optimization methods called PSO and WOA, for solving the

      problem of OPF. The two proposed techniques connect


      i gi i gi i i gi gi


      Newton Raphson-based Power Flow (PF) equations to

      determine the lowest cost of generation units. The losses of



      (a P2 b P

      • ci) d sin(e (Pmin P ))

        TLs and trends of convergence of the IEEE 30-bus system are

        compared after the optimization process end. In addition, the optimal WOA results obtained in this study are compared to the PSO algorithm results. However, the following are the primary contributions of this paper:

        • Minimizing the total cost of generation units is the main cost function of this study.

        • The PSO and WOA methods are applied to optimally solve the OPF problem.

        • A comparison between the two well-known optimization methods (PSO and WOA) is constructed to validate their efficiency in solving the studied optimization problem of OPF solution.

        • Standard IEEE 30-bus test system is applied to test and confirm the reliability and strength of the developed algorithms in solving the OPF problem.

        • The obtained results prove the robustness and reliability of WOA in solving the OPF problem compared with PSO.

      The other sections of the paper are structured as the followings: The OPF mathematical formulation is represented in Section 2. The developed optimization methods are explained in Section 3. Section 4 provides the simulations performed and the best results gained. Section 5 includes the paper's conclusion as well as the anticipated future work.


      Fuel Cost ($/MWh)

      where, ai, bi, and ci represent the cost coefficients of ith generator, Ng represents the number of generators, and di, ei represent the fuel cost coefficients of the ith generator with the influence of valve-loading point.

      Output Power (MW)

      Fig. 1. Fuel cost curves with and ithout the influence of valve-point.

      The state variables represent the dependent variables x which characterize a certain state of power system. The state variables are represented by the equation, which may be written as follows:

      The primary goal of the optimal power flow tool is to solve

      x V


      , P ,Q


      , S …..S


      the main equations of power flow problem to assign the control

      L1 LNPQ G1 G1

      GNPV TL1


      variables values and achieve the optimal solutions for the chosen objective function. Consequently, the resulting solutions are constrained by both kinds of constraints. The goal of the OPF issue in this study is to find the lowest generation cost of generator units that fulfill equality and inequality requirements. The inequality constraints describe the system's operating and control boundaries, whereas the equality constraints represent the traditional electric PF equations.

      The studied problem of the optimal power flow is

      where PG1 represent the active power of slack bus, VL

      denotes the load bus voltage, QG represents the generator reactive power, STL represents the transmission line (TL) loading, NPQ represents the number of load buses, NPV represents the generation buses number, and NTL denotes the TLs number in the power system.

      The control variables represent the independent variables u that can satisfy the power flow equations. The OPF control variables can be formulated as the following,

      mathematically formulated as a nonlinear optimization problem with two different types of constraints , namely,

      u VG1…..VGNG , PG2…..PGNG ,T1…..TNT


      equality and inequality restrictions as follows [30], Minimize:

      F (x, u)

      Subject to:


      where, VG represents the generator voltage bus, PG represent

      the real output power of generator, T denotes the tap setting of transformers, NG represents the generators number, and NT is the transformers number.

      1. Constraints of Operation

        g j (x,u) 0

        wj (x,u) 0

        j=1, 2, ., m (2)

        j=1, 2, ., p (3)

        There are two types of optimal power flow constraints: equality constraints and inequality constraints. The equality and inequality constraints are as follows:

        where, F (x, u) is the studied cost function, x denotes the state

        variables, u is the control variables, g (x, u) denotes the equality constraints, w (x, u) denotes the inequality constraints, m and p denote the equality and inequality constraints number,


        1. Equality Constraints: The equations that balance active and reactive power flow are known as equality constraints of OPF, and they are as follows:


          1. Objective Function

            The fuel cost functions of some generating units are nonlinear and convex, as seen in Fig. 1. This is due to the ripples caused by the opening procedures of steam turbine control valves. The objective function of the studied OPF

            PGi PLi Vi Vj (Gij cos(i j ) Bij sin(i j ))



            QGi QLi Vi Vj (Gij cos(i j ) Bij sin(i j ))




            problem, including the influence of valve loading point, is formulated as follows,

            where, PGi denotes the generator real power, PLi represents the load real power, QGi represents the generator reactive power,

            and QLi indicates the load reactive power. Gij represents the transfer conductance and Bij is the susceptance between any

            The velocity of ith individual at (k+1) iteration is computed as follows,

            two buses.

        2. Inequality Constraints: The inequality constraints are

      V k 1 wV k c rand

      i i 1 1

      ( pbestk xk )

      i i


      classified into generator constraints, transformer constraints

      and security constraints. The inequality constraints are


      i i

      (Gbestk xk )

      formulated as follows,

      where, K represents the number of iterations. V k and xk is

      i i

      min max


      PGi PGi

      i=1, 2, ., NPV (9)

      the velocity and position of particle i at iteration k, respectively. c1 and c2 represent the coefficients of

      min max


      QGi QGi

      i=1, 2, ., NPV (10)

      acceleration. w is the inertia weight parameter. rand1 and rand2

      are random numbers between 0 and 1. The flow chart of PSO

      min max


      VGi VGi

      i=1, 2, ., NPV (11)

      for the optimal power flow solution is shown in Fig. 2.

      1. WOA

      i i


      T min T T max


      i=1, 2, ., NT (12)

      WOA is based on whale hunting and encirclement techniques. This is known as the bubble-net feeding strategy.

      STLi STLi

      min max

      i=1, 2, ., NTL (13)

      Humpback whales seek to hunt small fish at the surface by forming a bubble net around the prey as it climbs along a circle


      VLi VLi

      i=1, 2, ., NPQ (14)

      path. The WOA algorithm assumes that the target prey is the

      A. PSO


      current best candidate solution. After the top search agent is

      identified, the remaining search agents will aim to improve their positions in relation to the best search agent. The

      Particle swarm optimization (PSO) is a technique

      developed by Eberhart, Kennedy, and Shi [31, 32]. PSO is a population-based approach that simulates the social ties of flocks of birds and fish education. The velocity of particles governs their movement, which is represented as a vector with magnitude and direction. The particles organize their route for each generation based on their best position (local best) and the location of the best particle (global best) of the whole population. According to this viewpoint, particles' stochastic properties are enhanced, resulting in better solutions and faster convergence to global optima. PSO works similarly to the other evolution strategies. The population size in the search space is represented by the number of particles. Particles began their movement at random. Every particle has a fitness value determined by the fitness function of the issue to be solved.

      PSO is determined by the values of key parameters. The best parameter values are determined by the type of problem under study [33]. It is critical to strike a balance between exploration and exploitation based on the algorithm's goal. PSO is governed by the following parameters: total number of particles, total number of iterations, inertia weight (w), and social behavior coefficients (c1 and c2). For given values of c1, c2, convergence of the cost function is guaranteed [34].

      The equations (15) and (160) represent a particle's position and velocity vectors in a N dimensional search space:

      mathematical formulation of this phenomenon is as follows [35]:

      = |. () ()| (21)

      ( + 1) = () . (22)

      where t is the current iteration, and represent coecient vectors,

      represents the position vector of the best solution obtained so far,

      denotes the position vector, and . is an element-by-element multiplication if there is a better solution must be updated in each individual iteration. The vectors A and can be computed as,

      A = 2a · r a (23)

      = 2. r (24)

      where, a is linearly decreased from 2 to 0 through the iterations number and r is an arbitrary vector in [0, 1].

      Xi (xi1,……, xin )

      Vi (vi1,……,vin )



      where, xin and vin represent the particle ith position and velocity in a search space with n particles, respectively. A particle's optimal position can be described as (17) and the particle with the best position among all the other particles in the population is represented in (18).

      pbest (x x


      best best

      i1 ,……, in

      Gbest (x x


      best best

      i i1 ,……, in



      Each particle's position and velocity are updated every (k+1) steps as follows:

      k 1

      k k 1

      Xi Xi





      Initialize the population of the whales xi(i = 1, 2, .., n) consider the boundaries ub and lb and maximum no. of iterations

      Random initial population within feasible range


      Run NR for every particle

      Calculate each search agent fitness

      Record the violation values of voltage and line


      F=the best search agent


      if j>max_iter

      Is population

      count over?


      Output the best position




      if p<0.5

      Calculate the objective function


      if (A >=1) ?





      Record the best and global best positions

      Update the position of the current search agent

      Update the position of the current search agent

      Update the position of the current search agent

      Update the velocity and position of


      Run NR for every updated particle

      if i<n



      Evaluate the objective function for

      updated population


      update whales depending on

      the upper and lower bounds

      Is stopping criteria




      Fig. 2. The flow chart of PSO for the OPF problem.

      The flow chart of WOA for the OPF problem is presented in Fig. 3.

      Fig. 3. The flow chart of WOA for the OPF problem.


      In this work, Newton Raphson based WOA is applied to standard IEEE 30-bus systems to find the optimal solution for the objective function. The proposed WOA has been compared with conventional PSO algorithm. The control variables for the proposed WOA technique are summarized as follows, Maximum number of iterations are 500 iterations while the number of search agents is adjusted to 15. while for the PSO algorithm the following control variables are utilized in the optimization process; number of iterations = 500, number of particles = 15, wmin = 0.4, wmax = 0.9, c1 = c2 = 1.4. The cost coefficients of generation units, active and reactive power bound for IEEE 30 bus test systems are listed in Table I [27].

      P1 (MW)



      P2 (MW)



      P5 (MW)



      P8 (MW)



      P11 (MW)



      P13 (MW)



      VG1 (pu)



      VG2 (pu)



      VG5 (pu)



      VG8 (pu)



      VG11 (pu)


















      Plosses (MW)



      Cost ($/h)




      Bu s















































































      The IEEE 30-bus test system is presented in Fig. 4. In this system, while 6 buses of the system are chosen as generation buses (PV), the remaining 21 buses are load buses (PQ). Total load demand of the system is defined as (PD) 283.40 MW.

      Fig. 4. Standard IEEE 30-bus test system.

      The convergence curves of the proposed WOA and the conventional PSO algorithms are presented in Fig. 5. Moreover, the obtained results of the OF, active and reactive power generation, power losses in the lines of the IEEE 30 bus standard system are shown in Table II. The results obtained from the proposed WOA are compared with that of the conventional PSO algorithm. The objective function is found to be 805.805 $/h and 812.755 $/h for WOA and PSO, respectively. The transmission line losses obtained are 9.371 MW and 8.291 MW, for WOA and PSO, respectively. It is clearly observed that the proposed WOA method gives better results over the PSO in terms of the generation cost of the generating units. The main objective in this work is the total generation cost, therefore the system losses are not taken into consideration as an objective function. Therefore, it can be concluded that the losses of the studied system are in the acceptable margins provided in the current study.

      Fig. 5. Convergence curves of the OPF solution for standard IEEE 30-bus system.

      IEEE 30-Bus





      In this work, PSO and WOA optimization techniques are applied to solve the OPF problem. The objective function is tested on IEEE 30-bus system. The objective function has been restricted with equality and inequality constraints to demonstrate the reliability and robustness of OPF solutions of the proposed algorithms. The results show that WOA can find a better OPF solutions compared with the conventional technique called PSO. The objective function is found to be 805.805 $/h and 812.755 $/h for WOA and PSO, respectively. The comparison between the convergence trends of WOA and PSO techniques proves the dominance of WOA to achieve the OPF solution with fast convergence with fewer number of iterations. In the future work, the WOA technique can be used to tackle various optimization problems in power systems and other different disciplines.


      The authors acknowledge the support of King Fahd University of Petroleum and Minerals in conducting this research work.


      [1] A. Mukherjee and V. Mukherjee, "Solution of optimal power flow using chaotic krill herd algorithm," Chaos, Solitons & Fractals, vol. 78, pp. 10-21, 2015.

      [2] Y. Brar and J. . Randhawa, "Optimal power flow using power world simulator," in 2010 ieee electrical power & energy conference, 2010, pp. 1-6: IEEE.

      [3] M. Ghasemi, S. Ghavidel, M. M. Ghanbarian, M. Gharibzadeh, and A.

      1. Vahed, "Multi-objective optimal power flow considering the cost, emission, voltage deviation and power losses using multi-objective modified imperialist competitive algorithm," Energy, vol. 78, pp. 276- 289, 2014.

[4] A.-F. Attia, R. A. El Sehiemy, and H. M. Hasanien, "Optimal power flow solution in power systems using a novel Sine-Cosine algorithm," International Journal of Electrical Power & Energy Systems, vol. 99, pp. 331-343, 2018.

[5] K. Lee, Y. Park, and J. Ortiz, "A united approach to optimal real and reactive power dispatch," IEEE Transactions on power Apparatus and systems, no. 5, pp. 1147-1153, 1985.

[6] B. E. Turkay and R. I. Cabadag, "Optimal power flow solution using particle swarm optimization algorithm," in Eurocon 2013, 2013, pp. 1418-1424: IEEE.

[7] R. Mota-Palomino and V. Quintana, "Sparse reactive power scheduling by a penalty function-linear programming technique," IEEE Transactions on Power Systems, vol. 1, no. 3, pp. 31-39, 1986.

[8] T. A. Al-Muhawesh and I. S. Qamber, "The established mega watt linear programming-based optimal power flow model applied to the real power 56-bus system in eastern province of Saudi Arabia," Energy, vol. 33, no. 1, pp. 12-21, 2008.

[9] H. Habibollahzadeh, G.-X. Luo, and A. Semlyen, "Hydrothermal optimal power flow based on a combined linear and nonlinear programming methodology," IEEE Transactions on Power Systems,

vol. 4, no. 2, pp. 530-537, 1989.

[10] R. Burchett, H. Happ, and D. Vierath, "Quadratically convergent optimal power flow," IEEE Transactions on Power Apparatus and Systems, no. 11, pp. 3267-3275, 1984.

[11] X. Yan and V. H. Quintana, "Improving an interior-point-based OPF by dynamic adjustments of step sizes and tolerances," IEEE Transactions on Power Systems, vol. 14, no. 2, pp. 709-717, 1999.

[12] M. AlRashidi and M. El-Hawary, "Hybrid particle swarm optimization approach for solving the discrete OPF problem considering the valve loading effects," IEEE transactions on power systems, vol. 22, no. 4, pp. 2030-2038, 2007.

[13] D. I. Sun, B. Ashley, B. Brewer, A. Hughes, and W. F. Tinney, "Optimal power flow by Newton approach," IEEE Transactions on Power Apparatus and systems, no. 10, pp. 2864-2880, 1984.

[14] M. Osman, M. A. Abo-Sinna, and A. Mousa, "A solution to the optimal power flow using genetic algorithm," Applied mathematics and computation, vol. 155, no. 2, pp. 391-405, 2004.

[15] T. Chung and Y. Li, "A hybrid GA approach for OPF with consideration of FACTS devices," IEEE power engineering Review, vol. 21, no. 2, pp. 47-50, 2001.

[16] S. Duman, U. Güvenç, Y. Sönmez, and N. Yörükeren, "Optimal power flow using gravitational search algorithm," Energy conversion and management, vol. 59, pp. 86-95, 2012.

[17] S. Duman, "Gü venç U, Sö nmez Y, Yö rü keren N. Optimal power flow using gravitational search algorithm," Energy Conversion and Management, vol. 59, pp. 86-95, 2012.

[18] A. Abou El Ela, M. Abido, and S. Spea, "Optimal power flow using differential evolution algorithm," Electric Power Systems Research, vol. 80, no. 7, pp. 878-885, 2010.

[19] F. S. Abu-Mouti and M. E. El-Hawary, "Overview of Artificial Bee Colony (ABC) algorithm and its applications," in 2012 IEEE International Systems Conference SysCon 2012, 2012, pp. 1-6: IEEE.

[20] M. R. Adaryani and A. Karami, "Artificial bee colony algorithm for solving multi-objective optimal power flow problem," International Journal of Electrical Power & Energy Systems, vol. 53, pp. 219-230, 2013.

[21] M. A. Abido, "Optimal power flow using particle swarm optimization," International Journal of Electrical Power & Energy Systems, vol. 24, no. 7, pp. 563-571, 2002.

[22] G. Chen and J. Yang, "A new particle swarm optimization solution to optimal reactive power flow problems," in 2009 Asia-Pacific Power

and Energy Engineering Conference, 2009, pp. 1-4: IEEE.

[23] H. Pulluri, R. Naresh, and V. Sharma, "An enhanced self-adaptive differential evolution based solution methodology for multiobjective optimal power flow," Applied Soft Computing, vol. 54, pp. 229-245, 2017.

[24] S. Kamel, M. Ebeed, and F. Jurado, "An improved version of salp swarm algorithm for solving optimal power flow problem," Soft Computing, vol. 25, no. 5, pp. 4027-4052, 2021.

[25] G. E. Manoranjitham and A. Shunmugalatha, "Retracted: application of firefly algorithm on optimal power flow control incorporating simplified impedance UPFC model," ed: Elsevier, 2015.

[26] P. K. Roy and C. Paul, "Optimal power flow using krill herd algorithm," International Transactions on Electrical Energy Systems, vol. 25, no. 8, pp. 1397-1419, 2015.

[27] T. N. Malik, A. ul Asar, M. F. Wyne, and S. Akhtar, "A new hybrid approach for the solution of nonconvex economic dispatch problem with valve-point effects," Electric Power Systems Research, vol. 80, no. 9, pp. 1128-1136, 2010.

[28] M. Abdo, S. Kamel, M. Ebeed, J. Yu, and F. Jurado, "Solving non- smooth optimal power flow problems using a developed grey wolf optimizer," Energies, vol. 11, no. 7, p. 1692, 2018.

[29] D. H. Wolpert and W. G. Macready, "No free lunch theorems for optimization," IEEE transactions on evolutionary computation, vol. 1, no. 1, pp. 67-82, 1997.

[30] A. J. Wood and F. Bruce, "Wollenberg.Power Generation, Operation and Control," John Wily & Sons, Inc, USA, 1996.

[31] J. Kennedy and R. Eberhart, "Particle swarm optimization," in Proceedings of ICNN'95-international conference on neural networks, 1995, vol. 4, pp. 1942-1948: IEEE.

[32] Y. Shi and R. Eberhart, "A modified particle swarm optimizer," in 1998 IEEE international conference on evolutionary computation proceedings. IEEE world congress on computational intelligence (Cat. No. 98TH8360), 1998, pp. 69-73: IEEE.

[33] E.-G. Talbi, Metaheuristics: from design to implementation. John Wiley

& Sons, 2009.

[34] F. V. D. Bergh, "An analysis of particle swarm optimizers," Unpublished doctoral dissertation, University of Pretoria, South Africa, 2001.

[35] S. Mirjalili and A. Lewis, "The whale optimization algorithm,"

Advances in engineering software, vol. 95, pp. 51-67, 2016.