Probabilistic Optimal Power Flow Solution Using a Novel Hybrid Metaheuristic and Machine Learning Algorithm

: This paper proposes a novel hybrid optimization technique based on a machine learning (ML) approach and transient search optimization (TSO) to solve the optimal power ﬂow problem. First, the study aims at developing and evaluating the proposed hybrid ML-TSO algorithm. To do so, the optimization technique is implemented to solve the classical optimal power ﬂow problem (OPF), with an objective function formulated to minimize the total generation costs. Second, the hybrid ML-TSO is adapted to solve the probabilistic OPF problem by studying the impact of the unavoidable uncertainty of renewable energy sources (solar photovoltaic and wind turbines) and time-varying load proﬁles on the generation costs. The evaluation of the proposed solution method is examined and validated on IEEE 57-bus and 118-bus standard systems. The simulation results and comparisons conﬁrmed the robustness and applicability of the proposed hybrid ML-TSO algorithm in solving the classical and probabilistic OPF problems. Meanwhile, a signiﬁcant reduction in the generation costs is attained upon the integration of the solar and wind sources into the investigated power systems.


Introduction
The optimal power flow (OPF) problem is classified as a nonlinear optimization problem, and it can be used as a power system tool that aims to determine the best possible values for the decision variables corresponding to the objective functions, satisfying the system constraints [1,2].In the last decade, several approaches to solutions have been presented in the literature to solve the OPF problem, as reviewed in detail in [3,4].In the same vein, different objective functions are studied by the researchers, such as the minimization of the generators' real power costs, daily operational costs, production emission rate, and power losses [5,6].However, an optimal decision for the dispatchable distributed generation units has not yet been achieved [7].Previously, deterministic approaches were used to solve the classical OPF problem without integrating renewable energy sources (RESs) [8].Motivated by the ambitious new climate change policies and regulatory schemes that encourage the diversification of energy sources for energy security and carbon emission mitigation purposes, the high penetration of RESs into grids has been promoted [9,10].However, this results in uncertainties and parameters' statistical changes [11,12].Consequently, the probabilistic power flow (PPF) [13,14] or probabilistic OPF (POPF) problems should be solved from a probabilistic point of view rather than the traditional deterministic approaches, as reviewed in detail by Ramadhani et al. [15] and Prusty and Jena [16,17].The stochastic variations in wind speed and solar irradiance are the motivation for researchers to seek sophisticated statistical models for simulating solar and wind power generation.
The major classifications of PPF problem solution methods are subject to the analytical, approximate, numerical, and heuristic methods classified in the large reviews [18,19].In the analytical method, the equation is obtained between the input and the output and then calculated directly from the input variables.For example, [20] proposed a datadriven approach for probabilistic forecasts of the distribution grid state and PPF solution.
Ref. [21] developed a fast-specialized point estimate method compared to the Monte Carlo simulation (MCS) approach to solve the POPF considering the IEEE-69 bus distribution system with the presence of RESs.Ref. [22] presented a clustering-based analytical method for PPF and interval power flow, in which the uncertainties of load demands and wind power outputs were adequately handled.Ref. [23] introduced a new framework based on the relevance vector machine (RVM) compared to the Newton-Raphson method in order to calculate the PPF and the multivariate distribution of wind speed considering uncertainties associated with multi-dimensional wind turbine (WT) farms studying the correlation between wind speed in different regions.The linearization in the analytical method makes the power flow calculations simpler; however, the accuracy of the PPF problem solution is poor.The approximate method computes the moments of the output using the PDF of the input variables.Despite successfully solving the PPF problem without large-scale computations, the computation burden increases as the number of stochastic variables increases.The third type, the MCS, is a frequently utilized numerical method for the solution of the PPF problem [24].The MCS is a more reliable method to solve the PPF problem.According to the recent review by Skolfield and Escobedo [19], the advancements in metaheuristic algorithms for power system applications have proven to have superior advantages compared to methods in solving the classical and stochastic OPF [18].
Considering the scope of the current study, the review analysis only focuses on the most recent studies on PPF or POPF.For example, [25] presented differential evolutionary particle swarm optimization to solve the multiple objectives (fuel cost, emission, and prohibited operating zones of thermal generators) POPF problem, in which the uncertain solar irradiance and wind speed were simulated via log-normal and Rayleigh probability distributions validated for IEEE 30, 57, and 118 test systems.Ref. [26] proposed a novel barnacles mating optimizer (BMO) to solve the POPF with stochastic solar power to minimize either the generation cost, power loss, voltage deviation, emission minimization, or combined cost and emission of power generations of the IEEE-30 bus system.Similarly, the BMO algorithm was used by [27], while the study incorporated the stochastic small hydro power generator plus wind and solar.Ref. [28] developed a hybrid algorithm that combines the Moth Swarm Algorithm (MSA) and the Gravitational Search Algorithm (GSA) with the Weibull Distribution Function (WDF) used to demonstrate the alternating nature of wind farms integrated with the studied power systems.Moreover, [29] introduced a hybrid methodology based on the differential evolution (AGDE) algorithm and the Fitness-Distance Balance (FDB) method to solve the POPF involving wind and solar energy systems with the IEEE 30-bus test system.Ref. [30] developed a combination of phasor particle swarm optimization and a gravitational search algorithm-namely, a hybrid PPSOGSA algorithm-to calculate the POPF in the case of the IEEE 30-bus system, considering the forecasted WT and PV power generation as uncertain variables.Most recently, Ref. [31] came up with a novel algorithm called the Heap Optimization Algorithm (HEAP) for OPF solutions when solar and wind generators are added.The method was validated with three standard systems (IEEE 30, 57, and 118) and compared with a genetic algorithm.Ref. [32] solved the POPF problem for the modified IEEE-39 bus system while incorporating the uncertainty-related expense incurred due to the stochastic behavior of PV and WT generation, in which the solar radiation and wind speed are modelled using WPD and normal distributions and the uncertainty is simulated using the MCS method.Ref. [33] employed a hybrid Point Estimate Method (PEM)/Ant Lion Optimization (MALO) approach for handling loads, wind, and solar uncertainties and solving the POPF with multiple objectives in the case of a modified IEEE 33-bus islanded microgrid system.Ref. [34] developed a general computationally efficient copula-polynomial chaos expansion to solve PPF, including both linear and nonlinear relations of stochastic wind and PV power generation.Rosenblatt transformation is employed to convert the correlated variables and obtain independent variables, keeping in mind the dependence structure.The systems used are the IEEE 57-and 118-bus systems.Ref. [35] presents the PPF problem solution based on a scaled unscented transformation.The PPF problem is applied on AC/DC networks.It is applied on the modified IEEE 1354-bus (PEGASE) system.Ref. [36] introduces a PPF problem solution including hundreds of uncertain variables.The Zhao's point estimate technique is used when solving the PPF problem.As the number of PPF problem inputs increases, the computational burden increases linearly.
The studied cases are investigated on a modified IEEE 118-bus system.Ref. [37] presents a comparative analysis of Monte Carlo simulation with the Latin Hypercube sampling method and Unscented transformation methods.The comparisons are with the results achieved by the classical Monte Carlo simulation method.The test systems used are the IEEE 14-and 30-bus systems.The results confirm the superiority of the unscented transformation method in terms of speed and reliability over the other two methods.Table 1 summarizes the optimization methods used in this literature.

