Power flow optimization method and device based on deep learning and quantum genetic algorithm, terminal equipment and storage medium

By combining deep learning and quantum genetic algorithms, the change in active power output of generators is optimized, solving the problem of local optima in power flow optimization, achieving overall optimization effect, and improving computational efficiency and robustness.

CN121566483APending Publication Date: 2026-02-24POWER DISPATCHING CONTROL CENT OF GUANGDONG POWER GRID CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511753179.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-26
Publication Date
2026-02-24

AI Technical Summary

Technical Problem

Existing power system flow optimization methods are prone to being locked into local optima, failing to meet overall optimization requirements, especially with increased complexity when renewable energy is integrated into the grid.

Method used

A power flow optimization method based on deep learning and quantum genetic algorithm is adopted. By constructing a power flow model and constraints, a qubit population is generated. Quantum rotation, mutation and crossover operations are used in combination with a Q-network of deep reinforcement learning to optimize the output active power of generators, update the sample data pool, and avoid local optima.

Benefits of technology

It achieves global optimal power flow optimization of the power system, meets the overall optimization requirements of fuel cost, power loss and voltage deviation, and improves computational efficiency and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121566483A_ABST
    Figure CN121566483A_ABST
Patent Text Reader

Abstract

The invention discloses a power flow optimization method and device based on deep learning and a quantum genetic algorithm, terminal equipment and a storage medium, and belongs to the technical field of power flow optimization of a power system. Constructing a power flow model and constraint conditions by taking minimization of fuel cost, power loss and voltage deviation of a load bus as targets, and generating an initial quantum population which meets the constraint conditions and is provided with a plurality of quantum bits; wherein each quantum bit represents the output active power variation of one group of generators; and then, according to the initial power flow data and the initial quantum population, power flow solving operation is repeatedly executed, the optimal output active power variation of each generator is obtained, and output adjustment is carried out on each generator according to the optimal output active power variation. By implementing the method, the problem that the power flow optimization result cannot meet the overall optimization requirement when a traditional optimization method is used in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power system power flow optimization technology, and in particular to a power flow optimization method, apparatus, terminal equipment, and storage medium based on deep learning and quantum genetic algorithms. Background Technology

[0002] When renewable energy is integrated into the grid, the reliable operation of the power system depends on optimal power flow (OPF). Determining the optimal solution to the OPF problem is crucial for ensuring voltage stability and minimizing power losses and fuel costs when the power system is combined with renewable energy. However, the nonlinear characteristics of renewable energy increase the complexity of OPF, thus increasing the difficulty of solving it.

[0003] Existing technologies typically employ traditional mathematical programming methods, such as the interior-point method and Newton's method. These methods solve for the optimal solution by establishing an accurate physical model of the system. The solution approach generally starts from an initial solution and iteratively optimizes along the gradient direction of the objective function. However, the initial solution is easily locked into a local optimum, preventing the subsequent attainment of the global optimum. Therefore, existing technologies suffer from the problem that power flow optimization results cannot meet the overall optimization requirements. Summary of the Invention

[0004] This invention provides a power flow optimization method, device, terminal equipment, and storage medium based on deep learning and quantum genetic algorithms. It can solve the problem that the solutions obtained by existing power flow solution methods are easily locked in local optima, and the power flow optimization results cannot meet the overall optimization requirements.

[0005] One embodiment of the present invention provides a power flow optimization method based on deep learning and quantum genetic algorithms, comprising: The initial power flow data of the power system is acquired, and based on the initial power flow data, a power flow model and corresponding constraints are constructed with the objectives of minimizing fuel cost, power loss and voltage deviation of the load bus. An initial quantum population with several qubits that satisfies the constraints is generated. Each qubit represents the change in active power output of a group of generators. Based on the initial power flow data and the initial quantum population, the power flow solution operation is repeatedly executed to obtain the optimal change in active power output of each generator, and the output of each generator is adjusted according to the optimal change in active power output. The power flow solving operation includes: Acquire the current power flow data and the current sample data pool; wherein, the initial power flow data is the initial power flow data, and the initial sample data pool is obtained based on the initial quantum population; Several currently selected training sample groups are uniformly sampled from the current sample data pool. Based on these selected training sample groups, the current power flow optimization model to be optimized is fine-tuned to obtain the current optimized power flow optimization model. Based on the current power flow data and the current optimized power flow optimization model, the current output active power change of each generator and the current difference between adjacent objective functions are calculated. If the current difference between adjacent objective functions is not less than a preset threshold, the power flow data for the next moment is determined based on the current output active power change of each generator, and the current sample data pool is updated according to the constraints; otherwise, the current output active power change of each generator is taken as the optimal output active power change.

[0006] Furthermore, the objective function of the power flow model is: In the formula, Let represent the objective function of the power flow model. This represents the weighting factor corresponding to fuel costs. Represents the fuel cost objective function. This represents the weighting coefficient corresponding to power loss. Represent the objective function for power loss. The weighting factor represents the voltage deviation. The objective function representing the voltage deviation is... This indicates the total number of heat generators. , and This represents the different cost coefficients of the i-th thermal power generator. This represents the active power output of the i-th generator. Let be the initial value of the active power output of the i-th generator. Let be the change in active power output of the i-th generator. Indicates the total number of transmission lines. This represents the voltage value at bus m. This represents the voltage value at bus n, and L represents the Lth transmission line. This represents the conductance on the transmission line L between bus m and bus n. This represents the voltage angle at bus m. This represents the voltage angle at bus n. Indicates the total number of load buses. This represents the voltage amplitude at node j. This indicates the reference voltage amplitude.

