Transportation path optimization method, system and device based on natural gas pipeline network and storage medium
By combining breadth-first search and Dijkstra's algorithm, the path planning of natural gas pipeline networks is optimized, solving the problems of known and unknown intermediate node order. This achieves efficient and low-cost path optimization in complex natural gas pipeline networks, ensuring the search for the shortest path through specified intermediate nodes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- PETROCHINA CO LTD
- Filing Date
- 2024-11-07
- Publication Date
- 2026-05-08
AI Technical Summary
Existing technologies for optimizing natural gas transmission routes suffer from problems such as the inability to guarantee passage through important intermediate nodes, high computational complexity, and high resource consumption, especially lacking flexibility and efficiency when there are multiple intermediate nodes.
By combining breadth-first search and Dijkstra's algorithm, and through ordered and unordered path planning, the topology of the natural gas pipeline network is optimized, ensuring the search of the shortest path through the specified intermediate nodes and providing path backtracking functionality.
This algorithm efficiently searches for the shortest path through a specified intermediate node in a complex natural gas pipeline network, reducing transportation costs and improving the applicability and flexibility of the algorithm.
Smart Images

Figure CN121998209A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural gas transmission technology, and particularly relates to methods, systems, devices and storage media for optimizing natural gas pipeline transmission routes. Background Technology
[0002] Currently, the optimization of natural gas transportation routes typically relies on constructing a topological network graph for route planning. The natural gas transportation network mainly consists of gas sources, stations, users, gas storage facilities, LNG receiving terminals, and the pipelines connecting them. In previous studies, facilities such as gas sources, stations, users, gas storage facilities, and LNG receiving terminals were abstracted as nodes in graph theory, and the pipelines connecting these facilities were considered edges. The entire natural gas pipeline network was modeled as a topological graph. Subsequently, relevant graph theory algorithms were applied to solve for the shortest transportation path.
[0003] In existing technologies, Dijkstra's algorithm is mainly used to solve for the shortest transport path. Dijkstra's algorithm is a typical shortest path algorithm in graph theory, used to calculate the shortest path from one node to all other nodes. Its main feature is that it uses the idea of breadth-first traversal, expanding outward layer by layer from the starting point until it reaches the destination.
[0004] However, Dijkstra's algorithm can only solve the shortest path problem between two points, which has significant limitations, mainly in the following aspects: First, essential nodes that must be traversed: In the natural gas transportation process, certain important intermediate nodes must be traversed, but the traditional Dijkstra algorithm cannot guarantee that these nodes are included in the shortest path, making it unsuitable for real-world problem scenarios. Second, the case where the order of intermediate nodes is known: When the order of intermediate nodes is known, Dijkstra's algorithm can be called multiple times to solve the shortest path for each adjacent node, and finally all results can be merged into a complete shortest path. This method is suitable when there are few intermediate nodes, but when the number of nodes increases and the topology becomes complex, this method will significantly increase the computation time and resource consumption. Third, the case where the order of intermediate nodes is unknown: When the order of intermediate nodes is unknown, an intuitive method is to perform a full permutation of all intermediate nodes, calculate the shortest path between each pair of adjacent nodes for each possible permutation, and merge these paths into a complete path. By comparing the lengths of the complete paths under all permutations, the shortest path can be found, which is the desired shortest path. However, this method not only involves a huge amount of computation, but also significantly increases the solution time and resource consumption.
[0005] Therefore, in natural gas transmission systems, selecting transmission routes efficiently and cost-effectively, especially when multiple intermediate nodes are involved, is a core issue. Existing technologies still have limitations in route planning, particularly lacking flexibility and efficiency when multiple intermediate nodes are involved. Summary of the Invention
[0006] This invention addresses the shortcomings of existing technologies by providing a method, system, device, and storage medium for optimizing natural gas pipeline transportation paths. Based on the natural gas pipeline network topology diagram, it combines shortest path algorithms from graph theory with practical business requirements to match and optimize the transportation paths of various resources in the pipeline network. This invention can efficiently search for the shortest path from the starting point through specified intermediate nodes to the final destination in complex natural gas pipeline network topologies, thereby effectively reducing the cost of natural gas transportation.
[0007] This invention is achieved through the following technical solution:
[0008] In one aspect, the present invention provides a method for optimizing the transmission path of a natural gas pipeline network, the method comprising the following steps:
[0009] Step 1: Obtain all natural gas pipeline and station data from the natural gas pipeline network database, and preprocess all natural gas pipeline and station data;
[0010] Step 2: Based on the preprocessed natural gas pipeline and station data, perform path planning from the starting point to the end point, taking into account intermediate nodes;
[0011] Step 3: Perform path search and update operations according to the path planning algorithm. After the search is completed, backtrack from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
[0012] Furthermore, in step 1, the preprocessing of all natural gas pipeline and station data specifically involves: initially setting the pipeline transportation cost from the starting station to each other station to positive infinity; and establishing a data table to store all natural gas pipeline data.
[0013] Furthermore, in step 2, the path planning from the starting point to the ending point, taking into account intermediate nodes, includes:
[0014] Initialize the starting station, set the pipeline cost of the given starting station to 0, and keep the pipeline cost of other nodes positive infinity;
[0015] Construct an ordered set of nodes by traversing all intermediate and final nodes in a predetermined order.
[0016] Traverse the pipeline data in the natural gas pipeline network, create a set of downstream paths corresponding to the starting node of each pipeline, and add the relevant information of the corresponding pipeline;
[0017] Create a linked list to be visited (linklist), and complete the ordered path planning for intermediate nodes.
[0018] Furthermore, in step 3, the path search and update operation based on the path planning algorithm includes ordered path planning and unordered path planning, wherein:
[0019] The ordered path planning refers to a process where the order in which intermediate nodes are visited is fixed and known. There may be other nodes between each intermediate node, and the shortest path obtained needs to pass through each intermediate node in a predetermined order until the destination is reached. Specifically, it includes the following steps:
[0020] Step 301: Mark nodes. Check if the shortest path has been determined for the selected access node. If it has, skip the node. If the shortest path has not been determined for the node, mark it as accessed.
[0021] Step 302: Traverse all downstream paths of the node, calculate the pipeline cost to the downstream node, and if the current path can reduce the pipeline cost of the downstream node, update the cost and record the preceding node.
[0022] Step 303: Add the updated downstream node to the list of nodes to be visited;
[0023] Step 304: Based on the access list, process the intermediate nodes until the path planning of all intermediate nodes and the destination is completed;
[0024] Step 305: After completing the path planning for all intermediate nodes and the destination, backtrack from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
[0025] Unordered path planning refers to a path where the order in which intermediate nodes are visited is not fixed. The search path does not need to traverse intermediate nodes in a predetermined order, but rather dynamically determines which intermediate nodes to pass through during the path search process. Compared to ordered path planning, unordered path planning methods offer greater flexibility and are suitable for situations where the order of intermediate nodes is unknown or uncertain.
[0026] Furthermore, the main difference between unordered path planning and ordered path planning lies in:
[0027] Unordered path planning does not require visiting intermediate nodes in a specific order. It simply involves forming a set of all intermediate nodes that need to be visited, representing the nodes that must be visited during the path search process. When a node is found to be an intermediate node that needs to be visited, it is removed from the set.
[0028] Once all intermediate nodes have been processed, i.e. the set of intermediate nodes is empty, the destination is added to the set to ensure that the destination is not reached prematurely, which would result in some intermediate nodes not being visited.
[0029] After processing all nodes, if the set of intermediate nodes is empty, it means that the search has ended successfully and the path has covered all necessary nodes; otherwise, it means that there are unvisited nodes, indicating that there is no shortest path that can pass through all intermediate nodes and reach the destination.
[0030] In another aspect, the present invention provides a natural gas pipeline transportation path optimization system, the system comprising:
[0031] The data acquisition and preprocessing module is used to acquire all natural gas pipeline and station data from the natural gas pipeline network database and preprocess all natural gas pipeline and station data.
[0032] The route planning module is used to perform route planning from the starting point to the end point, taking into account intermediate nodes, on the pre-processed natural gas pipeline and station data.
[0033] The path search and update module is used to perform path search and update operations based on the path planning algorithm. After the search is completed, it backtracks from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
[0034] In another aspect, the present invention provides a natural gas pipeline transportation path optimization device, including a memory and a processor, wherein the memory stores a computer program, characterized in that, when the computer program is executed by the processor, the processor performs the steps of a natural gas pipeline transportation path optimization method as described above.
[0035] In another aspect, the present invention provides a computer storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of a natural gas pipeline transportation path optimization method as described above.
[0036] Compared with the prior art, the present invention has the following advantages:
[0037] 1. By improving the breadth-first search (BFS) and Dijkstra's algorithm, and combining the characteristics of natural gas pipeline networks and business requirements, the minimum cost path search problem with a given intermediate node is solved, and path backtracking function is supported.
[0038] 2. This invention provides a shortest path search algorithm based on the breadth-first search concept, offering different node management strategies: ordered path planning and unordered path planning. In ordered path planning, the visiting order of intermediate nodes remains unchanged; in unordered path planning, the node order is flexibly handled to ensure that all intermediate nodes are visited. This invention enables efficient searching of a shortest path from the starting point through specified intermediate nodes to the final destination in complex natural gas pipeline topologies, effectively improving the algorithm's applicability and flexibility while reducing costs in natural gas transportation.
[0039] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures pointed out in the description, claims and drawings. Attached Figure Description
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 It is a flowchart of the methods, systems, devices and storage media for optimizing the natural gas pipeline transportation path.
[0042] Figure 2 It is a technical roadmap for the orderly path planning of intermediate nodes in natural gas pipeline transportation path optimization methods, systems, devices, and storage media.
[0043] Figure 3 It is a technical roadmap for unordered path planning of intermediate nodes in natural gas pipeline transportation path optimization methods, systems, devices, and storage media.
[0044] Figure 4 It is a directed weighted graph simulating the method, system, device, and storage medium for optimizing the natural gas pipeline transportation path.
[0045] Figure 5 This is a schematic diagram of the method, system, device, and storage medium path initialization stage for optimizing the natural gas pipeline transportation path.
[0046] Figures 6 to 11 It is a schematic diagram of the method, system, device and storage medium path search and update process for optimizing the natural gas pipeline transportation path. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0048] Example 1:
[0049] Please see Figure 1 , Figure 2 and Figure 3 , Figure 1 This is a flowchart illustrating the methods, systems, devices, and storage media for optimizing natural gas pipeline transportation routes. Figure 2 It is a technical roadmap for the orderly path planning of intermediate nodes in natural gas pipeline transportation path optimization methods, systems, devices, and storage media. Figure 3 This is a technical roadmap for unordered path planning of intermediate nodes in a natural gas pipeline transportation path optimization method, system, device, and storage medium. In this embodiment, a natural gas pipeline transportation path optimization method, system, device, and storage medium are provided. The method includes the following steps:
[0050] Step S1: Obtain all natural gas pipeline and station data from the natural gas pipeline network database, and preprocess all natural gas pipeline and station data;
[0051] Furthermore, the preprocessing of all natural gas pipeline and station data specifically involves: initially setting the pipeline transportation cost from the starting station to each other station to positive infinity; and establishing a data table to store all natural gas pipeline data.
[0052] Furthermore, among all the acquired natural gas pipeline (edge) and station (node) data, a unique number is assigned to each station (node), and the pipeline transportation cost from the origin to each other station (node) is initially set to positive infinity, indicating that the path is not yet determined; its specific expression can be:
[0053]
[0054] Create a data table and store all natural gas pipeline data in it. This natural gas pipeline data includes the pipeline's starting point, ending point, and transportation cost. The starting point and ending point are represented by node numbers, and their specific expressions are as follows:
[0055]
[0056] In the formula, Name represents the name of the corresponding pipeline, point_up_code represents the starting point of the pipeline, point_down_code represents the ending point of the pipeline, and fee represents the infusion cost from the starting point to the ending point of the pipeline.
[0057] For the same pipeline, the starting and ending points are opposite when transporting goods in the forward and reverse directions.
[0058] Step S2: Based on the preprocessed natural gas pipeline and station data, perform path planning from the starting point to the end point, taking into account intermediate nodes;
[0059] Furthermore, the path planning from the starting point to the ending point, taking into account intermediate nodes, includes the following steps:
[0060] Step S201: Initialize the starting station, set the pipeline cost of the given starting station to 0, and keep the pipeline cost of other nodes positive infinity;
[0061] Furthermore, the way to initialize the starting station can be:
[0062]
[0063] Step S202: Construct an ordered set of nodes for all intermediate nodes and the endpoint that need to be passed through in a predetermined order;
[0064] Furthermore, the ordered set of nodes represents the order of nodes that the search path must traverse.
[0065] Step S203: Traverse the pipeline data in the natural gas pipeline network, create a set of downstream paths corresponding to the starting node of each pipeline, and add the relevant information of the corresponding pipeline;
[0066] Furthermore, its specific expression is:
[0067]
[0068] Step S204: Create a linked list to be visited (linklist) and complete the path planning for intermediate nodes.
[0069] Furthermore, the linked list to be visited represents the next node to be visited during the path search process; when visiting an element in the linked list in a loop, it may be necessary to traverse the set of downstream paths of that element. Step S204 also includes:
[0070] Step S2041: Set a Boolean variable for each node;
[0071] Step S2042: Initialize the linked list of the nodes to be visited;
[0072] Step S2043: After visiting a node in the linked list linklist, add the unvisited downstream nodes connected to it to the linked list to be visited, and sort them according to the pipeline cost.
[0073] Furthermore, a boolean variable is set for each node to mark whether the node has been visited, avoiding repeated visits; at the same time, a linked list of nodes to be visited is initialized, initially containing only the starting point; whenever a node in the linked list is visited, all downstream nodes of the pipelines connected to it are added to the linked list to be visited; after each new node is added, the nodes in the linked list are sorted from low to high according to the pipeline cost, and the node with the lowest pipeline cost is processed first to ensure search efficiency.
[0074] Step S3: Perform path search and update operations according to the path planning algorithm. After the search is completed, backtrack from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
[0075] Furthermore, in step 3, the path search and update operation based on the path planning algorithm includes ordered path planning and unordered path planning, wherein:
[0076] The ordered path planning refers to the fact that the order of visiting intermediate nodes is fixed and known. There may be other nodes between each intermediate node. The shortest path obtained by searching needs to pass through each intermediate node in a predetermined order until the destination is reached.
[0077] For further details, please refer to Figure 2 The ordered path planning specifically includes the following steps:
[0078] Step S301: Mark the node. Check whether the shortest path has been determined for the selected access node. If it has, skip the node. If the shortest path has not been determined for the node, mark it as accessed.
[0079] Furthermore, the check to see if the shortest path has been determined for the selected access node is performed by checking whether the node's boolean variable is True. If the boolean variable is True, the node is skipped; otherwise, it is marked as accessed.
[0080] Step S302: Traverse all downstream paths of the node, calculate the pipeline transportation cost to the downstream node, and if the current path can reduce the pipeline transportation cost of the downstream node, update the cost and record the upstream node.
[0081] Furthermore, the pipeline transportation cost of the downstream node is calculated as follows: downstream node pipeline transportation cost = current node pipeline transportation cost + connecting pipeline pipeline transportation cost.
[0082] Step S303: Add the updated downstream node to the list of nodes to be visited;
[0083] Furthermore, if the updated downstream node is already in the access list, it does not need to be added again.
[0084] Step S304: Based on the access list, process the intermediate nodes until the path planning of all intermediate nodes and the destination is completed;
[0085] Furthermore, step S304 also includes:
[0086] Step S3041: If the accessed node is an intermediate node, lock its transportation cost and clear the current list of nodes to be accessed.
[0087] Step S3042: Set the intermediate node as the new starting point and remove it from the ordered node set. At this time, the node list to be visited is empty.
[0088] Furthermore, the removal from the ordered node set specifically involves removing the first value from the ordered node set composed of the intermediate node and the endpoint. Since the intermediate node has already been removed from the list of nodes to be visited, if the ordered node set is empty at this time, it means that the endpoint has been found and the search process ends.
[0089] Step S3043: Re-plan the route until all intermediate nodes and the destination have been processed.
[0090] Step S305: After completing the path planning for all intermediate nodes and the destination, backtrack from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
[0091] Furthermore, during the entire path planning process, it is necessary to determine whether the shortest path exists, specifically:
[0092] If the ordered set of nodes is empty after processing all the necessary nodes in sequence, the search is considered complete; otherwise, it means there are unvisited nodes and there is no shortest path that passes through all intermediate nodes in sequence.
[0093] For further details, please refer to Figure 3 The unordered path planning refers to a path where the order in which intermediate nodes are visited is not fixed. The search path does not need to traverse intermediate nodes in a predetermined order; instead, it dynamically determines which intermediate nodes to pass through during the path search process. Compared to ordered path planning, unordered path planning offers greater flexibility and is suitable for situations where the order of intermediate nodes is unknown or uncertain.
[0094] Furthermore, the main difference between unordered path planning and ordered path planning lies in:
[0095] Unordered path planning does not require visiting intermediate nodes in a specific order. It simply involves forming a set of all intermediate nodes that need to be visited, representing the nodes that must be visited during the path search process. When a node is found to be an intermediate node that needs to be visited, it is removed from the set.
[0096] Once all intermediate nodes have been processed, i.e. the set of intermediate nodes is empty, the destination is added to the set to ensure that the destination is not reached prematurely, which would result in some intermediate nodes not being visited.
[0097] After processing all nodes, if the set of intermediate nodes is empty, it means that the search has ended successfully and the path has covered all necessary nodes; otherwise, it means that there are unvisited nodes, indicating that there is no shortest path that can pass through all intermediate nodes and reach the destination.
[0098] Example 2:
[0099] Please see Figures 4 to 11 In this embodiment, to better understand the present invention, the optimization of the pipeline transportation path is further described below:
[0100] Please see Figure 4 Given a directed weighted graph representing the connection between stations and pipelines in a natural gas pipeline network, where each node represents a station and the weight of each edge represents the pipeline transportation cost between stations. Suppose S0 is the starting point, S6 is the ending point, and S4 is the intermediate node that must be passed through.
[0101] For further details, please refer to Figure 5 Initialize the distance from each node to the starting point S0 (excluding the starting point S0) to positive infinity, and set the distance from the starting point S0 to itself to 0; the shortest distance and the preceding node of the shortest path of each node will be stored in the information of each node and displayed below the node in the graph; construct a set and add all the intermediate nodes and the endpoint that must be passed to the set.
[0102] In this embodiment, the set mid_node = {S4, S6} is initialized; the starting point S0 is added to the linked list, i.e., linklist = {S0}. The linked list is used to store the nodes to be processed; S0 is taken out from the linked list and marked as the node whose shortest path has been confirmed; since S0 is not an intermediate node, all downstream paths of S0 are traversed, and the cost of the new path is calculated (new cost = cost of S0 + pipeline cost to the downstream node). If the cost of the new path is less than the cost of the currently recorded downstream node, the cost of the node and the preceding node are updated, and the updated downstream node is added to the linked list.
[0103] For further details, please refer to Figure 6Sort the nodes in the linked list in ascending order of current pipeline cost to obtain linklist = {S1, S2}. This ensures that the node processed each time is the optimal node on the current path. Take S1 out of the linked list and confirm it as the node whose shortest path has been confirmed. Since S1 is not an intermediate node, traverse all downstream paths of S1, update the pipeline cost and preceding node of the downstream node, and add the downstream node to the linked list.
[0104] For further details, please refer to Figure 7 Sort the nodes in the linked list according to the pipeline cost in ascending order to get linklist = {S2, S3, S5}. Take S2 out of the linked list and confirm it as the node whose shortest path has been confirmed. Since S2 is not an intermediate node, traverse the downstream path of S2, update the pipeline cost of the downstream node and the information of the preceding node, and add the downstream node that is not in the linked list to the linked list. It should be noted that when S3 has S2 as its preceding node, the shortest path from the starting point to S3 is 6, which is less than the shortest path from the starting point to S3 of 8 when S3 has S1 as its preceding node. Therefore, update the shortest distance from S3 to the starting point and the preceding node under the premise of the shortest distance.
[0105] For further details, please refer to Figure 8 Sort the nodes in the linked list according to the pipeline cost in ascending order to get linklist = {S3, S5, S4}. Take S3 out of the linked list and confirm S3 as the node whose shortest path has been confirmed. Since S3 is not an intermediate node, traverse the downstream path of S3, update the pipeline cost and predecessor node of the downstream node, update the predecessor node of S5 to S3, and update the shortest path to the starting point to 8. Update the predecessor node of S4 to S3, and update the shortest path to the starting point to 7. Since S4 and S5 already exist in the linked list, there is no need to add them again.
[0106] For further details, please refer to Figure 9 The nodes in the linked list are sorted in ascending order of pipeline cost to obtain linklist = {S4, S5}. S4 is removed from the linked list and confirmed as the node for which the shortest path has been found. Since S4 is a necessary intermediate node, special handling is required. At this point, the linked list of nodes to be visited is redefined, and S4 is used as the new starting point. Because S4 has been removed, the linked list of nodes to be visited is empty. S4 is removed from the set of intermediate nodes. At this point, the set of intermediate nodes needs to be checked. It is found that there is still a destination node, so the path search loop has not ended and needs to continue. The downstream path of S4 is traversed, the pipeline cost and the preceding node of each downstream node are calculated and updated. At the same time, all downstream nodes not in the linked list are added to the linked list of nodes to be visited for subsequent path search.
[0107] For further details, please refer to Figure 10 Sort the nodes in the linked list according to the pipeline cost in ascending order to obtain linklist = {S6}. Remove S6 from the linked list and confirm S6 as the node whose shortest path has been confirmed. Since S6 is the destination, redefine the linked list of nodes to be visited, linklist, and use S6 as the new starting point. Because S6 has been removed, the linked list is now empty. Remove S6 from the set of intermediate nodes. At this point, the set of intermediate nodes is empty, indicating that all necessary nodes have been visited, and the path search loop ends.
[0108] For further details, please refer to Figure 11 Based on the preceding node of each node, tracing back from the endpoint S6, the shortest path passing through the intermediate node S4 is: S0-S2-S3-S4-S6, with a minimum pipeline cost of 14.
[0109] For further details, please refer to Figures 6 to 11 This document details how the path planning algorithm progressively updates the minimum cost distance from each node to the starting point during the search process. In this process, due to the presence of intermediate nodes, the distance from each node to the starting point is not necessarily the shortest. For example, the final searched path may not be the shortest path, but merely the shortest path passing through the given intermediate nodes. Furthermore, the linked list is cleared each time an intermediate node is encountered, potentially causing some nodes to be missed. Ultimately, a shortest path from the starting point through the given intermediate nodes to the destination is obtained. Each node on the shortest path records the shortest path from the starting point through some of the given intermediate nodes to that node, as well as the preceding nodes that reach this minimum distance. In this way, we can backtrack the entire shortest path using the information from the preceding nodes. As the search progresses, this information is continuously updated until the minimum cost path is found.
[0110] For further details, please refer to Figures 4 to 11 If the traditional Dijkstra's algorithm is used directly, the shortest path obtained is S0-S2-S3-S5-S6, with a minimum pipeline cost of 11. Although Dijkstra's algorithm yields a lower cost path, this path does not pass through the specified intermediate node S4. This invention, through an improved algorithm, finds the path with the minimum pipeline cost while ensuring that the path passes through the given intermediate node S4, thus meeting actual business needs, rather than simply focusing on minimizing cost as the sole objective.
[0111] Example 3:
[0112] In this embodiment, a natural gas pipeline transportation path optimization system is provided, the system comprising:
[0113] The data acquisition and preprocessing module is used to acquire all natural gas pipeline and station data from the natural gas pipeline network database and preprocess all natural gas pipeline and station data.
[0114] The route planning module is used to perform route planning from the starting point to the end point, taking into account intermediate nodes, on the pre-processed natural gas pipeline and station data.
[0115] The path search and update module is used to perform path search and update operations based on the path planning algorithm. After the search is completed, it backtracks from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
[0116] Example 4:
[0117] In this embodiment, a natural gas pipeline transportation path optimization device is provided, including a memory and a processor. The memory stores a computer program. The computer program is characterized in that, when executed by the processor, the processor performs the steps of the natural gas pipeline transportation path optimization method as described in Embodiment 1 above.
[0118] Example 5:
[0119] In this embodiment, a computer storage medium is provided, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, it implements the steps of the natural gas pipeline transportation path optimization method as described in Embodiment 1 above.
[0120] It should be noted that, in this invention, for ease of understanding and description of the technical solution, the terms "natural gas pipeline" and "edge" have the same meaning, and the terms "station" and "node" have the same meaning.
[0121] Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for optimizing the transmission path of a natural gas pipeline network, characterized in that: Obtain all natural gas pipeline and station data from the natural gas pipeline network database, and preprocess all natural gas pipeline and station data; Based on the preprocessed natural gas pipeline and station data, path planning is performed from the starting point to the end point, taking into account intermediate nodes; The path search and update operation is performed according to the path planning algorithm. After the search is completed, the path is backtracked from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
2. The method for optimizing the transmission path of a natural gas pipeline network as described in claim 1, characterized in that, The preprocessing of all natural gas pipeline and station data includes: The pipeline transportation cost from the starting station to each other station is initially set to positive infinity; Create a data table to store all natural gas pipeline data.
3. The method for optimizing the transportation path of a natural gas pipeline network as described in claim 1, characterized in that, The path planning from the starting point to the ending point, taking into account intermediate nodes, includes: Initialize the starting station, set the pipeline cost of the given starting station to 0, and keep the pipeline cost of other nodes positive infinity; Construct an ordered set of nodes by traversing all intermediate and final nodes in a predetermined order. Traverse the pipeline data in the natural gas pipeline network, create a set of downstream paths corresponding to the starting node of each pipeline, and add the relevant information of the corresponding pipeline; Create a linked list to be visited (linklist) and complete the path planning for intermediate nodes.
4. The method for optimizing the transportation path of a natural gas pipeline network as described in claim 3, characterized in that, The process of creating the linked list to be visited and completing the path planning for intermediate nodes also includes: Set a boolean variable for each node; Initialize the linked list (linklist) of nodes to be visited; After visiting a node in the linked list, add the unvisited downstream nodes connected to it to the unvisited linked list and sort them by pipeline cost.
5. The method for optimizing the transmission path of a natural gas pipeline network as described in claim 1, characterized in that: The path search and update operation based on the planned path includes ordered path planning and unordered path planning, wherein: Ordered path planning refers to a process where the order in which intermediate nodes are visited is fixed and known. There may be other nodes between each intermediate node. The shortest path obtained by searching needs to pass through each intermediate node in a predetermined order until the destination is reached. Unordered path planning refers to the fact that the order in which intermediate nodes are visited is not fixed. The search path does not need to traverse intermediate nodes in a predetermined order, but rather dynamically determines which intermediate nodes to pass through during the path search process.
6. The method for optimizing the transmission path of a natural gas pipeline network as described in claim 5, characterized in that, The ordered path planning specifically includes: Check if the shortest path has been determined for the selected access node. If it has, skip the node. If the shortest path has not been determined for the node, mark it as accessed. Traverse all downstream paths of a node, calculate the pipeline cost to the downstream node, and if the current path can reduce the pipeline cost of the downstream node, update the cost and record the preceding node. Add the updated downstream nodes to the list of nodes to be accessed; Based on accessing the linked list, process intermediate nodes until the path planning of all intermediate nodes and the destination is completed; After completing the path planning for all intermediate nodes and the destination, backtrack from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
7. The method for optimizing the transmission path of a natural gas pipeline network as described in claim 6, characterized in that: The check to see if the shortest path has been determined for the selected access node is performed by checking if the boolean variable of the access node is True. If the boolean variable is True, the node is skipped; otherwise, it is marked as accessed.
8. The method for optimizing the transmission path of a natural gas pipeline network as described in claim 6, characterized in that, The path planning based on accessing the linked list, processing intermediate nodes, until all intermediate nodes and the destination are completed, also includes: If the node being visited is an intermediate node, its transportation cost is locked, and the current list of nodes to be visited is cleared. Set the intermediate node as the new starting point and remove it from the ordered set of nodes. At this point, the list of nodes to be visited is empty. Re-plan the route until all intermediate nodes and the destination have been processed.
9. The method for optimizing the transmission path of a natural gas pipeline network as described in claim 8, characterized in that: The step of setting the intermediate node as the new starting point and removing it from the ordered node set specifically refers to the first value in the ordered node set composed of the intermediate node and the endpoint. If the ordered node set is empty after removing the intermediate node, it means that the endpoint has been found and the search process ends.
10. The method for optimizing the transportation path of a natural gas pipeline network as described in claim 5, characterized in that, The main difference between unordered path planning and ordered path planning is: Unordered path planning does not require visiting intermediate nodes in a specific order. It simply involves forming a set of all intermediate nodes that need to be visited, representing the nodes that must be visited during the path search process. When a node is found to be an intermediate node that needs to be visited, it is removed from the set. Once all intermediate nodes have been processed, i.e. the set of intermediate nodes is empty, the destination is added to the set to ensure that the destination is not reached prematurely, which would result in some intermediate nodes not being visited. After processing all nodes, if the set of intermediate nodes is empty, it means that the search has ended successfully and the path has covered all necessary nodes; otherwise, it means that there are unvisited nodes, indicating that there is no shortest path that can pass through all intermediate nodes and reach the destination.
11. A method for optimizing the transmission path of a natural gas pipeline network as described in any one of claims 1 to 10, characterized in that, During the entire path planning process, it is necessary to determine whether the shortest path exists. The specific method is as follows: If the ordered set of nodes is empty after processing all the necessary nodes in sequence, the search is considered complete; otherwise, it means there are unvisited nodes and there is no shortest path that passes through all intermediate nodes in sequence.
12. A natural gas pipeline transportation path optimization system, characterized in that, The system includes: The data acquisition and preprocessing module is used to acquire all natural gas pipeline and station data from the natural gas pipeline network database and preprocess all natural gas pipeline and station data. The route planning module is used to perform route planning from the starting point to the end point, taking into account intermediate nodes, on the pre-processed natural gas pipeline and station data. The path search and update module is used to perform path search and update operations based on the path planning algorithm. After the search is completed, it backtracks from the destination to the starting point to generate the shortest path and its corresponding minimum transportation cost and path information.
13. A natural gas pipeline transportation route optimization device, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the computer program is executed by the processor, the processor performs a natural gas pipeline transportation path optimization method as described in any one of claims 1 to 11.
14. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a natural gas pipeline transportation path optimization method as described in any one of claims 1 to 11.