Ref. No.
Approach Used Advantages Disadvantages [19] Data-driven approach No need for the inversion of the power-flow equations' Jacobian [20] Fast-specialized point estimate method compared to the MCS approach use deep-rooted linear programming commercial solvers [22] New framework based on the RVM compared to the Newton-Raphson method.Guaranteed to yield a solution if one exists [24] Differential evolutionary particle swarm optimization Combines PSO and DE advantages [30] HEAP algorithm Flexible and applicable [32] Hybrid PEM and MALO The distribution curve of a variable is plotted from the obtained moments.The probability of the occurrence of the variable over a specific range can be determined.[33] General computationally efficient copula-polynomial chaos expansion and Rosenblatt transformation.

Faster in terms of computational time than other methods
This paper introduces a new hybridization of the self-organizing maps (SOM) machine learning technique and the transient search optimization (TSO) algorithm.The ML provides the systems with the ability to understand themselves and then estimate unknown outputs [38,39].The SOM technique is considered one of the important artificial neural network (ANN) architectures and features the ability for data visualization processing.It is classified as an unsupervised ANN and is utilized for knowledge extraction in order to determine the best areas with the objective of reducing the exploration field.The TSO algorithm was first proposed in 2020 by Qais, Hasanien, and Alghuwainem [38,40] and was inspired by the transient behavior of the first-and second-order circuits, which include energy storage elements (e.g., inductors and/or capacitors).Using the ML-TSO in opti-mization, one reaches the global solution efficiently without being stuck in a local solution.The main contributions of this paper are as follows:

•
Proposing a novel hybrid optimization approach based on the ML technique and TSO algorithm-namely, ML-TSO-for the optimal solution of classic OPF and POPF problems.

•
Formulating the ML-TSO algorithm to consider the integration of both conventional generators, renewable sources (PV panels and WTs), and time-varying load profiles.

•
Introducing the statistical models for the PV panels and WTs using the Beta and Weibull distribution functions based on real-time historical data.This allows us to calculate the generated electrical power RESs accurately while solving the PPF problem.

•
Validating the robustness of the proposed hybrid algorithm, built in MATLAB software, on the IEEE 57-and 118-bus test systems, with comparative analysis with the most recent literature.
The rest of the paper is organized in the following sections as follows: the problem formulation is illustrated in Section 2; the modeling of WT and PV generation systems is presented in Section 3; Section 4 describes the proposed hybrid ML-TSO algorithm.The simulation results are demonstrated in Section 5; and, finally, the paper is concluded in Section 6.

Problem Formulation
Considering the study objectives, the proposed hybrid ML-TSO optimization algorithm is first implemented to solve the classical OPF, with the objective function formulated to minimize the total generation costs.For a realistic solution of the POPF problem, the algorithm structure is adapted to consider the unavoidable uncertainty of solar PV and WT generators and time-varying load profiles.

The Classical OPF Problem
In this analysis, the OPF is solved for the IEEE 57 and 118 systems with fixed demand and conventional generations only.The objective function as well as the constraints of the problem are explained more in the following subsections.

The Objective Function
Herein, the objective function is formulated as the summation of the total costs of the power generated by the conventional generators.The defined cost function is a quadratic function of the active generated powers in the system.It is mathematically expressed in Equations ( 1) and ( 2) [41].
where J represents the objective function, which is the summation of the power generation cost.NG refers to the number of the conventional generators in the system under study.P Gi,h refers to the power generated from the generator at the bus number 'i' at the hour 'h'.For part 'B' of the problem formulation, this objective function is recalculated hourly with 'h' step = 1.

The System Constraints
The OPF problem has equality constraints on the active and reactive power besides the thermal limits of the transmission lines, as expressed in Equations ( 3), (4), and (8).There are inequality constraints representing the limits on the active and reactive power of each generator, in addition to the bus voltage constraints given in Equations ( 5)-( 7) [41].
where P injk,h and Q injk,h represent the power injection into the bus 'k'.In part 'B' of the problem formulation, when the OPF is repeated hourly, the symbol 'h' refers to the hour at which the simulation is run.The symbols V k,h and V l,h represent the voltages of bus 'k' and bus 'l'.Additionally, the symbol 'h' refers to the hour during the day when the simulation is run.G kl refers to the conductance.Meanwhile, B kl refers to the susceptance.The δ l,h is the voltage angle of bus 'k'.The δ k,h is the voltage angle of bus 'l'.Additionally, 'h' is the simulation hour at part 'B'.
where P Gmin is the minimum allowable active power that can be generated from the generator number 'i'.Meanwhile, P Gmax is the maximum active power that can be generated from the 'i'th generator.Q Gmin is the minimum allowable reactive power of the 'i'th generator.Meanwhile, Q Gmax is the maximum reactive power of the 'i'th generator.P limkl denotes the thermal limit of the transmission line between buses 'k' and 'l'.

