Optimal power flow using hybrid firefly and particle swarm optimization algorithm

In this paper, a novel, effective meta-heuristic, population-based Hybrid Firefly Particle Swarm Optimization (HFPSO) algorithm is applied to solve different non-linear and convex optimal power flow (OPF) problems. The HFPSO algorithm is a hybridization of the Firefly Optimization (FFO) and the Particle Swarm Optimization (PSO) technique, to enhance the exploration, exploitation strategies, and to speed up the convergence rate. In this work, five objective functions of OPF problems are studied to prove the strength of the proposed method: total generation cost minimization, voltage profile improvement, voltage stability enhancement, the transmission lines active power loss reductions, and the transmission lines reactive power loss reductions. The particular fitness function is chosen as a single objective based on control parameters. The proposed HFPSO technique is coded using MATLAB software and its effectiveness is tested on the standard IEEE 30-bus test system. The obtained results of the proposed algorithm are compared to simulated results of the original Particle Swarm Optimization (PSO) method and the present state-of-the-art optimization techniques. The comparison of optimum solutions reveals that the recommended method can generate optimum, feasible, global solutions with fast convergence and can also deal with the challenges and complexities of various OPF problems.


Introduction
Electric services companies are repeatedly working for generation scheduling and reasonable operational state to optimize the generating cost based on effective security limits and power transfer confinements. The optimal power flow (OPF) is an essential and complex optimization technique in electrical power system operations to adjust and optimize the control settings with various constraints sit [1] [2] [3] [4]. The earliest, various conventional optimization techniques have been used to solve the OPF problems. Main objective of the OPF problem to obtain the optimize scheduling of particular control variables based on limitation of system constraints sit [5] [6] [7]. These constraints consists of equality and inequality constraints. Equality constrains includes power flow or balance equations, whereas the inequality constrains sphere the dependent and decision variables within its limits. a1111111111 a1111111111 a1111111111 a1111111111 a1111111111 Newly, single and multiple objective OPF techniques have been developed to obtain optimized solutions based on technical and economic interests. Many developers applied conventional and recent optimization techniques to deal with the OPF problems. there conventional optimization algorithms are: non-linear programming sit [8] [9], decomposition algorithms sit [10], the Newton algorithm sit [11], and quadratic programming sit [12] to solve the OPF problems. Linearization of constraints and specific objective function are main drawback that effects the final solution. Many limitations of the conventional OPF are mentioned in sit [13]. Complete review of the mentioned classical optimization methods is presented in sit [14]. New techniques with critical aspects and new advance are suggested for OPF problems sit [15].
Recently, Notable progress in the field of digital computation, artificial intelligence algorithms combined with nature-inspired, meta-heuristic based optimization methods are used to help electrical system based on economic concern. Numerous heuristic-based optimization algorithms have been proposed and applied to handle OPF problems, such as genetic algorithm (GA) sit [16] [17] [18]. In addition, many methods were developed to improve global performance and convergence of GA method, such as adaptive genetic algorithms with adjusting population size (AGA-POP) sit [19] and enhanced GA sit [19].
Newly developed search-based optimization algorithms are applied for OPF problems, like particle swarm optimization (PSO) method sit [2], differential evolutionary technique sit [20] [21]), improved colliding bodies optimization method sit [22], improved PSO algorithm sit [23], biogeography-based optimization technique sit [24], imperialist competitive method sit [25], grey wolf optimizer sit [26], hybrid algorithm of PSO and GSA algorithm sit [27], differential search technique sit [28], gravitational search method (GSM) sit [29] [30] [31], multiphase search optimization technique sit [32] [33], fuzzy-based hybrid PSO algorithm sit [34], chaotic self-adaptive differential harmony search method sit [35], black-hole-based optimization technique sit [36], harmony search technique sit [37], artificial bee colony method (4), Jaya optimization technique sit [38], teaching-learning-optimization algorithm sit [39], biogeography-based optimization (BBO) sit [40], differential evolution (DE) sit [41], artificial bee colony (ABC) algorithm sit [42], distributed algorithm (DA) sit [43], and the Firefly algorithm (FA) sit [44]. An analysis of a non-deterministic algorithm, which is applied to solve OPF, is mentioned in sit [45]. Unfortunately, some of these methods are not effective for global optimization of various OPF problems, through a simultaneous calculation of various points in the search space. Such population-based, meta-heuristics algorithms are more efficient, compared to trajectory techniques, to find local optima. On the other hand, the trajectory techniques are good at describing global optima. Hence, hybridization of these meta-heuristic methods can use the benefits of both methods and can deal with more complex and challenging problems because of their robustness and flexibility sit [46].
The key goals of the hybrid meta-heuristic particle swarm optimization algorithm modifications are to create equilibrium between exploration and exploitation and to escape from premature results. Additionally, hybridization can improve the PSO's capability and eliminate its weakness sit [47]. The main advantages of the PSO method are fast convergence, less calculating resource necessities, and easy implementation. But when populations are near to each other sit [48], this method suffers from being confined in local optima and by slow convergence. The Firefly optimization method is also a nature-inspired optimization method that copies the behavior of fireflies. It has some specific benefits over the PSO algorithm sit [49]. One of the benefits is that it does not have local or global best variables, so this helps it from being caught up in local optima. The method also doesn't have a velocity vector, so it can prevent the problems that are created by the variations in velocity sit [50].
One of the recently developed hybrid meta-heuristic, population-based optimization methods entitled Hybrid Firefly Particle Swarm Optimization (HFPSO), developed by Aydilek İB sit [51]. Some real engineering problems have been tested on the HFPSO algorithm and the results have been compared to present-day state-of-the-art optimization algorithms. The overall results confirmed that the HFPSO method has the power to provide promising results that were not explored before sit [51]. The use of the HFPSO method to solve the OPF problems had not been studied. Hence, applying a robust optimization method can efficiently overcome the OPF problems.
This article proposed using the Hybrid Firefly Particle Swarm Optimization (HFPSO) method first, to contribute and solve various OPF problems in the power-engineering field. An expanded set of variables is used in the suggested OPF formulations. The set consists of actual power and voltages of generating units, transformer turn ratios, and reactive power of Shunt VAR compensators.
Five single-objective functions are considered in this article to show the efficiency of the proposed method considering optimum results of OPF problems: total generation cost minimization, voltage profile improvement, voltage stability enhancement, active and reactive power transmission loss reduction.
The improved performance is shown by comparing the results of the proposed HFPSO algorithm with the state-of-the-art algorithms chosen from the current literature for OPF problems. The proposed algorithm is also compared with its mother PSO algorithm, from which it is derived. The same single-objective OPF problems were used in the above-mentioned algorithms for the comparison. The standard IEEE 30-bus test scheme is applied to observe, authenticate, and show the effectiveness of the HFPSO algorithm.
The key contributions of this paper are as follows: 1. This work proposes an already developed HFPSO algorithm to tackle the OPF problems.
2. The algorithm is applied to five single-objective functions of OPF problems.
3. Various objective functions of OPF problems are considered, such as total fuel cost minimization, voltage profile improvement, voltage stability enhancement, active and reactive power losses reduction. 4. Results of the proposed algorithm are compared with simulated results of PSO and current literature work. So, these compressions prove supremacy of the algorithm in terms of convergence ratio and optimal results based on OPF problems. 5. Statistical analysis showed that HFPSO algorithm is a robust and reliable optimization method to solve OPF problems.
The rest of this paper is organized as follows: Mathematical formulation of OPF issues is given in Part 2. Part 3, 4, and 5 briefly explain PSO, FOA, and HFPSO algorithms, respectively. Part 6 summarizes application of the proposed HFPSO algorithm to the OPF problems. Results, comparison, and discussion are explained in Part 7. Conclusions about the application of the HFPSO algorithm are mentioned in Part 8.