[0007] Furthermore, the constraints include: power equality constraints, generator inequality constraints, solar energy inequality constraints, wind energy inequality constraints, voltage inequality constraints, and transmission line inequality constraints. The power equation constraint is: In the formula, Indicates the number of thermal power generators. Indicates the number of solar power generator sets. Indicates the number of wind turbine generators. This represents the active power demand at bus i. Indicates the number of busbars. This represents the generator output active power of the a-th thermal power generator. This represents the active power output of the b-th solar generator. This represents the active power output of the c-th wind turbine. This represents the reactive power output of the a-th thermal power generator. This represents the reactive power output of the b-th solar generator. This represents the reactive power output of the c-th wind turbine. This represents the reactive power demand at bus i. express, express; The generator inequality constraint is: In the formula, This represents the minimum active power output of the a-th thermal power generator. This represents the maximum active power output of the a-th thermal power generator. This represents the minimum reactive power output of the a-th thermal power generator. This represents the maximum reactive power output of the a-th thermal power generator; The solar energy inequality constraint is: In the formula, Let t represent the maximum active power output of the b-th solar generator at time t. The wind energy inequality constraint is: In the formula, Let t represent the maximum active power output of the c-th wind turbine at time t. The voltage inequality constraint is: In the formula, This represents the minimum voltage at bus i. This represents the maximum voltage at bus i; The transmission line inequality constraint is: In the formula, This represents the line power flow between bus i and j. This represents the maximum allowable value of the line power flow between bus i and j.

[0008] Furthermore, the step of calculating the current output active power change of each generator and the current difference in the adjacent objective function based on the current power flow data and the current optimized power flow optimization model includes: Input the current power flow data into the optimized power flow model to obtain the current change in active power output of each generator; Based on all current output active power changes and the objective function of the power flow model, the current objective function value of the power flow model is calculated. The difference between the current and previous objective functions is calculated based on the current objective function value and the objective function value at the previous time step.

[0009] Furthermore, updating the current sample data pool according to the constraints includes: Obtain the current quantum population, and observe the collapse of each qubit in the current quantum population to obtain the generator output active power change group corresponding to each qubit; wherein, the initial quantum population is the initial quantum population. Based on the active power output change group of each generator and the power flow model, the current first fitness of the active power output change group of each generator is calculated. Based on the current first fitness, the corresponding generator output active power change set is subjected to quantum rotation and quantum mutation operations in sequence to obtain the initially updated generator output active power change set. Based on the initially updated generator output active power change set and the power flow model, the current second fitness corresponding to each initially updated generator output active power change set is calculated. Based on the current second fitness, a quantum crossover operation is performed on the initially updated generator output active power change set to obtain the first generator output active power change set. By retaining the set of active power output changes of the first generator that satisfies the aforementioned constraints, several sets of active power output changes of target generators are obtained. The current sample data pool is updated based on the active power change groups of all target generators.

[0010] Furthermore, updating the current sample data pool based on the active power change groups of all target generators includes: Obtain the first power flow data of the power system after adjustment according to the active power change groups of each target generator output; The reward value is calculated based on the change in active power output of each target generator. For each target generator output active power change set, the target generator output active power change set, the corresponding current power flow data, the corresponding reward value, and the corresponding first power flow data are used as a training sample set and added to the current sample data pool.

[0011] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments; This invention provides a power flow optimization device based on deep learning and quantum genetic algorithms, comprising: Model building module and power flow solution module; The model building module is used to acquire the initial power flow data of the power system, and based on the initial power flow data, construct a power flow model and corresponding constraints with the objectives of minimizing fuel cost, power loss and voltage deviation of the load bus, and generate an initial quantum population with several qubits that satisfies the constraints; wherein each qubit represents the change in active power output of a group of generators. The power flow solving module is used to repeatedly perform power flow solving operations based on the initial power flow data and the initial quantum population to obtain the optimal change in active power output of each generator, and to adjust the output of each generator based on the optimal change in active power output. The power flow solving operation includes: Acquire the current power flow data and the current sample data pool; wherein, the initial power flow data is the initial power flow data, and the initial sample data pool is obtained based on the initial quantum population; Several currently selected training sample groups are uniformly sampled from the current sample data pool. Based on these selected training sample groups, the current power flow optimization model to be optimized is fine-tuned to obtain the current optimized power flow optimization model. Based on the current power flow data and the current optimized power flow optimization model, the current output active power change of each generator and the current difference between adjacent objective functions are calculated. If the current difference between adjacent objective functions is not less than a preset threshold, the power flow data for the next moment is determined based on the current output active power change of each generator, and the current sample data pool is updated according to the constraints; otherwise, the current output active power change of each generator is taken as the optimal output active power change.

[0012] Based on the above method embodiments, the present invention provides a corresponding terminal device embodiment; The present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the power flow optimization method based on deep learning and quantum genetic algorithm described in any embodiment of the present invention.

[0013] Based on the above method embodiments, the present invention provides a corresponding storage medium embodiment; The present invention provides a storage medium including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the power flow optimization method based on deep learning and quantum genetic algorithm described in any embodiment of the present invention.

