Multi-target-point searching method based on graph searching technology

By using the search node container and task completion progress calculation in the graph search algorithm, the problem of multi-target point search is solved, the optimal path of multiple target points is obtained in one search process, the calculation steps are simplified and the application is broadened. scene.

CN118733838APending Publication Date: 2024-10-01QINGDAO ARTROBOT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410734042.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

Existing graph search algorithms cannot effectively solve the multi-target point search problem and cannot obtain the optimal path to all target points in one search process. They usually need to manually specify the order of target points or introduce other algorithms to determine the path order, resulting in the algorithm Complexity increases.

Method used

By creating a graph structure search space, using the search node containers openlist and closelist, and calculating the actual cost and task completion progress, it is judged whether the search node has completed the task, and whether to update the path is determined by the coverage of the target point in the backtracking path, ensuring that one search Obtain the optimal or suboptimal global path during the process.

Benefits of technology

It achieves the optimal path of multiple target points in one search process, simplifies the calculation steps, avoids the need to introduce other methods to determine the order of multiple target points, and broadens the application scenarios of traditional graph search algorithms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733838A_ABST
    Figure CN118733838A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-target-point search method based on a graph search technology, and aims to solve the problem that in the face of a multi-target-point search problem, it cannot be guaranteed that a path reaching all target points is obtained or a path for connecting all target points in series is optimal. According to the method, whether the two backtracking paths reaching the same node pass through the same target point or not is judged to determine whether the two backtracking paths have comparative significance, and if the two backtracking paths pass through the same target point, whether the backtracking paths are updated or not is determined according to the actual cost, so that the problems in the prior art can be solved. According to the method, the optimal path of the multiple target points connected in series can be obtained in one search process, the situation that other modes are additionally introduced to determine the arrival sequence of the multiple target points can be avoided, the calculation steps are simplified, and the optimal or suboptimal global path can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of graph search for multiple target points, and in particular to a multi-target point search method based on graph search technology. Background Art

[0002] Graph search technology is widely used and is usually used to solve the problem of the optimal path from point A to point B. Commonly used graph search algorithms include A* algorithm, Dijkstra algorithm, etc. In the path planning problem, taking A* algorithm as an example, the basic process of graph search algorithm is to model the search space into a graph structure, create a container to store the nodes to be visited, generally represented by openlist; create a container to store the visited nodes, generally represented by closelist; add the starting point to the openlist, and then start the loop: the loop process is to select a node from the openlist, obtain the nodes that the node can reach, and determine whether the node to be reached is in the openlist and closelist. If the node is a new node, that is, it is not in the openlist and closelist, then add the node to the openlist; if the node already exists in the openlist or closelist, then determine whether the cost of the path from the starting point to the node is less than the cost of the existing node. If it is less, then replace the previous node with the node and add it to the openlist. The condition for loop exit is to determine whether the end point is reached or the openlist is empty. Based on this, an optimal path or suboptimal path from the starting point to the end point can be obtained.

[0003] However, the existing graph search algorithms cannot solve the problem of searching for multiple target points. When faced with a search for multiple target points, for example, when the starting point is S and the target point set is [A, B, C], the path from S to A is often searched first, and then A is used as the starting point to search for the path to B, and so on. The final path is S→A→B→C, and the path of adjacent nodes in this path is optimal, but it cannot guarantee that a path to all target points or a path that connects all target points in series is optimal. The usual way to solve this problem is to manually specify the order of target points or determine the order of target points through other algorithms, and then input the individual target points into the graph search algorithm for search, which makes the algorithm complicated. Summary of the invention

[0004] In view of the above problems existing in the prior art, the present invention provides a multi-target point search method based on graph search technology.

[0005] The present invention adopts the following technical solutions:

[0006] A multi-target point search method based on graph search technology comprises the following steps:

[0007] Step 1: Create a graph structure search space. The nodes in the graph structure search space are represented by graph node structures. The cost of the edges of the connected graph nodes is determined.