Problem formulation
Five cases, with five objectives, are considered in this study to verify the efficiency of the proposed HFPSO technique regarding optimum results of OPF problems. The objectives are total fuel cost minimization of the power network, voltage profile improvement, reduction of the active power losses of transmission lines, reduction of reactive power losses of transmission lines and voltage stability enhancement. Fuel cost f 1 of a particular electrical power system is characterized by subsequent functions sit [39]: Where N G represents the number of power generating units and the fuel cost of the i − th power-generating unit is denoted by f i , the quadratic function f i is formulated as follows: Where a i ,b i , and c i are coefficients of fuel price of the i − th power generating unit and P Gi output active power of the i − th generator unit. The bus voltage is one of the key indicators for security and service quality indices sit [41]. To avoid the infeasibility, a double objective function, such as improvement of voltage profile and reduced fuel cost are considered as a singleobjective function in the OPF issue. The objective task f 2 is stated as sit [52]: Where c is used as a weight factor for the stability between the objectives to avoid the dominance of one function over the other. Due to economic reasons, a transmission network of a power system is mandatory to function near its security boundaries. The stability of a power system is one of the very important domains, to limit the bus voltage at every single point below standard working conditions during the load surge. The disturbance leads to changes in the system's configuration. Consequently, an unavoidable voltage collapse accrues sit [39]. Voltage balance of a specific power network can be indicated by using L − index, that is L max sit [53].
Where L a denotes the L max of a − th demand bus and N L is the integer of PQ (demand) buses, the objective function f 3 of the case is represented as follows sit [39]: Active power line transmission losses are a very important factor to optimize in a power network. The objective work f 4 is denoted by the power balance equation in this case sit [36].
Where P i is the active transmission line power loss, P Gi is the active power of a generating unit and P Di the active power of the request (demand) of the i − th load line. The availability of reactive power is an important factor in consideration of the voltage balance margin of a static power network, to reinforce the conduction of active power from the generator to the load. Thus, the optimization of reactive power losses can be stated by the following equation sit [36]: Where Q i is the reactive transmission line power loss, Q Gi is the reactive power of source and Q Di the reactive power of demand of the i − th load line. As aforementioned, OPF provides optimal tuning of the control variables of demand or load to minimize a preset objective task, such as the total cost of a power system or active and reactive transmission line power losses. Most of the OPF detail may be characterized by the standard method sit [14]: Subjected to uðg; hÞ ¼ 0 ð9Þ And zðg; hÞ x2264; 0 ð10Þ Where h denotes the vector of control variables and g denotes the vector of stated variables, x(g, h) states the system's objective function. u(g, h) and z(g, h) indicates the sets of equality and inequality constraints. Also, the dependent h and the independent g variables of the OPF problems are detailed in (11) and (12) separately. The control variable h can be stated as sit [54] [39]: Where P G stands for the active power generation at the PV (generator) buses apart from the swing bus, T represents the tapping ratio of the transformer. V G refers to the voltage value at generator buses, Q C denotes the reactive power injection by shunt capacitor respectively. Moreover, N GG , N TT , and N CC represent the number of generator units, regulating transformer units and shunt capacitor units. The state of an electrical network can be represented by OPF formulations sit [10]. The most common, dependent variables for OPF issue are formulated along these lines sit [54] [39]: Where P Slack shows the active power generation of the swing bus, V L1 denotes the voltage value at PQ or load buses. Q G symbolizes the reactive power of generators, and S ln denotes the line flow and line loading, respectively. Furthermore, N L and N are the integers of PQ buses and power lines, correspondingly. OPF constraints can be categorized into two types: 1) equality and 2) inequality constraints. The equality constraints of the OPF show the physical condition of a power network sit [54] [39]: Where P Gi and Q Gi represent the real and imaginary parts of the creation of a power network, P Di and Q Di are the real and imaginary parts of the network demands on the i − th bus. Moreover, B ij and G ij reflect the susceptance and conductance between the node i and j. δ ij = δ i − δ j denotes a change in voltage angle. N represents the number of buses. More details of power flow formulas are discussed in sit [55].
The inequality constraints, confines the physical devices to certain limits, to assure the security of the power network. Furthermore, active power outputs, reactive power outputs, Shunt VAR compensators, transformer turn ratios, the voltage of all the generator units as well as slack should be limited by their upper and lower limits as formulated sit [39] [41]: Security constraints, such as the voltage values of PQ buses and voltage of transmission line should be limited within the boundaries of its capacity. Which can be formulated as follows sit [36]: Similarly, the inequality constraints of the control variables, like voltage magnitude of PV bus, real and reactive power output at swing bus and generation, and loading of the transmission line can be combined into one objective part in the form of quadratic penalty expressions. Furthermore, a particular penalty factor is multiplied with the square of the control variable and then is added to the objective function sit [36]. Mathematical formula of the penalty function is stated as follows: Where α p ,α v , α q and α s represent the penalty factors, x lim is the boundary of the control variable. If x value crosses the upper limit, then it automatically brings x to the x lim , similarly, if x crosses the lower limit, then it brings to the x lim sit [36]. Limits of the control variable can be expressed mathematically as follows: 3 Particle swarm optimization (PSO) algorithm The particle swarm optimization is a meta-heuristic population-based algorithm originally designed by Kennedy and Eberhart sit [56]. The technique is based on the combined behavior of living organisms such as a swarm of fish or a flock of birds. The PSO algorithm consists of two expressions P best and G best Its position (X) and velocity (V) updates in every iteration.
These parameters can be expressed mathematically as follows: Where w, c 1 , and c 2 are the inertia weight and acceleration coefficients, r 1 and r 2 denotes two random values within the range of [1,0]. Inertia weight is calculated on linearly decreasing order based on number of iterations. Inertia weight can be calculated mathematically as follows sit [57] [58]: The PSO algorithm can be studied in detail at sit [59].