[0014] The embodiments of the present invention have the following beneficial effects: This invention provides a power flow optimization method, apparatus, terminal device, and storage medium based on deep learning and quantum genetic algorithms. The method includes: acquiring initial power flow data of a power system; constructing a power flow model and corresponding constraints based on the initial power flow data, with the objectives of minimizing fuel cost, power loss, and voltage deviation of the load bus; and generating an initial quantum population with several qubits that satisfies the constraints; wherein each qubit represents the change in active power output of a group of generators; repeatedly performing power flow solution operations based on the initial power flow data and the initial quantum population to obtain the optimal change in active power output of each generator; and adjusting the output of each generator based on the optimal change in active power output; wherein the power flow solution operation includes: acquiring current power flow data and current samples. A data pool is defined as follows: the initial power flow data is the initial power flow data, and the initial sample data pool is obtained based on the initial quantum population. Several currently selected training sample groups are uniformly sampled from the current sample data pool, and the current power flow optimization model to be optimized is fine-tuned based on these groups to obtain the current optimized power flow optimization model. Based on the current power flow data and the current optimized power flow optimization model, the current output active power change of each generator and the current difference between adjacent objective functions are calculated. If the current difference between adjacent objective functions is not less than a preset threshold, the power flow data for the next moment is determined based on the current output active power change of each generator, and the current sample data pool is updated according to the constraints. Otherwise, the current output active power change of each generator is taken as the optimal output active power change. Therefore, in this invention, the change in the active power output of the generator is used as each qubit in the quantum population. Due to the uncertainty of the qubit, it can cover a wider search space. Then, based on this quantum population, training samples for fine-tuning the power flow optimization model are continuously updated to help the model learn the global optimization rules rather than being limited to local experience. Therefore, the model will not be limited to a certain local optimal solution when outputting the final result, so that the power flow optimization result can meet the overall optimization requirements. Attached Figure Description

[0015] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0016] Figure 1 This is a flowchart illustrating a power flow optimization method based on deep learning and quantum genetic algorithms, provided in an embodiment of the present invention.

[0017] Figure 2 This is a schematic diagram of the structure of a power flow optimization device based on deep learning and quantum genetic algorithm provided in an embodiment of the present invention. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0020] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0021] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0022] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0023] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0024] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0025] See Figure 1 To address the problem that existing power flow optimization methods often result in solutions that are locked into local optima, failing to meet overall optimization requirements, this invention provides a power flow optimization method based on deep learning and quantum genetic algorithms, comprising: Step S101: Obtain the initial power flow data of the power system, and based on the initial power flow data, construct a power flow model and corresponding constraints with the goal of minimizing fuel cost, power loss and voltage deviation of the load bus, and generate an initial quantum population with several qubits that satisfies the constraints; wherein, each qubit represents the change in active power output of a group of generators. Specifically, power flow data includes the output active power, voltage amplitude, and voltage angle of generators on each bus.

[0026] Specifically, the initial quantum population mentioned above can be represented as: In the formula, Represents the initial quantum population. N represents the vector of each group of qubits (i.e., each qubit) in the initial quantum population, and N represents the total size of the initial quantum population.

[0027] Specifically, a quantum bit can be represented mathematically as follows: In the formula, This represents the i'-th qubit. and Let represent the probability magnitude of the i'-th qubit. and This represents two ground states. Therefore, each qubit can be in a superposition of these ground states, allowing it to explore multiple solutions in parallel.

[0028] In a preferred embodiment, the objective function of the power flow model is: In the formula, Let represent the objective function of the power flow model. This represents the weighting factor corresponding to fuel costs. Represents the fuel cost objective function. This represents the weighting coefficient corresponding to power loss. Represent the objective function for power loss. The weighting factor represents the voltage deviation. The objective function representing the voltage deviation is... This indicates the total number of heat generators. , and This represents the different cost coefficients of the i-th thermal power generator. This represents the active power output of the i-th generator. Let be the initial value of the active power output of the i-th generator. Let be the change in active power output of the i-th generator. Indicates the total number of transmission lines. This represents the voltage value at bus m. This represents the voltage value at bus n, and L represents the Lth transmission line. This represents the conductance on the transmission line L between bus m and bus n. This represents the voltage angle at bus m. This represents the voltage angle at bus n. Indicates the total number of load buses. This represents the voltage amplitude at node j. This indicates the reference voltage amplitude.

[0029] Specifically, the power flow model is based on a weighted average of the fuel cost objective function, the power loss objective function, and the voltage deviation objective function.

[0030] In this preferred embodiment, a power flow model is constructed based on the initial power flow data, with the objectives of minimizing fuel costs, power losses, and voltage deviations of the load bus.

[0031] In another preferred embodiment, the constraints include: power equality constraints, generator inequality constraints, solar energy inequality constraints, wind energy inequality constraints, voltage inequality constraints, and transmission line inequality constraints. Specifically, the analysis of hybrid renewable energy systems, when integrating resources such as wind power, solar photovoltaic power generation, and heat sources, should essentially consider equality and inequality constraints.

