Intelligent ship cable arrangement method
By improving the Dijkstra algorithm to optimize path selection and generate centralized backbone paths, the problems of dispersion and redundancy in ship cable laying are solved, the cable layout efficiency and maintainability are improved, and the ship design changes are adapted to.
Patent Information
- Application Number
- CN202510626074.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-08-26
AI Technical Summary
The paths generated by the Dijkstra algorithm in the laying of ship cables are difficult to meet the requirements of cable arrangement for centralized laying and maintenance of the main paths, and it is difficult to deal with the physical constraints in the actual ship cable laying path.
By improving the Dijkstra algorithm, optimizing the path selection strategy, generating centralized backbone paths, introducing node capacity constraints and three-dimensional spatial dynamic adjustments, reducing branch redundancy, and meeting cable physical constraints and cabin layout restrictions.
It improves the concentration and maintenance efficiency of cable laying, reduces the complexity of algorithms, quickly generates optimal solutions, and adapts to the needs of modular ship design changes.
Smart Images

Figure BDA0005403984860000021 
Figure BDA0005403984860000041 
Figure BDA0005403984860000043
Abstract
Description
Technical Field
[0001] The present invention relates to an intelligent arrangement method for ship cables, and in particular to an intelligent arrangement method for unmanned ship cables based on an improved Dijkstra algorithm, belonging to the technical field of ship cable path planning. Background Art
[0002] Currently, commonly used shortest path algorithms for cable routing include Dijkstra's algorithm, A* algorithm, SPFA algorithm, Bellman-Ford algorithm, and DAG graph algorithms. Dijkstra's algorithm uses a greedy algorithm to solve the weighted single-source shortest path problem on directed graphs. It is highly efficient and has been developed and improved upon by numerous algorithms. Its core concept is to gradually determine the shortest path from a source vertex to all other vertices using a greedy strategy, requiring that all edge weights in the graph be non-negative.
[0003] The Dijkstra algorithm is a greedy algorithm used to find the shortest path in a weighted graph. It starts from the starting point and traverses to the node closest to the starting point that has been visited, until it reaches the end point, completing the search for the global shortest path. This method can handle path searches with multiple end points and can also find the global optimal solution.
[0004] While the Dijkstra algorithm can solve the single-source shortest path problem, its greedy strategy, which seeks the shortest path to each destination, results in fragmented and redundant paths. This increases the difficulty of cable laying and makes it difficult to meet the cable layout requirements of centralized trunk paths and maintainability. Furthermore, the Dijkstra algorithm struggles to address practical limitations in shipboard cable laying paths, such as the maximum cable radius. Therefore, an improved algorithm is urgently needed to address these issues. Summary of the Invention
[0005] Purpose of the invention: The purpose of the present invention is to provide an intelligent cable layout method based on an improved Dijkstra algorithm, which generates a centralized trunk path by optimizing the path selection strategy, reduces branch redundancy, and satisfies the physical constraints of the cable and the limitations of the cabin layout, thereby improving the efficiency and maintainability of cable layout.
[0006] Technical solution: The present invention provides a method for intelligently arranging ship cables, comprising the following steps:
[0007] (1) Construct a three-dimensional spatial node model;
[0008] (2) Improve Dijkstra algorithm to generate initial path;
[0009] (3) Trunk path optimization;
[0010] (4) Simulation verification and dynamic adjustment.
[0011] Furthermore, in step (1), constructing the three-dimensional space node model includes the following steps:
[0012] S11. Node Definition and Topology Construction: The cabin layout is abstracted into a three-dimensional node network. Based on the actual cabin conditions, the connectivity between nodes is determined to complete the construction of the three-dimensional node network.
[0013] S12. Constraint modeling: The path weight between nodes is defined as the Euclidean distance d between two reachable nodes. ij ;
[0014] Furthermore, in step S11, the nodes to be constructed include the starting node S, the intermediate node p i and the final node e i , where the starting node S is the starting point of the cable and the intermediate node p i is the node that the cable can pass through, and the final node e i For the access point of the final equipment cable, any node is selected as the three-dimensional coordinate origin, and the X, Y, and Z three-dimensional coordinate systems are established respectively. The three-dimensional coordinate positions of the three nodes are determined, and the connectivity between the nodes and the maximum cable radius that can be accommodated are configured to complete the definition of each node.
[0015] Furthermore, each node definition looks like this:
[0016] p i {{x i ,y i , z i},{p j , p k ...}, w i}
[0017] Where: {x i ,y i , z i} is node p i The three-dimensional coordinates of {p j , p k ...} is a set of adjacent nodes, determined by the cabin structure connectivity; w i The maximum radius of the cable that the node can accommodate.
[0018] Furthermore, for two connected nodes Pi and Pj, the Euclidean distance d between the nodes is ij Calculate using the following formula (1):
[0019]
[0020] Among them, x iFor node p i The X-axis coordinate value, x j For adjacent nodes The X-axis coordinate value, y i For node p i The Y-axis coordinate value, y j is the Y-axis coordinate value of the adjacent node Pj, For node p i The Z-axis coordinate value, is the Z-axis coordinate value of the adjacent node Pj.
[0021] Furthermore, step (2) includes the following steps:
[0022] S21. Input the starting node S and the intermediate node p i and the endpoint set {e1, e2, ..., e m ,};
[0023] S22. Initialize the distance matrix: set the distance of the starting point S to 0, and the distances of the remaining nodes to {d1, d2, ...d n} are all set to infinity;
[0024] S23. Initialize the backbone path P m , and set S to the backbone path P m The first element of
[0025] S24. Initialize the shortest path set to store the shortest path from the starting node S to each node;
[0026] S25. Path search and constraint processing:
[0027] S251. Iterative search: From the trunk path P m Extract the distance from the last node i, take it as the initial node, and traverse its adjacent nodes j: if the current radius of the cable is w cable <The maximum width w of the cable that node j can accommodate j That is w cable <w j When , the temporary distance d is calculated temp =d i +d ij , d i is the shortest distance from the initial node S to node i, when d temp <d j When d j Update the shortest path set to the shortest distance from the initial node S to node j;
[0028] S252. Multi-end processing: Continue iterative search until all end points are visited, and generate a list of all the destinations from the starting point S to each end point {e1, e2, ..., em ,} is the initial shortest path set.
[0029] Furthermore, step (3) includes the following steps:
[0030] S31. Main node screening:
[0031] S311. Count the number of times all nodes in the initial path are passed, and calculate the number of times the final node e is passed. n , record the remaining path length of the path, and generate a set F = {f1, f2...f n}, where f n =(e n , p n , s n ), e n is the final node of the path, p n is the corresponding next intermediate node, s n is the remaining path length to reach the end point;
[0032] S312. Select the node with the highest weight as the next node based on the remaining path length. Then any intermediate node p j Its corresponding selection weight W pj It is calculated according to the following formula (2):
[0033]
[0034] Where:
[0035] W pj For the corresponding p j The selection weight of the node;
[0036] S32. Iterative trunk generation:
[0037] S321. First round of backbone selection: Based on the starting point S, select the node with the highest weight p main For the first backbone node:
[0038] W main =max(W pj );
[0039] S322. Path reconstruction: with p main As the sub-starting point, re-execute the improved Dijkstra algorithm to generate a new path set;
[0040] S322. Delete the trunk path whose depth is less than the threshold d th The endpoint path that intersects the shortest path with the generated trunk, 1≤d th ≤4, the formula is shown as follows (3):
[0041]
[0042] Where: N P is the total number of cabin nodes, N e is the final number of nodes in the cabin;
[0043] S33. Iteration termination condition: Repeat the above process until the number of remaining endpoints is 0.
[0044] Furthermore, step (4) includes the following steps:
[0045] S41. Simulation verification:
[0046] S411. Merge the trunk path with the reserved terminal path to ensure that the path is continuous and complies with the cable laying specifications;
[0047] S412. Output the final cable layout plan, marking the trunk path and branch paths;
[0048] S42. Dynamic update of parameters:
[0049] S421. If the device location changes or the cable specifications are adjusted, update the w of the corresponding node i and its corresponding {x i ,y i , z i};
[0050] S42. Re-execute steps (2)-(3) to generate a path that adapts to the new constraints.
[0051] Beneficial effects: Compared with the prior art, the present invention has the following significant advantages:
[0052] (1) The method of the present invention reduces the number of branches by optimizing the trunk path, thereby improving the concentration of cable laying and maintenance efficiency;
[0053] (2) The method of the present invention introduces node capacity constraints to avoid cable overload and physical damage;
[0054] (3) The method of the present invention supports dynamic adjustment of three-dimensional space and adapts to the requirements of modular ship design changes;
[0055] (4) The algorithm complexity of the method of the present invention is low, and the optimal solution can be generated quickly, thereby reducing the cost of manual design. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is the flow chart of the algorithm of the present invention;
[0057] Figure 2 A three-dimensional model diagram constructed in Example 1;
[0058] Figure 3 This is a diagram showing the improved algorithm layout of the present invention;
[0059] Figure 4 Lay out a scheme diagram for a traditional algorithm. DETAILED DESCRIPTION
[0060] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0061] Example 1
[0062] The basic process of the present invention is referenced Figure 1 The algorithm flow chart uses Python software. First, the initial data is input to complete the model construction and data definition. According to the Dijkstra algorithm, the constraints are considered and the shortest path is found. The initial node is set as the first trunk path. The branch end point is deleted according to the conditions. Then, it is determined whether the trunk selection is completed. If not, a trunk point is selected according to the weight, and the new trunk point is set as the starting path and the above steps are repeated. If the trunk selection is completed, the cable arrangement plan is output.
[0063] The specific implementation of the algorithm is as follows:
[0064] 1. Constructing a 3D spatial node model:
[0065] 1. Node definition and topology construction: The cabin layout is abstracted into a three-dimensional node network. Based on the actual cabin conditions, the connectivity between nodes is determined to complete the construction of the three-dimensional node network. The details are as follows:
[0066] Based on the existing ship cabin structure reference, the path where the cable can pass, the starting point of the cable, the intermediate position where the cable can pass, and the final access point of the equipment cable are selected. They are abstracted into the cable path, starting node, intermediate node and final node respectively to complete the model construction. Then, Matplotlib in Python is used to visualize it. The constructed three-dimensional model is as follows Figure 2 shown. Figure 2 In the figure, the green path is the cable path that can be arranged, which is determined by the connectivity of the cabin, where S is the starting node, i.e. the starting point of the cable, and e i is the final node, i.e., the end point of the device, and the remaining nodes are intermediate nodes p i , that is, the nodes that the cable can pass through. Take any node as the three-dimensional coordinate origin, establish the X, Y, and Z three-dimensional coordinate systems respectively, determine the three-dimensional coordinate positions of the three nodes, and configure the connectivity between the nodes and the maximum cable radius that can be accommodated, including the starting node S and the final node e i , each node is represented by a two-dimensional array, that is, p i {{x i ,yi , z i},{p j , p k …}, w i}, where {x i ,y i , z i} is node p i The three-dimensional coordinates of {p j , p k …} is a set of adjacent nodes, determined by the cabin structure connectivity, w i Indicates the maximum radius of the cable that the node can accommodate, to complete the definition of each node.
[0067] 2. Constraint modeling: The path weight between nodes is defined as the Euclidean distance d between two reachable nodes. ij , as follows:
[0068] For two connected nodes Pi and Pj, the Euclidean distance d ij The calculation method is shown in the following formula:
[0069]
[0070] Among them, x i For node p i The X-axis coordinate value, x j is the adjacent node P j The X-axis coordinate value, y i For node p i The Y-axis coordinate value, y j is the adjacent node P j The Y-axis coordinate value, Z i For node p i The Z-axis coordinate value, Z j is the adjacent node P j The Z-axis coordinate value of .
[0071] 2. Improve Dijkstra algorithm to generate initial path:
[0072] 1. Input the starting node S and the intermediate node p i and the endpoint set {e1, e2, ..., e m ,};
[0073] 2. Initialize the distance matrix, set the distance of the starting point S to 0, and set the distances between the remaining nodes {d1, d2, ...d n} are all set to infinity, and the backbone path P is initialized. m , used to save the longest trunk path, set S to the trunk path P mBuild an initialized shortest path set to store the shortest paths from the starting node S to each node.
[0074] Then perform iterative search, starting from the trunk path P m Extract the last node i and use it as the initial node. For the first iterative search, its backbone path P m The last node is S, traverse its adjacent nodes j, when the current radius of the cable is w cable <w j (the maximum width of the cable that node j can accommodate), that is, when the actual cable width is less than the node capacity, calculate the temporary distance d temp =d i +d ij Among them, d i The shortest distance from the initial node S to the node i, the calculation formula of the Euclidean distance If d temp <d j , d j is the shortest distance from the initial node S to node j, that is, when the new path is shorter than the old path, update d j The shortest path from the starting point S to each end point {e1, e2, ..., e m ,}, and obtain the shortest path generated by the basic Dijkstra algorithm.
[0075] 3. Trunk Path Optimization
[0076] 1. Main node screening:
[0077] After completing the Dijkstra algorithm, the shortest paths from the starting point S to each end point are obtained, and the paths with a depth less than the threshold d from the main path are deleted. th The endpoint path that intersects the shortest path with the generated backbone, d th The selection depends on the specific situation. The minimum value is 1 and should not be higher than 4. The formula is as follows:
[0078]
[0079] Where: N P is the total number of cabin nodes, N e is the final number of nodes in the cabin.
[0080] Taking the cabin conditions into consideration, at this time d th Take 2. After deleting the branch path, first determine whether the trunk is selected, that is, whether there are any remaining endpoints. If there are any remaining endpoints, then according to the weight selection algorithm, first gradually calculate the remaining path length s of each endpoint n, record its next intermediate node p n Get the corresponding path set F = {f1, f2...f n}, where: f n =(e n , p n , s n ), e n is the final node of the path, and then the remaining path lengths of the same intermediate node px as the end point of the next node are added to obtain the intermediate node p j and its corresponding selection weight W pj Right now Where: For the corresponding p j The selection weight of the node, W main =max(W pj ), taking the starting point S as the benchmark, select the node p with the highest weight main The next backbone node.
[0081] Then the backbone node p main Update to a new starting point, and then use the Dijkstra algorithm again to cyclically select the main path, repeating the above process until the number of remaining endpoints is 0, completing the selection of the endpoint path.
[0082] 4. Simulation verification:
[0083] Merge the trunk path with the reserved terminal path to ensure that the path is continuous and complies with the cable laying specifications. Output the trunk path and the actual branch path. Output the final cable layout plan through the Python program, mark the trunk path and branch path. The generated path is as follows: Figure 3 As shown, Figure 3 In the figure, the green path is determined by the connectivity of the cabin and is the path where cables can be laid. The red path is the trunk path, which is the maximum shared path selected by the algorithm. The blue path is the branch path on the trunk path, which is used to connect specific equipment in the cabin on the trunk path.
[0084] For the same cabin layout, the path obtained by the original Dijkstra algorithm is as follows Figure 4As shown, the green path is determined by the cabin connectivity, and the blue path is the optimal path selected by the algorithm. Compared with the improved algorithm of the present invention, the path of the algorithm is relatively more dispersed, and the complexity and difficulty of wiring are higher. It is effectively proved that the improved Dijkstra algorithm of the present invention can effectively reduce the number of path branches and optimize the arrangement of paths compared with the original algorithm. Its total number of path edges and trunk sharing rate (number of shared edges / total number of edges) are better than the traditional Dijkstra algorithm. The total number of path edges of the traditional Dijkstra algorithm is 24, and the total number of path edges of the improved Dijkstra algorithm is 21, which is a decrease of 12.5%. The trunk sharing rate for the trunks with more than or equal to three shared edges is also significantly better than the traditional Dijkstra algorithm. The trunk sharing rate of the traditional Dijkstra algorithm is 39.4%, and the trunk sharing rate of the improved Dijkstra algorithm is 55%. The improved Dijkstra algorithm can better concentrate the branches.
Claims
1. A method for intelligent arrangement of ship cables, characterized in that: The following steps are involved: (1) Construct a three-dimensional spatial node model; (2) Improve Dijkstra algorithm to generate initial path; (3) Trunk path optimization; (4) Simulation verification and dynamic adjustment.
2. The method for intelligent arrangement of ship cables according to claim 1, characterized in that: In step (1), constructing a three-dimensional space node model includes the following steps: S11. Node Definition and Topology Construction: The cabin layout is abstracted into a three-dimensional node network. Based on the actual cabin conditions, the connectivity between nodes is determined to complete the construction of the three-dimensional node network. S12. Constraint modeling: The path weight between nodes is defined as the Euclidean distance d between two reachable nodes. ij .
3. The method for intelligent arrangement of ship cables according to claim 2, characterized in that: In step S11, the nodes to be constructed include the starting node S, the intermediate node p i and the final node e i , where the starting node S is the starting point of the cable and the intermediate node p i is the node that the cable can pass through, and the final node e i For the access point of the final equipment cable, any node is selected as the three-dimensional coordinate origin, and the X, Y, and Z three-dimensional coordinate systems are established respectively. The three-dimensional coordinate positions of the three nodes are determined, and the connectivity between the nodes and the maximum cable radius that can be accommodated are configured to complete the definition of each node.
4. The method for intelligent arrangement of ship cables according to claim 3, characterized in that: Each node is defined as follows: p i {{x i ,y i ,z i },{p j ,p k ...},w i } Where: {x i ,y i , z i } is node p i The three-dimensional coordinates of {p j , p k ...} is a set of adjacent nodes, determined by the connectivity of the cabin structure; W i The maximum radius of the cable that the node can accommodate.
5. The method for intelligent arrangement of ship cables according to claim 2, characterized in that: For two connected nodes Pi and Pj, the Euclidean distance d between the nodes ij Calculate using the following formula (1): in, For node p i The X-axis coordinate value, For adjacent nodes The X-axis coordinate value, For node p i The Y-axis coordinate value, is the Y-axis coordinate value of the adjacent node Pj, For node p i The Z-axis coordinate value, is the Z-axis coordinate value of the adjacent node Pj.
6. The method for intelligent arrangement of ship cables according to claim 3, characterized in that: Step (2) includes the following steps: S21. Input the starting node S and the intermediate node p i and the endpoint set {e1, e2, ..., e m ,}; S22. Initialize the distance matrix: set the distance of the starting point S to 0, and the distances of the remaining nodes to {d1, d2, ...d n } are all set to infinity; S23. Initialize the backbone path P m , and set S to the backbone path P m The first element of S24. Initialize the shortest path set to store the shortest path from the starting node S to each node; S25. Path search and constraint processing: S251. Iterative search: From the trunk path P m Extract the distance from the last node i, take it as the initial node, and traverse its adjacent nodes j: if the current radius of the cable is w cable <The maximum width w of the cable that node j can accommodate j That is w cable <w j When , the temporary distance d is calculated temp =d i +d ij , d i is the shortest distance from the initial node S to node i, when d temp <d j When d j Update the shortest path set to the shortest distance from the initial node S to node j; S252. Multi-end processing: Continue iterative search until all end points are visited, and generate a list of all the endpoints {e1, e2, ..., e1} from the starting point S to each end point. m ,} is the initial shortest path set.
7. The method for intelligent arrangement of ship cables according to claim 6, characterized in that: Step (3) includes the following steps: S31. Main node screening: S311. Count the number of times all nodes in the initial path are passed, and calculate the number of times the final node e is passed. n , record the remaining path length of the path, generate a set F = {f1, f2, ...f n }, where f n =(e n , p n , s n ), en is the final node of the path, p n is the corresponding next intermediate node, S n is the remaining path length to reach the end point; S312. Select the node with the highest weight as the next node based on the remaining path length. Then any intermediate node p j Its corresponding selection weight W pj It is calculated according to the following formula (2): Where: W pj For the corresponding p j The selection weight of the node; S32. Iterative trunk generation: S321. First round of backbone selection: Based on the starting point S, select the node with the highest weight p main For the first backbone node: W main =max(W pj ); S322. Path reconstruction: with p main As the sub-starting point, re-execute the improved Dijkstra algorithm to generate a new path set; S322. Delete the trunk path whose depth is less than the threshold d th The endpoint path that intersects the shortest path with the generated trunk, 1≤d th ≤4, the formula is shown as follows (3): Where: N P is the total number of cabin nodes, N e is the final number of nodes in the cabin; S33. Iteration termination condition: Repeat the above process until the number of remaining endpoints is 0.
8. The method for intelligent arrangement of ship cables according to claim 1, characterized in that: Step (4) includes the following steps: S41. Simulation verification: S411. Merge the trunk path with the reserved terminal path to ensure that the path is continuous and complies with the cable laying specifications; S412. Output the final cable layout plan, marking the trunk path and branch paths; S42. Dynamic update of parameters: S421. If the equipment location changes or the cable specifications are adjusted, update the W of the corresponding node i and its corresponding {x i ,y i , z i }; S42. Re-execute steps (2)-(3) to generate a path that adapts to the new constraints.