Firefly optimization algorithm (FOA)
The firefly optimization algorithm is based on fireflies. These fireflies emit unique flashing light for their survival sit [49] [60]. The algorithm based on the intensity of flashing light and medium's absorption. As stated by the inverse square law, the light strength decreases from a light source as distance increases. Moreover, the medium between light source and destination also absorbs the light. The method can be studied in more detail with the mathematical formulation in sit [61]

Hybrid firefly and particle swarm optimization (HFPSO) technique
The hybrid firefly and particle swarm optimization has been designed by Ibrahim Berkan Aydilek sit [51]. Hybrid equilibrium is maintained between exploration (localoptima) and exploitation (globaloptima) to take the strengths and advantages of both firefly and particle swarm methods sit [62] [63]. There are no velocity (V) and personal best location (p best ) terms in the firefly algorithm. In a global search, The PSO method offers fast convergence in terms of exploration. Moreover, the firefly algorithm is beneficial in local region search or it gives fine exploitation. The flowchart of the HFPSO method is shown in Fig 1. Initially, input parameters are inserted. Then these parameters are used step by step by both population-based methods. Afterward, constant swarm vectors are initiated in the search space and velocity ranges. Global best (g best ) and individual best (p best ) swarms are mathematically considered and allocated. The calculated values are compared in the final alternation. Moreover, the present location is saved and then new velocity and location are calculated as follows sit [51]: If a particle's fitness value is equal to or better than the preceding global best, then the particle will be picked up by the firefly part according to the Eqs (28) and (29); otherwise, it will be carried by the PSO part according to the Eqs (24) and (25).