[0032] The power equation constraint is: In the formula, Indicates the number of thermal power generating units. Indicates the number of solar power generator sets. Indicates the number of wind turbine generators. This represents the active power demand at bus i. Indicates the number of busbars. This represents the generator output active power of the a-th thermal power generator. This represents the active power output of the b-th solar generator. This represents the active power output of the c-th wind turbine. This represents the reactive power output of the a-th thermal power generator. This represents the reactive power output of the b-th solar generator. This represents the reactive power output of the c-th wind turbine. This represents the reactive power demand at bus i. express, express; Specifically, since power imbalance can lead to frequency deviations and instability in voltage distribution, power equality constraints need to be added to ensure stable power balance.

[0033] The generator inequality constraint is: In the formula, This represents the minimum active power output of the a-th thermal power generator. This represents the maximum active power output of the a-th thermal power generator. This represents the minimum reactive power output of the a-th thermal power generator. This represents the maximum reactive power output of the a-th thermal power generator; The solar energy inequality constraint is: In the formula, Let t represent the maximum active power output of the b-th solar generator at time t. The wind energy inequality constraint is: In the formula, Let t represent the maximum active power output of the c-th wind turbine at time t. Specifically, wind energy inequality constraints are constructed to ensure that wind-based power generation operates within a safe and effective range.

[0034] The voltage inequality constraint is: In the formula, This represents the minimum voltage at bus i. This represents the maximum voltage at bus i; Specifically, voltage inequality constraints define the necessity of specified voltage limits for power systems to maintain stable operation under different conditions.

[0035] The transmission line inequality constraint is: In the formula, This represents the line power flow between bus i and j. This represents the maximum allowable value of the line power flow between bus i and j.

[0036] Specifically, the transmission line inequality constraint defines the necessity of maintaining the integrity of power system infrastructure.

[0037] Specifically, since the analysis focuses on hybrid renewable energy systems, the generators include generators for thermal power generation, generators for solar power generation based on solar PV panels, and generators for wind power generation.

[0038] In this preferred embodiment, constraints for the power flow model are constructed based on the initial power flow data.

[0039] Step S102: Based on the initial power flow data and the initial quantum population, repeat the power flow solution operation to obtain the optimal output active power change of each generator, and adjust the output of each generator according to the optimal output active power change. Specifically, after obtaining the optimal change in active power output, adjusting the active power output of the corresponding generator can achieve power flow optimization of the power system.

[0040] The power flow solving operation includes: Acquire the current power flow data and the current sample data pool; wherein, the initial power flow data is the initial power flow data, and the initial sample data pool is obtained based on the initial quantum population; Specifically, the collapse of each qubit in the initial quantum population is observed to obtain the initial generator output active power change set corresponding to each qubit. Then, based on each initial generator output active power change set and the power flow model, the initial first fitness of each initial generator output active power change set is calculated. Next, based on the initial first fitness, quantum rotation and quantum mutation operations are sequentially performed on the corresponding initial generator output active power change sets to obtain the initially updated generator output active power change sets. Then, based on the initially updated generator output active power change sets and the power flow model, the initial second fitness corresponding to each initially updated generator output active power change set is calculated. Subsequently, the generator output active power change sets corresponding to the K largest initial second fitnesss are used as parents, and quantum crossover operations are performed to obtain the initial first generator output active power change sets. Finally, the initial first generator output active power change sets that satisfy the constraints are retained to obtain several initial target generator output active power change sets. Then, the initial first power flow data of the power system is obtained after adjustment according to the active power change groups of each initial target generator output; the initial reward value is calculated based on the active power change groups of each initial target generator output, and then the initial sample data pool is obtained.

[0041] Several currently selected training sample groups are uniformly sampled from the current sample data pool. Based on these selected training sample groups, the current power flow optimization model to be optimized is fine-tuned to obtain the current optimized power flow optimization model. Based on the current power flow data and the current optimized power flow optimization model, the current output active power change of each generator and the current difference between adjacent objective functions are calculated. The specific power flow optimization model is essentially a Q-network based on deep reinforcement learning, using power flow data as the state space and the output active power changes of each generator as the action space. The vector expression for the state space is as follows: In the formula, This represents the state space at time t. This represents the output active power of each generator unit at time t. This represents the voltage value at each busbar at time t. This represents the voltage angle at each busbar at time t.

[0042] Specifically, the vector expression for the action space is: In the formula, This represents the action space at time t. This indicates the change in the active power output of each generator.

[0043] Specifically, using a Markov decision process, the agent is continuously guided to perform actions within the current state space. The input layer of its policy network receives a normalized vector of the state space, while the hidden layer extracts key features from the high-dimensional state through a nonlinear transformation of two 128-neuron layers (i.e., the ReLU activation function). The output layer then maps the output to the action space using the tanh activation function, controlling the output range within [-1, 1]. This effectively limits the model output to a reasonable action range, ensuring that the generated actions conform to the actual operational constraints of the power system. The policy network can be represented as follows: In the formula, Represents the policy function. The network parameters represent the policy network. express.

[0044] If the current difference between adjacent objective functions is not less than a preset threshold, the power flow data for the next moment is determined based on the current output active power change of each generator, and the current sample data pool is updated according to the constraints; otherwise, the current output active power change of each generator is taken as the optimal output active power change.

[0045] Specifically, the convergence condition of the entire iterative process can be expressed mathematically as follows: In the formula, This represents the difference between adjacent objective functions. This indicates the aforementioned preset threshold.

