Natural gas supply model correction method, system and equipment and storage medium
By deleting the gas source components in the natural gas pipeline optimization model and using the slack penalty algorithm, the problem of infeasible solutions for large-scale natural gas pipeline optimization model is solved, and correction with minimal resource changes and effective detection of contradiction constraints is achieved, and correction efficiency and accuracy.
Patent Information
- Application Number
- CN202310808983.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2025-01-03
AI Technical Summary
When the existing technology has no feasible solution to the large-scale natural gas pipeline optimization model, it lacks effective correction methods, resulting in resource adjustments relying on user experience, low efficiency and difficulty in achieving global optimization of resource utilization, and the correction plan does not meet user needs.
By building a natural gas supply model, deleting the gas source components in the infeasible model, forming a new model, and using the slack penalty algorithm to process the gas source and pipeline components, obtaining the model correction plan, ensuring the minimum resource changes and classifying the contradictions and constraints, proposing Revision suggestions.
It realizes the correction of infeasible models with minimal resource changes, improves correction efficiency and accuracy, reduces the number of variables and constraints, speeds up the solution speed, systematically completes the detection and positioning of contradiction constraints, and provides multiple a modification plan.
Smart Images

Figure CN119250246A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of big data technology, and in particular to a natural gas supply model correction method, system, device and storage medium. Background Art
[0002] In my country's energy consumption structure, the proportion of natural gas consumption has increased year by year. With the steady growth of natural gas pipeline construction, the structure of the natural gas pipeline system has become more complex and the volume of the pipeline system has become larger. In the process of natural gas supply, in order to enable natural gas providers to obtain greater profits and natural gas users to obtain sufficient natural gas supply, it is necessary to reasonably plan the allocation of limited natural gas resources.
[0003] In the prior art, a large-scale natural gas pipeline optimization model can be established, and a natural gas resource allocation plan can be obtained by solving the natural gas pipeline optimization model. However, when the constructed large-scale natural gas pipeline optimization model has no feasible solution, there is a lack of effective and convenient methods to correct the natural gas pipeline optimization model.
[0004] When large-scale gas pipeline optimization models are not feasible to run, on the one hand, users need to have a detailed understanding of the constructed model and existing resources, and on the other hand, they need to modify the data to test whether the model is feasible.
[0005] The current technical shortcomings of the modified natural gas pipeline optimization model mainly come from two aspects:
[0006] First, from the perspective of the method of deleting multiple relaxation-penalty constraints of gas sources, correcting an infeasible natural gas optimization model to a feasible model is a conservative solution to correct it under the condition of minimum resource change, which leads to limitations and defects. First, the correction of the model is completed with the minimum resource change, which means that the model changes from an infeasible state to a state with only a small feasible domain interval, or even only one feasible point. This will cause the subsequent changes of the model and data to depend on the user's experience and ability, making the user's own modification efficiency low, resulting in a high risk of model infeasibility, and it is difficult to effectively use the corrected model; secondly, the multiple relaxation-penalty constraint method lacks verification means or highly convincing explanations. The correction of the model using this method may not achieve the global optimality of a wide range of resources, resulting in insufficient resource utilization; finally, in order to propose multiple modification suggestions, the constraint contradiction detection and location of the model need to be solved multiple times, resulting in a long running time for the final suggestion.
[0007] Second, from the perspective of the quality of the suggestions proposed by the method of removing multiple relaxation-penalty constraints on gas sources, in the absence of user resource information, the proposed modification plans are only a few of many modifiable plans, resulting in the final result may still not be the resource plan that the user exactly needs or expects to change. Summary of the invention
[0008] The embodiments of the present disclosure provide a natural gas supply model correction method, system, device and storage medium to solve or alleviate one or more of the above technical problems in the prior art.
[0009] According to one aspect of the present disclosure, a natural gas supply model correction method is provided, comprising:
[0010] Constructing a first natural gas supply model, wherein the first natural gas supply model includes a gas source component, a pipeline component, and a user component;
[0011] solving the first natural gas supply model;
[0012] When there is no feasible solution to the first natural gas supply model, deleting the gas source component in the first natural gas supply model to form a second natural gas supply model;
[0013] Solving the second natural gas supply model to obtain a solution state;
[0014] According to the solution state, the gas source component and / or the pipeline component is processed using a relaxation penalty algorithm to obtain a revised solution for the first natural gas model.
[0015] In a possible implementation, when the first natural gas supply model has no feasible solution, deleting the gas source component in the first natural gas supply model to form the second natural gas supply model includes:
[0016] Determine an item to be deleted that includes a gas source decision variable in the objective function of the first natural gas supply model, wherein the item to be deleted is a cost calculation item of the gas source decision variable;
[0017] Obtaining the natural gas cost of the gas source component and the pipeline natural gas flow variable of the pipeline component connected to the gas source component;
[0018] The product of the natural gas cost of the gas source component and the pipeline natural gas flow variable is used as a replacement item to replace the item to be deleted in the objective function.
[0019] In a possible implementation, the method of processing the gas source component and / or the pipeline component using a relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model includes:
[0020] When the solution state is that there is no feasible solution, a relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the pipeline decision variables corresponding to the pipeline component;
[0021] Solve the second natural gas supply model after performing multiple relaxation-penalty restriction processing on pipeline decision variables to obtain pipeline relaxation variables;
[0022] A correction solution for the pipeline component is formed based on the pipeline relaxation variables.
[0023] In a possible implementation, when the solution state is that there is no feasible solution, using a relaxation penalty algorithm to perform multiple relaxation-penalty restriction processing on the pipeline decision variables corresponding to the pipeline component includes:
[0024] Add slack variables to pipeline decision variables to form pipeline optimization decision variables;
[0025] In the objective function of the second natural gas supply model, a large M coefficient penalty term is added to the slack variables attached to the pipeline decision variables.
[0026] In a possible implementation, the correction scheme for forming a pipeline component according to the pipeline slack variable includes:
[0027] Get the values of the slack variables that are not 0 in the pipeline slack variables, and record them as pipeline non-zero slack variables;
[0028] Release the slack constraint of the slack variable with the largest value among the non-zero slack variables of the pipeline;
[0029] solving the second natural gas supply model;
[0030] Determining whether the second natural gas supply model has a feasible solution;
[0031] When the second natural gas supply model has a feasible solution, continue to obtain pipeline non-zero slack variables generated when solving the second natural gas supply model until the number of solutions reaches a preset number, and output a correction solution for the pipeline components formed by all pipeline non-zero slack variables;
[0032] When the second natural gas supply model has no feasible solution, recovering the slack variable with the largest value among the non-zero slack variables of the pipeline;
[0033] Release the slack constraint of the slack variable with the largest value among the non-zero slack variables of other pipelines until the number of solutions reaches the preset number, or when all the non-zero slack variables of the pipelines are traversed, output the correction scheme of the pipeline components formed by the values of all the non-zero slack variables of the pipelines;
[0034] The second natural gas supply model is modified according to the modification scheme of the pipeline component.
[0035] In a possible implementation, the step of modifying the second natural gas supply model according to the modification scheme of the pipeline component includes:
[0036] Solving the modified second natural gas supply model to obtain pipeline natural gas flow variables of the pipeline component connected to the gas source component;
[0037] comparing the pipeline natural gas flow variable with the maximum natural gas flow provided by the gas source component;
[0038] When each of the pipeline natural gas flow variables is not greater than the maximum natural gas flow provided by the gas source component, detecting the constraint condition corresponding to the pipeline slack variable;
[0039] The constraint conditions corresponding to the pipeline slack variables are located as a pipeline contradiction constraint set.
[0040] In a possible implementation, comparing the pipeline natural gas flow variable with the maximum natural gas flow provided by the gas source component includes:
[0041] When there is a situation where the pipeline natural gas flow variable is greater than the maximum natural gas flow provided by the gas source component, the difference between the pipeline natural gas flow variable corresponding to the optimal pipeline decision variable and the maximum natural gas flow provided by the gas source component is calculated;
[0042] Using the difference as a correction value of the air source component to correct the air source component;
[0043] and modifying the pipeline assembly by using a modification scheme corresponding to the pipeline assembly connected to the gas source assembly;
[0044] Detecting the constraint conditions corresponding to the gas source relaxation variable and the constraint conditions corresponding to the pipeline relaxation variable;
[0045] The constraint conditions corresponding to the gas source relaxation variables are positioned as a gas source contradiction constraint set, and the constraint conditions corresponding to the pipeline relaxation variables are positioned as a pipeline contradiction constraint set.
[0046] In a possible implementation, the method of processing the gas source component and / or the pipeline component using a relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model includes:
[0047] When the solution state is that there is a feasible solution, a relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the gas source decision variables corresponding to the gas source component;
[0048] Solve the first natural gas supply model after performing multiple relaxation-penalty restriction processing on the gas source decision variables to obtain the gas source relaxation variables;
[0049] A correction scheme of the air source component is formed according to the air source relaxation variable.
[0050] In a possible implementation, when the solution state is that there is a feasible solution, using a relaxation penalty algorithm to perform multiple relaxation-penalty restriction processing on the gas source decision variables corresponding to the gas source component includes:
[0051] Adding slack variables to the gas source decision variables to form gas source optimization decision variables;
[0052] In the objective function of the first natural gas supply model, a large M coefficient penalty term is added to the slack variable attached to the gas source decision variable.
[0053] In a possible implementation, the correction scheme for forming the air source component according to the air source relaxation variable includes:
[0054] Obtain the slack variable values that are not 0 in the air source slack variables, and record them as air source non-zero slack variables;
[0055] Release the relaxation constraint of the relaxation variable with the largest value among the non-zero relaxation variables of the gas source;
[0056] solving a first natural gas supply model;
[0057] Determining whether the first natural gas supply model has a feasible solution;
[0058] When the first natural gas supply model has a feasible solution, continue to obtain the gas source non-zero relaxation variables generated when solving the first natural gas supply model until the number of solutions reaches a preset number, and output a correction scheme for the gas source components formed by all the gas source non-zero relaxation variables;
[0059] When there is no feasible solution to the first natural gas supply model, the slack variable with the largest value among the non-zero slack variables of the gas source is restored;
[0060] Release the slack constraint of the slack variable with the largest value among other non-zero slack variables of the gas source, until the number of solutions reaches the preset number, or when all non-zero slack variables of the gas source are traversed, output the correction scheme of the gas source component formed by the values of all non-zero slack variables of the gas source;
[0061] The first natural gas supply model is modified according to the modification scheme of the gas source component.
[0062] In a possible implementation, the step of modifying the first natural gas supply model according to the modification scheme of the gas source component includes:
[0063] Detecting the constraint condition corresponding to the gas source relaxation variable;
[0064] The constraint conditions corresponding to the gas source relaxation variables are positioned as a gas source contradiction constraint set.
[0065] According to one aspect of the present disclosure, there is provided a natural gas supply model correction system, comprising: a construction unit, for constructing a first natural gas supply model, the first natural gas supply model comprising a gas source component, a pipeline component and a user component;
[0066] A first solving unit, used for solving the first natural gas supply model;
[0067] a deleting unit, configured to delete the gas source component in the first natural gas supply model to form a second natural gas supply model when there is no feasible solution to the first natural gas supply model;
[0068] A second solving unit, used for solving the second natural gas supply model and obtaining a solving state;
[0069] The calculation unit is used to process the gas source component and / or the pipeline component using a relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model.
[0070] According to one aspect of the present disclosure, there is provided a natural gas supply model correction device, comprising:
[0071] Processor and memory;
[0072] The memory is used to store a computer program, and the processor calls the computer program stored in the memory to execute any one of the above-mentioned natural gas supply model correction methods.
[0073] According to one aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium. When the computer program is executed by a processor, the processor is enabled to execute any one of the above-mentioned natural gas supply model correction methods.
[0074] The exemplary embodiments of the present disclosure have the following beneficial effects: The exemplary embodiments of the present disclosure, according to the relaxation-penalty method, ensure that the infeasible model is corrected with the minimum resource change, avoiding the resource adjustment amount of the modification plan being too large and not in line with the actual engineering application. The method of deleting the gas source is cleverly used to lay the foundation for effectively performing contradictory constraint analysis, wherein the method of deleting the gas source is not only equivalent to the original model, but also reduces the number of variables and constraints, and increases the speed and efficiency of solving. The contradictory constraints are classified into three infeasible problems of pipeline components and gas source components for analysis, and the component variables with problems are judged in turn according to the classification, and then the corresponding modification suggestions are put forward according to the relaxation values of these variables and the extraction of the contradictory constraint set is completed, thereby systematically and completely completing the detection and positioning of the contradictory constraints. On the basis of relaxation-penalty, it is improved to the idea of multiple relaxation-penalty restrictions, thereby ensuring the modification of different resource variables and proposing more modification plans.
[0075] The details of one or more embodiments of the present application are presented in the following drawings and descriptions. Other features and advantages of the present application will become apparent from the accompanying drawings. It should be understood that the above general description and the detailed descriptions below are only exemplary and explanatory and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0077] Figure 1 is a flow chart of a natural gas supply model correction method of the present exemplary embodiment;
[0078] Figure 2 is a flow chart of the exemplary embodiment for determining whether there are problems with the pipeline assembly and the gas source assembly;
[0079] Figure 3 is a flow chart of forming a correction scheme for a pipeline component according to pipeline relaxation variables of the present exemplary embodiment;
[0080] Figure 4 is a flow chart of forming a correction scheme of an air source component according to an air source relaxation variable of the present exemplary embodiment;
[0081] Figure 5 is a flow chart of locating contradictory constraint sets of the present exemplary embodiment;
[0082] Figure 6is a block diagram of a natural gas supply model correction system of the exemplary embodiment;
[0083] Figure 7 is a structural block diagram of a natural gas supply model correction device according to the exemplary embodiment. DETAILED DESCRIPTION
[0084] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0085] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware units or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0086] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the steps. For example, some steps may be decomposed, while some steps may be combined or partially combined, so the actual execution order may change according to the actual situation.
[0087] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein, for example.
[0088] In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or sub-modules is not necessarily limited to those steps or sub-modules explicitly listed, but may include other steps or sub-modules not explicitly listed or inherent to these processes, methods, products, or apparatuses.
[0089] Figure 1 is a flow chart of a natural gas supply model correction method of this exemplary embodiment. Figure 1 As shown, an exemplary embodiment of the present disclosure provides a natural gas supply model correction method, comprising:
[0090] S1 constructs a first natural gas supply model, wherein the first natural gas supply model includes a gas source component, a pipeline component, and a user component;
[0091] S2 solving the first natural gas supply model;
[0092] S3, when there is no feasible solution to the first natural gas supply model, deleting the gas source component in the first natural gas supply model to form a second natural gas supply model;
[0093] S4 solves the second natural gas supply model to obtain a solution state;
[0094] S5: According to the solution state, the gas source component and / or the pipeline component are processed by using a relaxation penalty algorithm to obtain a correction scheme for the first natural gas model.
[0095] This exemplary embodiment is an application of the relaxation penalty algorithm in the optimization theory in the natural gas network. Exemplarily, the application of the relaxation penalty algorithm in the natural gas network is implemented through Python language code and Gurobi solver.
[0096] In this embodiment, constructing the first natural gas supply model includes:
[0097] Data was extracted and material balance constraints and benefit maximization objective functions were constructed, and a mathematical optimization model for natural gas supply was built in the Gurobi solver.
[0098] For example, first use Python software to retrieve data from the database (sqlite3) to extract information such as the upper and lower flow limits (Max Positive FlowRate, upper flow limit, Max Negative FlowRate, lower flow limit), component identification (Source ID, gas source identification, Pipe ID, pipeline identification, Client ID, customer identification, Node ID node identification), component serial number (GroupOrder) and unit variable cost (UnitAlterablePrice) of the gas source, pipeline, customer and node components.
[0099] Among them, the original variable names and meanings are mapped through Python dictionaries and the corresponding elements are put into the same dictionary, so that a two-dimensional list corresponding to all decision variables and Node IDs can be obtained. The program is used to traverse the dictionary formed by Node ID and match the same, so as to construct the constraints of the entire model.
[0100] For the part where the gas source component is deleted, when the gas source decision variable is encountered in traversing the Node ID element, the constraint condition to be constructed is deleted.
[0101] In the natural gas supply model, the objective function is to maximize the overall benefits of the natural gas sales business, where the overall benefits of the natural gas sales business are expressed by total sales minus all costs.
[0102] It is worth noting that, when the present embodiment is solving the first natural gas supply model and there is no feasible solution to the first natural gas supply model, it indicates that there are contradictory constraints in the first natural gas supply model. The present embodiment provides corresponding modification plans by positioning variables. Specifically, the present embodiment uses a method of detecting and locating constraint contradictions in the natural gas optimization model using relaxed constraints, and while considering the minimum change in resource quantity, it performs restricted searches for a variety of different resources, and can quickly provide users with a variety of modification plans, as well as a set of contradictory constraints with problems in the model.
[0103] Specifically, when there is no feasible solution to the first natural gas supply model, the step S3 of deleting the gas source component in the first natural gas supply model to form a second natural gas supply model includes:
[0104] S30 determines an item to be deleted that includes a gas source decision variable in the objective function of the first natural gas supply model, wherein the item to be deleted is a cost calculation item of the gas source decision variable;
[0105] S31 obtains the natural gas cost of the gas source component and the pipeline natural gas flow variable of the pipeline component connected to the gas source component;
[0106] S32 replaces the item to be deleted in the objective function with the product of the natural gas cost of the gas source component and the pipeline natural gas flow variable as a replacement item.
[0107] In this exemplary embodiment, because there is an operation of deleting the gas source component, the cost of the gas source component is connected to the gas source component to obtain the product of the natural gas flow of the pipeline component to replace the cost calculation item of the gas source variable in the objective function. The optimal value obtained in this way still considers the influence of the gas source in the objective function, but there is no trace of the gas source in the constraint, which provides a theoretical basis for analyzing which type of component the constraint contradiction exists in. At the same time, it should be noted that the upper and lower limits of the pipeline connected to the gas source should take the smaller value of the absolute value of the upper and lower limit flow of the pipeline and the gas source connected to it, so as to ensure the feasibility of the model.
[0108] Specifically, Figure 2 As shown, the S5 processes the gas source component and / or the pipeline component using a relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model, including:
[0109] S510: When the solution state is that there is no feasible solution, a relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the pipeline decision variables corresponding to the pipeline component;
[0110] S511 solves the second natural gas supply model after performing multiple relaxation-penalty restriction processing on the pipeline decision variables to obtain pipeline relaxation variables;
[0111] S512 forms a correction scheme for the pipeline component according to the pipeline relaxation variables.
[0112] In this embodiment, when the solution state of the second natural gas supply model is no feasible solution, it means that there is a problem with the pipeline component, and there may be a problem with the gas source component, or there may be no problem.
[0113] At this time, the pipeline component is processed first. Since the model without a feasible solution is the second natural gas supply model without the gas source component, this embodiment can relax the pipeline component to change the second natural gas supply model from an inoperable state to an operable state.
[0114] Specifically, when the solution state is that there is no feasible solution, the S510 uses a relaxation penalty algorithm to perform multiple relaxation-penalty restriction processing on the pipeline decision variables corresponding to the pipeline component, including:
[0115] S5100 adds slack variables to pipeline decision variables to form pipeline optimization decision variables;
[0116] S5101 In the objective function of the second natural gas supply model, a large M coefficient penalty term is added to the slack variables attached to the pipeline decision variables.
[0117] In this embodiment, if the second natural gas supply model without the gas source component is not feasible, it indicates that there is a problem with the pipeline component. At this time, it is necessary to add new optimization decision variables and positive and negative slack variables to the second natural gas supply model. These variables and the original decision variables form the following constraint relationship:
[0118]
[0119] Among them, x * represents the pipeline optimization decision variable, x represents the pipeline decision variable, and x P represents a positive slack variable, x N Represents a negative slack variable. The lower limit of positive and negative slack variables is 0, and the upper limit is positive infinity. In addition, a large M coefficient penalty term of positive and negative slack variables is added to the objective function of the optimized natural gas supply model to meet the minimum change in the upper limit of the pipeline, and provide a correction plan for the model based on the obtained slack value.
[0120] When the second natural gas supply model formed by deleting the gas source component in the first natural gas supply model is infeasible, relaxation-penalty is completed by adding additional variables, constraints and corrections to the objective function, and the relaxed second natural gas supply model is solved again (the number of solutions is increased by 1). At this time, the second natural gas supply model must be feasible.
[0121] Figure 3 is a flow chart of a correction scheme for forming a pipeline component according to pipeline relaxation variables of the present exemplary embodiment; Figure 3 As shown, specifically, the S512 forms a correction scheme for the pipeline component according to the pipeline slack variable, including:
[0122] S5120 obtains the slack variable values of the pipeline slack variables whose values are not 0, and records them as pipeline non-zero slack variables;
[0123] S5121 releases the slack constraint of the slack variable with the largest value among the non-zero slack variables of the pipeline;
[0124] S5122 solves the second natural gas supply model;
[0125] S5123 determines whether the second natural gas supply model has a feasible solution;
[0126] S5124: when the second natural gas supply model has a feasible solution, continue to obtain pipeline non-zero slack variables generated when solving the second natural gas supply model until the number of solutions reaches a preset number, and output a correction solution for the pipeline components formed by all pipeline non-zero slack variables;
[0127] S5125 When there is no feasible solution to the second natural gas supply model, restore the slack variable with the largest value among the non-zero slack variable values of the pipeline;
[0128] S5126 releases the slack constraint of the slack variable with the largest value among other pipeline non-zero slack variables until the number of solutions reaches a preset number, or when all pipeline non-zero slack variables are traversed, a correction solution for the pipeline components formed by the values of all pipeline non-zero slack variables is output.
[0129] S5127 Modify the second natural gas supply model according to the modification plan of the pipeline component.
[0130] In this embodiment, when the second natural gas supply model formed after deleting the gas source component in the first natural gas supply model is infeasible, relaxation-penalty is completed by adding additional variables, constraints and corrections to the objective function, and the second natural gas supply model after relaxation is solved again, and the number of solutions is recorded as n=1 times, and the solved pipeline relaxation variable values are stored. According to the pipeline relaxation variable values, a corresponding pipeline modification plan can be proposed. Check the number of pipeline relaxation variable values that are not 0 after the solution, limit the pipeline relaxation variable with the largest pipeline relaxation value to not relax, and solve again. At this time, the number of solutions is increased by 1, recorded as n=2. Next, according to the feasible and infeasible state of the second natural gas supply model, the following cycle process is performed, wherein each determination of the state of the second natural gas supply model will increase the number of solutions by 1. First, check the state of the solution of the second natural gas supply model according to m.Status (register). Secondly, if the second natural gas supply model is feasible, add relaxation restrictions according to the above rules, and continue to solve and determine. If the second natural gas supply model is infeasible, loosen the variables restricted in the last time, and relax the second largest pipeline relaxation variable value obtained in the last solution, and continue to solve and determine. The conditions for the end of the loop process are: 1. If the number of solutions reaches the number of solutions specified by the user (preset number k), the above process ends and the obtained pipeline correction plan is returned. 2. In the infeasible model, different pipeline relaxation variables are restricted upward in turn. If the top layer of pipeline relaxation variables is found and all pipeline relaxation variables corresponding to pipeline relaxation values are traversed within the number of solutions specified by the user, the loop process ends at this time and the correction plans for all existing pipeline components are returned.
[0131] Specifically, after the second natural gas supply model is corrected according to the correction scheme of the pipeline component, the step S5127 includes:
[0132] S51270 solves the modified second natural gas supply model to obtain a pipeline natural gas flow variable of a pipeline component connected to the gas source component;
[0133] S51271 compares the pipeline natural gas flow variable with the maximum natural gas flow provided by the gas source component;
[0134] S51272: when each of the pipeline natural gas flow variables is not greater than the maximum natural gas flow provided by the gas source component, detecting the constraint condition corresponding to the pipeline relaxation variable;
[0135] S51273 locates the constraint conditions corresponding to the pipeline slack variables as a pipeline conflict constraint set.
[0136] Specifically, the step S51271 includes comparing the pipeline natural gas flow variable with the maximum natural gas flow provided by the gas source component:
[0137] S51274 When there is a situation where the pipeline natural gas flow variable is greater than the maximum natural gas flow provided by the gas source component, calculate the difference between the pipeline natural gas flow variable corresponding to the optimal pipeline decision variable and the maximum natural gas flow provided by the gas source component;
[0138] S51275 uses the difference as a correction value of the air source component to correct the air source component;
[0139] S51276 and modifying the pipeline assembly by a modification scheme corresponding to the pipeline assembly connected to the gas source assembly;
[0140] S51277 detects the constraint conditions corresponding to the gas source relaxation variable and the constraint conditions corresponding to the pipeline relaxation variable;
[0141] S51278 locates the constraint conditions corresponding to the gas source relaxation variables as a gas source contradiction constraint set, and locates the constraint conditions corresponding to the pipeline relaxation variables as a pipeline contradiction constraint set.
[0142] like Figure 5As shown, after the second natural gas supply model is corrected according to the correction scheme of the pipeline component, the problem of the pipeline component is solved. At this time, it is still unknown whether there is a problem with the gas source component. This embodiment further judges whether there is a problem with the gas source component. The specific judgment method is: if the second natural gas supply model formed after deleting the gas source component is an infeasible model, then on the feasible second natural gas supply model formed after the pipeline component is corrected, the natural gas flow of the pipeline component directly connected to the gas source component is solved and compared with the maximum natural gas flow provided by the corresponding gas source component, and it is judged whether there is a problem with the gas source component based on the comparison result. Specifically, if the natural gas flow of the pipeline component is uniformly less than the maximum natural gas flow provided by the gas source component, there is no problem with the gas source. If there is a pipeline component with a natural gas flow greater than the maximum natural gas flow provided by the gas source component, it means that there is a problem with the gas source component. At this time, the difference between the optimal decision variable value of the pipeline component and the maximum natural gas flow of the gas source component is used as the modified value of the gas source, thereby completing the correction of the gas source part.
[0143] Specifically, Figure 2 As shown, the S5 processes the gas source component and / or the pipeline component using a relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model, including:
[0144] S520: when the solution state is that there is a feasible solution, a relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the gas source decision variables corresponding to the gas source component;
[0145] S521 solves the first natural gas supply model after performing multiple relaxation-penalty restriction processing on the gas source decision variables to obtain the gas source relaxation variables;
[0146] S522 forms a correction scheme for the air source component according to the air source relaxation variable.
[0147] In this embodiment, when the solution state of the second natural gas model formed after deleting the pipeline component is that there is a feasible solution, it means that there is no problem with the pipeline component, but there is a problem with the gas source component. At this time, the relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the gas source decision variables corresponding to the gas source component.
[0148] Specifically, when the solution state is that there is a feasible solution, the relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the gas source decision variables corresponding to the gas source component, including:
[0149] S5201 adds a slack variable to the gas source decision variable to form a gas source optimization decision variable;
[0150] S5202: In the objective function of the first natural gas supply model, a large M coefficient penalty term is added to the slack variable attached to the gas source decision variable.
[0151] In this embodiment, if the second natural gas supply model with the gas source component deleted is feasible, it means that there is no problem with the pipeline component, but there is a problem with the gas source component. At this time, it is necessary to add new optimization decision variables and positive and negative slack variables to the first natural gas supply model. These variables and the original decision variables form the following constraint relationship:
[0152] x1 * =x1+x P -x N ;
[0153] Among them, x1 * represents the gas source optimization decision variable, x1 represents the gas source decision variable, x P represents a positive slack variable, x N Represents a negative slack variable. The lower limit of positive and negative slack variables is 0, and the upper limit is positive infinity. In addition, a large M coefficient penalty term of positive and negative slack variables is added to the objective function of the optimized natural gas supply model to meet the minimum change in the upper limit of the pipeline, and provide a correction plan for the model based on the obtained slack value.
[0154] Figure 4 is a flow chart of a correction scheme for forming an air source component according to an air source relaxation variable of the present exemplary embodiment; Figure 4 As shown, specifically, the S522 forms a correction scheme for the air source component according to the air source relaxation variable, including:
[0155] S5220 obtains the slack variable values of the air source slack variables whose values are not 0, and records them as air source non-zero slack variables;
[0156] S5221 releases the relaxation constraint of the relaxation variable with the largest value among the non-zero relaxation variables of the gas source;
[0157] S5222 solves a first natural gas supply model;
[0158] S5223 determines whether the first natural gas supply model has a feasible solution;
[0159] S5224: when the first natural gas supply model has a feasible solution, continue to obtain the gas source non-zero relaxation variables generated when solving the first natural gas supply model until the number of solutions reaches a preset number, and output a correction scheme for the gas source components formed by all the gas source non-zero relaxation variables;
[0160] S5225 When there is no feasible solution for the first natural gas supply model, restore the slack variable with the largest value among the non-zero slack variable values of the gas source;
[0161] S5226 releases the relaxation constraint of the slack variable with the largest value among other air source non-zero slack variables until the number of solutions reaches a preset number, or when all air source non-zero slack variables are traversed, a correction scheme for the air source component formed by all air source non-zero slack variable values is output.
[0162] S5227 Modify the first natural gas supply model according to the modification scheme of the gas source component.
[0163] In this embodiment, when the second natural gas supply model formed after deleting the gas source component in the first natural gas supply model is infeasible, the relaxation-penalty of the first natural gas supply model is completed by adding additional variables, constraints and corrections to the objective function, and the first natural gas supply model after relaxation is solved again, and the number of solutions is recorded as n=1 times, and the solved gas source relaxation variable values are stored. According to the gas source relaxation variable values, a corresponding gas source modification plan can be proposed. Check the number of gas source relaxation variable values that are not 0 after the solution, limit the gas source relaxation variable with the largest gas source relaxation value to not relax, and solve again. At this time, the number of solutions is increased by 1, recorded as n=2. Next, according to the feasible and infeasible state of the first natural gas supply model, the following cycle process is performed, wherein each determination of the state of the first natural gas supply model will increase the number of solutions by 1. First, check the state of the solution of the first natural gas supply model according to m.Status (register). Secondly, if the first natural gas supply model is feasible, add relaxation restrictions according to the above rules, and continue to solve and determine. If the first natural gas supply model is not feasible, the variables restricted last time are released, and the second gas source relaxation variable value obtained in the last solution is relaxed and restricted, and the solution is continued. The conditions for the end of the loop process are: 1. If the number of solutions reaches the number of solutions specified by the user (the preset number of times k), the above process ends and the gas source correction scheme that has been obtained is returned. 2. In the case of an infeasible model, different gas source relaxation variables are restricted upward in turn. If the top layer of gas source relaxation variables is found, and all gas source relaxation variables corresponding to gas source relaxation values are traversed within the number of solutions specified by the user, the loop process is also ended at this time, and the correction schemes of all existing gas source components are returned.
[0164] Specifically, after the first natural gas supply model is corrected according to the correction scheme of the gas source component, the step S5227 includes:
[0165] S51270 detects the constraint condition corresponding to the gas source relaxation variable;
[0166] S51271 locates the constraint conditions corresponding to the gas source relaxation variables as a gas source contradiction constraint set.
[0167] Figure 5 is a flowchart of locating a contradictory constraint set in this exemplary embodiment, such as Figure 5As shown, in this embodiment, when the output correction scheme is the correction scheme of the gas source component, it means that the second natural gas supply model after deleting the gas source component is feasible, there is no problem with the pipeline component, and the problem exists in the gas source component. At this time, the gas source component is corrected, and the constraint conditions corresponding to the gas source relaxation variables are positioned as the gas source contradiction constraint set.
[0168] In summary, in this embodiment, when the first natural gas supply model with material balance as a constraint and the goal of maximizing the overall benefits of the natural gas sales business is not feasible, the gas source component in the first natural gas supply model is deleted to form a second natural gas supply model, and the second natural gas supply model is solved. When the solution state of the second natural gas supply model is that there is a feasible solution, it means that there is no problem with the pipeline component, but there is a problem with the gas source component. At this time, the gas source decision variable is subjected to multiple relaxation restriction penalty processing to form a correction scheme for the gas source component, and the constraint where the problematic gas source decision variable is located is positioned as a contradictory constraint. When the solution state of the second natural gas supply model is that there is no feasible solution, it means that there is a problem with the pipeline, and it is not yet certain whether there is a problem with the gas source component. At this time, the pipeline decision variable is first subjected to multiple relaxation restriction penalty processing to form a correction scheme for the pipeline component, and then it is determined whether there is a problem with the gas source component. Specifically, the natural gas flow rate of the pipeline component directly connected to the gas source component obtained by the solution is compared with the maximum natural gas flow rate provided by the corresponding gas source component. If the natural gas flow rate of the pipeline component is uniformly less than the maximum natural gas flow rate provided by the gas source component, it means that there is no problem with the gas source. At this time, the constraint where the problematic pipeline decision variable is located is positioned as a contradictory constraint. If the natural gas flow rate of a pipeline component is greater than the maximum natural gas flow rate provided by the gas source component, it means that there is a problem with the gas source component. At this time, the difference between the optimal decision variable value of the pipeline component and the maximum natural gas flow rate of the gas source component is used as the modified value of the gas source, thereby completing the correction of the gas source part, and the constraints where the problematic gas source decision variables are located and the constraints where the problematic pipeline decision variables are located are both located as contradictory constraints.
[0169] This embodiment uses the relaxation-penalty method to ensure that the infeasible model is corrected with the minimum resource change, thereby avoiding the situation where the resource adjustment amount of the modification plan is too large and does not conform to the actual engineering application.
[0170] This embodiment classifies the contradictory constraints into three infeasible problems of pipeline components and gas source components for analysis, and judges the problematic component variables in turn according to the classification, and then proposes corresponding modification suggestions based on the relaxation values of these variables and completes the extraction of the contradictory constraint set, thereby systematically and completely completing the detection and positioning of contradictory constraints.
[0171] This embodiment improves the relaxation-penalty concept to a multiple relaxation-penalty restriction concept, thereby ensuring that different resource variables are modified and proposing more modification plans.
[0172] Figure 6 FIG. 1 is a block diagram of a natural gas supply model correction system of the exemplary embodiment. Figure 6 As shown, an exemplary embodiment of the present disclosure provides a natural gas supply model correction system, comprising:
[0173] A construction unit 10 is used to construct a first natural gas supply model, wherein the first natural gas supply model includes a gas source component, a pipeline component and a user component;
[0174] A first solving unit 20, used for solving the first natural gas supply model;
[0175] a deleting unit 30, configured to delete the gas source component in the first natural gas supply model to form a second natural gas supply model when there is no feasible solution to the first natural gas supply model;
[0176] A second solving unit 40, used for solving the second natural gas supply model and obtaining a solving state;
[0177] The calculation unit 50 is used to process the gas source component and / or the pipeline component using a relaxation penalty algorithm according to the solution state to obtain a correction solution for the first natural gas model.
[0178] Figure 7 is a structural block diagram of a natural gas supply model correction device according to the exemplary embodiment. Figure 7 As shown, corresponding to the natural gas supply model correction method provided above, the present invention also provides a natural gas supply model correction device. Since the embodiment of the device is similar to the above method embodiment, the description is relatively simple. For relevant parts, please refer to the description of the above method embodiment. The device described below is only schematic. The device may include: a processor (processor) 1, a memory (memory) 2 and a communication bus (i.e., the above device bus) and a search engine, wherein the processor 1 and the memory 2 communicate with each other through the communication bus and communicate with the outside through the communication interface. The processor 1 can call the logic instructions in the memory 2 to execute the natural gas supply model correction method.
[0179] In addition, the logic instructions in the above-mentioned memory 2 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: a storage chip, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, and other media that can store program codes.
[0180] On the other hand, an embodiment of the present invention further provides a processor-readable storage medium, on which a computer program 3 is stored. When the computer program 3 is executed by the processor 1, the natural gas supply model correction method provided in the above embodiments is implemented.
[0181] The processor-readable storage medium can be any available medium or data storage device that can be accessed by the processor 1, including but not limited to magnetic storage (such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc.), optical storage (such as CD, DVD, BD, HVD, etc.), and semiconductor storage (such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD)), etc.
[0182] The above are only preferred implementations of the present disclosure, and the protection scope of the present disclosure is not limited to the above embodiments. All technical solutions under the concept of the present disclosure belong to the protection scope of the present disclosure. It should be pointed out that for ordinary technicians in this technical field, some improvements and modifications without departing from the principle of the present disclosure should be regarded as the protection scope of the present disclosure.
Claims
1. A natural gas supply model correction method, characterized in that: include: Constructing a first natural gas supply model, wherein the first natural gas supply model includes a gas source component, a pipeline component, and a user component; solving the first natural gas supply model; When there is no feasible solution to the first natural gas supply model, deleting the gas source component in the first natural gas supply model to form a second natural gas supply model; Solving the second natural gas supply model to obtain a solution state; According to the solution state, the gas source component and / or the pipeline component is processed using a relaxation penalty algorithm to obtain a revised solution for the first natural gas model.
2. The natural gas supply model correction method according to claim 1, characterized in that: When there is no feasible solution to the first natural gas supply model, deleting the gas source component in the first natural gas supply model to form a second natural gas supply model includes: Determine an item to be deleted that includes a gas source decision variable in the objective function of the first natural gas supply model, wherein the item to be deleted is a cost calculation item of the gas source decision variable; Obtaining the natural gas cost of the gas source component and the pipeline natural gas flow variable of the pipeline component connected to the gas source component; The product of the natural gas cost of the gas source component and the pipeline natural gas flow variable is used as a replacement item to replace the item to be deleted in the objective function.
3. The natural gas supply model correction method according to claim 1, characterized in that: The method of processing the gas source component and / or the pipeline component using the relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model includes: When the solution state is that there is no feasible solution, a relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the pipeline decision variables corresponding to the pipeline component; Solve the second natural gas supply model after performing multiple relaxation-penalty restriction processing on pipeline decision variables to obtain pipeline relaxation variables; A correction solution for the pipeline component is formed based on the pipeline relaxation variables.
4. The natural gas supply model correction method according to claim 3, characterized in that: When the solution state is that there is no feasible solution, using the relaxation penalty algorithm to perform multiple relaxation-penalty restriction processing on the pipeline decision variables corresponding to the pipeline component includes: Add slack variables to pipeline decision variables to form pipeline optimization decision variables; In the objective function of the second natural gas supply model, a large M coefficient penalty term is added to the slack variables attached to the pipeline decision variables.
5. The natural gas supply model correction method according to claim 3 or 4, characterized in that: The correction scheme for forming a pipeline component according to the pipeline relaxation variable includes: Get the values of the slack variables that are not 0 in the pipeline slack variables, and record them as pipeline non-zero slack variables; Release the slack constraint of the slack variable with the largest value among the non-zero slack variables of the pipeline; solving the second natural gas supply model; Determining whether the second natural gas supply model has a feasible solution; When the second natural gas supply model has a feasible solution, continue to obtain pipeline non-zero slack variables generated when solving the second natural gas supply model until the number of solutions reaches a preset number, and output a correction solution for the pipeline components formed by all pipeline non-zero slack variables; When the second natural gas supply model has no feasible solution, recovering the slack variable with the largest value among the non-zero slack variables of the pipeline; Release the slack constraint of the slack variable with the largest value among the non-zero slack variables of other pipelines until the number of solutions reaches the preset number, or when all the non-zero slack variables of the pipelines are traversed, output the correction scheme of the pipeline components formed by the values of all the non-zero slack variables of the pipelines; The second natural gas supply model is modified according to the modification scheme of the pipeline component.
6. The natural gas supply model correction method according to claim 5, characterized in that: The method of modifying the second natural gas supply model according to the modification scheme of the pipeline assembly includes: Solving the modified second natural gas supply model to obtain pipeline natural gas flow variables of the pipeline component connected to the gas source component; comparing the pipeline natural gas flow variable with the maximum natural gas flow provided by the gas source component; When each of the pipeline natural gas flow variables is not greater than the maximum natural gas flow provided by the gas source component, detecting the constraint condition corresponding to the pipeline slack variable; The constraint conditions corresponding to the pipeline slack variables are located as a pipeline contradiction constraint set.
7. The natural gas supply model correction method according to claim 6, characterized in that: The step of comparing the pipeline natural gas flow variable with the maximum natural gas flow provided by the gas source component comprises: When there is a situation where the pipeline natural gas flow variable is greater than the maximum natural gas flow provided by the gas source component, the difference between the pipeline natural gas flow variable corresponding to the optimal pipeline decision variable and the maximum natural gas flow provided by the gas source component is calculated; Using the difference as a correction value of the air source component to correct the air source component; and modifying the pipeline assembly by using a modification scheme corresponding to the pipeline assembly connected to the gas source assembly; Detecting the constraint conditions corresponding to the gas source relaxation variable and the constraint conditions corresponding to the pipeline relaxation variable; The constraint conditions corresponding to the gas source relaxation variables are positioned as a gas source contradiction constraint set, and the constraint conditions corresponding to the pipeline relaxation variables are positioned as a pipeline contradiction constraint set.
8. The natural gas supply model correction method according to claim 1, characterized in that: The method of processing the gas source component and / or the pipeline component using the relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model includes: When the solution state is that there is a feasible solution, a relaxation penalty algorithm is used to perform multiple relaxation-penalty restriction processing on the gas source decision variables corresponding to the gas source component; Solve the first natural gas supply model after performing multiple relaxation-penalty restriction processing on the gas source decision variables to obtain the gas source relaxation variables; A correction scheme for the air source component is formed according to the air source relaxation variable.
9. The natural gas supply model correction method according to claim 8, characterized in that: When the solution state is that there is a feasible solution, using the relaxation penalty algorithm to perform multiple relaxation-penalty restriction processing on the gas source decision variables corresponding to the gas source component includes: Adding slack variables to the gas source decision variables to form gas source optimization decision variables; In the objective function of the first natural gas supply model, a large M coefficient penalty term is added to the slack variable attached to the gas source decision variable.
10. The natural gas supply model correction method according to claim 8 or 9, characterized in that: The modification scheme for forming the air source component according to the air source relaxation variable includes: Obtain the slack variable values that are not 0 in the air source slack variables, and record them as air source non-zero slack variables; Release the relaxation constraint of the relaxation variable with the largest value among the non-zero relaxation variables of the gas source; solving a first natural gas supply model; Determining whether the first natural gas supply model has a feasible solution; When the first natural gas supply model has a feasible solution, continue to obtain the gas source non-zero relaxation variables generated when solving the first natural gas supply model until the number of solutions reaches a preset number, and output a correction scheme for the gas source components formed by all the gas source non-zero relaxation variables; When there is no feasible solution to the first natural gas supply model, the slack variable with the largest value among the non-zero slack variables of the gas source is restored; Release the slack constraint of the slack variable with the largest value among other non-zero slack variables of the gas source, until the number of solutions reaches the preset number, or when all non-zero slack variables of the gas source are traversed, output the correction scheme of the gas source component formed by the values of all non-zero slack variables of the gas source; The first natural gas supply model is modified according to the modification scheme of the gas source component.
11. The natural gas supply model correction method according to claim 10, characterized in that: The method of modifying the first natural gas supply model according to the modification scheme of the gas source component includes: Detecting the constraint condition corresponding to the gas source relaxation variable; The constraint conditions corresponding to the gas source relaxation variables are positioned as a gas source contradiction constraint set.
12. A natural gas supply model correction system, characterized in that: include: A construction unit, configured to construct a first natural gas supply model, wherein the first natural gas supply model includes a gas source component, a pipeline component, and a user component; A first solving unit, used for solving the first natural gas supply model; a deleting unit, configured to delete the gas source component in the first natural gas supply model to form a second natural gas supply model when there is no feasible solution to the first natural gas supply model; A second solving unit, used for solving the second natural gas supply model and obtaining a solving state; The calculation unit is used to process the gas source component and / or the pipeline component using a relaxation penalty algorithm according to the solution state to obtain a correction scheme for the first natural gas model.
13. A natural gas supply model correction device, characterized in that: include: Processor and memory; The memory is used to store a computer program, and the processor calls the computer program stored in the memory to execute the natural gas supply model correction method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is enabled to execute the natural gas supply model correction method according to any one of claims 1 to 11.