Application of the HFPSO method to optimal load flow problems
The subsequent steps show the application procedure of the proposed HFPSO algorithm to deal with the optimal power flow problem.
Step 1 Define the system data, real power limits, reactive power limits, generators' data, state the primary values of real power and the voltage level of generator buses, reactive power of shunt capacitors, and the turn ratio of transformers.
Step 2 Execute the base case power flow. Evaluate the initial values of the objective functions that include the generation cost, voltage profile improvement, voltage stability enhancement, and real and reactive power transmission line loss reduction, by applying Eqs (1), (3), (4), (6), and (7). Step 3 State the i − th goal function f i to evaluate as described in section 2. Define the designed variables (X) and its limits (X min , X max ), initial population (Pop), dimensions (D), maximum iterations (Iteration max ), and algorithm specified parameters(C, w and V).
Step 4 Generate prime random positions of swarm particles (population) within specified limits of controlled variables. The position of the particles are formulated in such a way: Where the control variables and the number of various solutions are denoted by n and m. The estimation of the j − th designed variable X (k,j) and k − th applicant solution can be calculated as follows: Where X ðmaxÞ j and X ðminÞ j are the limits of the j − th designed variables and rand(.) denotes the random number within limits of (0 − 1). For more clarification, the physical components of X (k, j) can be formulated as follow: Step 5 Execute the load flow for every single solution and compute the value of the particular objective function that relates to the solution.
Step 6 Evaluate the fitness value and find the personal best (pbest) and global best (gbest) solutions in the group of calculated values.
Step 7 Examine the improvement in the calculated objective function values in the final iteration as stated by Eq (27).
Step 8 Calculate the dispatch in view of the changed vector of controlled variables. Compute the fresh values of the objective functions. Include the allocated penalty(s) to the goal function, if it violates the limits, according to Eq (22).
Step 9 Compare the goal function f i values. If the values are superior to previous ones, then execute the Eqs (28) and (29); otherwise, use the Eqs (24) and (25), respectively.
Step 10 If the termination standard is achieved, then stop and print the results of the optimal values. Otherwise, come back to step 7.
For more clarification, the flowchart of the suggested application of the HFPSO method to solve optimal load flow is presented in Fig 2.