OPF with RES Considering the Uncertainty (Probabilistic OPF Problem)
The OPF formulation is adapted to consider the unavoidable uncertainty of solar PV and WT generators and time-varying load profiles [42,43].For an extensive analysis, the four different cases of the OPF problem are constructed and solved (i) case 1: the load is changing hourly through the day, and there is no RESs integrated into the system; (ii) case 2: the load is changing hourly through the day, and PV is integrated into the system; (iii) case 3: the load is changing hourly through the day, and WT is integrated into the system; (iv) case 4: the load is changing hourly through the day, and both solar PV and WT are integrated into the system.All these cases of OPF are studied to investigate how much the generation costs are changed by changing the load and by connecting renewable energy sources to the systems under study.The addition of the RESs increases the model complexity of the OPF problem.
In the later three cases with PV and/or WT integration, the output powers from these RESs are correctly modeled as non-dispatchable.To do so, the generation values from the PV and WT are applied to the system as forecasted values at certain preset buses, and they supply part of the systems' demands.This correspondingly reduces the amount of electrical power generation needed from the conventional generators.The time interval of the repetition of the OPF solution is set to be one hour through a day.At every time interval 'h' (1 h), there are 6 wind speed readings and 60 solar irradiance readings.The PV and the WT are assumed to generate only active power, and there is no reactive power generation.The forecasted power generation from the PV and WT sources are calculated according to probabilistic models of the wind speed and the solar irradiance, besides some technical characteristics of each source [31].
Using the MATLAB software and the built-in MATPOWER library, the classic OPF and POPF are solved.The computer used for this study is "lenovo ideapad 330 (15" Intel)", whose CPU is "Up to 8th Gen Intel ® Quad Core i7-8550U".The proposed ML-TSO algorithm generates random solutions and guarantees that these suggested solutions have values between their maximum and minimum limits defined in Equation ( 5).The constraints defined in Equations ( 3), ( 4) and ( 6) are satisfied by the Newton-Raphson power flow.Moreover, penalties are inserted into the main objective function, defined in Equation ( 2), to eliminate any violation of limits that can happen to the other dependent variables and to consider this suggested solution as an infeasible one.These penalties are defined in Equation (9).
where K v and K l refer to predefined large positive numbers, 9 × 10 15 and 9 × 10 13 .Sa refers to the apparent power of the branch number j.Meanwhile, Sa rated j refers to the maximum value of the apparent power of the branch j.

Modeling of the PV and WT Generation
In this paper, the integration of wind turbines and PV generation has been considered in the PPF problem solution.However, as we mentioned earlier, due to the RES power generation dependency on the metallurgical conditions, the power generation profile of the WT and PV is highly uncertain [44,45].Therefore, it is important to accurately model the PV and WT generators as follows:

Modelling of PV Power Generation
The active power generated by the PV panel depends on the solar irradiance (S) in (W/m 2 ).It can be calculated as follows [29]: where P pvn refers to the nominal power of the PV panel.S stc represents the standard conditions' solar irradiance.R c defines a certain irradiance point.The solar irradiance is modelled by the Beta PDF f s(S) as follows: In Equation (11), S is expressed in kW/m 2 .α and β are the shape parameters of the Beta PDF.Γ is the Gamma function.
The parameters α and β are calculated using the mean and the standard deviation of the observations of the solar irradiance during a periodic time h: The Beta function is sampled to N s samples.The probabilistic solar irradiances, which correspond to the samples of the Beta PDF, are then used to calculate the forecasted values of active power generation from the PV panel as follows: where S h g represents the solar irradiance of the sample number g at hour h.f s S h g represents the irradiance probability of the sample number g at hour h.

Modelling of WT Power Generation
The power generated by the wind turbine depends on the wind speed (v).It can be calculated as follows [30]: where P wtn represents the nominal wind turbine power.v n refers to the nominal speed of the wind.v ci and v co are the cut-in and the cutoff wind speeds.
The wind speed is modelled by the Weibull PDF f v (v) as follows: where C and k represent the scale and shape parameters of the Weibull PDF.r represents a uniform random which is distributed between 0 and 1.The scale and shape parameters, C and k, are obtained from the mean µ h v and the standard deviation σ h v values of the wind speeds measured at hour 'h' as follows: The Weibull function is sampled to N v samples.The probabilistic wind speeds, which correspond to the samples of the Weibull PDF, are then used to calculate the forecasted values of active power generation from the wind turbine as follows: where v h g represents the wind speed of sample number g at hour h.f v v h g represents the wind speed probability of the sample number g at hour h.

Proposed Solution Method
This paper proposes a new hybrid ML-TSO optimization algorithm in order to acquire the features of ML and TSO together and introduce an efficient tool for finding the optimal solutions for classic and POPF problems.