[0046] In a preferred embodiment, the step of fine-tuning the power flow optimization model to be optimized based on several currently selected training sample groups to obtain the optimized power flow optimization model includes: Several currently selected training sample groups are input into the current power flow optimization model to be optimized for iterative training until the loss function converges, generating the current optimized power flow optimization model; In each iteration of training, based on the current power flow optimization model to be optimized and the currently selected training sample group, the current predicted Q value and the current target Q value are obtained; the current loss function is calculated based on the current predicted Q value and the current target Q value, and it is determined whether the current loss function has converged; if it has converged, the current power flow optimization model to be optimized is taken as the current optimized power flow optimization model; otherwise, the model parameters in the current power flow optimization model to be optimized are adjusted, and training continues.

[0047] Specifically, during training, the policy network generates actions and interacts with the environment to obtain rewards. Therefore, an approximate function is used to measure the optimal action value function of the target network (i.e., the target Q-value). This optimal action value is the expected cumulative reward for taking the action. The optimal action value function can be decomposed into the discounted sum of the current reward and the future optimal action value using the Bellman equation, ultimately yielding the optimal action value function of the target network: In the formula, This represents the target Q value at time t. This represents the reward value at time t. Indicates the discount factor. This represents the expected cumulative reward at the next moment. This represents the network parameters of the target network.

[0048] Specifically, after obtaining the target Q-value, the parameters of the main network are iterated using the gradient of the predicted Q-value of the main network (i.e., the policy network mentioned above) and the loss function of the target Q-value. The loss function uses mean squared error and is mathematically expressed as: In the formula, Represents the loss function. This represents the predicted Q-value of the main network. E represents the selected training sample group obtained from the sample data pool. This represents the expectation of a selected training sample set consisting of state s, action a, immediate reward R, and next state s′ sampled from the sample data pool D.

[0049] Specifically, gradient descent is used to perform soft updates on the parameters of the main network and the target network. The update process is as follows: In the formula, Indicates the soft update coefficient. The weights represent the gradient. This represents the gradient of the main network parameters with respect to the loss function.

[0050] Preferably, soft updating of network parameters is an important means to ensure the stability of network training. The target network is used to provide a stable target Q-value, while the policy network is used to generate actions and predict Q-values. By slowly copying the parameters of the policy network into the target network through soft updating, drastic changes in the target network parameters can be avoided, thus ensuring the stability of the target Q-value. With each update, the parameters of the target network are adjusted according to the current network parameters and the update rate, causing the target network parameters to gradually approach the current network parameters. This gradual update method can reduce fluctuations during network training, improve training stability, and help the network converge to the optimal solution more quickly.

[0051] In this preferred embodiment, the power flow optimization model to be optimized is fine-tuned by using several currently selected training sample groups to obtain the optimized power flow optimization model.

[0052] In another preferred embodiment, the step of calculating the current output active power change of each generator and the current adjacent objective function difference based on the current power flow data and the current optimized power flow optimization model includes: Input the current power flow data into the optimized power flow model to obtain the current change in active power output of each generator; Based on all current output active power changes and the objective function of the power flow model, the current objective function value of the power flow model is calculated. Specifically, by substituting all current output active power changes into the objective function of the power flow model, the current objective function value can be calculated.

[0053] The difference between the current and previous objective functions is calculated based on the current objective function value and the objective function value at the previous time step.

[0054] Specifically, the difference between adjacent objective functions can be obtained by calculating the difference between the current objective function value and the template function value at the previous time step.

[0055] In this preferred embodiment, the current change in active power output of each generator and the current difference in the adjacent objective function are calculated using the current power flow data and the current optimized power flow optimization model.

[0056] In another preferred embodiment, updating the current sample data pool according to the constraints includes: Obtain the current quantum population, and observe the collapse of each qubit in the current quantum population to obtain the generator output active power change group corresponding to each qubit; wherein, the initial quantum population is the initial quantum population. Based on the active power output change group of each generator and the power flow model, the current first fitness of the active power output change group of each generator is calculated. Specifically, the reciprocal of the objective function of the power flow model is used as the fitness function. Therefore, after obtaining the active power output change set of each generator, the reciprocal of the objective function of the corresponding power flow model is calculated to obtain the corresponding current first fitness.

[0057] Based on the current first fitness, the corresponding generator output active power change set is subjected to quantum rotation and quantum mutation operations in sequence to obtain the initially updated generator output active power change set. Specifically, quantum rotation operations update individuals by modifying the amplitude probability of qubits, guiding the search process towards the optimal solution. Its mathematical representation is: In the formula, This represents the probability magnitude after a quantum rotation operation. This represents the probability magnitude before the quantum rotation operation. This represents the quantum rotation angle.

[0058] Specifically, a quantum mutation is performed after a quantum rotation operation. This mutation helps maintain population diversity and avoids premature convergence. The mathematical expression for the mutation operation is: In the formula, This represents the probability magnitude after a mutation operation.

[0059] Based on the initially updated generator output active power change set and the power flow model, the current second fitness corresponding to each initially updated generator output active power change set is calculated. Similarly, based on the initially updated generator output active power variation set and the objective function of the power flow model, the corresponding current second fitness is calculated.

[0060] Based on the current second fitness, a quantum crossover operation is performed on the initially updated generator output active power change set to obtain the first generator output active power change set. Specifically, the crossover operation ensures that better-performing solutions have a higher chance of propagating their features; therefore, the probability formula for selecting individuals based on second fitness is: In the formula, This represents the probability that the i'th individual (i.e., the group of generator output active power changes after the initial update) is selected. This represents the second fitness of the i'th individual. Let represent the second fitness of the j'-th individual, and N represent the total number of individuals.