[0008] Step 2: Determine the graph node s to which the starting point belongs, and determine all target graph nodes; create a search node S, set the actual cost value in the search node S to 0, the graph node pointer in the search node points to the starting point, and the previous search node pointer in the search node is set to null; create two search node containers openlist and closelist, the openlist is used to store the search nodes to be visited, and the closelist is used to store the search nodes that have been visited; put the search node S into the openlist;

[0009] Step 3: Determine whether openlist is empty. If it is empty, the search fails and exits. If it is not empty, execute step 4;

[0010] Step 4: Select the search node with the smallest cost from the openlist, represented by Best;

[0011] Step 5: Determine whether the search node Best has completed the search task. Completing the search task means that the backtracking path of the search node Best contains all the target graph nodes. If the search task is completed, exit. The optimal path is the backtracking path of the search node Best. If the search task is not completed, execute step 6;

[0012] Step 6: Get the set subs of all graph nodes that can be reached by the graph node pointed to by the search node Best;

[0013] Step 7: Determine whether subs is empty. If it is empty, jump to step 3. If it is not empty, go to step 8.

[0014] Step 8: Get a graph node sub from subs, and calculate the actual cost g of reaching the graph node sub via the search node Best;

[0015] Step 9: Determine whether there is a search node in the openlist and closelist pointing to the graph node sub. If not, jump to step 10; if yes, jump to step 11;

[0016] Step 10: Create a new search node N, the graph node pointer of search node N points to graph node sub, the pre-order search node pointer of N points to Best, calculate the cost value of search node N, then insert search node N into openlist, and jump to step 7;

[0017] Step 11: Record the search node set in openlist and closelist pointing to graph node sub as SearchNodeSet;

[0018] Step 12: Determine whether SearchNodeSet is empty. If it is empty, jump to step 7. If it is not empty, go to step 13.

[0019] Step 13: Get a search node search_node from SearchNodeSet, and determine whether the backtracking path of the search node search_node and the backtracking path of the search node Best pass through the same target graph node. If yes, execute step 14; if not, execute step 16.

[0020] Step 14: Compare the actual cost g(search_node) recorded in the search node search_node with the actual cost value g in step 8. If g<g(search_node), execute step 15, otherwise jump to step 12;

[0021] Step 15: If the search node search_node exists in the openlist, update the actual cost of the search node search_node g(search_node) = g, point the pre-order search node pointer of search_node to the search node Best, and calculate the cost value of search_node; if the search node search_node exists in the closelist, update the actual cost of the search node search_node g(search_node) = g, point the pre-order search node pointer of search_node to Best, calculate the cost value of search_node, add the search node search_node to the openlist, delete the search node search_node from the closelist, and jump to step 12;

[0022] Step 16: Create a new search node M, the graph node pointer of M points to the graph node sub, the pre-order search node pointer of M points to the search node Best, calculate the cost value of the search node M, insert the M node into the openlist, and jump to step 12.

[0023] Preferably, the cost value of any search node X is cost=g(X)+h(X), where g(X) represents the actual cost from the starting graph node s to the graph node pointed to by the search node X, that is, the distance from the graph node s to the graph node pointed to by X;

[0024] h(X) is defined as the progress of task completion, h(x) = max-i / n*Max+dis(x,nearest_goal), where max is a preset constant value, n is the number of target graph nodes, i is the number of target graph nodes contained in the path from graph node s to the graph node pointed to by search node X, and dis(x,nearest_goal) is the distance from the graph node pointed to by the current search node X to the nearest target graph node that has not been passed.

[0025] Preferably, in step 8, the actual cost g of searching for node Best to reach graph node sub is:

[0026] g=g(Best)+c(Best.node,sub);

[0027] g(Best) represents the actual cost from the starting graph node s to the graph node pointed to by the search node Best, that is, the distance from the graph node s to the graph node pointed to by Best; c(Best.node,sub) represents the value of the edge between the graph node pointed to by the search node Best and the graph node sub, that is, the distance between the graph node pointed to by Best and the graph node sub.

[0028] The present invention has the following beneficial effects:

[0029] Compared with the traditional graph search method that can only search for one target point in one search process, the present invention can obtain the optimal path of multiple target points in series in one search process. The present invention determines whether there is a comparison significance by judging whether the two backtracking paths to the same node pass through the same target point. If the two backtracking paths pass through the same target point, it decides whether to update the backtracking path based on the actual cost, thereby solving the problems existing in the prior art. The present invention broadens the application scenarios of traditional graph search algorithms. In the field of multi-point path navigation, it can avoid the introduction of additional methods to determine the order of arrival of multiple target points, simplify the calculation steps, and obtain the optimal or suboptimal global path. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 This is the result of multi-target search using the existing algorithm in Comparative Example 1.

[0031] Figure 2 This is the result of multi-target search using the method of the present invention in Example 1.

[0032] Figure 3 This is the result of multi-target search using the method of the present invention in Example 2.

[0033] Figure 4 This is the first part of the flowchart of the present invention.

[0034] Figure 5 This is the second part of the flowchart of the present invention.

[0035] Figure 6 This is the third part of the flow chart of the present invention.

[0036] Figure 4 , Figure 5 and Figure 6 Combine them in sequence to form the complete flow chart of the present invention. DETAILED DESCRIPTION

[0037] The specific implementation of the present invention is further described below in conjunction with the accompanying drawings and specific embodiments:

[0038] Combination Figures 1 to 6 , a multi-target point search method based on graph search technology, comprising the following steps:

[0039] Step 1: Create a graph structure search space. The nodes in the graph structure search space are represented by a graph node structure. The cost of the edges of the connected graph nodes is determined.

[0040] Step 2: Determine the graph node s to which the starting point belongs, and determine all the target graph nodes; create a search node S, set the actual cost value in the search node S to 0, the graph node pointer in the search node points to the starting point, and the previous search node pointer in the search node is set to null; create two search node containers openlist and closelist, the openlist is used to store the search nodes to be visited, and the closelist is used to store the search nodes that have been visited; put the search node S into the openlist.

[0041] Step 3: Determine whether openlist is empty. If it is empty, the search fails and exits. If it is not empty, execute step 4.

[0042] Step 4: Select the search node with the smallest cost from the openlist and represent it as Best.

[0043] The cost value of any search node X is cost = g(X) + h(X), where g(X) represents the actual cost from the starting graph node s to the graph node pointed to by the search node X, that is, the distance from the graph node s to the graph node pointed to by X.

[0044] h(X) is defined as the progress of task completion, h(x) = max-i / n*Max+dis(x,nearest_goal), where max is a preset constant value, n is the number of target graph nodes, i is the number of target graph nodes contained in the path from graph node s to the graph node pointed to by search node X, and dis(x,nearest_goal) is the distance from the graph node pointed to by the current search node X to the nearest target graph node that has not been passed.

[0045] Step 5: Determine whether the search node Best has completed the search task. Completing the search task means that the backtracking path of the search node Best contains all the target graph nodes. If the search task is completed, exit. The optimal path is the backtracking path of the search node Best. If the search task is not completed, execute step 6.

[0046] Step 6: Get the set subs of all graph nodes that can be reached by the graph node pointed to by the search node Best.

[0047] Step 7: Determine whether subs is empty. If it is empty, jump to step 3. If it is not empty, go to step 8.

[0048] Step 8: Get a graph node sub from subs, and calculate the actual cost g of reaching the graph node sub via the search node Best.

[0049] g=g(Best)+c(Best.node,sub).

[0050] g(Best) represents the actual cost from the starting graph node s to the graph node pointed to by the search node Best, that is, the distance from the graph node s to the graph node pointed to by Best; c(Best.node,sub) represents the value of the edge between the graph node pointed to by the search node Best and the graph node sub, that is, the distance between the graph node pointed to by Best and the graph node sub.

[0051] Step 9: Determine whether there is a search node in the openlist and closelist pointing to the graph node sub. If not, jump to step 10; if yes, jump to step 11.