TSO Algorithm
The transient search optimization algorithm is inspired by the transient behavior of the circuits, which include energy storage elements in their configuration [46].The transient behavior of the circuit depends on the circuit order, whether it is the first-order or second-order circuit.The circuit order can be determined by the number of energy storage elements, inductors, and capacitors in the circuit schematic.This overall transient behavior consists of transient and steady-state parts.
For the first-order circuits, the differential equation describing the transient behavior can be expressed as follows [46].
This equation can be solved for x(t) as a function of time as follows: where x(t) represents the capacitor voltage or inductor current.τ is the time constant.K is an initial condition-dependent constant.x (∞) is the steady-state x value.
The previous second-order differential equation can be solved as follows: where α is the damping coefficient and ω 0 and f d are the resonant and damped frequencies.B 1 and B 2 refer to arbitrary constants.The responses of the circuits are graphically shown in Figure 1.

The TSO Inspiration
Similar to the other metaheuristic optimization algorithms, the first step in the TSO is to set random agents whose values lie between predefined boundaries according to the following equation [47]: After that, it explores the optimal solution using the exploration and exploitation steps.The exploration step is inspired by the oscillatory response of the second-order circuits.Finally, it reaches the optimal solution after a predefined number of iterations.Moreover, the exploitation step is inspired by the exponential decay of the first-order circuits.Mathematically, the exploration and the exploitation steps can be expressed as follows: where T, C 1 , r 1 , r 2 , and r 3 refer to random numbers.Y l and Y * l represent the population and the best population until the lth iteration, respectively.k refers to a counter that starts from 0. The stopping criterion is that when the iterations reach L max .Y * l corresponds to x(∞).Additionally, 'T' is a variable that lies between −2 and 2, which is used to balance the exploration and exploitation processes.The effect of changing 'T' is shown in Figure 2. The pseudo-code of the TSO is provided in Algorithm 1.Moreover, modifications to the existing TSO algorithm are made using the levy [48] and Weibull distribution functions [49], as described below.

Levy Function
Part of the population is modified using the levy function with the factor 'LF'.It is expressed as follows: where v and u are random numbers ranging from [0, 1].

Weibull Distribution Function
Another part of the population is modified using the Weibull distribution function with factor (W D ).It is mathematically expressed as follows: ) η (30) where v 1 and η refer to the Weibull distribution constants whose values are 2 and 1, respectively.
The modified TSO populations, using the levy and Weibull distribution functions, are calculated as shown in (31).The population of the next iteration is updated by one of four equations according to a random number (r 1 ).When r 1 is less than '0.25', the population is modified using the levy function based on the current best population, the parameter 'P', and the parameter 'CF'.When r 1 is between '0.25' and '0.5', the population is modified using the Weibull function based on the current best population and stepsize2 l .When r 1 is between '0.5' and '0.75', the population is modified using the Levy function based on the current best population and stepsize3 l .Finally, when r 1 is greater than '0.75', the population is modified using the Weibull function according to the current best population and stepsize4 l .
where P is a constant that is set to '0.5' in this research.CF is a constant that depends on the number of current iterations and the maximum number of iterations.The stepsize l is calculated as follows: where 'Y l ' is the current population.'Y * l ' is the best population obtained until the current iteration.'W D is the Weibull distribution function whose inputs are the dimension of the problem, the population size, and the location, shape, and scale parameters of the Weibull distribution.The location, shape, and scale parameters of the Weibull distribution are set to be 0, 2, and 1. 'LF' is the levy function, whose inputs are the dimension of the problem, the population size, and a constant set to '1.5'.

Machine Learning Approach
Self-organizing maps (SOMs) are considered important techniques in the machine learning approach [50].SOMs can be classified as unsupervised neural networks that are utilized as a technique to extract the knowledge to determine the best areas to reduce the exploration field [51,52].By using SOMs, multidimensional data can be analyzed.It has advantages over the other knowledge extraction methods such as preserving the organized data of the original elements as they are.Consequently, SOMs are commonly used as an approach for data reduction.
The SOM integrates two layers, where the first layer is called the input layer, and the second layer is named the competitive layer.The second layer involves a number of neural units ordered as a 2-D lattice.The construction of the SOM is shown in Figure 3.The SOM has an output lattice of h × h neural elements.The input is a vector x of dimension n.The data of vector x are connected to each neural element.Every neural element lattice contains a weight vector with n units.The training of a SOM includes the weight adjustment and the neighborhood definition [50].The learning steps contain two phases: the similarity calculation and the weight adaptation.First, the initial weights are small and random.After that, the initial vector of data is inserted into the neural network.Then, the weights of the neural elements are adapted.For more visualization to the effect of data-reduction and clustering, Figure 4