[0061] Then, a random intersection point is selected, and parts of the parents are swapped to create offspring. Mathematically, single-point intersection is expressed as: In the formula, This represents the new individual obtained after the crossover of the i'-th individual. This represents the cross coefficient, which ranges from [0,1]. and Indicates the two parent trees that were selected.

[0062] By retaining the set of active power output changes of the first generator that satisfies the aforementioned constraints, several sets of active power output changes of target generators are obtained. The current sample data pool is updated based on the active power change groups of all target generators.

[0063] Preferably, the global optimization of the quantum-inspired genetic algorithm described above provides better solution space exploration. Therefore, it effectively avoids local optima in power flow solution and achieves the globally optimal solution for the power flow.

[0064] In this preferred embodiment, the current sample data pool is updated according to constraints.

[0065] In another preferred embodiment, updating the current sample data pool based on the active power change groups of all target generators includes: Obtain the first power flow data of the power system after adjustment according to the active power change groups of each target generator output; Specifically, a simulation model can be constructed in advance based on the topology of the power system and related operating power data. In this simulation model, adjustments are made according to the active power output change groups of each target generator to obtain the first power flow data.

[0066] The reward value is calculated based on the change in active power output of each target generator. Specifically, the reward function is designed to provide immediate feedback to the Q-network and keep the learning process aligned with the optimization objective; therefore, the reward function can be expressed as: For each target generator output active power change set, the target generator output active power change set, the corresponding current power flow data, the corresponding reward value, and the corresponding first power flow data are used as a training sample set and added to the current sample data pool.

[0067] Preferably, the combination of quantum-inspired genetic algorithms and Q-networks can guarantee global optimality and dynamically adjust control strategies in high-dimensional nonlinear power flow problems. In this process, the reward function penalizes out-of-bounds behavior in real time, thereby achieving output under complex constraints and demonstrating high engineering feasibility. Quantum gate operations accelerate global search, and the sample data pool reduces sample requirements; the iterative synergy of both improves convergence speed compared to traditional methods, enhancing computational efficiency. Furthermore, in scenarios with fluctuating renewable energy output, the algorithm forms a closed loop of "dynamic learning + global correction," significantly improving robustness and engineering practicality. In the Q-network, by constructing a high-dimensional state space and employing a dynamically weighted multi-objective formula for the reward function, a three-layer neural network maps states to actions, enhancing the Q-network's real-time response capability to uncertainties in hybrid renewable energy systems.

[0068] In this preferred embodiment, the current sample data pool is updated based on the active power change groups of all target generator outputs.

[0069] Preferably, to better verify the feasibility and efficiency of the present invention, optimal power flow calculations are performed and compared with the method of the present invention using the Particle Swarm Optimization (PSO) algorithm, the Grey Wolf Optimization (GWO) algorithm, and the method of the present invention. The example used is a modified IEEE 30 bus system, in which the thermal generators in the traditional system are replaced by wind turbines and solar panels. The traditional IEEE 30 nodes 5 and 11 are replaced by solar photovoltaic power generation systems, and nodes 8 and 13 are replaced by wind turbines.

[0070] Regarding the hyperparameter settings of the algorithm model: the learning rate of the Q-network is set to 0.001, the discount factor is set to 0.99, the capacity of the experience buffer pool (i.e., the aforementioned sample data pool) is set to 100,000, the small sample size is set to 64, the neural network architecture has 2 hidden layers, each with 128 neurons, the activation function is the ReLU function, the update frequency is once every 1000 steps, the initial exploration rate is 1.0, and the final exploration rate is 0.01. The quantum population size is 50, and the initialization of qubits is set to... The crossover probability is set to 0.8, the mutation probability to 0.05, and the selection method is roulette wheel selection (i.e., individuals with high fitness have a higher probability of being selected for the next generation, which can guide the algorithm to evolve towards a better solution). The maximum number of iterations is 100, and the convergence threshold is [value missing]. .

[0071] The experiment measured the performance of the proposed method and the comparison algorithm under the condition of RES (Renewable Energy Sources). The cost comparison results of optimal power flow are shown in the table below: As can be seen from the table above, the optimal power flow solution obtained based on the method proposed in this invention has the lowest fuel loss in practical applications, thus exhibiting better performance than existing optimization algorithms in solving the optimal power flow problem.

[0072] Based on the above method embodiments, the present invention provides corresponding apparatus embodiments.

[0073] like Figure 2 As shown, an embodiment of the present invention provides a power flow optimization device based on deep learning and quantum genetic algorithms, comprising: Model building module and power flow solution module; The model building module is used to acquire the initial power flow data of the power system, and based on the initial power flow data, construct a power flow model and corresponding constraints with the objectives of minimizing fuel cost, power loss and voltage deviation of the load bus, and generate an initial quantum population with several qubits that satisfies the constraints; wherein each qubit represents the change in active power output of a group of generators. The power flow solving module is used to repeatedly perform power flow solving operations based on the initial power flow data and the initial quantum population to obtain the optimal change in active power output of each generator, and to adjust the output of each generator based on the optimal change in active power output. The power flow solving operation includes: Acquire the current power flow data and the current sample data pool; wherein, the initial power flow data is the initial power flow data, and the initial sample data pool is obtained based on the initial quantum population; Several currently selected training sample groups are uniformly sampled from the current sample data pool. Based on these selected training sample groups, the current power flow optimization model to be optimized is fine-tuned to obtain the current optimized power flow optimization model. Based on the current power flow data and the current optimized power flow optimization model, the current output active power change of each generator and the current difference between adjacent objective functions are calculated. If the current difference between adjacent objective functions is not less than a preset threshold, the power flow data for the next moment is determined based on the current output active power change of each generator, and the current sample data pool is updated according to the constraints; otherwise, the current output active power change of each generator is taken as the optimal output active power change.

