CN-121192707-B - Active power distribution network tide optimization method based on large language model
Abstract
The invention discloses an active power distribution network tide optimization method based on a large language model, and belongs to the field of power system optimization. The method comprises the steps of firstly realizing optimal power flow problem modeling according to topology and equipment parameter data of an active power distribution network to be subjected to power flow optimization, then designing a structured prompt word through the optimal power flow problem, driving a zero sample of a large language model to generate a diversified heuristic algorithm initial population, further adopting a thinking chain evolution strategy, guiding another large language model to simulate selection, crossing and mutation operation to realize heuristic algorithm iterative optimization by taking calculation errors as evaluation standards, and obtaining output required by each distributed energy source of the active power distribution network based on the heuristic algorithm with the minimum calculation errors to finish power flow optimization of the active power distribution network. The method solves the core problems of low design efficiency of heuristic algorithms and high dependence on expert experience in the complex optimal power flow problem of the active power distribution network, and can realize automatic generation of high-quality algorithms aiming at self-defined problem scenes.
Inventors
- YANG QIANG
- ZHU YITING
- WANG YIHENG
- GAO JUNLU
Assignees
- 浙江大学
Dates
- Publication Date
- 20260508
- Application Date
- 20250819
Claims (10)
- 1. The active power distribution network tide optimization method based on the large language model is characterized by comprising the following steps of: 1) Acquiring topology and equipment parameter data of an active power distribution network to be subjected to power flow optimization, and establishing an optimal power flow problem model of the active power distribution network; 2) Constructing a structured prompt word and inputting the structured prompt word into a large language model, guiding the large language model to output a plurality of heuristic algorithm search modules meeting the optimal power flow requirement of the active power distribution network, and combining each heuristic algorithm search module with a preset evaluation module and an iteration update module to obtain a plurality of heuristic algorithms; 3) The method comprises the steps of 1) inputting an active power distribution network optimal power flow problem model into each heuristic algorithm, obtaining the output of each distributed energy source of the active power distribution network, and then calculating the result of an objective function in the optimal power flow problem model; 4) Constructing evolutionary strategy prompt words, and carrying out algorithm self-adaptive evolution on the reserved heuristic algorithm by utilizing a large language model to obtain N new heuristic algorithms; 5) Repeating the steps 3) -4) until the preset number of turns is reached, outputting the heuristic algorithm with the minimum error with the theoretical optimal solution in the step 3), obtaining the output required by each distributed energy source of the active power distribution network, and completing the power flow optimization of the active power distribution network.
- 2. The method according to claim 1, wherein in step 1), the topology and equipment parameter data of the active power distribution network includes network topology and line parameters of the active power distribution network, and connection relations between each distributed energy source and nodes and equipment information of each distributed energy source in the active power distribution network.
- 3. The method according to claim 1, wherein in step 1), an objective function and constraint conditions are designed based on topology and equipment parameter data of the active power distribution network to be subjected to power flow optimization, and an active power distribution network optimal power flow problem model is established according to the objective function and constraint conditions.
- 4. The method according to claim 1, wherein in the step 2), the structured prompt words include task descriptions, input semantic interpretation, output setting, domain knowledge enhancement and error recognition mechanisms, wherein the task descriptions include problem backgrounds and specific tasks, the problem backgrounds refer to active power distribution network optimal power flow problem models, the specific tasks refer to generation of heuristic algorithm search modules and natural language descriptions of the heuristic algorithm search modules, the input semantic interpretation refers to input parameters of the heuristic algorithm search modules and physical meanings and implicit constraints of the input parameters, the output setting is used for specifying function names, output variable names, return value types and numerical accuracy of functions in the generated search modules, the domain knowledge enhancement is used for supplementing power system expertise, and the error recognition mechanism refers to safety rules or code error types.
- 5. The method according to claim 1, wherein in step 2), the structured prompt word is input into the large language model for a plurality of times to obtain a plurality of heuristic search modules, wherein the large language model receives the structured prompt word once and outputs one heuristic search module; The search module is core content of a heuristic algorithm and is used for receiving a candidate solution of an optimal power flow problem in a current iteration process, and then searching and outputting a new solution conforming to a problem constraint, wherein a penalty function of the heuristic algorithm is designed in the step 1), the evaluation module is used for judging the output of the search module by combining the penalty function and an objective function in an active power distribution network optimal power flow problem model to generate fitness, and the iteration update module screens, reserves or replaces the output of the search module based on the result of the evaluation module to form the input of the heuristic algorithm search module in the next iteration.
- 6. The method according to claim 1, wherein in step 3), when the output of each distributed energy source of the active power distribution network is obtained by using a heuristic algorithm, the termination condition of the heuristic algorithm is that the absolute value of the variation of the calculation result of five consecutive iterations is less than 0.1% or reaches a preset maximum iteration number; In the step 3), a Gurobi solver is utilized to obtain a theoretical optimal solution of an active power distribution network optimal power flow problem model, wherein the theoretical optimal solution is an objective function result under the theoretical condition; The calculation formula of the error between the objective function result obtained by each heuristic algorithm and the theoretical optimal solution of the active power distribution network optimal power flow problem model is as follows: wherein f (h) represents an error between an objective function result obtained by the heuristic algorithm and a theoretical optimal solution, C heuristic represents an objective function result obtained by the heuristic algorithm, and C Gurobi represents the theoretical optimal solution.
- 7. The method of claim 1, wherein the evolutionary strategy cues in step 4) comprise E1, E2, M1, M2 and M3; The method comprises the steps of generating a large language model, generating a new heuristic algorithm which is obviously different from the received heuristic algorithm, wherein the large language model is guided by a strategy prompt word E1 to generate the new heuristic algorithm, the strategy prompt word E2 prompts the large language model to identify common potential ideas of the received heuristic algorithm and generate the new heuristic algorithm with the new ideas, the large language model is guided by the strategy prompt word M1 to modify the structure of a search module of the received heuristic algorithm to generate the new heuristic algorithm, the key parameters of the received heuristic algorithm are guided by the large language model to modify by the strategy prompt word M2 to generate the new heuristic algorithm, and the large language model is guided by the strategy prompt word M3 to delete redundant parts of the search module of the received heuristic algorithm to generate the new heuristic algorithm.
- 8. The method of claim 1, wherein in step 4), the algorithm adaptive evolution of the heuristic algorithms using the large language model comprises obtaining a respective algorithm idea language description and algorithm implementation code of the n reserved heuristic algorithms, Inputting the task description, the input semantic interpretation and the output setting in the structured prompt words of the step 2), and the strategy prompt words E1 and any p heuristic algorithms and algorithm idea language description of the heuristic algorithms into a large language model to obtain the task description, the input semantic interpretation and the output setting P is smaller than n; Inputting the task description, the input semantic interpretation and the output setting in the structured prompt words of the step 2), the strategy prompt words E2 and any p heuristic algorithms and algorithm idea language description of the heuristic algorithms into a large language model to obtain the task prompt words New heuristic algorithms; Inputting the task description, the input semantic interpretation and the output setting in the structured prompt words in the step 2), the strategy prompt words M1 and each heuristic algorithm and the algorithm idea language description of the heuristic algorithm into a large language model to obtain n new heuristic algorithms in total; inputting the task description, the input semantic interpretation and the output setting in the structured prompt words in the step 2), the strategy prompt words M2 and each heuristic algorithm and the algorithm idea language description of the heuristic algorithm into a large language model to obtain n new heuristic algorithms in total; the task description, the input semantic interpretation and the output setting in the structured prompt word in the step 2) and the strategy prompt word M3 and each heuristic algorithm and the algorithm idea language description of the heuristic algorithm are input into a large language model, so that n new heuristic algorithms are obtained in total.
- 9. The method of claim 1, wherein the large language model in step 2) is Deepseek-R1, deepSeek-R1-Distill-ilama-70B or Deepseek-V3; the large language model in step 4) is Deepseek-V3.
- 10. The method of claim 1, wherein each of the plurality of heuristic algorithms in step 3) is a plurality of heuristic algorithms obtained in step 2) during a first cycle, wherein each of the plurality of heuristic algorithms in step 3) is N new heuristic algorithms obtained in step 4) and N heuristic algorithms remaining in step 3) from a beginning of a second cycle until an end of the cycle.
Description
Active power distribution network tide optimization method based on large language model Technical Field The invention belongs to the field of intelligent optimization of power systems, and particularly relates to an active power distribution network tide optimization method based on a large language model. Background Along with the low carbonization and intelligent transformation of the global energy structure, the permeability of the distributed renewable energy represented by photovoltaic and wind power in the power distribution network is rapidly improved, and the 'passive, unidirectional and static' operation mode of the traditional power distribution network is difficult to adapt to the complexity and uncertainty caused by high-proportion distributed energy access. The active distribution network (Active Distribution Network, ADN) realizes bidirectional power flow management, dynamic scheduling and network reconstruction by integrating a distributed power supply, an energy storage system and a controllable load, and becomes an important development direction of a modern power system. The optimal power flow research is an indispensable part of planning operation of an active power distribution network, and specifically means that a certain optimization target (such as operation cost, network loss and the like) achieves optimal power flow distribution by adjusting control variables in the power distribution network under the condition of ensuring safe and stable operation of the system. However, due to the fact that ADN is greatly converted compared with the traditional power distribution network, the OPF (Optimal Power Flow ) problem faces a brand new challenge, the power flow distribution is of strong nonlinear characteristics due to the fact that a large number of inverters are connected in a large number, the time variability of the system state is aggravated due to the intermittence of distributed energy, and the difficulty of analysis modeling is further increased due to bidirectional power flow. In contrast, the conventional numerical analysis method often has the problems of poor convergence, low calculation efficiency and the like, the intelligent algorithm simplifies the simulation process of complex constraint, but is easy to sink into local optimum and has low solving speed, and the improved algorithm often needs a great deal of time and expertise for design. Meanwhile, large language models (Large Language Model, LLM) represented by GPT-4 and DeepSeek are largely developed and gradually tend to mature, and a new thought is brought to the design of intelligent algorithms. The method not only makes breakthrough progress in the traditional natural language processing tasks such as text generation, language translation and the like, but also makes excellent results in the fields of algorithm design and optimization with higher difficulty, and has strong universality and adaptability. In the field of power systems, the method has the advantages of obtaining preliminary application results in the fields of load prediction, fault diagnosis, safety evaluation and the like, and displaying huge application potential. Disclosure of Invention In order to solve the problems in the prior art, the invention provides an active power distribution network tide optimization method based on a large language model. The technical scheme of the invention is as follows: the invention discloses an active power distribution network tide optimization method based on a large language model, which comprises the following steps: 1) Acquiring topology and equipment parameter data of an active power distribution network to be subjected to power flow optimization, and establishing an optimal power flow problem model of the active power distribution network; 2) Constructing a structured prompt word and inputting the structured prompt word into a large language model, guiding the large language model to output a plurality of heuristic algorithm search modules meeting the optimal power flow requirement of the active power distribution network, and combining each heuristic algorithm search module with a preset evaluation module and an iteration update module to obtain a plurality of heuristic algorithms; 3) The method comprises the steps of 1) inputting an active power distribution network optimal power flow problem model into each heuristic algorithm, obtaining the output of each distributed energy source of the active power distribution network, and then calculating the result of an objective function in the optimal power flow problem model; 4) Constructing evolutionary strategy prompt words, and carrying out algorithm self-adaptive evolution on the reserved heuristic algorithm by utilizing a large language model to obtain N new heuristic algorithms; 5) Repeating the steps 3) -4) until the preset number of turns is reached, outputting the heuristic algorithm with the minimum error with the theoretical optimal solution in the