Proposed Hybrid ML-TSO
In this paper, a new hybridization between the modified version of the SOM and TSO was made.First, an initial random population is assumed.The machine learning part of the optimization code is applied.A small random value is assigned to all weights.The initial learning rate and topological structure are determined.A number of iterations for the learning process are set.After the training, an input vector is selected randomly from the training set.Define the winner neuron as the nearest to the input.Update the weights of the winner unit and neighboring ones.Then, the fitness function is calculated, and it converges to the best solution using the SOM.The populations are also updated correspondingly.The employment of the SOM before starting optimization using the TSO makes the convergence performance of the TSO more efficient.The population of the TSO is then modified and updated by the levy function and the Weibull distribution function.According to a random number, there are four possibilities to update the population.This process is repeated until the maximum number of iterations is reached.At every iteration, the best solution is obtained.The best solution is compared with the fitness calculated in the current iteration.If the fitness of the current iteration is better than the saved best solution, the fitness replaces the best solution.It should be mentioned that the metaheuristic optimization methods are significantly affected by the initialization process.The flow chart of the proposed hybrid ML-TSO algorithm is provided in Figure 5.

Results and Discussion
In this section, the results and discussion of the main findings are comprehensively demonstrated by dividing them into three subsections.The first subsection presents the classical OPF problem.This subsection aims to examine, analyze, and evaluate the performance of the newly developed hybrid ML-TSO optimization method in solving the OPF problem compared to other methods in the existing literature.Furthermore, this subsection shows how applicable the ML-TSO method is in further optimization problems in the field of power systems.The test validation systems adopted in this study are the standard IEEE-57 bus and IEEE 118-bus test systems.The second subsection presents the simulation results of the POPF problem after integrating the RESs of PV and/or WT.The uncertainties caused by the random variability of the load demand and the stochastic behavior of the solar and wind power were adequately handled and modelled.This subsection also shows the effect of the RESs' integration on the overall operating costs of the power system.The final subsection provides a statistical analysis of the numerical optimization results obtained for OPF in the case of the 57-and 118-bus systems.The main specifications of the adopted test systems are listed in Table 2.The data include the number of buses in each system, the number of generators, the number of branches, the number and capacity of the connected loads, and the systems' losses.The hyper parameters of the machine learning code are the number of neurons and the number of sampling neurons.In the IEEE 57-bus system case, they are set to 10.Meanwhile, in the 118-bus system case, they are set to 5.These values are selected by trial and error.
The conventional GA is the type of GA used in this study.The mutation operator is set to 10% of the population size.The crossover operator is set to 65% of the population size.The selection process depends on the uniform distribution function.The following Table 3 summarizes the selected type and parameters of the GA used in this study.

The GA Type
Conventional GA The mutation operator 10% The crossover operator 65% The selection process Depend on the uniform distribution function Regarding the PSO algorithm, the used PSO is the global best PSO.The inertia coefficient is set to 1, the damping ratio of the inertia coefficient is set to 0.99, and the personal and social acceleration coefficients are set to 2. The swarm size is set to 15.
The following Table 4 summarizes the selected type and parameters of the PSO used in this study.

The PSO Type Global Best PSO
The inertia coefficient 1 The damping ratio of the inertia coefficient 0.99 The personal acceleration coefficient 2 The social acceleration coefficient 2

Classical Optimal Power Flow (Base Case)
The results obtained by ML-TSO are compared with the solutions achieved by other single optimization algorithms such as GA and PSO.The stopping criterion for the runs of all algorithms is the number of iterations, which is set to 600.The comparisons shown in Tables 5 and 6 depict the values of the design variables, which are the output power needed from each conventional generating unit in each system to meet the demand of the network.Additionally, the fuel cost in each system needed to operate the generators can be seen.Furthermore, Figures 6 and 7 show the convergence performance of the proposed hybrid algorithm in comparison to other methods while solving the PPF problem; clearly, the optimal results obtained by the proposed hybrid ML-TSO in both applied cases can be seen.In the case of the IEE 57-bus system, the PSO reached the worst result after 600 iterations.The GA and the proposed ML-TSO methods reached close results, but the proposed ML-TSO method's result is better.The ML-TSO reached better results than the GA by 0.0441% and better results than the PSO by 0.93%.It can be argued that the ML-TSO convergence performance is better, as it needed about 100 iterations to settle.Meanwhile, the GA needed about 450 iterations.
With respect to the IEEE 118-bus system, the GA reached the worst result after 600 iterations.The proposed ML-TSO method reached the best result.The ML-TSO result is better than that of the GA by 6.4% and better than that of the PSO by 2.56%.Hence, the ML-TSO convergence performance is better, as it needed about 300 iterations to settle.
In general, the convergence of the cost function curves in the two standard systems using the ML-TSO method is fast and smooth.