[0074] It should be noted that the device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided by this invention, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without creative effort. The above schematic diagram is merely an example of a power flow optimization device based on deep learning and quantum genetic algorithms, and does not constitute a limitation on a power flow optimization device based on deep learning and quantum genetic algorithms. It may include more or fewer components than illustrated, or combine certain components, or use different components.

[0075] Based on the above method embodiments, the present invention provides corresponding terminal device embodiments.

[0076] Another embodiment of the present invention provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the power flow optimization method based on deep learning and quantum genetic algorithm described in any embodiment of the present invention.

[0077] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the device. The aforementioned terminal devices may be computing devices such as desktop computers, laptops, handheld computers, and cloud servers. These devices may include, but are not limited to, processors and memory. The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. This processor is the control center of the device, connecting various parts of the device via various interfaces and lines. The aforementioned memory can be used to store the aforementioned computer programs and / or modules. The aforementioned processor implements various functions of the aforementioned device by running or executing the computer programs and / or modules stored in the aforementioned memory, and by calling data stored in the memory. The aforementioned memory may mainly include a program storage area and a data storage area, wherein the program storage area may store the operating system, at least one application program required for a function, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0078] Based on the above method embodiments, the present invention provides corresponding storage medium embodiments.

[0079] Another embodiment of the present invention provides a storage medium including a stored computer program, wherein, when the computer program is running, it controls the device where the storage medium is located to execute the power flow optimization method based on deep learning and quantum genetic algorithm described in any embodiment of the present invention.

[0080] In this embodiment, the storage medium is a computer-readable storage medium, and the computer program includes computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0081] The above are preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A power flow optimization method based on deep learning and quantum genetic algorithms, characterized in that, include: The initial power flow data of the power system is acquired, and based on the initial power flow data, a power flow model and corresponding constraints are constructed with the objectives of minimizing fuel cost, power loss and voltage deviation of the load bus. An initial quantum population with several qubits that satisfies the constraints is generated. Each qubit represents the change in active power output of a group of generators. Based on the initial power flow data and the initial quantum population, the power flow solution operation is repeatedly executed to obtain the optimal change in active power output of each generator, and the output of each generator is adjusted according to the optimal change in active power output. The power flow solving operation includes: Acquire the current power flow data and the current sample data pool; wherein, the initial power flow data is the initial power flow data, and the initial sample data pool is obtained based on the initial quantum population; Several currently selected training sample groups are uniformly sampled from the current sample data pool. Based on these selected training sample groups, the current power flow optimization model to be optimized is fine-tuned to obtain the current optimized power flow optimization model. Based on the current power flow data and the current optimized power flow optimization model, the current output active power change of each generator and the current difference between adjacent objective functions are calculated. If the current difference between adjacent objective functions is not less than a preset threshold, the power flow data for the next moment is determined based on the current output active power change of each generator, and the current sample data pool is updated according to the constraints; otherwise, the current output active power change of each generator is taken as the optimal output active power change.

2. The power flow optimization method based on deep learning and quantum genetic algorithm according to claim 1, characterized in that, The objective function of the power flow model is: In the formula, Let represent the objective function of the power flow model. This represents the weighting factor corresponding to fuel costs. Represents the fuel cost objective function. This represents the weighting coefficient corresponding to power loss. Represent the objective function for power loss. The weighting factor represents the voltage deviation. The objective function representing the voltage deviation is... This indicates the total number of heat generators. , and This represents the different cost coefficients of the i-th thermal power generator. This represents the active power output of the i-th generator. Let be the initial value of the active power output of the i-th generator. Let be the change in active power output of the i-th generator. Indicates the total number of transmission lines. This represents the voltage value at bus m. This represents the voltage value at bus n, and L represents the Lth transmission line. This represents the conductance on the transmission line L between bus m and bus n. This represents the voltage angle at bus m. This represents the voltage angle at bus n. Indicates the total number of load buses. This represents the voltage amplitude at node j. This indicates the reference voltage amplitude.

3. The power flow optimization method based on deep learning and quantum genetic algorithm according to claim 2, characterized in that, The constraints include: power equality constraints, generator inequality constraints, solar energy inequality constraints, wind energy inequality constraints, voltage inequality constraints, and transmission line inequality constraints. The power equation constraint is: In the formula, Indicates the number of thermal power generators. Indicates the number of solar power generator sets. Indicates the number of wind turbine generators. This represents the active power demand at bus i. Indicates the number of busbars. This represents the generator output active power of the a-th thermal power generator. This represents the active power output of the b-th solar generator. This represents the active power output of the c-th wind turbine. This represents the reactive power output of the a-th thermal power generator. This represents the reactive power output of the b-th solar generator. This represents the reactive power output of the c-th wind turbine. This represents the reactive power demand at bus i. This represents the electrical conductance of the line between busbar m and busbar n. This represents the phase angle difference between bus m and bus n; The generator inequality constraint is: In the formula, This represents the minimum active power output of the a-th thermal power generator. This represents the maximum active power output of the a-th thermal power generator. This represents the minimum reactive power output of the a-th thermal power generator. This represents the maximum reactive power output of the a-th thermal power generator; The solar energy inequality constraint is: In the formula, Let t represent the maximum active power output of the b-th solar generator at time t. The wind energy inequality constraint is: In the formula, Let t represent the maximum active power output of the c-th wind turbine at time t. The voltage inequality constraint is: In the formula, This represents the minimum voltage at bus i. This represents the maximum voltage at bus i; The transmission line inequality constraint is: In the formula, This represents the line power flow between bus i and j. This represents the maximum allowable value of the line power flow between bus i and j.

