# A Setting Optimization Ensemble for a Distributed Power Grid Protective Relay
## 4 Quantum Genetic Optimization Model
### Example of QGO Simulation  
Here, we refer to the book _Introduction to Operations Research_ by [PERSON] and [PERSON] [35]. The book provides classical examples of linear programming, which are commonly used for testing purposes. Linear programming falls under convex programming, where a global optimal solution theoretically exists. Classical algorithms, such as the \"simplex method\", have been proven to efficiently find the global optimal solution. In MATLAB 2021a, the linprog function, based on the simplex method, can accurately search for the global optimal solution of a linear programming problem.  
From a perspective of nonlinear programming models, linear programming models can have multiple decision variables and multiple sets of linearly independent equality and inequality constraints. This makes them suitable for testing heuristic search algorithms for nonlinear programming models.  
Below are some test examples:  
\[max=2x_{1}+3x_{2}-5x_{3}\] \[s.t.\left\{\begin{array}{l}x_{1}+x_{2}+x_{3}=7\\ 2x_{1}-5x_{2}+x_{3}\geq 10\\ x_{1}+3x_{2}+x_{3}\leq 12\\ x_{1},x_{2},x_{3}\geq 0\end{array}\right.\]  
QGO algorithm is used to solve the above linear programming model.  
First, the objective function of building foundation augmentation is  
\[Z=2x_{1}+3x_{2}- 5x_{3}+\alpha_{1}max\{10-2x_{1}+5x_{2}-x_{3},0\}\] \[+ \alpha_{2}max\{x_{1}+3x_{2}+x_{3}-12,0\}+\alpha_{3}(x_{1}+x_{2}+x _{3}-7)^{2}\]where \(\alpha_{1},\alpha_{2},\alpha_{3}\) are penalty factors, which are artificially controllable constants. Here, we take \(\alpha_{1}=\alpha_{2}=\alpha_{3}=10\).  
Following the aforementioned steps, we utilize the QGO algorithm for optimization and present the iteration curve in Figure 2:  
This iteration curve demonstrates the convergence behavior of the QGO algorithm during the optimization process. It provides insights into the algorithm's performance and the rate at which it approaches the optimal solution.  
The comparison between QGO optimization results and simplex optimization results is shown in Tables 1 and 2.  
By analyzing Tables 1 and 2, we observe that the optimization results obtained using the QGO algorithm are nearly identical to those obtained using the simplex method. These results indicate that the QGO algorithm is capable of achieving solutions that are close to the global optimum. Additionally, the maximum violation of the constraint conditions does not exceed 0.03, indicating that the QGO algorithm effectively satisfies the constraints.  
The successful application of the QGO algorithm in solving complex planning problems further highlights its ability to find global optimal solutions. This demonstrates the algorithm's robustness and effectiveness in tackling optimization challenges.  
In summary, the overall process of optimizing the assigned value of distributed grid relay protection using the aforementioned method is as follows (Figure 3):  
\begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Objective Function Optimal Value** & \(x_{1}\) & \(x_{2}\) & \(x_{3}\) \\ \hline Simplex method & 14.5714 & 6.4286 & 0.5714 & 0.0000 \\ QGO & 14.5585 & 6.4256 & 0.5770 & 0.0048 \\ \hline \hline \end{tabular}
\end{table}
Table 1: The results of QGO optimization are compared with those of the simplex method.  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Penalty Function Term** & **Numerical Value** \\ \hline \(\max\{10-2x_{1}+5x_{2}-x_{3},0\}\) & 0.02907 \\ \(\max\{x_{1}+3x_{2}+x_{3}-12,0\}\) & 0.00000 \\ \((x_{1}+x_{2}+x_{3}-7)^{2}\) & 0.00004 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Degree of constraint satisfaction.  
Figure 2: Test example iteration curve.