Cable shortest path optimization method and device based on improved Astar algorithm and medium

By improving the Astar algorithm, combining the minimum heap and adjacency table matrix, optimizing the shortest path optimization of cables, solving the efficiency and accuracy problems of traditional manual selection methods, and achieving more efficient cable path calculations.

CN120087003AActive Publication Date: 2025-06-03WISDRI ENG & RES INC LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411942043.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-06-03
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

The traditional manual cable path selection method has the problems of relying on subjective experience, slow computing efficiency, inaccurate calculation quantity, and inability to ensure optimal routes. The existing shortest path algorithm cannot achieve the optimal solution quality and solution efficiency at the same time.

Method used

Using the improved Astar algorithm, by constructing a record matrix, path matrix and minimum heap Q, combined with an adjacency table matrix, the shortest path optimization process of cable is optimized, reducing invalid path search and improving algorithm efficiency.

Benefits of technology

It significantly improves the operating efficiency of the Astar algorithm, especially when the power system scales, it can find the shortest path of the cable more quickly, improving calculation accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120087003A_ABST
    Figure CN120087003A_ABST
Patent Text Reader

Abstract

The invention relates to a cable shortest path optimization method and device based on an improved Astar algorithm, and a medium. The method comprises the following steps: constructing and initializing a record matrix B, a path matrix P, a minimum heap Q and an adjacency list matrix G; updating the adjacency list matrix G according to the bridge network adjacency matrix A; updating the minimum heap Q according to the starting point coordinate and the terminal point coordinate of the cable to be laid; updating the path matrix P in combination with the minimum heap Q and the adjacency list matrix G; and according to the updated path matrix P, obtaining the laying path of the cable to be laid. According to the invention, the operation efficiency of the Astar algorithm is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of cable laying, and particularly to a method, device and medium for optimizing the shortest path of a cable based on an improved A* algorithm. Background Art

[0002] Cable laying is crucial in the design of the factory power system. The length of a cable connecting a starting device and an ending device determines the procurement cost of that cable, and the total length of all cables to be laid determines the total procurement cost of the cables. Although the traditional manual cable path selection method is simple to operate, it has problems such as relying on subjective experience, slow calculation efficiency, inaccurate quantity calculation, and inability to guarantee the optimal route. With the continuous development of computer hardware and various path optimization algorithms, the traditional manual cable path selection method has gradually changed to an automatic shortest path optimization method using intelligent algorithms.

[0003] The factory power system is composed of many cable trays connected together, and these cable trays form a graph network that the cable can pass through. Each end point of each cable tray corresponds to a node in the graph network, and the length of each cable tray corresponds to the edge weight in the graph network. When all the cable trays are determined, the corresponding graph network is also determined. For a certain cable to be laid, its starting point and ending point are known and determined. At this time, finding the shortest cable laying path is equivalent to finding the shortest path between the starting node and the ending node on the graph network.

[0004] In graph theory, generally, the graph network is first converted into an adjacency matrix for subsequent calculation and solution. The element corresponding to the i-th row and the j-th column in the adjacency matrix represents the distance from node i to node j in the graph network. Since the cable trays are bidirectionally connected and the lengths in any direction are equal, the graph formed by the cable tray network is an undirected graph, that is, its corresponding adjacency matrix is a symmetric matrix with a main diagonal of 0.

[0005] There are various methods to solve the shortest path between specified node pairs using the shortest path algorithm on a graph, but no single algorithm can achieve both the best solution quality and the best solution efficiency at the same time. The optimal adaptation scenarios of different types of algorithms are different. The A* algorithm is a classic shortest path algorithm on a graph, and it also cannot achieve both the best solution quality and the best solution efficiency at the same time. Summary of the Invention

[0006] In order to solve the above problems, the present invention proposes a method, device and medium for optimizing the shortest path of a cable based on an improved A* algorithm.

[0007] The specific solutions are as follows:

[0008] A method for optimizing the shortest path of a cable based on an improved A* algorithm includes the following steps:

[0009] S1: Construct an N×N record matrix B and initialize it. Assign True to the elements on the diagonal positions and False to the remaining elements; construct an N×N path matrix P and initialize it. Assign -1 to all its elements; construct a minimum heap Q and initialize it as an empty heap; construct an adjacency list matrix G with N rows and initialize it so that each column is empty; N represents the total number of nodes in the cable bridge network;