Results and discussion
Standard IEEE − 30 bus test network is used as a benchmark function for single-objective OPF problems to examine the efficiency of the proposed HFPSO and original PSO algorithms. Both algorithms were initialized with a population of 30 and executed for a maximum iteration of 100. The algorithms are coded and executed in MATLAB R2016asitbib [64] andtheresultsare carriedoutonaPCwith8GBRAManda4GHzIntelCorei7CPU.

IEEE 30-Bus test network
In this research work, the IEEE30 − bus test scheme is applied for the suggested HFPSO and the original PSO algorithms to investigate the effectiveness of the suggested HFPSO method.  ). In addition, the bus data, line data, and generator cost coefficients are detailed in sit [5].
To validate the usefulness and robustness of the proposed method, several cases with diverse goal functions, such as total fuel cost reduction, voltage deviation, voltage profile enhancement L max , real power losses, and reactive power losses have been simulated as follows: 7.1.1 Case 1: Fuel cost minimization. In this section, the minimization of the total fuel cost of generation is considered as a goal function during the execution of the HFPSO and the original PSO method. As we see, from the graphs (a) and (b) in Fig 4, Tables 1 and 2. In addition, the fuel cost value calculated by the proposed method 11.4% decreased from the base value 902.0207 $/h sit [36] to the optimized value of 799.123 $/h with an average execution time of a single repetition of 0.821s. Table 3 illustrates the improved performance of the HFPSO method over the current heuristic optimization methods in terms of an optimum solution. The minimum values achieved by the proposed algorithm are 799.132, as compared to the best value achieved by the MVO algorithm is 799.242. Consequently, these results showed the dominance of the HFPSO heuristic algorithm over the current heuristic methods in terms of optimality and convergence. 7.1.2 Case 2: Voltage profile improvement. The objective of this section is to minimize the total fuel cost ($/h) of the system and to improve the voltage profile simultaneously by   To further verify the effectiveness of the suggested algorithm, the optimum solution of the algorithm is also compared with the various natural-inspired-heuristic algorithms in the present research work, as shown in Table 4. Consequently, optimum solutions to the fuel cost and voltage deviation obtained from the proposed HFPSO technique are better than the original PSO and most of the heuristic methods. It is important to note that the voltage stability index is strengthened by 33.94% from the base value of 0.1723 sit [36] to the optimum value of 0.1144, by the proposed algorithm.