Probabilistic OPF with RESs Uncertainties and Time-Varying Loads
The proposed hybrid ML-TSO algorithm has been applied to solve POPF for the modified IEEE 57-and 118 bus test systems.The RESs (PV and/or WT) are integrated on certain buses in the two test systems, as given in Table 7.Meanwhile, the hourly load demand variation using typical day forecasting is taken into account.The hourly active and reactive power demand variations are given in Figures 8 and 9 for the 57-and 118-bus systems, respectively.The active output power of the PV and WT generators varies through the day according to the irradiance and the wind speed profiles [53,54].So, in this study, the uncertainties of renewable energy resources [55] are considered when forecasting the hourly active output power of the solar and wind systems.Different cases of POPF are evaluated in this scenario.In the first case, the OPF solution has only been evaluated with the hourly variable load consideration and with no RESs integrated.In second and third cases, the OPF solution is performed with the integration of either PV or WT.Finally, the proposed hybrid ML-TSO was implemented for the POPF solution, including both the PV and WT to the studied test systems.The nominal, cut-in, and cutoff wind speeds are assumed to be 10 m/s, 2.7 m/s, and 25 m/s.The generated active power from the PV system is calculated using (15).At the standard condition of irradiance (Sstc), the solar irradiance is assumed to be 1000 W/m 2 .Additionally, the certain irradiance point (Rc) is assumed to be 120 W/m 2 .This part of the research investigates the uncertainty of the RESs and the effect of their variable active power generation on the power generation of the conventional generators, which reflects on the total fuel cost, correspondingly.In this study, it is assumed that renewable energy sources were already installed when defining the cost function.The POPF is performed sequentially through a whole day divided into preset time intervals of 1 h each.The wind speed data were taken in Zafarana in Egypt on 25 November 2014.The solar irradiance data have been obtained from the Natural Energy Laboratory of Hawaii Authority (NELHA) on 3 January 2022.Figures 10 and 11 show the variation of the wind speeds and the solar irradiance throughout a day.According to the measured data, the PDFs of the wind speeds and the solar irradiance are determined, and a sample of these PDFs, at hour 17, is illustrated in Figures 12 and 13.The forecasted generated active powers from the wind turbine and the PV panel are then calculated using Equations ( 15) and (19).Implementing the proposed methodology on the IEEE 57 bus system, the obtained results in Figure 14 show the hourly cost of four investigated scenarios.The investigated scenarios include the system without RES, the system with only PV or WT energy sources, and both types of RESs integration.It is noted that a reduced cost was obtained when the PV panel was contributing between hours 9 and 18, as it is the duration when the solar irradiance is beneficial to generating maximum power.In contrast, the effect of the wind turbine in the system can be noticed during the entire time slot.However, the maximum cost reduction is recorded between hours 10 and 17.Similarly, the comparison of hourly costs for the four scenarios in the case of the 118-bus system is shown in Figure 15.It can be seen that the proposed hybrid ML-TSO method provides the best optimal solutions for the PPF problem, and the illustrated results show the impact of renewable energy integration subject to fuel cost reduction.

Statistical Analysis of the Classical OPF Results
In order to examine and verify the performance of the proposed hybrid ML-TSO optimization approach, the simulations are repeated for the three optimization methods (ML-TSO, PSO, and GA) using the investigated test system, i.e., the IEEE 57-and 118-bus systems.The performed statistical analysis shows valuable insights regarding the best value, worst value, mean value, median value, and standard deviation.
Tables 8 and 9 show the statistical indicators for the two investigated test systems, where the statistic obtained by the proposed ML-TSO method outperforms the other tech-niques.For instance, using the optimization parameters, the standard deviation calculated by the ML-TSO method is the lowest in both investigated systems.The obtained results prove the consistency, relevance and robustness of the proposed optimization method.The meta-heuristic techniques are known for their uncertainty in results over the repetition of the runs of the simulation.One of the tests used to verify how robust the metaheuristic algorithm is is Wilcoxon's rank-sum test.This test provides a fair comparison among the introduced ML-TSO method and the PSO and GA optimization methods.Twenty independent runs are implemented in the test.The selected level of significance is 5%.The p-values determined by Wilcoxon's rank-sum test are shown in Table 10.The hvalues obtained from the test is '1 , which means that the null hypothesis is rejected among the optimization algorithms.It can be concluded from the test results that the ML-TSO is superior to the PSO and the GA optimization methods when applied to solve the OPF and PPF problems under the different scenarios stated previously in the problem formulation.