[0052] Step 10: Create a new search node N, the graph node pointer of search node N points to graph node sub, the predecessor search node pointer of N points to Best, calculate the cost value of search node N, then insert search node N into openlist, and jump to step 7.

[0053] Step 11: The search node set in openlist and closelist pointing to graph node sub is recorded as SearchNodeSet, and the search nodes in SearchNodeSet all point to graph node sub.

[0054] Step 12: Determine whether SearchNodeSet is empty. If it is empty, jump to step 7. If it is not empty, go to step 13.

[0055] Step 13: Get a search node search_node from SearchNodeSet, and determine whether the backtracking path of the search node search_node and the backtracking path of the search node Best pass through the same target graph node. If yes, execute step 14; if not, execute step 16.

[0056] Step 14: Compare the actual cost g(search_node) recorded in the search node search_node with the actual cost value g in step 8. If g<g(search_node), execute step 15, otherwise jump to step 12.

[0057] The traditional graph search algorithm handles this situation by comparing the calculated value of g in step 8 with the value of g recorded in the search node search_node to decide whether to update the actual cost of the search node in search_node and the previous search node. This logic is reasonable when there is only one starting point and end point, but when there are multiple target graph nodes, although the two search nodes have reached the same graph node, their backtracking paths may pass through different target graph nodes. When the backtracking paths pass through different target graph nodes, it can be understood that the two have reached the graph node from different "states" and have reached the same graph node from different "initial conditions". Since the two start from different "starting points", it is obviously impossible to use the actual cost of reaching the graph node from the "same starting point s" to decide whether to update. It is only meaningful to compare the actual costs of the two starting from the same "starting point" and the same "state".

[0058] Therefore, this method determines whether the backtracking path of Best and the backtracking path of search_node pass through the same target graph node. The number and order of the target graph nodes in the backtracking path of search node search_node and the backtracking path of search node Best do not affect the judgment result. For example: when the backtracking paths are goal1→....→goal2 and goal2→...→goal1→...→goal2, the two backtracking paths are judged to pass through the same target graph node. If the two backtracking paths do not pass through any target graph node, they are also considered to be consistent.

[0059] Step 15: If the search node search_node exists in the openlist, update the actual cost of the search node search_node g(search_node) = g, point the pre-order search node pointer of search_node to the search node Best, and calculate the value of the cost of search_node; if the search node search_node exists in the closelist, update the actual cost of the search node search_node g(search_node) = g, point the pre-order search node pointer of search_node to Best, calculate the value of the cost of search_node, add the search node search_node to the openlist, delete the search node search_node from the closelist, and jump to step 12.

[0060] Step 16: Create a new search node M, the graph node pointer of M points to the graph node sub, the predecessor search node pointer of M points to the search node Best, calculate the cost value of the search node M, insert the M node into the openlist, and jump to step 12.

[0061] The overall flow chart of the present invention is shown in Figure 4-Figure 6 , because the flowchart is too large, the complete flowchart is split into Figure 4 , Figure 5 and Figure 6 , Figure 4 , Figure 5 and Figure 6 Merge them in sequence to form a complete flowchart.

[0062] Comparative Example 1

[0063] Figure 1 The search results of the original A* algorithm when the cost of each edge is 1, starting from node 0 and the target points are nodes 1, 2, and 3.

[0064] It can be seen that the original A* algorithm cannot obtain a path that passes through nodes 1, 2, and 3 at the same time. The backtracking paths of each node recorded in the closelist are:

[0065] 0→1

[0066] 0→2 ...

[0068] 0→8.

[0069] Example 1

[0070] Figure 2The cost of each edge is 1, when starting from node 0 and the target point is node 1, 2, 3, the search result of the present invention is 0→3→2→1, which meets the expected effect.

[0071] Example 2

[0072] Figure 3 When the edge cost is 1, starting from the 0th node and the target point is the 1st and 5th nodes, the search result of the present invention is 0→5→0→1, which meets the expected effect.

[0073] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the protection scope of the present invention.

Claims