4. The power flow optimization method based on deep learning and quantum genetic algorithm according to claim 3, characterized in that, The step of fine-tuning the power flow optimization model to be optimized based on several currently selected training sample groups to obtain the optimized power flow optimization model includes: Several currently selected training sample groups are input into the current power flow optimization model to be optimized for iterative training until the loss function converges, generating the current optimized power flow optimization model; In each iteration of training, based on the current power flow optimization model to be optimized and the currently selected training sample group, the current predicted Q value and the current target Q value are obtained; the current loss function is calculated based on the current predicted Q value and the current target Q value, and it is determined whether the current loss function has converged; if it has converged, the current power flow optimization model to be optimized is taken as the current optimized power flow optimization model; otherwise, the model parameters in the current power flow optimization model to be optimized are adjusted, and training continues.

5. The power flow optimization method based on deep learning and quantum genetic algorithm according to claim 4, characterized in that, The calculation of the current active power output change of each generator and the current difference in the adjacent objective function based on the current power flow data and the current optimized power flow optimization model includes: Input the current power flow data into the optimized power flow model to obtain the current change in active power output of each generator; Based on all current output active power changes and the objective function of the power flow model, the current objective function value of the power flow model is calculated. The difference between the current and previous objective functions is calculated based on the current objective function value and the objective function value at the previous time step.

6. The power flow optimization method based on deep learning and quantum genetic algorithm according to claim 5, characterized in that, The step of updating the current sample data pool according to the constraints includes: Obtain the current quantum population, and observe the collapse of each qubit in the current quantum population to obtain the generator output active power change group corresponding to each qubit; wherein, the initial quantum population is the initial quantum population. Based on the active power output change group of each generator and the power flow model, the current first fitness of the active power output change group of each generator is calculated. Based on the current first fitness, the corresponding generator output active power change set is subjected to quantum rotation and quantum mutation operations in sequence to obtain the initially updated generator output active power change set. Based on the initially updated generator output active power change set and the power flow model, the current second fitness corresponding to each initially updated generator output active power change set is calculated. Based on the current second fitness, a quantum crossover operation is performed on the initially updated generator output active power change set to obtain the first generator output active power change set. By retaining the set of active power output changes of the first generator that satisfies the aforementioned constraints, several sets of active power output changes of target generators are obtained. The current sample data pool is updated based on the active power change groups of all target generators.

7. The power flow optimization method based on deep learning and quantum genetic algorithm according to claim 6, characterized in that, The step of updating the current sample data pool based on the active power change groups of all target generators includes: Obtain the first power flow data of the power system after adjustment according to the active power change groups of each target generator output; The reward value is calculated based on the change in active power output of each target generator. For each target generator output active power change set, the target generator output active power change set, the corresponding current power flow data, the corresponding reward value, and the corresponding first power flow data are used as a training sample set and added to the current sample data pool.

8. A power flow optimization device based on deep learning and quantum genetic algorithms, characterized in that, include: Model building module and power flow solution module; The model building module is used to acquire the initial power flow data of the power system, and based on the initial power flow data, construct a power flow model and corresponding constraints with the objectives of minimizing fuel cost, power loss and voltage deviation of the load bus, and generate an initial quantum population with several qubits that satisfies the constraints; wherein each qubit represents the change in active power output of a group of generators. The power flow solving module is used to repeatedly perform power flow solving operations based on the initial power flow data and the initial quantum population to obtain the optimal change in active power output of each generator, and to adjust the output of each generator based on the optimal change in active power output. The power flow solving operation includes: Acquire the current power flow data and the current sample data pool; wherein, the initial power flow data is the initial power flow data, and the initial sample data pool is obtained based on the initial quantum population; Several currently selected training sample groups are uniformly sampled from the current sample data pool. Based on these selected training sample groups, the current power flow optimization model to be optimized is fine-tuned to obtain the current optimized power flow optimization model. Based on the current power flow data and the current optimized power flow optimization model, the current output active power change of each generator and the current difference between adjacent objective functions are calculated. If the current difference between adjacent objective functions is not less than a preset threshold, the power flow data for the next moment is determined based on the current output active power change of each generator, and the current sample data pool is updated according to the constraints; otherwise, the current output active power change of each generator is taken as the optimal output active power change.

9. A terminal device, characterized in that, The device includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a power flow optimization method based on deep learning and quantum genetic algorithms as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium includes a stored computer program, wherein, when the computer program is executed, it controls the device where the storage medium is located to perform a power flow optimization method based on deep learning and quantum genetic algorithms as described in any one of claims 1 to 7.