Conclusions
This paper has introduced a novel hybrid optimization method based on the combination of TSO and machine learning techniques, namely, a hybrid ML-TSO algorithm with the main target of solving the classic OPF and POPF problems optimally.The main inferences of the paper can be given in bullets as follows: • The proposed hybrid ML-TSO algorithm's implementation of the solution of the OPF and PPF problems was verified on standard IEEE 57-bus and 118-bus systems.

•
The results and statistics demonstrate the applicability of the hybrid ML-TSO algorithm, as the convergence performance was observed to be better than that of the other optimization algorithms.

•
The application of the ML-TSO for the OPF resulted in a reduction in the fuel costs of 0.0441% to 0.93% for the IEEE 57-bus system.

•
The application of the ML-TSO for the OPF resulted in a reduction in the fuel costs of 2.56% to 6.4% for the IEEE 118-bus system.

•
The ML-TSO effectively solves the PPF by using distribution functions to simulate the stochastic nature of solar irradiance and wind speed over an entire day.
In the PPF solution strategy, different cases were investigated and analyzed based on the penetration level of the RESs, in which the implications of each case for the calculations were analyzed and evaluated in detail.The findings show that the fuel cost has been significantly minimized when the solar and wind turbine generators were simultaneously added to either the IEEE-57 or 118-bus systems in comparison with a single integration of each source.Lately, the statistical analysis confirms the superior performance of the proposed ML-TSO over that of the PSO and GA algorithms.Finally, it is recommended to use the hybrid ML-TSO optimization method to solve further optimization problems in the field of renewable energy systems and smart grids.

Figure 1 .
Figure 1.Transient response of the circuits.

Figure 2 .Algorithm 1 .
Figure 2. Effect of the variable 'T' on the exploration and exploitation processes.Algorithm 1. Pseudo code of the TSO algorithm.Initialize the first population and obtain the best agents Compute the fitness function While the iteration number < the max.number of iterations Use the Equations (26)-(28) to calculate T, C1, and a Do for each population Use the Equation (25) to calculate the Updated positions End do Obtain the fitness of the updated population IF the new fitness is better than the best fitness Then Replace the fitness and the population End IF l = l + 1 end while return Y l *

Figure 3 .
Figure 3. Representation of a SOM.

Figure 4 .
Figure 4. Data reduction effect: Training process function.

Figure 5 .
Figure 5.The flowchart of the proposed algorithm.

Figure 6 .
Figure 6.Cost function vs. iterations in the 57-bus system.

Figure 7 .
Figure 7. Cost function vs. iterations in the 118-bus system.

Figure 9 .
Figure 9. Hourly demand of the 118-bus system.

Figure 10 .
Figure 10.Measured wind speed throughout the day.

Figure 11 .
Figure 11.Measured sun irradiance throughout the day.

Figure 13 .
Figure 13.PDF of wind speed at hour 17.

Figure 14 .
Figure 14.Hourly fuel cost in the case of the 57-bus system.

Figure 15 .
Figure 15.Hourly fuel cost in the case of the 118-bus system.

Table 1 .
Summary of some of the references stated in the literature.

Table 2 .
Main specifications of the IEEE 57 and 118 bus systems.

Table 3 .
Main parameters of the GA.

Table 4 .
Main parameters of the PSO.

Table 5 .
Minimum fuel cost and optimal design variables for the IEEE 57-bus system.

Table 6 .
Minimum fuel cost and optimal design variables for the IEEE 118-bus system.

Table 7 .
Locations of the RESs in the 57-and the 118-bus systems.

Figure 8 .
Hourly demand of the 57-bus system.

Table 8 .
The best, worst, mean, median, and standard deviation values in the case of the 57-bus system.

Table 9 .
The best, worst, mean, median, and standard deviation values in the case of the 118-bus system.