## 2 Optimal Power Flow Problem  
**A. Formulation of OPF problem**  
The OPF problem aims to determine the optimal adjustments of the control equipment by assessing their optimal control variables in the power system network to obtain an optimized objective function, while simultaneously guaranteeing various operating restrictions. These restrictions are given by power flow equations as equality constraints and the functional limits of control equipment are given as inequality constraints. The most recognized objective function to be minimized in the OPF area is that of the total generation cost, with various complexities, including the quadratic, non-quadratic, and piecewise quadratic of the fuel cost function besides the valve point effects, affecting the fuel cost curves of the generating units [2; 5; 6]. In general, the conventional OPF problem can be mathematically formulated as follows:  
\[ \begin{cases}\min f(x,u)\\ subject\ to\ :g(x,u)\ =\ 0\\ h(x,u)\leq 0\end{cases}  \tag{1}\]  
where \(f\) is the objective function to be optimized, \(g\) is the set of equality constraints represented by the nonlinear power flow equations, \(h\) is the set of inequality constraints reflecting the operating limits of control equipment, \(u\) is the vector of control variables, and \(x\) is the vector of state variables. The vector \(u\) can be expressed as  
\[u\ =\ \left[P_{\text{G2}}\ldots P_{\text{CN}_{g}},\ V_{\text{G1}}\ldots V_{ \text{GN}_{g}},\ T_{1}\ldots T_{\text{N}t},\ Q_{\text{C1}}\ldots Q_{\text{CN}c }\right]^{T} \tag{2}\]  
Vector \(x\) is given as follows:  
\[x\ =\ \left[P_{\text{G1}},\ V_{\text{L1}}\ldots V_{\text{LNP}q},\ \ Q_{\text{G1}} \ldots Q_{\text{GN}_{g}},\ S_{\text{L1}}\ldots S_{\text{LNI}}\right]^{T} \tag{3}\]  
The equality constraints represent the balance equations of the active and reactive powers assigned to each bus, and the expression of \(g(x,u)\) can be formulated in terms of control and state variables as follows:  
\[ \begin{cases}P_{Gi}-P_{Di}-V_{i}\Sigma_{j=1}^{N_{g}}V_{j}\big{(}G_{ij}cos\delta _{ij}+B_{ij}sin\delta_{ij}\big{)}\ =\ 0\\ Q_{Gi}-Q_{Di}-V_{i}\Sigma_{j=1}^{N_{g}}V_{j}\big{(}G_{ij}sin\delta_{ij}-B_{ij} cos\delta_{ij}\big{)}\ =\ 0\end{cases}  \tag{4}\]  
The inequality constraints expressed as \(h(x,u)\) are as follows:  
Limits of Generators:  
The capability constraints for each generation unit are presented for limiting the active and reactive power outputs within the operational limits as follows:  
\[ \begin{cases}P_{Gi,min}\leq P_{Gi}\leq P_{Gi,max}\ \ \ i\ =\ 1,\ldots N_{g} \end{cases}  \tag{5}\]  
Similar to the power capability constraints, the voltage at the generator terminals is kept within the minimum and maximum limits as follows:  
\[V_{Gi,min}\leq V_{Gi}\leq V_{Gi,max}\ \ i\ =\ 1,\ldots N_{g} \tag{6}\]  
Limits of tap setting transformers:  
In Equation (7), the transformer tap settings are kept between the accepted boundaries that are able to control the voltage at the transformer terminals as follows:  
\[T_{i,min}\leq T_{i}\leq T_{i,max}\ \ i\ =\ 1,\ldots N_{t} \tag{7}\]  
Limits of reactive power compensators:  
Reactive power compensators are bounded in Equation (8) as follows:  
\[Q_{Ci,min}\leq Q_{Ci}\leq Q_{Ci,max}\ \ i\ =\ 1,\ldots N_{\text{C}} \tag{8}\]  
Limits of voltage magnitude for load buses  
\[V_{Li,min}\leq V_{Li}\leq V_{Li,max}\ \ i\ =\ 1,\ldots N_{PQ} \tag{9}\]  
Power flow limits of transmission lines:  
\[S_{Li,min}\leq S_{Li}\leq S_{Li,max}\ \ i\ =\ 1,\ldots N_{l} \tag{10}\]To handle an inequality constraint of a state variable, a penalty function is introduced in the augmented objective function as follows [6]:  
\[F_{aug}\ =\ f(x,u)+\sum_{k\ =\ 1}^{Ns}\lambda_{pk}(x_{k}-x_{k}^{lim})^{2} \tag{11}\]  
where \(x_{k}\) is the variable of the \(k\)-th violation of the state, \(x^{lim}_{\ \ k}\) is the limit of the variable of the \(k\)-th violation of the state, \(f(x,u)\) is the objective function, and \(\lambda_{R}\) is the penalty factor for the penalty function of the variable of the \(k\)-th violation of the state. **B.