1. A multi-target point search method based on graph search technology, characterized in that: The following steps are involved: Step 1: Create a graph structure search space. The nodes in the graph structure search space are represented by graph node structures. The cost of the edges of the connected graph nodes is determined. Step 2: Determine the graph node s to which the starting point belongs, and determine all target graph nodes; Create a search node S, set the actual cost value in the search node S to 0, set the graph node pointer in the search node to the starting point, and set the previous search node pointer in the search node to null; create two search node containers openlist and closelist, the openlist is used to store the search nodes to be visited, and the closelist is used to store the search nodes that have been visited; put the search node S into the openlist; Step 3: Determine whether openlist is empty. If it is empty, the search fails and exits. If it is not empty, execute step 4; Step 4: Select the search node with the smallest cost from the openlist, represented by Best; Step 5: Determine whether the search node Best has completed the search task. Completing the search task means that the backtracking path of the search node Best contains all the target graph nodes. If the search task is completed, exit. The optimal path is the backtracking path of the search node Best. If the search task is not completed, execute step 6; Step 6: Get the set subs of all graph nodes that can be reached by the graph node pointed to by the search node Best; Step 7: Determine whether subs is empty. If it is empty, jump to step 3. If it is not empty, go to step 8. Step 8: Get a graph node sub from subs, and calculate the actual cost g of reaching the graph node sub via the search node Best; Step 9: Determine whether there is a search node in the openlist and closelist pointing to the graph node sub. If not, jump to step 10; if yes, jump to step 11; Step 10: Create a new search node N, the graph node pointer of search node N points to graph node sub, the pre-order search node pointer of N points to Best, calculate the cost value of search node N, then insert search node N into openlist, and jump to step 7; Step 11: Record the search node set in openlist and closelist pointing to graph node sub as SearchNodeSet; Step 12: Determine whether SearchNodeSet is empty. If it is empty, jump to step 7. If it is not empty, go to step 13. Step 13: Get a search node search_node from SearchNodeSet, and determine whether the backtracking path of the search node search_node and the backtracking path of the search node Best pass through the same target graph node. If yes, execute step 14; if not, execute step 16. Step 14: Compare the actual cost g(search_node) recorded in the search node search_node with the actual cost value g in step 8. If g<g(search_node), execute step 15, otherwise jump to step 12; Step 15: If the search node search_node exists in the openlist, update the actual cost of the search node search_node g(search_node)=g, point the pre-order search node pointer of search_node to the search node Best, and calculate the cost value of search_node; If the search node search_node exists in the closelist, update the actual cost of the search node search_node g(search_node) = g, point the pre-order search node pointer of search_node to Best, calculate the value of the cost of search_node, add the search node search_node to the openlist, delete the search node search_node from the closelist, and jump to step 12; Step 16: Create a new search node M, the graph node pointer of M points to the graph node sub, the pre-order search node pointer of M points to the search node Best, calculate the cost value of the search node M, insert the M node into the openlist, and jump to step 12.

2. According to claim 1, a multi-target point search method based on graph search technology is characterized in that: The cost value of any search node X is cost = g(X) + h(X), where g(X) represents the actual cost from the starting graph node s to the graph node pointed to by the search node X, that is, the distance from the graph node s to the graph node pointed to by X; h(X) is defined as the progress of task completion, h(x) = max-i / n*Max+dis(x,nearest_goal), where max is a preset constant value, n is the number of target graph nodes, i is the number of target graph nodes contained in the path from graph node s to the graph node pointed to by search node X, and dis(x,nearest_goal) is the distance from the graph node pointed to by the current search node X to the nearest target graph node that has not been passed.

3. The multi-target point search method based on graph search technology according to claim 1, characterized in that: In step 8, the actual cost g of searching node Best to reach graph node sub is: g=g(Best)+c(Best.node,sub); g(Best) represents the actual cost from the starting graph node s to the graph node pointed to by the search node Best, that is, the distance from the graph node s to the graph node pointed to by Best; c(Best.node,sub) represents the value of the edge between the graph node pointed to by the search node Best and the graph node sub, that is, the distance between the graph node pointed to by Best and the graph node sub.