[0010] S2: Obtain the adjacency matrix A of the cable bridge network. Traverse each element in A. For each element, judge whether the value of this element satisfies both not equal to ∞ and not equal to 0. If so, extract the row number k 1 and column number k 2 after that, add an element with the value of k 1 to the row with the row number k 2 in G;

[0011] S3: Obtain the starting coordinates and ending coordinates of a cable to be laid. Set the node number in the cable bridge network corresponding to the starting coordinates of the cable as index1, and the node number corresponding to the ending coordinates as index2. Traverse each element in the row with the row number index1 in G. For the i-th element, represent its value as g i , construct a tuple corresponding to this element (g i , A[index1, g i + h(ICM(g i ), ICM(index2))) and push it into the minimum heap Q, where A[index1, g i represents the value of the element in matrix A with the row number index1 and the column number g i , the function ICM(.) represents solving the coordinates corresponding to the node number in the cable bridge network, ICM(g i ) represents the coordinates corresponding to the node with the number g i in the cable bridge network, ICM(index2) represents the coordinates corresponding to the node with the number index2 in the cable bridge network, and h(.) represents calculating the distance between two coordinates; set that when the value of the second element in the tuple is smaller, the priority of this tuple is higher. Each time a value is taken from the minimum heap Q, the tuple with the highest priority is automatically popped out;

[0012] S4: Update the path matrix P by combining the minimum heap Q and the adjacency list matrix G, including the following steps:

[0013] S401: Judge whether the number of tuples in the minimum heap Q is 0. If so, assign True to B[index1, index2];

[0014] S402: Determine whether B[index1, index2] equals True. If so, break out of the loop and proceed to S407; otherwise, proceed to S403;

[0015] S403: Extract a tuple from the minimum heap Q, and denote the value of the first element in this tuple as cur;

[0016] S404: Determine whether B[index1, cur] equals True. If so, return to S401; otherwise, assign True to B[index1, cur];

[0017] S405: Traverse each element in the row with row number cur in G; for the i-th element, denote its value as ad_node i , and determine whether both of the following conditions are satisfied: B[index1, ad_node i is False and A[index1, ad_node i > (A[index1, cur] + A[cur, ad_node i ). If so, assign A[index1, ad_node i the value of A[index1, cur] + A[cur, ad_node i , and at the same time assign P[index1, ad_node i the value of cur. Then, construct the tuple corresponding to the i-th element (ad_node i , A[index1, ad_node i + h(ICM(ad_node i ), ICM(index2))) and push it into the minimum heap Q;

[0018] S406: Continuously loop through steps S401 - S405 until the condition that B[index1, index2] equals True in step S402 is satisfied and the loop is broken.

[0019] S5: According to the updated path matrix P, obtain the laying path of the cable to be laid.

[0020] Furthermore, when traversing each element in A, traverse in the order from left to right and from top to bottom.

[0021] Furthermore, if the value of A[index1, index2] in the cable tray network adjacency matrix A of the cable to be laid equals ∞, then determine that there is no path between the starting device and the ending device of the cable to be laid, and skip the laying of this cable.

[0022] Furthermore, step S5 specifically includes the following steps:

[0023] S501: Initialize the path node list path = [index1], and initialize the path index index4 = index2;

[0024] S502: Determine whether P[index1, index4] is equal to -1. If so, go to S504; otherwise, go to S503;

[0025] S503: In path, insert index4 after index1, and at the same time assign index4 to P[index1, index4], then return to S502;

[0026] S504: Construct the laying path of the j-th cable according to the order of the nodes included in path.

[0027] A cable shortest path optimization terminal device based on an improved Astar algorithm, including a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method in the above embodiments of the present invention are implemented.

[0028] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method in the above embodiments of the present invention are implemented.

[0029] The present invention adopts the above technical solution. By using a minimum heap, the search time for the minimum element value in the open list during each loop is reduced; by using an adjacency list matrix, the search for invalid paths by the algorithm is reduced. The combination of the two greatly improves the running efficiency of the Astar algorithm, and this improvement effect becomes more obvious as the scale of the power system expands. Description of the Drawings

[0030] Figure 1 The flowchart of the method in Embodiment 1 of the present invention is shown. Detailed Embodiments

[0031] To further illustrate the embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, mainly used to illustrate the embodiments, and can be combined with the relevant descriptions in the specification to explain the operating principle of the embodiments. With reference to these contents, those of ordinary skill in the art should be able to understand other possible implementation manners and the advantages of the present invention.

[0032] The present invention will be further described below in conjunction with the drawings and specific embodiments.

[0033] Embodiment 1:

[0034] An embodiment of the present invention provides a method for optimizing the shortest path of a cable based on an improved Astar algorithm, as Figure 1 shown, the method includes the following steps:

[0035] S1: Initialize and set the cable serial number j = 1; construct an N×N record matrix B and initialize it, assign the elements at the diagonal positions to True, and assign the elements at the remaining positions to False; construct an N×N path matrix P and initialize it, assign all the elements in it to -1; construct a minimum heap Q and initialize it as an empty heap; construct an adjacency list matrix G with N rows and initialize it to set each column to be empty; N represents the total number of nodes included in the bridge network.

[0036] S2: Obtain the adjacency matrix A of the bridge network, traverse each element in A, and for each element, judge whether the value of the element simultaneously satisfies not being equal to ∞ and not being equal to 0. If so, extract the row number k 1 and column number k 2 after that, add an element with a value of k 1 to the row with the row number k 2 in G.

[0037] Before performing step S2, it is first necessary to construct the adjacency matrix A of the bridge network. In this embodiment, it is constructed through the following steps:

[0038] S201: Obtain the bridge information of each bridge corresponding to the cable to be laid.

[0039] In this embodiment, the bridge information of each bridge (i.e., each section of the bridge) is represented by an array r, that is: the bridge information r i of the i-th section of the bridge = [id i , s_p i (x i1 , y i1 , z i1 ), e_p i (x i2 , y i2 , z i2 ), length i , where i ∈ [1, m] represents the i-th section of the bridge, m represents the total number of bridges; id represents the bridge identification name, which is identified by a globally unique string; s_p i (x i1 , y i1 , z i1 ) and e_p i (x i2 , y i2 , z i2) represent the coordinates of the starting point and the ending point of the bridge, where \(x,y,z\in(-\infty,\infty)\); and \(length\in(0,\infty)\) represents the length of the bridge.

[0040] S202: Initialize the index count \(n = 0\), \(A\) as an \(n\times n\) empty matrix, initialize the coordinate index dictionary \(CIM\) as empty, and initialize the index coordinate dictionary \(ICM\) as empty.

[0041] S203: Traverse the bridge information \(r\) of each section of the bridge in sequence i , until \(i = m\), that is, all bridge information has been traversed. For each section of the bridge, perform the following processing:

[0042] Judge Whether it holds. If so, store \(\{s_p i (x i1 ,y i1 ,z i1 ):n\}\) into \(CIM\), and store \(\{n:s_p i (x i1 ,y i1 ,z i1 )\}\) into \(ICM\); at the same time, judge Whether it holds. If so, store \(\{e_p i (x i2 ,y i2 ,z i2 ):n\}\) into \(CIM\), and store \(\{n:e_p i (x i2 ,y i2 ,z i2 )\}\) into \(ICM\). \(s_p i (x i1 ,y i1 ,z i1 ):n\) represents a key-value pair, where \(s_p i (x i1 ,y i1 ,z i1 )\) is the key and \(n\) is the value; \(n:e_p i (x i2 ,y i2 ,z i2 )\) also represents a key-value pair, where \(n\) is the key and \(s_p i (x i1 ,y i1 ,z i1 )\) is the value.

[0043] Let \(n\) be incremented by 1 to obtain a matrix \(A\) with an increased order. For the newly added elements in \(A\), except for the diagonal elements which are assigned 0, the rest of the elements are all assigned \(\infty\).

[0044] Obtain index2 = CIM[e_pi (x i2 ,y i2 ,z i2 ), update matrix A according to the following formula;

[0045] A[index1, index2] = A[index2, index1] = length i

[0046] S3: Obtain the starting coordinates and ending coordinates of a cable to be laid. Set the node number of the cable tray network corresponding to the starting coordinates of the cable as index1, and the node number of the cable tray network corresponding to the ending coordinates as index2. Traverse each element in the row with row number index1 in G. For the i-th element, represent its value as g i , construct the tuple corresponding to this element (g i , A[index1, g i + h(ICM(g i ), ICM(index2))) and push it into the minimum heap Q, where A[index1, g i represents the value of the element in matrix A with row number index1 and column number g i . The following similar symbolic expressions have the same meaning and will not be elaborated here. The function ICM(.) represents solving the coordinates corresponding to the node number in the cable tray network. ICM(g i ) represents the coordinates corresponding to the node with number g i in the cable tray network, and ICM(index2) represents the coordinates corresponding to the node with number index2 in the cable tray network. h(.) represents calculating the distance between two coordinates, and the calculation formula is as follows: represents the starting coordinates, and e(x 2 , y 2 , z 2 ) represents the ending coordinates; set that the smaller the value of the second element in the tuple, the higher the priority of the tuple. Each time a value is taken from the minimum heap Q, the tuple with the highest priority is automatically popped out.

[0047] In this embodiment, when traversing each element in A, it is traversed in the order from left to right and from top to bottom.

[0048] In this embodiment, when obtaining the cables to be laid, all the cables to be laid are arranged in descending order of priority, and the cables with higher priority are obtained first. When all the cables to be laid are processed, it ends.

[0049] S4: Update the path matrix P in combination with the minimum heap Q and the adjacency list matrix G, including the following steps:

[0050] S401: Determine whether the number of tuples in the minimum heap Q is 0. If so, assign True to B[index1, index2].

[0051] S402: Determine whether B[index1, index2] equals True. If so, break out of the loop and proceed to S407; otherwise, proceed to S403.

[0052] S403: Extract a tuple from the minimum heap Q and denote the value of the first element in the tuple as cur.

[0053] S404: Determine whether B[index1, cur] equals True. If so, return to S401; otherwise, assign True to B[index1, cur].

[0054] S405: Traverse each element in the row with row number cur in G; for the i-th element, denote its value as ad_node i , and determine whether both B[index1, ad_node i is False and A[index1, ad_node i > (A[index1, cur] + A[cur, ad_node i ). If so, assign A[index1, ad_node i the value of A[index1, cur] + A[cur, ad_node i , and at the same time assign P[inode1, ad_node i the value of cur, then construct the tuple corresponding to the i-th element (ad_node i , A[index1, ad_node i + h(ICM(ad_node i ), ICM(index2))) and push it into the minimum heap Q, where ICM(ad_node i ) represents the coordinates corresponding to the node with serial number ad_node i in the bridge network.

[0055] S406: Continuously loop through steps S401 - S405 until the condition that B[index1, index2] equals True in step S402 is met and the loop is exited.

[0056] It should be noted that if, after the algorithm iteration is completed, the value of A[index1, inode2] in the adjacency matrix A of the cable tray network to be laid is equal to ∞, it is determined that there is no path between the starting device and the ending device of the cable to be laid, and the laying of this cable is skipped; if it is not equal to ∞, the laying path of the cable to be laid is obtained through step S5.

[0057] S5: Obtain the laying path of the cable to be laid according to the updated path matrix P.

[0058] In this embodiment, step S5 specifically includes the following steps:

[0059] S501: Initialize the path node list path = [index1], and initialize the path index index4 = index2;

[0060] S502: Determine whether P[index1, index4] is equal to -1. If so, enter S504; otherwise, enter S503;

[0061] S503: Insert index4 after index1 in path, and at the same time assign P[index1, index4] to index4, and return to S502;

[0062] S504: Construct the laying path of the jth cable according to the order of the nodes included in path.

[0063] In each iteration loop of the A* algorithm, it is necessary to obtain the minimum value node in the open list and may add new nodes. The time complexity of storing data in an unordered list is O(1), and the time complexity of retrieving the minimum value in the unordered list is O(n) as it requires traversing each element in the list. A min-heap is a tree-like structure stored in the form of an array. Different from an ordinary binary tree, the value of each node in it is less than or equal to the value of its child nodes. Its unique data structure is particularly suitable for the storage and retrieval of ordered data. Storing data in a min-heap requires comparison with the parent node. If the new element is less than the parent node, it needs to exchange positions with the parent node, and this process will continue upward until the heap property is satisfied, with a total time complexity of O(logn). Since the root node of the min-heap is the minimum value, it can be directly accessed without any comparison or exchange operations, so the time complexity of retrieving the minimum value from the min-heap is O(1). In summary, the time complexity of one insertion and one retrieval operation of the min-heap in one loop of the A* algorithm saves O(n - logn) compared to the unordered list. Therefore, using a min-heap instead of an unordered list can improve the computational efficiency of the A* algorithm. Especially as the scale of the power system expands, the number of cable tray nodes will increase proportionally, and at this time, the total number of loops of the A* algorithm will increase exponentially, and the efficiency improvement effect brought by the min-heap will be more obvious.

[0064] In addition, due to the particularity of the power system design, the adjacency matrix formed by its cable tray network is a sparse matrix, that is, most of the values are ∞. The paths corresponding to these ∞ cannot be used to optimize the existing explored paths in step S405. However, because the standard A* algorithm does not know the specific positions of these ∞, it must traverse and judge each possible expansion node. Using an adjacency list can record the information of the remaining nodes that are actually connected to each node. In this way, in step S405, many meaningless path searches can be avoided, thus saving a large amount of search time. In addition, the sparsity of the cable tray network becomes more obvious as the scale of the power system expands. Specifically, in the adjacency matrix, the proportion of ∞ in all values will gradually increase, and at this time, the overall efficiency improvement effect of using the adjacency list matrix for the A* algorithm is more obvious.

[0065] In summary, the existence of the min-heap can reduce the search time for the minimum element value in the open list in each loop; the design of the adjacency list can reduce the search for invalid paths by the algorithm. The combination of the two greatly improves the running efficiency of the A* algorithm, and this improvement effect becomes more obvious as the scale of the power system expands.

[0066] Example Two:

[0067] The present invention also provides a cable shortest path optimization terminal device based on an improved A* algorithm, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above method embodiment of Embodiment 1 of the present invention are implemented.

[0068] Further, as an executable solution, the cable shortest path optimization terminal device based on the improved A* algorithm may be a computing device such as a desktop computer, a notebook, a palm computer, and a cloud server. The cable shortest path optimization terminal device based on the improved A* algorithm may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the composition structure of the above cable shortest path optimization terminal device based on the improved A* algorithm is only an example of the cable shortest path optimization terminal device based on the improved A* algorithm, and does not constitute a limitation on the cable shortest path optimization terminal device based on the improved A* algorithm. It may include more or fewer components than the above, or combine some components, or different components. For example, the cable shortest path optimization terminal device based on the improved A* algorithm may further include an input / output device, a network access device, a bus, etc. The embodiments of the present invention do not make any limitations in this regard.

[0069] Further, as an executable solution, the so-called processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The processor is the control center of the cable shortest path optimization terminal device based on the improved A* algorithm, and connects various parts of the entire cable shortest path optimization terminal device based on the improved A* algorithm through various interfaces and lines.

[0070] The memory can be used to store the computer programs and / or modules. By running or executing the computer programs and / or modules stored in the memory and invoking the data stored in the memory, the processor realizes various functions of the cable shortest path optimization terminal device based on the improved Astar algorithm. The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include high-speed random access memory, and can also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0071] The present invention also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of the above method in the embodiments of the present invention are realized.

[0072] If the modules / units integrated in the cable shortest path optimization terminal device based on the improved Astar algorithm are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, to realize all or part of the processes in the above method embodiments of the present invention, it can also be completed by a computer program instructing relevant hardware. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above method embodiments can be realized. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disc, a computer memory, a read-only memory (ROM), a random access memory (RAM), and a software distribution medium, etc.

[0073] Although the present invention is specifically shown and described in combination with the preferred embodiments, those skilled in the art should understand that various changes can be made to the present invention in form and details without departing from the spirit and scope of the present invention defined by the appended claims, and all are within the protection scope of the present invention.

Claims

1. A cable shortest path optimization method based on an improved Astar algorithm, characterized in that: The following steps are involved: S1: Construct an N×N record matrix B and initialize it, assign the elements in its diagonal position to True, and the elements in other positions to False; construct an N×N path matrix P and initialize it, assign all its elements to -1; construct a minimum heap Q and initialize it to an empty heap; construct an adjacency list matrix G with N rows and initialize it to set each column to be empty; N represents the total number of nodes contained in the bridge network; S2: Get the bridge network adjacency matrix A, traverse each element in A, and for each element, determine whether the value of the element satisfies both unequal to ∞ and unequal to 0. If so, extract the row number k1 and column number k2 corresponding to the element, and add an element with a value of k2 to the row with the row number k1 of G; S3: Get the starting point coordinates and the end point coordinates of a cable to be laid, set the node number of the bridge network corresponding to the starting point coordinate of the cable to index1, and the node number of the bridge network corresponding to the end point coordinate to index2, traverse each element in the row with index1 in G, and for the i-th element, represent its value as g i , construct the tuple corresponding to the element (g i ,A[index1,g i ]+h(ICM(g i ),ICM(index2))) and push into the minimum heap Q, where A[index1,g i ] indicates that the row number in matrix A is index1 and the column number is g i The value of the element, the function ICM (.) means to solve the coordinates corresponding to the serial number of the node in the bridge network, ICM (g i ) indicates that the sequence number in the bridge network is g i The coordinates corresponding to the node of , ICM(index2) indicates the coordinates corresponding to the node with index2 in the bridge network, and h(.) indicates the distance between the two coordinates; the smaller the value of the second element in the tuple is, the higher the priority of the tuple is. Each time a value is taken from the minimum heap Q, the tuple with the highest priority is automatically popped out; S4: Update the path matrix P by combining the minimum heap Q and the adjacency list matrix G, including the following steps: S401: Determine whether the number of tuples in the minimum heap Q is 0. If so, assign True to B[index1,index2]; S402: Determine whether B[index1, index2] is equal to True. If so, exit the loop and enter S407; otherwise, enter S403; S403: extract a tuple from the minimum heap Q, and record the value of the first element in the tuple as cur; S404: Determine whether B[index1,cur] is equal to True. If so, return to S401; otherwise, assign True to B[index1,cur]; S405: traverse each element in the row numbered cur in G; for the i-th element, represent its value as ad_node i , and determine whether B[index1,ad_node i ] is False and A[index1,ad_node i ]>(A[index1,cur]+A[cur,ad_node i ]), if so, then A[index1,ad_node i ] is assigned to A[index1,cur]+A[cur,ad_node i ], and at the same time P[index1,ad_node i ]After assigning the value to cur, construct the tuple corresponding to the i-th element (ad_node i ,A[index1,ad_node i ]+h(ICM(ad_node i ),ICM(index2))) and push into the minimum heap Q; S406: Steps S401-S405 are looped continuously until the condition that B[index1, index2] is equal to True in step S402 is satisfied and the loop is exited; S5: According to the updated path matrix P, the laying path of the cable to be laid is obtained.

2. The cable shortest path optimization method based on the improved Astar algorithm according to claim 1 is characterized in that: When traversing each element in A, traverse from left to right and from top to bottom.

3. The cable shortest path optimization method based on the improved Astar algorithm according to claim 1 is characterized in that: After step S4 is completed, if the value of A[index1, index2] in the bridge network adjacency matrix A of the cable to be laid is equal to ∞, it is determined that there is no path between the starting device and the end device of the cable to be laid, and the laying of the cable is skipped.

4. The cable shortest path optimization method based on the improved Astar algorithm according to claim 1 is characterized in that: Step S5 specifically includes the following steps: S501: Initialize the path node list path = [index1], initialize the path index index4 = index2; S502: Determine whether P[index1, index4] is equal to -1. If yes, proceed to S504; otherwise, proceed to S503; S503: insert index4 after index1 in path, assign index4 to P[index1,index4], and return to S502; S504: Construct a laying path for the jth cable according to the order of the nodes included in the path.

5. A cable shortest path optimization terminal device based on an improved Astar algorithm, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 4 when executing the computer program.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Intelligent cable path optimizing method

    CN103427371A

  • Path planning method based on line segments

    CN114674336A

  • Multi-cable optimal path planning method based on improved ant colony algorithm

    CN115270377A

  • 3-D Crossbar Architecture for Fast Energy-Efficient In-Memory Computing of Graph Transitive Closure

    US20190051825A1

  • Shortest route planning method and system

    WO2024113575A1