Quantum Newton-Raphson load flow calculation method and system based on variable component subalgorithm
By combining variable component quantum algorithm and subspace method, random prototyping and dynamic learning rate strategies are introduced, which solves the local extreme value problem of variable component quantum algorithm in current calculation, realizes efficient current calculation on NISQ equipment, and improves calculation accuracy and efficiency.
Patent Information
- Application Number
- CN202411229478.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-20
AI Technical Summary
Variable component quantum algorithms are prone to fall into local extreme values in power system trend calculations, resulting in reduced algorithm efficiency and inability to effectively utilize existing NISQ computer hardware resources.
The quantum Newton-Ravson trend calculation method based on variable component quantum algorithm is adopted, and the linear system of equations is obtained through the Newton-Ravson trend calculation, and the classical subspace method is used to map it to small dimensions, and randomly proposed parameters and dynamic learning rate strategies are introduced. , use the variational idea to solve the gradient of Hamiltonian, combine the gradient descent method to obtain the solution of linear equations, and update the flow calculation results through the subspace method.
The exponential acceleration of trend calculations is achieved on NISQ equipment, improving the accuracy of output results, avoiding local extreme values, and meeting the needs of high-precision trend calculations.
Smart Images

Figure CN119167768A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of power system flow calculation, and in particular to a quantum Newton-Raphson flow calculation method and system based on a variational quantum algorithm. Background Art
[0002] Power flow calculation is the core foundation of various power system calculations. As the scale of power systems continues to expand and the complexity increases, the amount of data that needs to be processed by power flow calculations is also increasing. The processing speed of traditional computers is limited, so it takes longer to complete the calculation task. At the same time, the accuracy of traditional power flow calculation methods is limited by factors such as hardware architecture and algorithms, and it is difficult to meet the needs of high-precision power flow calculations.
[0003] The emergence of quantum computers provides a new solution for power system optimization. Quantum computers have the advantages of high-speed computing and parallel processing, which can greatly improve the efficiency and accuracy of power flow calculation. Specifically, quantum computers can achieve faster and more accurate optimization by utilizing quantum phenomena such as quantum entanglement and quantum random walk. At present, the application of quantum computing to solve power flow problems at home and abroad is mainly based on the exploration of the HHL algorithm. For example, the Chinese patent application with publication number CN116706921A discloses a quantum Newton-Raphson method power flow calculation method and system based on the HHL algorithm, which uses quantum computers and traditional computers to alternately calculate, improves the accuracy of existing quantum power flow calculations, and can also ensure better convergence times and convergence accuracy. However, the HHL algorithm is based on the premise of an ideal quantum computer, and requires more quantum resources. The available resources of the Noisy Intermediate-Scale Quantum (NISQ) computer cannot meet the quantum resource requirements required by this method.
[0004] The variational quantum algorithm can combine the advantages of classical computers and quantum computers, and use limited quantum resources to build low-depth, high-expression quantum circuits, thereby reducing the impact of noise on quantum algorithms. It uses fewer quantum resources and is currently one of the effective algorithms for using NISQ computers to achieve quantum advantages. For example, the Chinese patent application with publication number CN118381029A discloses a method for calculating power system flow based on a discrete adiabatic variational quantum algorithm, which solves the problem of combining quantum computing with power system flow calculations to reduce the time complexity of quantum algorithms in order to match the current hardware resources of NISQ computers. However, it does not solve the problem of the best setting strategy of the Ansatz in the variational quantum algorithm, and it is easy to fall into local extreme values in multiple iterative algorithms, resulting in reduced algorithm efficiency. Summary of the invention
[0005] The problem to be solved by the present invention is that, with the continuous expansion of the scale and increase of complexity of the power system, in order to adapt to the existing limited NISQ computer hardware resources, the problem that the above-mentioned variational quantum algorithm is easily trapped in local extreme values when applied to power system flow calculations, resulting in reduced algorithm efficiency, is solved.
[0006] The present invention solves the above technical problems through the following technical means:
[0007] The present invention discloses a quantum Newton-Raphson power flow calculation method based on a variational quantum algorithm, the method comprising the following steps:
[0008] S1. Obtain the linear equations to be solved by Newton-Raphson power flow calculation;
[0009] S2, using the classical subspace method to map large linear equations to small-dimensional linear equation solving problems;
[0010] S3. Solving a small-dimensional linear equation system by a variational quantum algorithm to obtain a solution to a large linear equation system; the variational quantum algorithm is specifically:
[0011] Decompose the coefficient matrix of the linear equations into a number of unitary matrix linear summation forms, and encode the vector into the quantum circuit; construct the Hamiltonian containing the information of the linear equations; introduce the random parameter setting strategy and dynamic learning rate strategy, use the variational idea to find the gradient of the loss function of the Hamiltonian, and use the gradient descent method to obtain the Hamiltonian ground state, that is, the solution of the linear equations;
[0012] S4. Based on the solution of the linear equation group described in S3, update the power flow calculation correction equation, determine the convergence accuracy, and output the calculation result.
[0013] Furthermore, the step S1 includes the following steps:
[0014] S11, input the initial model parameters for quantum power flow calculation;
[0015] S12, sorting the node data and constructing an admittance matrix;
[0016] S13. Substitute the initial value and the admittance matrix into the Newton-Raphson flow calculation equation, calculate the partial derivative through the equation, construct the Jacobian matrix A, calculate the unbalanced quantity b, and then construct the linear equation group Ax=b.
[0017] Furthermore, the step S2 is specifically as follows: based on the GMERS subspace method, the original linear equation system Ax=b is mapped to a small-dimensional Hy=e linear solution problem.
[0018] Furthermore, the step S3 includes the following steps:
[0019] S31, using a variational quantum algorithm to solve the small-dimensional Hy=e linear equation;
[0020] S32, converting the quantum data obtained in step S31 into classical data, mapping the optimal solution of the linear equation Hy=e in the subspace to the original dimension, and obtaining the solution of the equation system Ax=b in the original dimension;
[0021] Furthermore, the step S4 is specifically as follows: updating the non-equilibrium node parameters, determining whether the preset convergence accuracy or the maximum number of iterations of the Newton method is reached, if not, returning to step S13, if yes, outputting the calculation result.
[0022] Furthermore, the Hamiltonian in the variational quantum algorithm in step S31 is specifically:
[0023] The loss function is specifically:
[0024]
[0025] in In actual calculation, the normalized loss function is defined as:
[0026]
[0027] The gradient of the loss function is specifically:
[0028]
[0029] in is a unitary matrix.
[0030] The above-mentioned method of using gradient descent to obtain the Hamiltonian ground state, that is, the solution of the linear equation system, is specifically:
[0031] Construct a series of matrices that evolve over time:
[0032] A(t)=(1-t)I+tA
[0033] Where the imaginary time t∈[0,1], when the imaginary time t gradually increases to 1, find The ground state, at this time the parameter As the initial position of the next time instant t+1, find the ground state of the Hamiltonian at the next time, and so on. In more general cases, in order to ensure that A(t) is always reversible during the evolution process, we can construct at this time
[0034] When the loss function approaches 0, |φ> is the solution of the linear equations, which can be converted into a classical vector representation: Assume that the solution of the equations obtained by the quantum circuit and solutions to real linear systems Satisfy the proportional relationship:
[0035]
[0036] Substituting it into the initial linear equation system, we get:
[0037]
[0038] Multiply the above formulas by their respective transposes on the left to obtain:
[0039]
[0040] The left side of the above formula Equal to the measured loss function term; therefore, the coefficient η can be calculated and finally the solution of the linear equations can be obtained.
[0041] The random parameter strategy is specifically:
[0042] When it is detected that the loss function falls into the vicinity of a local extreme value, the algorithm will generate a set of random hypothetical parameters while retaining the current hypothetical parameters and obtain the loss function corresponding to this group of random parameters. Finally, the hypothetical parameters with the minimum loss function are selected as the new optimal hypothetical parameters to continue executing the variational quantum algorithm.
[0043] The dynamic learning rate strategy is specifically:
[0044] The variational quantum algorithm proposes a parameter update strategy as follows:
[0045]
[0046] Here β is the learning rate, that is, the step size of the gradient or slope decrease.
[0047] The present invention also provides a system for quantum Newton-Raphson power flow calculation method based on variational quantum algorithm, wherein the system adopts the above algorithm during execution.
[0048] The advantages of the present invention are:
[0049] (1) A quantum Newton-Raphson power flow calculation method based on a variational quantum algorithm was used to realize the combination of current real quantum computers and power flow calculation technology. A 16-node power flow calculation example was completed on a real quantum computer on the current NISQ device. The results were consistent with the classical calculation results, and the error was negligible. This achieved an exponential acceleration in solving the dimension N of the linear equation system, while improving the accuracy of the output results.
[0050] (2) Introduce random pseudo-parameter strategy and dynamic learning strategy to achieve the pseudo-parameter escape from the local extreme value of the gradient descent method.
[0051] (3) Based on the subspace method, only two quantum bits are needed to implement calculations with more than 16 nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 This is a flow chart of a quantum Newton-Raphson power flow calculation method based on a variational quantum algorithm according to an embodiment of the present invention;
[0053] Figure 2 A schematic diagram of efficient hardware design in a variational quantum algorithm according to an embodiment of the present invention;
[0054] Figure 3 A schematic diagram of a fixed structure in a variational quantum algorithm according to an embodiment of the present invention is provided;
[0055] Figure 4 This is a schematic diagram of a three-term quantum measurement circuit of the gradient of the loss function according to an embodiment of the present invention;
[0056] Figure 5 A schematic diagram of an experimental platform for performing performance testing on a variational quantum algorithm using a real quantum computer according to an embodiment of the present invention;
[0057] Figure 6 This is a schematic diagram comparing the classical and quantum calculation results of the linear equation system solved 4 times in the Newton-Raphson iteration process of an embodiment of the present invention when iter=1;
[0058] Figure 7 This is a schematic diagram comparing the classical and quantum calculation results of the linear equation system solved 4 times in the Newton-Raphson iteration process in an embodiment of the present invention when iter=2;
[0059] Figure 8 This is a schematic diagram comparing the classical and quantum calculation results of the linear equation system solved 4 times in the Newton-Raphson iteration process in an embodiment of the present invention when iter=3;
[0060] Fig. 9 This is a schematic diagram comparing the classical and quantum calculation results of the linear equation system solved 4 times in the Newton-Raphson iteration process of an embodiment of the present invention when iter=4;
[0061] Fig.10 A schematic diagram showing the comparison between the classical and quantum calculation results of the voltage amplitude in an embodiment of the present invention;
[0062] Fig.11 A schematic diagram showing the comparison between the classical and quantum calculation results of the voltage phase according to an embodiment of the present invention;
[0063] Fig.12This is a schematic diagram of the maximum unbalanced power of a virtual machine and a real quantum computer changing with the number of iterations according to an embodiment of the present invention. DETAILED DESCRIPTION
[0064] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in combination with the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] Example 1
[0066] like Figure 1 As shown, specifically, the embodiment provides a quantum Newton-Raphson power flow calculation method based on a variational quantum algorithm, comprising the following steps:
[0067] S1. Obtain the linear equations to be solved through Newton-Raphson power flow calculation.
[0068] Furthermore, the step S1 comprises the following steps:
[0069] S11. Input the initial model parameters for quantum power flow calculation.
[0070] S12. Sort the node data and construct an admittance matrix.
[0071] S13. Substitute the initial value and the admittance matrix into the Newton-Raphson flow calculation equation, calculate the partial derivative through the equation, construct the Jacobian matrix A, calculate the unbalanced quantity b, and then construct the linear equation group Ax=b.
[0072] Furthermore, the step S13 is specifically as follows:
[0073] In polar coordinate system, voltage can be expressed as:
[0074] Among them, V i is the voltage amplitude at node i, j is the imaginary unit, θ i is the phase angle;
[0075] The calculation formula for active and reactive power is:
[0076]
[0077] Among them, P i Active power of node i, that is, the power actually consumed or generated at node i; V j is the voltage amplitude at node j; G ijIt is the real part of the admittance (i.e. the sum of conductance and susceptance) between nodes i and j, representing the inverse of the resistance between the two nodes; B ij is the imaginary part of the admittance between nodes i and j, representing the inverse of the inductance between the two nodes; θ ij is the phase angle difference between nodes i and j.
[0078] The calculation formula of node imbalance is:
[0079]
[0080] Among them, P is is the initial active power, Q is is the initial reactive power.
[0081] application and the elements of the nodal admittance matrix to calculate the elements of the Jacobian matrix, Solve the modified equation group (5) to find the voltage change of each node, that is, the correction value and
[0082]
[0083] Among them, the off-diagonal elements (i≠j)
[0084]
[0085] Diagonal elements (i=j)
[0086]
[0087] Determine whether the convergence condition is met. If not, calculate the new voltage value of each node according to formula (8), that is, the corrected voltage value of each node, set k=k+1, and perform the next round of iteration according to formula (5).
[0088]
[0089] If converged, the reactive injection power of each PV node is calculated to balance the node power and line power.
[0090] S2. Use the classical subspace method to map large systems of linear equations to small-dimensional linear equation solving problems.
[0091] Furthermore, the step S2 is specifically as follows:
[0092] Based on the GMERS subspace method, the original linear equation system Ax=b is mapped to a small-dimensional Hy=e linear solution problem.
[0093] Furthermore, the GMERS subspace-based method is specifically as follows:
[0094] Based on the Krylov subspace method, consider the following linear equations
[0095]
[0096] in is the required solution. Currently, the large-scale sparse linear equation system Ax = b is solved.
[0097] The preferred method for (1) is the Krylov subspace method. The basic idea is to use a subspace with a smaller dimension. Therefore, this type of method can also be regarded as a projection method, that is, finding the projection of the analytical solution in the subspace, which can be an orthogonal projection or an oblique projection.
[0098] set up yes A subspace of , with dimension Need to Find a "best" approximation to the exact solution in . The dimension of is m. In order to uniquely determine this approximate solution, m constraints need to be set. In general, the residual is required to satisfy m orthogonality conditions:
[0099]
[0100] in is the approximate solution we are looking for, is another m-dimensional subspace, also called constraint space. This is the Petrov-Garlerkin condition commonly used in numerical calculations. Correspondingly, This is often called the search space.
[0101] So a projection method can be described as:
[0102] Search satisfy
[0103] If an initial approximation is given In order to make full use of the relevant information of this initial value, we change it to affine space Find the best approximation to the exact solution. At this time, the method can be described as:
[0104] Search satisfy
[0105] In fact, if Written in the following form: in Then search satisfy that is:
[0106] Search satisfy
[0107] Where r0 = b-Ax (0) is the initial residual. This is similar to finding satisfy The format is the same.
[0108] satisfy Let {v1,v2,…,vm} and {w1,w2,…,wm} be and A set of bases. Let V = [v1, v2, ..., v m ],W=[w1,w2,…,w m ].because So there is a vector Make
[0109]
[0110] satisfy It can be seen that:
[0111] r0-AVy⊥w i ,i=1,2,…,m
[0112] Right now
[0113] W T AVy=W T r0
[0114] If W T AV is non-singular, then we can solve y = (W T AV) -1 W T r0. Therefore, the approximate solution It can be expressed as
[0115]
[0116] In actual calculation, the matrix W T The AV can usually be formed directly without additional calculations.
[0117] From the above derivation process, we can see that the approximate solution The only condition for existence is that the matrix W T AV is not exotic.
[0118] Furthermore, the generalized minimum residual method (GMRES) is used to solve
[0119] For a linear problem Ax = b, where A is a non-singular full-rank n-dimensional matrix. Given an initial solution x0, there is an initial residual r0 = b-Ax0. An important definition is as follows
[0120]
[0121] is the m-order Krylov subspace of the matrix A and the initial residual r0.
[0122] GMRES starts directly from the condition of minimum r-modulus length, and its optimal criterion can be described as
[0123] Search Solution
[0124] For any vector Existence vector So that x∈x (0) +V m y m ,have
[0125]
[0126] Since V m+1 The column vectors of are orthogonal, so
[0127]
[0128] Therefore, in the GMRES method, the problem is transformed into a least squares problem. When m is not very large, QR decomposition can be used to solve the least squares problem.
[0129]
[0130] H m+1,m QR decomposition, where Q m+1 is an orthogonal matrix, R m+1,m is an upper triangle, so
[0131]
[0132] where q1 is Q m+1 The first column, R m For R m+1,m The first m rows of y. m It can be obtained by solving the following upper triangular equations
[0133] βq1(1:m)=R my m
[0134] Where q1(1:m) represents the vector consisting of the first m elements of the q1 vector.
[0135] Therefore, the solution space of the GMRES method is The solution constraint space is Its minimum optimal criterion can be described as
[0136] Search Make
[0137] The following is the pseudo code for this method:
[0138]
[0139]
[0140] Without considering the rounding error, when the GMRES method iterates to n steps, the residual is definitely 0, so the method must converge. However, for large-scale linear equations, it is impossible to iterate n steps, because the amount of computation and storage for each iteration of GMRES will increase with the increase of the number of iterations. Therefore, when the number of iterations is large, the computation time and storage will increase greatly, which makes the method lose its competitiveness. Therefore, it is hoped that the number of iterations can be controlled within an acceptable range.
[0141] The current approach to achieve this goal is to adopt an iterative strategy, that is, given a maximum number of iterations m (usually much smaller than n, such as 20, 50, etc.), if GMRES does not converge after iterating to m steps, then calculate the approximate solution Then use it as the new initial value of the iteration, that is, let x (0) =x (m) , re-iterate the GMRES method, and the process can be repeated until a satisfactory approximate solution is found.
[0142]
[0143]
[0144] In order to achieve high-precision solutions, the algorithm uses the GMRES iterative strategy. The specific iterative process is as follows:
[0145] 1. Confirm that the linear equations to be solved are the subspace linear equations Hy=βe
[0146] 2. i = 0, give any initial solution y i
[0147] 3. Calculate the residual r i=b-Hy i , if the 2-norm of the residual is less than the given convergence criterion ‖r i ‖2≤∈, then x i It is the solution that meets the standard and is directly output; if ‖r i ‖2>∈, then return to step S24 and establish the residual equation system Hz=r i , using quantum linear algorithm to obtain the noisy quantum state |z> on a quantum computer. Note that the quantum linear algorithm here is an arbitrary quantum linear algorithm
[0148] 5. Use the exclusive quantum state to classical data module to convert the noisy quantum state |z> into classical data z, which is the quantum computing solution of the residual equation.
[0149] 6. Update y i+1 =y i +z, return to step S13.
[0150] Obviously, as long as ‖r i ‖ is strictly non-increasing, then the above algorithm can definitely achieve high-precision solution of linear equations.
[0151] S3. Solve small-dimensional linear equations through variational quantum algorithms to obtain solutions to large linear equations.
[0152] Furthermore, the step S3 includes the following steps:
[0153] S31. Use a variational quantum algorithm to solve the small-dimensional Hy=e linear equation.
[0154] Furthermore, the variational quantum algorithm in step S31 is specifically:
[0155] The coefficient matrix of the linear equations is decomposed into a number of unitary matrix linear sum forms, and the vector is encoded into the quantum circuit; a Hamiltonian containing information about the linear equations is constructed; a random parameter strategy and a dynamic learning rate strategy are introduced, and the gradient of the loss function of the Hamiltonian is calculated using the variational idea, and the ground state of the Hamiltonian, that is, the solution to the linear equations, is obtained using the gradient descent method.
[0156] Furthermore, the Hamiltonian is specifically:
[0157] The loss function is specifically:
[0158]
[0159] in In actual calculation, the normalized loss function is defined as:
[0160]
[0161] When the loss function When |x>=|φ>, it is the solution of the linear equations.
[0162] The gradient of the loss function is specifically:
[0163]
[0164] in is a unitary matrix. The specific derivation form is as follows:
[0165]
[0166] In the above partial derivative form, it can be divided into three terms, as well as<b|A|φ> , these three items can be measured through quantum circuits. Two of the above three items involve Combined with the |φ> form given above, we can thus:
[0167]
[0168] For the purpose of quantum circuit measurement, Rewrite it as follows:
[0169]
[0170] in is a unitary matrix.
[0171] Furthermore, it is necessary to measure the gradient of the loss function, specifically:
[0172] When measuring the three terms of the loss function separately, it involves how the matrix A is encoded into the quantum circuit. In the variational algorithm, A is decomposed into a linear combination of several unitary matrices, such as: Among them l s is a complex number, σ s represents a unitary matrix. Therefore, the three terms of the loss function gradient can be solved in the following forms:
[0173]
[0174] The above three items can be respectively Figure 4 The quantum circuit measurement shown.
[0175] The Hamiltonian ground state, i.e., the solution of the linear equations, is obtained by using the gradient descent method, specifically:
[0176] Construct a series of matrices that evolve over time:
[0177] A(t)=(1-t)I+tA
[0178] Where the imaginary time t∈[0,1], when the imaginary time t gradually increases to 1, find The ground state, at this time the parameter As the initial position of the next time instant t+1, find the ground state of the Hamiltonian at the next time, and so on. In more general cases, in order to ensure that A(t) is always reversible during the evolution process, we can construct at this time
[0179] When the loss function approaches 0, is the solution of the linear equations, which can be transformed into a classical vector representation Assume that the solution of the equations obtained by the quantum circuit and solutions to real linear systems Satisfy the proportional relationship:
[0180]
[0181] Substituting it into the initial linear equation system, we get:
[0182]
[0183] Multiply the above formulas by their respective transposes on the left to obtain:
[0184]
[0185] The left side of the above formula Equal to the measured loss function term; therefore, the coefficient η can be calculated and finally the solution of the linear equations can be obtained.
[0186] The random parameter setting strategy is specifically:
[0187] In the variational linear solver algorithm, the quality of the ansatz will determine the success and accuracy of the calculation. Therefore, the construction of the ansatz in the variational algorithm is crucial. In most of the literature, the variational linear solver algorithm generally adopts an efficient hardware ansatz, such as Figure 2 As shown. The advantage of this assumption is that it can be easily adjusted dynamically, that is, adding or reducing the number of assumption layers. Another assumption is a fixed assumption structure, which is generally used to solve a system of linear equations with fixed known dimensions. Since this type of assumption is a specific setting, the solution efficiency is generally high. Among them, the assumption is as follows Figure 3 shown.
[0188] In this embodiment, when it is detected that the loss function falls into the vicinity of a local extreme value, the algorithm will generate a set of random hypothetical parameters while retaining the current hypothetical parameters and obtain the loss function corresponding to this group of random parameters. Finally, the hypothetical parameters with the minimum loss function are selected as the new optimal hypothetical parameters to continue executing the variational quantum algorithm.
[0189] The reason for adopting the random pseudo-parameter strategy is that the variational quantum algorithm uses low-dimensional pseudo-parameters to express the original high-dimensional data, and the pseudo-expressive ability is limited. Although the iterative strategy makes up for the problem that a single pseudo-parameter is not enough to accurately express the solution of the linear equations, the local extreme value problem in the pseudo-parameter optimization is still not solved.
[0190] The dynamic learning rate strategy is specifically:
[0191] The variational quantum algorithm proposes a parameter update strategy as follows:
[0192]
[0193] Here β is the learning rate, that is, the step size of the gradient or slope decrease.
[0194] The optimal learning rate should be determined using the minimum line search, but the calculation process is cumbersome, and β = 1 is generally selected. However, different learning rates will lead to different program convergence efficiency.
[0195] In order to better utilize the parallel strategy to improve the efficiency of solving, the program will set multiple learning rates and submit the lines corresponding to the newly proposed parameter groups corresponding to the multiple learning rates in parallel, so as to determine the optimal learning rate in one task. In addition, the learning rate will also be dynamically adjusted according to the last optimal learning rate.
[0196] S32. Convert the quantum data obtained in step S31 into classical data, map the optimal solution of the linear equation Hy=e in the subspace to the original dimension, and obtain the solution of the equation group Ax=b in the original dimension.
[0197] S4. Based on the solution of the linear equation group described in S3, update the power flow calculation correction equation, determine the convergence accuracy, and output the calculation result.
[0198] Furthermore, the step S4 is specifically as follows: updating the non-equilibrium node parameters, determining whether the preset convergence accuracy or the maximum number of iterations of the Newton method is reached, if not, returning to step S31, if yes, outputting the calculation result.
[0199] In particular, Example 1 also provides a performance test experiment of Newton-Raphson power flow calculation based on variational quantum algorithm to verify the error comparison between the algorithm output result and the classical calculation result. Figure 5As shown, the performance test was carried out on the Benyuan Wukong 72-bit quantum computer platform.
[0200] Figure 6 to Figure 9 The comparison between classical and quantum calculation results of the linear equations solved four times in the Newton-Raphson method iteration process is given in turn; Figure 10-11 A comparison between the classical and quantum calculation results of voltage amplitude and phase is given; Fig.12 Maximum unbalanced power of virtual machines and real quantum computers as a function of the number of iterations.
[0201] Depend on Figure 6 to Figure 12 From the comparison data, we can see that there is a certain error between the calculation results of the real quantum computer and the classical calculation results. This error comes from the existence of noise on the one hand, and the convergence condition of the time-varying quantum linear solver in the real machine experiment is not set high, about 1e-4 on the other hand. However, this error can be almost ignored after multiple iterations, which is 1e-6; the final quantum calculation results of the voltage amplitude and phase are basically consistent with the classical calculation results, meeting the calculation requirements; Fig.12 The voltage phase error in the equation comes from the Newton method iterative convergence judgment of 1e-2. This error can be eliminated by reducing the convergence judgment value in the later stage.
[0202] Example 2
[0203] It should be further explained that, based on the same inventive concept, the present invention also provides a system for quantum Newton-Raphson power flow calculation method based on variational quantum algorithm, and the system includes the following modules:
[0204] The linear equations building block is used to obtain the linear equations to be solved through Newton-Raphson power flow calculation.
[0205] The linear equations dimensionality reduction module is used to map large linear equations to small-dimensional linear equation solving problems using classical subspace methods.
[0206] The variational quantum linear solver module is used to solve small-dimensional linear equations through variational quantum algorithms to obtain solutions to large linear equations.
[0207] The linear equation group correction and convergence judgment module is used to update the power flow calculation correction equation according to the solution of the linear equation group obtained by the variational quantum linear solver module, and to determine whether the output result is a converged solution that meets the calculation accuracy requirements.
[0208] Furthermore, the linear equations building block includes the following units:
[0209] 1. Parameter input unit, used to input the initial model parameters for quantum power flow calculation;
[0210] 2. Matrix construction unit, used to sort the node data and construct the admittance matrix;
[0211] 3. The linear equation group conversion unit is used to substitute the initial value and the admittance matrix into the Newton-Raphson power flow calculation equation, obtain the partial derivative through the equation, construct the Jacobian matrix A, obtain the unbalanced quantity b, and then construct the linear equation group Ax=b.
[0212] The linear equations dimensionality reduction module is specifically used to map the original linear equations Ax=b to a small-dimensional Hy=e linear solution problem based on the GMERS subspace method.
[0213] The variational quantum linear solver module includes the following units:
[0214] 1. The variational quantum linear solver unit is used to solve the small-dimensional Hy=e linear equation;
[0215] 2. A data conversion unit, which is used to convert the quantum data obtained in the variational quantum linear solver into classical data, map the optimal solution of the Hy=e linear equation in the subspace to the original dimension, and obtain the solution of the equation system Ax=b in the original dimension;
[0216] Furthermore, the variational quantum linear solver is specifically used to decompose the coefficient matrix of the linear equation system into a plurality of unitary matrix linear sum forms, encode the vector into the quantum circuit; construct a Hamiltonian containing information about the linear equation system; introduce a random pseudo parameter strategy and a dynamic learning rate strategy, use the variational idea to find the gradient of the loss function of the Hamiltonian, and use the gradient descent method to obtain the Hamiltonian ground state, that is, the solution of the linear equation system.
[0217] Furthermore, the Hamiltonian is specifically:
[0218] The loss function is specifically:
[0219]
[0220] in In actual calculation, the normalized loss function is defined as:
[0221]
[0222] The gradient of the loss function is specifically:
[0223]
[0224] in is a unitary matrix.
[0225] The above-mentioned method of using gradient descent to obtain the Hamiltonian ground state, that is, the solution of the linear equation system, is specifically:
[0226] Construct a series of matrices that evolve over time:
[0227] A(t)=(1-t)I+tA
[0228] Where the imaginary time t∈[0,1], when the imaginary time t gradually increases to 1, find The ground state, at this time the parameter As the initial position of the next time instant t+1, find the ground state of the Hamiltonian at the next time, and so on. In more general cases, in order to ensure that A(t) is always reversible during the evolution process, we can construct at this time
[0229] When the loss function approaches 0, is the solution of the linear equations, which can be transformed into a classical vector representation Assume that the solution of the equations obtained by the quantum circuit and solutions to real linear systems Satisfy the proportional relationship:
[0230]
[0231] Substituting it into the initial linear equation system, we get:
[0232]
[0233] Multiply the above formulas by their respective transposes on the left to obtain:
[0234]
[0235] The left side of the above formula Equal to the measured loss function term; therefore, the coefficient η can be calculated and finally the solution of the linear equations can be obtained.
[0236] The random parameter setting strategy is specifically:
[0237] When it is detected that the loss function falls into the vicinity of a local extreme value, the algorithm will generate a set of random hypothetical parameters while retaining the current hypothetical parameters and obtain the loss function corresponding to this group of random parameters. Finally, the hypothetical parameters with the minimum loss function are selected as the new optimal hypothetical parameters to continue executing the variational quantum algorithm.
[0238] The dynamic learning rate strategy is specifically:
[0239] The variational quantum algorithm proposes a parameter update strategy as follows:
[0240]
[0241] Here β is the learning rate, that is, the step size of the gradient or slope decrease.
[0242] The linear equation group correction and convergence judgment module is specifically used to update the non-equilibrium node parameters and determine whether the preset convergence accuracy or the maximum number of iterations of the Newton method is reached. If not, it returns to the linear equation group construction module. If so, it outputs the calculation results.
[0243] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A quantum Newton-Raphson power flow calculation method based on a variational quantum algorithm, characterized in that: The method comprises the following steps: S1. Obtain the linear equations to be solved by Newton-Raphson power flow calculation; S2, using the classical subspace method to map large linear equations to small-dimensional linear equation solving problems; S3. Solving a small-dimensional linear equation system by a variational quantum algorithm to obtain a solution to a large linear equation system; the variational quantum algorithm is specifically: Decompose the coefficient matrix of the linear equations into a number of unitary matrix linear summation forms, and encode the vector into the quantum circuit; construct the Hamiltonian containing the information of the linear equations; introduce the random parameter setting strategy and dynamic learning rate strategy, use the variational idea to find the gradient of the loss function of the Hamiltonian, and use the gradient descent method to obtain the Hamiltonian ground state, that is, the solution of the linear equations; S4. Based on the solution of the linear equation group described in S3, update the power flow calculation correction equation, determine the convergence accuracy, and output the calculation result.
2. A quantum Newton-Raphson power flow calculation method based on a variational quantum algorithm according to claim 1, characterized in that: The step S1 comprises the following steps: S11, input the initial model parameters for quantum power flow calculation; S12, sorting the node data and constructing an admittance matrix; S13. Substitute the initial value and the admittance matrix into the Newton-Raphson flow calculation equation, calculate the partial derivative through the equation, construct the Jacobian matrix A, calculate the unbalanced quantity b, and then construct the linear equation group Ax=b.
3. The quantum Newton-Raphson power flow calculation method based on variational quantum algorithm according to claim 1 is characterized in that: Specifically, the step S2 is to map the original linear equation system Ax=b to a linear solution problem of small dimension Hy=e based on the GMERS subspace method.
4. The quantum Newton-Raphson power flow calculation method based on variational quantum algorithm according to claim 3 is characterized in that: The step S3 comprises the following steps: S31, using a variational quantum algorithm to solve the small-dimensional Hy=e linear equation; S32. Convert the quantum data obtained in step S31 into classical data, map the optimal solution of the linear equation Hy=e in the subspace to the original dimension, and obtain the solution of the equation group Ax=b in the original dimension.
5. The quantum Newton-Raphson power flow calculation method based on variational quantum algorithm according to claim 1 is characterized in that: The step S4 specifically updates the non-equilibrium node parameters and determines whether the preset convergence accuracy or the maximum number of iterations of the Newton method is reached. If not, return to step S13; if so, output the calculation result.
6. The quantum Newton-Raphson power flow calculation method based on variational quantum algorithm according to claim 4 is characterized in that: The Hamiltonian in the variational quantum algorithm in step S31 is specifically: The loss function is specifically: in In actual calculation, the normalized loss function is defined as: The gradient of the loss function is specifically: in is a unitary matrix.
7. The quantum Newton-Raphson power flow calculation method based on variational quantum algorithm according to claim 4 is characterized in that: Step S31 uses the gradient descent method in the variational quantum algorithm to obtain the Hamiltonian ground state, that is, the solution of the linear equation system, which is specifically: Construct a series of matrices that evolve over time: A(t)=(1-t)I+tA Where the imaginary time t∈[0,1], when the imaginary time t gradually increases to 1, find The ground state, at this time the parameter As the initial position of the next time instant t+1, find the ground state of the Hamiltonian at the next time, and so on. In a more general case, in order to ensure that A(t) is always reversible during the evolution process, construct at this time When the loss function approaches 0, |φ> is the solution of the linear equations, which can be converted into a classical vector representation: Assume that the solution of the equations obtained by the quantum circuit and solutions to real linear systems Satisfy the proportional relationship: Substituting it into the initial linear equation system, we get: Multiply the above formula by their respective transposes on the left to obtain: The left side of the above formula Equal to the measured loss function term; therefore, the coefficient η is solved and finally the solution of the linear equations is obtained.
8. The quantum Newton-Raphson power flow calculation method based on variational quantum algorithm according to claim 4 is characterized in that: The random assumption parameter strategy in the variational quantum algorithm described in step S31 is specifically: When it is detected that the loss function falls into the vicinity of a local extreme value, the algorithm will generate a set of random hypothetical parameters while retaining the current hypothetical parameters and obtain the loss function corresponding to this group of random parameters. Finally, the hypothetical parameters with the minimum loss function are selected as the new optimal hypothetical parameters to continue executing the variational quantum algorithm.
9. The quantum Newton-Raphson power flow calculation method based on variational quantum algorithm according to claim 4, characterized in that: The dynamic learning rate strategy in the variational quantum algorithm described in step S31 is specifically: The variational quantum algorithm proposes a parameter update strategy as follows: Here β is the learning rate, that is, the step size of the gradient or slope decrease.
10. A system for quantum Newton-Raphson power flow calculation method based on variational quantum algorithm, characterized in that: The system comprises: Linear equation system building module, used to obtain the linear equation system to be solved through Newton-Raphson power flow calculation; The linear equations dimensionality reduction module is used to map large linear equations to small-dimensional linear equation solving problems using classical subspace methods; The variational quantum linear solver module is used to solve small-dimensional linear equations through variational quantum algorithms to obtain solutions to large linear equations. The linear equation group correction and convergence judgment module is used to update the power flow calculation correction equation according to the solution of the linear equation group obtained by the variational quantum linear solver module, and to determine whether the output result is a converged solution that meets the calculation accuracy requirements.
Citation Information
Cited By
Power system transient stability time domain numerical value recursive calculation method based on HHL algorithm
CN121072196A
