Kruskal-based improved rapid path planning and scheduling algorithm
By converting the path planning problem into an undirected graph and using the Kruskal algorithm to generate a minimum spanning tree, combined with task priority weight allocation, the local optimal solution and slow iteration problems of the existing algorithm are solved, and fast and efficient path planning is achieved.
Patent Information
- Application Number
- CN202510583135.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-08-01
AI Technical Summary
Existing path planning algorithms such as genetic algorithms have problems such as local optimal solutions and slow iteration convergence speed, and there are shortcomings in complexity and non-universality, which makes it difficult to meet the needs of fast path planning.
Using the fast path planning scheduling algorithm based on Kruskal, the path selection planning problem is converted into an undirected graph, the minimum spanning tree is generated through the Kruskal algorithm, and the final path is calculated based on the weight allocation of task priority and cost overhead priority.
Fast path planning is realized, the calculation speed is better than that of traditional genetic algorithms, the average running time is 0.1 seconds, and the accuracy is no lower than that of genetic algorithms, which significantly reduces the running time and is suitable for actual tasks.
Smart Images

Figure CN120403690A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent robots. More specifically, the present invention relates to a fast path planning and scheduling algorithm based on the improvement of Kruskal. Background Art
[0002] The Dutch scientist E.W. Dijkstra proposed the most classical Dijkstra algorithm. The main purpose of this algorithm is to solve the single-source path problem, that is, starting from a certain determined point, successively find the shortest paths from this determined point to the rest of the nodes. Many years later, the Stanford University professor R.W. Floyd proposed a solution to the multi-source path problem, that is, the Floyd algorithm for the shortest paths from any point to the rest of the nodes.
[0003] Nowadays, for the problem of shortest path planning, there are already a large number of planning algorithms and researches. Commonly used path planning methods include: shortest path search algorithm, ant colony algorithm, heuristic algorithm, Dijkstra algorithm, etc. These algorithms have their own advantages in terms of space complexity, time complexity, applicability, and reliability. Currently, the most commonly used, most mature algorithm that has been generally recognized by industry scholars is the Dijkstra algorithm. The idea of the Dijkstra algorithm was borrowed in the early stage of the design of this algorithm.
[0004] The genetic algorithm was mentioned by the student of a Dutch professor, Bagley, in his doctoral thesis in 1967. In 1975, Professor Holland published the first monograph systematically describing its content, laying the theoretical foundation. Nowadays, the genetic algorithm has become a very popular algorithm and is widely used in fields such as combinatorial optimization, automatic control, image processing, and machine learning.
[0005] The above technologies have problems such as local optimal solutions and slow iterative convergence speed. However, given that the genetic algorithm itself has high performance, and various modification schemes have certain complexity and non-universality, the classical genetic algorithm is still almost an absolute mainstream in the application field. However, this algorithm does not intend to use the genetic algorithm to obtain the optimal path through iteration. The genetic algorithm needs to be iterated multiple times to converge and find the ideal shortest path. The time cost of multiple iterations is too large and is not suitable for the intermittent bobbin-changing task. Moreover, the number of empty bobbins replaced each time is not determined, and it is not known how many times of iteration are needed to converge.
[0006] Therefore, there is an urgent need for a fast path planning and scheduling algorithm based on the improvement of Kruskal to solve the above problems. Summary of the Invention
[0007] To overcome the above-mentioned defects of the prior art, an embodiment of the present invention provides a fast path planning and scheduling algorithm based on the improvement of Kruskal. The algorithm of the present invention has a faster calculation speed than the traditional genetic algorithm and has an accuracy rate not inferior to that of the genetic algorithm. Moreover, this method can also be combined with task priorities. Only by determining the normalized weight distribution of task priorities and cost overhead priorities in the final path according to the actual situation, and then passing the two-dimensional coordinates of each subtask and the priorities of each subtask to this algorithm, the final path and the total cost overhead of this path can be obtained by combining the weight distribution ratio. The average running time of this method is 0.1 second, which greatly reduces the running time. Compared with the genetic algorithm that requires about 31 seconds for 10 iterations, the present invention is faster and has better actual use effects, so as to solve the problems raised in the above-mentioned background technology.
[0008] To achieve the above object, the present invention provides the following technical solution: A fast path planning and scheduling algorithm based on the improvement of Kruskal, comprising the following steps: S1: Convert the path selection and planning problem of the intelligent robot into an undirected graph. The nodes of the undirected graph represent the actual working points of the robot, and the weight of the edge between two nodes represents the path length between the two actual working points, which is calculated by the Euclidean distance between the two point coordinates; S2: Based on the converted graph, obtain the minimum spanning tree through the Kruskal algorithm; S3: Sort the edges of the undirected graph in S1 in ascending order according to the weight size; S4: Then sequentially select the edge with the smallest current weight and add it to the path. If one of the nodes of the currently selected edge has been selected twice, discard the current edge; S5: Loop the S4 step until the number of selected edges is equal to the number of nodes - 1. At this time, the final linear path of the robot is obtained.
[0009] The technical effects and advantages of the present invention: The algorithm of the present invention has a faster calculation speed than the traditional genetic algorithm and has an accuracy rate not inferior to that of the genetic algorithm. Moreover, this method can also be combined with task priorities. Only by determining the normalized weight distribution of task priorities and cost overhead priorities in the final path according to the actual situation, and then passing the two-dimensional coordinates of each subtask and the priorities of each subtask to this algorithm, the final path and the total cost overhead of this path can be obtained by combining the weight distribution ratio. The average running time of this method is 0.1 second, which greatly reduces the running time. Compared with the genetic algorithm that requires about 31 seconds for 10 iterations, the present invention is faster and has better actual use effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 It is a schematic diagram of the starting point, ending point and weight of the edge in Embodiment 1 of the present invention.
[0011] Figure 2 This is a schematic diagram in which the initialized visited array in Embodiment 1 of the present invention is all 0.
[0012] Figure 3 This is a schematic diagram of the visited array updated after adding edges ①-③ in Embodiment 1 of the present invention. Detailed implementation manners
[0013] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0014] As shown in Figure 1 , Figure 2 and Figure 3 shown, the present invention provides a fast path planning and scheduling algorithm based on the improvement of Kruskal, including the following steps: S1: Convert the path selection and planning problem of the intelligent robot into an undirected graph. The nodes of the undirected graph represent the actual working points of the robot, and the weight of the edge between two nodes represents the path length between the two actual working points, which is calculated by the Euclidean distance between the two point coordinates; S2: Based on the converted graph, obtain the minimum spanning tree through the Kruskal algorithm; S3: Sort the edges of the undirected graph in S1 in ascending order according to the weight values; S4: Then sequentially select the edge with the smallest current weight and add it to the path. If one of the nodes of the currently selected edge has been selected twice, discard the current edge; S5: Loop through step S4 until the number of selected edges is equal to the number of nodes - 1. At this time, the final linear path of the robot is obtained.
[0015] Embodiment Using the principle of the minimum spanning tree, during the process of obtaining the minimum spanning tree, add a restriction condition, that is, if when preparing to add an edge with the smallest weight among the remaining edges at this time, it will cause the degree of a certain node > 2, then discard this edge and re-find the next edge. In this way, the finally obtained is a path that meets our requirements, that is, starting from a node with a degree of 1, all nodes can be visited in sequence; Design a function kuruskal: This function requires a parameter, that is, the two-dimensional coordinates of all working points: data[3, , , , , , ; It is known that the total number of working points \(n\) is: data[0] = 3; The coordinates of the ①st working point are [data[1], data[2]], that is , , and the coordinates of the ②nd working point are [[data[3], data[4]], that is also , , and the coordinates of the ③rd working point are [data[5], data[6]], that is also , , and then calculate: The weight (distance) of the edge between ① and ②: = ; The weight (distance) of the edge between ① and ③: = ; The weight (distance) of the edge between ② and ③: = ; Then establish a triple to store the starting point, ending point of the edge obtained above and the weight of the edge, such as Figure 1 ; Then sort the data in the triple in ascending order according to the weight of the edge (assuming > > ); Next, take the edges from the sorted triple in turn and add them to the path: At this time, the edge with the smallest weight is the ②-③ edge, so add the ②-③ edge to the path; Then continue to find the edge ①-② with the smallest weight among the remaining edges other than ②-③, and add the ①-② edge to the path; It is detected that the nodes in the path already contain all the working points, that is, the number of path nodes = the number of working points, then the algorithm ends. The path is: ①-②-③ or ③-②-①; In summary, a path constraint condition is obtained: the degree of any node in the path must be less than or equal to 2, and cannot be greater than 2. That is, after adding an edge, if it causes the degree of a certain node in the path > 2, then discard this edge and continue to find the next edge; Algorithm implementation: Set an access array visited[], and each time an edge is added, increase the visited of the two end nodes of this edge by 1; Assume there are three nodes in total, and initialize the visited array to all 0, such as Figure 2 ; At this time, edges ①-③ need to be added. After adding, update the visited array, as Figure 3 ; When the visited value of a certain node is 2, edges with this point as an endpoint will no longer be added.
[0016] If adding an edge causes a local loop to appear in the generated path, assuming that the weight of edge ①-③ is the smallest among the remaining edges. Now add ①-③ to the path, and at this time, a local loop is formed. No matter which node is started from, it is impossible to traverse all nodes at once, and the obtained path will deviate from our actual requirements. Therefore, edges like ①-③ should be discarded, and continue to search for the next reasonable edge; Starting from one endpoint, search for the nodes on the path. If the other endpoint is found, stop and discard this edge; if the other endpoint is not found until the traversal is completed, add this edge.
[0017] The algorithm of the present invention has a faster calculation speed than the traditional genetic algorithm and has an accuracy no worse than that of the genetic algorithm. Moreover, this method can also be combined with the task priority. Just determine the normalized weight distribution of the task priority and the cost overhead priority in the final path according to the actual situation, and then pass the two-dimensional coordinates of each subtask and the priority of each subtask into this algorithm, and the final path and the total cost overhead of this path can be obtained by combining the weight distribution ratio. The average running time of this method is 0.1 second, greatly reducing the running time. Compared with the genetic algorithm that requires about 31 seconds for 10 iterations, the present invention is faster and has better actual use effects.
[0018] Finally: The above are only the preferred embodiments of the present invention and are not used to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A fast path planning and scheduling algorithm based on the improvement of Kruskal, characterized in that, Including the following steps: S1: Convert the path selection and planning problem of the intelligent robot into an undirected graph. The nodes of the undirected graph represent the actual working points of the robot, and the weight value of the edge between two nodes represents the path length between the two actual working points, which is calculated by the Euclidean distance between the coordinates of the two points; S2: Based on the converted graph, obtain the minimum spanning tree through the Kruskal algorithm; S3: Sort the edges of the undirected graph in S1 in ascending order according to the weight value; S4: Then sequentially select the edge with the smallest current weight value and add it to the path. If one of the nodes of the currently selected edge has been selected twice, discard the current edge; S5: Loop the S4 step until the number of selected edges is equal to the number of nodes - 1. At this time, the final linear path of the robot is obtained.