the proposed algorithm
It is evident from Fig 6(b) that the original PSO algorithm acquired an abrupt and very weak convergence ratio. Furthermore, the stability index is reinforced by 32.09% from the base value 0.1723 to the improved value 0.1170. Table 5 compares the results of the previous  population-based methods with the optimal value achieved by the application of the proposed HFPSO technique. It is obvious from Table 5 Table 6 are also matched with the proposed HFPSO method to demonstrate its effectiveness. The minimum value of the proposed algorithm is 2.865, as compared to the global minimum value by MVO algorithm 2.881 from the current literature work.  Tables 1 and 2. The reactive power losses are minimized from the base case value of -4.6066 MVAR sit [36] to the optimal value of -25.204 MVAR by using the HFPSO technique. But the same losses are only reduced to -21.329 MVAR after applying the PSO method. Table 7 compares the optimal values of the same losses of the population-based techniques from the current research work with the proposed method to further validate the usefulness of the proposed algorithm. As we see, the value of the MVO algorithm is -25.038 and is only more optimized as compared to the optimum value of the proposed algorithm.

Statistical results and complexity
To check the robustness of the algorithm, 40 independent trials are performed with initial populations and iterations of 50 and 100. Table 8 shows the best, average, worst, and standard  deviation values. It can be observed from the table that best, the mean, and the worst values are very close to each other and the standard deviation value is the minimum, which concludes the robustness of the HFPSO algorithm. We are interested in computing the computational complexity of the algorithm. More precisely, we compute the temporal (or time) complexity which indicates how the computational time of the algorithm changes with a change in input parameters.
FA and PSO techniques have two inside loops, when passing over the population of size n and one outside loop for t cycles. Both techniques have time complexity of O(n 2 t) in the extreme case. When n is relatively large, we can rank the selecting parameters for all particles by applying sorting technique to decrease the complexity to O(ntlog(n)) sit [66] [67].
These two algorithm have the same order of complexity and are applied in HFPSO simultaneously. The overall complexity in the extreme case (resp. when n is relatively large) of the algorithm is therefore O(MaxFESn 2 t) (resp. O(MaxFESntlog(n))) since the algorithm runs until the maximum number of function evaluations (MaxFES) is reached.

Conclusions
In this article, a novel meta-historic optimization algorithm called HFPSO has been effectively applied to handle the OPF issues in power systems. Equilibrium is maintained between explorations and exploitation to take the advantages of both FOA and PSO methods. Various objective functions of OPF problems were considered: total fuel cost reduction, voltage stability enhancement, voltage profile improvement, active power transmission line loss minimization, and reactive power transmission line loss minimization. A standard IEEE 30-bus test network was tested to authenticate the validity of the HFPSO to solve the OPF problems. The results of the HFPSO algorithm were compared with the standard PSO algorithm and other optimization techniques. Results revealed that optimal solution for each considered case could be presented by the HFPSO algorithm. The new suggested idea of the HFPSO technique led to fast finding of a global solution (that is, supported the exploration and exploitation property). Furthermore, results showed the effectiveness of HFPSO technique concerning the satisfactory convergence rate. Statistical analysis showed that HFPSO algorithm is a robust and reliable optimization method to solve OPF problems. In conclusion, based on the applicability, and performance of the HFPSO, it can be said that this method offers an excellent tool to solve OPF issues of power networks.