Optimal path acquisition method, device, equipment and processor
By determining the target map from the full-level road network map in path planning, hiding the irrelevant road network and exploring the transit sequence using the principle of shortest distance, combining the annealing algorithm to optimize the path, the calculation overhead problem of the A* algorithm in multi-node situation is solved. The efficiency of obtaining optimal paths in large-scale road networks has been improved.
Patent Information
- Application Number
- CN202411078546.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-06
- Publication Date
- 2024-12-06
AI Technical Summary
Existing path planning algorithms such as the A* algorithm have a high computational overhead when processing multiple nodes, resulting in increased performance consumption and it is difficult to effectively reduce the computational complexity in large-scale road networks.
By determining the target map from the full-level road network map, hiding the road network that is not related to the target road level, exploring the transit sequence using the principle of shortest distance, optimizing the path with the annealing algorithm, building the initial path and gradually querying the route points that meet the distance requirements, avoiding Global search has high computational overhead.
It significantly reduces the computational complexity and improves the efficiency of optimal path acquisition in large-scale road networks. It performs more prominently especially when the number of nodes is large, reduces nodes and edges that need to be processed, and reduces the performance consumption of the algorithm.
Smart Images

Figure CN119090103A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of path planning technology, and in particular to a method, device, equipment and processor for obtaining an optimal path. Background Art
[0002] The Traveling Salesman Problem (TSP) is a classic optimization problem, the core of which is to find the shortest path (i.e., the optimal path) that allows the traveling salesman to visit each city once and return to the starting point. This problem is widely used in real life, especially in logistics distribution and multi-point navigation. In logistics distribution, the reasonable planning of the order of multiple distribution points can significantly improve efficiency, reduce driving distance and time, thereby reducing costs and reducing environmental impact. Similarly, in carpooling or long-distance driving, if you need to pass through multiple points, optimizing the order of visiting these points can also bring similar benefits.
[0003] In the related art, the A* algorithm is used to find the optimal path. The A* algorithm is a search algorithm widely used in path planning. When searching for the best path, the A* algorithm uses a heuristic function to estimate the cost from the current node to the target node, and dynamically adjusts the search direction based on this estimate, in the hope of finding the optimal path faster. At the same time, the A* algorithm uses a priority queue to store the nodes to be expanded, and selects the node with the lowest cost for expansion in each iteration. Since the priority queue needs to be updated and maintained in each iteration to ensure that the node with the lowest cost can be quickly selected and expanded. Especially when the number of nodes is large, such operations will bring a large computational overhead. Summary of the invention
[0004] Based on the above problems, the present application provides a method, apparatus, device and processor for obtaining an optimal path, the purpose of which is to reduce the computational complexity and thereby reduce the performance consumption in the process of obtaining the optimal path.
[0005] The embodiments of the present application disclose the following technical solutions:
[0006] A method for obtaining an optimal path, the method comprising:
[0007] Determine a first target map from a full-level road network map according to a plurality of known road nodes; the plurality of known road nodes include a starting point, an end point, and a plurality of via points on the path to be planned; the first target map is an area map covering the starting point, the end point, and the plurality of via points;
[0008] determining a target road grade of the first target map based on an area of the first target map;
[0009] Hiding the road network irrelevant to the target road level in the first target map to obtain a second target map;
[0010] In the second target map, based on the road network of the target road level and the shortest distance exploration principle, the transit sequence of the via points is gradually explored from the starting point to the end point, and the starting point, the plurality of via points and the end point are sequentially connected according to the explored transit sequence to obtain an initial path;
[0011] The initial path is continuously optimized based on the nodes in the initial path and the transfer sequence using an annealing algorithm to obtain an optimal path.
[0012] In a possible implementation, obtaining the optimal path based on the nodes in the initial path and the transfer sequence by using an annealing algorithm includes:
[0013] Randomly select two known road nodes that meet a preset node interval number in the initial path to exchange positions, and obtain an alternative path;
[0014] Calculating the total path lengths of the initial path and the alternative path respectively;
[0015] Based on the total path length of the initial path and the total path length of the replaceable path, a target path is determined, and a change temperature is obtained; the change temperature is obtained by reducing the temperature based on the initial temperature, and the temperature is reduced once each time a target path is obtained;
[0016] If the change temperature is less than the temperature threshold, the target path is determined as the optimal path; if the change temperature is greater than or equal to the temperature threshold, the target path is reset as the initial path, and the change temperature is reset as the initial temperature, and the steps of obtaining an alternative path, calculating the total length of the path, determining the target path, and obtaining the change temperature are repeated until the latest change temperature is less than the temperature threshold, and the latest target path is determined as the optimal path.
[0017] In a possible implementation, randomly selecting two known road nodes that meet a preset number of node intervals in the initial path to exchange positions and obtain an alternative path includes:
[0018] Randomly select a known road node in the initial path as a node to be exchanged;
[0019] Taking the node to be exchanged as the center and according to the number of node intervals, randomly searching forward or backward for a target exchange node of the node to be exchanged in accordance with the transfer order;
[0020] The positions of the node to be exchanged and the target exchange node are exchanged to obtain the replaceable path.
[0021] In a possible implementation, determining the target path based on the total path length of the initial path and the total path length of the replaceable path, and obtaining the change temperature includes:
[0022] If the total path length of the initial path is greater than the total path length of the alternative path, the alternative path is set as the target path; if the total path length of the initial path is less than or equal to the total path length of the alternative path, the initial path is set as the target path;
[0023] If the total path length of the initial path is greater than the total path length of the replaceable path, the initial temperature is reduced according to a first cooling rate to obtain the changed temperature; if the total path length of the initial path is less than or equal to the total path length of the replaceable path, the initial temperature is reduced according to a second cooling rate to obtain the changed temperature; the first cooling rate is less than the second cooling rate.
[0024] In a possible implementation, determining the first target map from a full-level road network map according to a plurality of known road nodes includes:
[0025] Get the longitude and latitude of each known road node;
[0026] Determine the first coordinate based on the maximum longitude and the maximum latitude among all the longitudes and latitudes, and determine the second coordinate based on the minimum longitude and the minimum latitude among all the longitudes and latitudes;
[0027] According to the first coordinates and the second coordinates, an initial target map is selected from the full-level road network map; the initial target map is a full-level road network map determined in the full-level road network map that covers a starting point, an end point, and a plurality of via points and has a minimum area;
[0028] The initial target map is expanded according to the target expansion area to obtain the first target map.
[0029] In a possible implementation, in the second target map, gradually exploring the transit sequence of the via points from the starting point to the end point based on the road network of the target road level and the shortest distance exploration principle includes:
[0030] sequentially taking known road nodes in the second target map as exploration nodes;
[0031] When the target road level includes the road level to which the exploration node belongs, the distance from the exploration node to each of the other known road nodes is determined in the second target map; when the target road level does not include the road level to which the exploration node belongs, the road network corresponding to the road level to which the exploration node belongs is expanded in the second target map, and the distance from the exploration node to each of the other known road nodes is determined in the second target map with the road network of the road level to which the exploration node belongs expanded; there are one or more distances between the exploration node and any one of the known road nodes;
[0032] If there is one distance between the exploration node and one of the known road nodes, the distance is used as the exploration distance from the exploration node to the known road node; if there are multiple distances between the exploration node and one of the known road nodes, the shortest distance is selected from the multiple distances as the exploration distance from the exploration node to the known road node;
[0033] Traversing and searching the exploration distance from the exploration node to all the known road nodes;
[0034] Repeat the above steps of determining the distance from the exploration node to each other known road node and screening the exploration distance until the exploration distances from all exploration nodes to all other known road nodes are found; if the exploration distance from the exploration node to a known road node has been found, the exploration distance from the exploration node to the known road node will not be searched again;
[0035] Based on the exploration distance, starting from the starting point in the second target map, explore the via point with the smallest exploration distance from the starting point as the transit point of the starting point, and then start from the transit point to query the via point whose exploration distance with the transit point meets the distance requirement as the transit point of the transit point, and continue to query the transit points of each via point until all the transit points are queried and stop, and the order of exploring the transit points is used as the transit order.
[0036] In a possible implementation, the method further includes:
[0037] If there is an exploration node and a path to the target road node cannot be determined after traversing all roads in the second target map, then the straight-line distance between the exploration node and the target road node is calculated;
[0038] The N times of the straight-line distance between the exploration node and the target road node is used as the exploration distance between the exploration node and the target road node; N is a value between 1 and 5.
[0039] In a possible implementation, the road grades include a first road grade, a second road grade, a third road grade, a fourth road grade and a fifth road grade, with road network density increasing in sequence;
[0040] The relationship between the area of the first target map, the target road level and the hidden road network includes:
[0041] When the area of the first target map is less than or equal to the first exploration area, it is determined that the target road level of the first target map includes the first road level, the second road level, the third road level, the fourth road level and the fifth road level, and the road network is not hidden;
[0042] When the area of the first target map is greater than the first exploration area and less than or equal to the second exploration area, determining that the road level of the first target map includes the first road level, the second road level, the third road level and the fourth road level, and hiding the road network corresponding to the fifth road level;
[0043] When the area of the first target map is greater than the second exploration area and less than or equal to the third exploration area, determining that the road level of the first target map includes the first road level, the second road level, and the third road level, and hiding the road network corresponding to the fifth road level and the road network corresponding to the fourth road level;
[0044] When the area of the first target map is greater than the third exploration area and less than or equal to the fourth exploration area, determining that the road level of the first target map includes the first road level and the second road level, and hiding the road network corresponding to the fifth road level, the road network corresponding to the fourth road level, and the road network corresponding to the third road level;
[0045] When the area of the first target map is larger than the fourth exploration area, it is determined that the road level of the first target map includes the first road level, and the road network corresponding to the fifth road level, the road network corresponding to the fourth road level, the road network corresponding to the third road level, and the road network corresponding to the second road level are hidden.
[0046] An optimal path acquisition device, the device comprising:
[0047] A first determination unit is used to determine a first target map from a full-level road network map according to a plurality of known road nodes; the plurality of known road nodes include a starting point, an end point, and a plurality of via points on a path to be planned; the first target map is an area map covering the starting point, the end point, and the plurality of via points;
[0048] a second determining unit, configured to determine a target road grade of the first target map based on an area of the first target map;
[0049] A road network hiding unit, used for hiding the road network irrelevant to the target road level in the first target map to obtain a second target map;
[0050] An exploration unit, configured to gradually explore the transit sequence of the via points from the starting point to the end point in the second target map based on the road network of the target road level and the shortest distance exploration principle;
[0051] A connecting unit, configured to connect the starting point, the plurality of via points and the end point in sequence according to the transfer sequence obtained by exploration to obtain an initial path;
[0052] The third determining unit is used to continuously optimize the initial path based on the nodes in the initial path and the transfer sequence by using an annealing algorithm to obtain an optimal path.
[0053] A processor is used to run a computer program, and when the program is run, the method for obtaining the optimal path as described above is executed.
[0054] Compared with the prior art, this application has the following beneficial effects:
[0055] When solving the optimal path of multiple known road nodes on the path to be planned, the embodiment of the present application will determine the first target map with a full-level road network according to the starting point, the end point and several via points included in the multiple known road nodes. Then, the target road level of the first target map is determined based on the area of the first target map, and the road network that is not related to the target road level in the first target map is hidden to obtain the second target map. Then, in the second target map, the transit order of the via points is gradually explored from the starting point to the end point based on the road network of the target road level and the shortest distance exploration principle. Finally, the starting point, multiple via points and the end point are connected in sequence according to the transit order obtained by the exploration to obtain the initial path. Next, the initial path is continuously optimized using the annealing algorithm to determine the optimal path. The present application adopts a segmented query method to construct the initial path, and gradually queries the via points that meet the distance requirements as transit points, thereby avoiding the high computational overhead of a one-time global search. This query method is relatively efficient, especially when the number of nodes is large. At the same time, through the determination of the two target maps and the road network hiding operation, the search range can be narrowed to the map of the target road level, greatly reducing the nodes and edges that need to be processed, thereby reducing the computational complexity. This significantly reduces the performance cost of the algorithm when processing large-scale road networks. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0057] Figure 1 A schematic diagram of obtaining an optimal path provided in an embodiment of the present application;
[0058] Figure 2 A method flow chart of a method for obtaining an optimal path provided in an embodiment of the present application;
[0059] Figure 3 A method flow chart of a method for determining a first target map provided in an embodiment of the present application;
[0060] Figure 4 A schematic diagram of an initial target map provided in an embodiment of the present application;
[0061] Figure 5 A schematic diagram of a first target map provided in an embodiment of the present application;
[0062] Figure 6 A road network diagram provided in an embodiment of the present application;
[0063] Figure 7 A road network diagram provided in an embodiment of the present application;
[0064] Figure 8 A road network diagram provided in an embodiment of the present application;
[0065] Fig. 9 A method flow chart of a transit sequence exploration method provided in an embodiment of the present application;
[0066] Fig.10 A method flow chart of a path optimization method using an annealing algorithm provided in an embodiment of the present application;
[0067] Fig.11 A schematic diagram of an optimal path acquisition device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0068] To facilitate understanding of the technical solutions provided by the embodiments of the present application, the background technology involved in the embodiments of the present application will be described below.
[0069] A road network is a network system consisting of various roads, streets, highways, etc., which is used to connect cities, villages and various geographical locations. A road network is usually composed of intersections, road sections, transportation facilities and other elements, which are interconnected and form a complete transportation network. In a specific application, assuming that the road network between nodes A and B is more complex (that is, there are multiple roads from node A to node B, that is, there are multiple costs between nodes A and B), the A* algorithm will tend to explore the path with lower cost first.
[0070] As described above, the A* algorithm is a widely used search algorithm for path planning. It guides the search process by combining the actual cost (the distance from the starting point to the current node) and the heuristic estimate (the expected distance from the current node to the target node). The heuristic estimate estimates the expected distance from the current node to the target node through a heuristic function. The heuristic function is usually based on some form of distance or cost estimation, such as Manhattan distance, Euclidean distance, etc. At the same time, the A* algorithm uses a priority queue to store the nodes to be expanded, and selects the node with the smallest total cost for expansion in each iteration.
[0071] In the A* algorithm, updating and maintaining the priority queue is critical. Because in each iteration, it is necessary to ensure that the node with the lowest cost can be quickly selected and expanded, so when the number of nodes is large, such operations will bring a large computational overhead. Especially when searching for paths in large maps, this computational overhead may significantly affect the performance and efficiency of the algorithm.
[0072] Based on this, the embodiment of the present application provides a method, device, equipment and processor for obtaining an optimal path. In the process of obtaining the optimal path, first, a target map containing all levels of road networks is determined based on the starting point, the end point and the via points. Then, the target road level is determined based on the area of the target map, and a simplified second target map is obtained by hiding the road network that is not related to the level. Next, in the second target map, according to the target road level and the principle of shortest distance, the order of via points from the starting point to the end point is gradually explored to obtain the transit order. Finally, the starting point, the via points and the end point are connected in sequence according to the explored transit order to form an initial path. Then, the initial path is optimized using an annealing algorithm to obtain the optimal path. The present application constructs the initial path through segmented query to reduce the computational complexity, and through the determination of two target maps and the road network hiding operation, the search range is narrowed to the map of the target road level, thereby improving the performance and efficiency of the algorithm.
[0073] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0074] See also Figure 1 , Figure 1 A schematic diagram of obtaining an optimal path provided in an embodiment of the present application.
[0075] When obtaining the optimal path for known road nodes on the planned path, it is first necessary to determine the initial target map that can cover the minimum area corresponding to the known road nodes from the full-level road network map. The full-level road network map refers to a map containing all road level information. In the optimal path acquisition, roads are often divided into the first road level, the second road level, the third road level, the fourth road level and the fifth road level according to their levels, with the road network density increasing in sequence. The first road level can correspond to but not limited to the expressway network, the second road level can correspond to but not limited to the first-class highway (such as roads connecting major cities and economic zones) network or express road network, the third road level can correspond to but not limited to the urban trunk road network, the fourth road level can correspond to but not limited to the third-class highway (such as roads connecting small and medium-sized cities and towns) network or general road network, and the fifth road level can correspond to but not limited to the fourth-class highway (such as roads connecting villages and villages) network. The full-level road network map is a comprehensive map that includes the first road level network, the second road level network, the third road level network, the fourth road level network and the fifth road level network. Therefore, the full-level road network map contains road information of various levels so that all possible driving routes can be considered in the process of obtaining the optimal path. Known road nodes refer to the starting point, end point and multiple intermediate points that are clearly known on the path to be planned. These nodes are the basic elements of optimal path acquisition. By determining these nodes, the optimal path to be found can be defined.
[0076] Outside the boundary range of the initial target map, the area of the initial target map is further expanded and extended according to the target expansion area, thereby obtaining a new target map, namely the second target map. Specifically, this process will extend the boundary of the initial target map outward, increase the total area of the map, and ensure that all roads in the area covered by the map are connected, avoiding some roads becoming inaccessible due to boundary restrictions.
[0077] Then, after determining the first target map, the target road grade that needs to be considered in the first target map is determined according to the area of the first target map. Then, the roads corresponding to the road network in the first target map that are irrelevant to the target road grade are hidden, and a streamlined second target map that only contains information related to the target road grade is obtained. Through this step, the number of roads and nodes that need to be processed can be reduced, and the efficiency of obtaining the optimal path can be improved. The target road grade includes one or more of the first road grade, the second road grade, the third road grade, the fourth road grade and the fifth road grade. The larger the area of the first target map, the fewer road grades the target road grade includes and the more road networks need to be hidden. If the target road grade includes the first road grade and the second road grade, then it is necessary to hide the road networks corresponding to the third road grade, the fourth road grade and the fifth road grade.
[0078] According to the target road level and the road level to which each road node belongs, the shortest distance between any two road nodes in the second target map is explored as the exploration distance. There may be one or more passable roads between any two road nodes. If there is one passable road between two road nodes, the distance of the road is calculated as the exploration distance between the two road nodes; if there are multiple passable roads between two road nodes, the distances of all passable roads are calculated, and the one with the shortest distance is taken as the exploration distance between the two road nodes.
[0079] In the second target map, based on the shortest distance exploration principle, the transit order of the via points is gradually explored from the starting point to the end point, and the starting point, multiple via points and the end point are connected in sequence according to the transit order obtained by the exploration to obtain the initial path. The transit order is the access order of the via points from the starting point to the end point, and these via points are the points passed during the exploration process. Specifically, in a map or graph structure, there may be multiple paths between the starting point and the end point, and a path found based on the shortest distance principle will pass through multiple via points. The access order of these via points is the transit order.
[0080] The annealing algorithm is used to iteratively optimize the initial path to obtain the optimal path. The annealing algorithm simulates the physical annealing process and accepts poor solutions with a certain probability in each step, thereby avoiding falling into the local optimum and gradually converging to the global optimal path. With this method, the initial path can be effectively improved and the optimal driving route can be finally found.
[0081] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.
[0082] To facilitate understanding of the present application, a method for obtaining an optimal path provided in an embodiment of the present application is described below with reference to the accompanying drawings.
[0083] See also Figure 2 As shown in FIG. 1 , this figure is a flow chart of a method for obtaining an optimal path provided in an embodiment of the present application, such as Figure 2 As shown, the method may include S201-S206:
[0084] S201: Determine a first target map from a full-level road network map based on a plurality of known road nodes.
[0085] With the known starting point, end point and via points, a regional map covering these points is determined in the full-level road network map as the first target map. This process involves planning the path and determining the required map range to ensure that all key nodes are included and provide an accurate information basis for the subsequent acquisition of the optimal path.
[0086] Determining the first target map from the full-level road network map based on multiple known road nodes (including the starting point, the end point, and multiple via points) can effectively concentrate computing resources and optimize route selection in the process of obtaining the optimal path. By extracting the regional map covering these key nodes, the path search range can be narrowed, the computational complexity can be reduced, the efficiency of obtaining the optimal path can be improved, and at the same time, it can ensure that the selected path can connect all important locations.
[0087] See also Figure 3 , Figure 3 A method flow chart of a method for determining a first target map provided in an embodiment of the present application can be specifically implemented through steps A1-A4:
[0088] A1: Get the longitude and latitude of each known road node.
[0089] Longitude and latitude provide the precise geographic location of each known road node (including the starting point, end point, and via point). This information is the basis for determining the relative position and distance of nodes. By obtaining the longitude and latitude of all nodes, the minimum rectangular range covering all nodes can be calculated. This includes finding the maximum and minimum longitude, maximum and minimum latitude, and thus determining an initial area (i.e., the initial target map) that includes all nodes.
[0090] A2: The longitude of the first coordinate is determined based on the maximum longitude and the maximum latitude among all longitudes and latitudes, and the longitude of the first coordinate is determined based on the minimum longitude and the minimum latitude among all longitudes and latitudes.
[0091] Find the longitude and latitude of all known road nodes, traverse the longitude and latitude of all known road nodes, and find the largest longitude value and the largest latitude value. These two values together constitute the first coordinate, which is the upper right corner vertex of the initial target map.
[0092] Similarly, traverse the longitude and latitude of all known road nodes and find the smallest longitude value and the smallest latitude value. These two values together constitute the second coordinate, which is the lower left corner vertex of the bounding box.
[0093] For example, it is assumed that the known road nodes include a starting point S, a via point A, a via point B, a via point C, and an end point G. The longitude and latitude of the starting point S are 39.9042°N, 116.4074°E; the longitude and latitude of the via point A are 40.7128°N, 74.0060°W; the longitude and latitude of the via point B are 33.8688°S, 151.2093°E; the longitude and latitude of the via point C are 51.5074°N, 0.1278°W; the longitude and latitude of the end point G are 30.0444°N, 31.2357°E, of which the maximum longitude is 151.2093°E, the maximum latitude is 51.5074°N, the minimum longitude is 0.1278°W (note that since the longitude is the west longitude, it is actually smaller than all other east longitudes), and the minimum latitude is 30.0444°N. Therefore, the first coordinate is (151.2093°E, 51.5074°N), and the second coordinate is (0.1278°W, 30.0444°N).
[0094] A3: According to the first coordinates and the second coordinates, a rectangular map is selected from the full-level road network map, and the rectangular map is used as an initial target map.
[0095] Based on the first coordinate and the second coordinate, a full-level road network map that can cover the starting point, the end point and several passing points is determined from the full-level road network map, and it is a full-level road network map with the smallest area. This map is called the initial target map.
[0096] In a possible implementation, a line between the first coordinate and the second coordinate may be used as a diagonal line to select a rectangular map from a full-level road network map, and the rectangular map may be used as an initial target map.
[0097] Specifically, after obtaining the first coordinate (maximum longitude and maximum latitude) and the second coordinate (minimum longitude and minimum latitude), the line between these two coordinate points is used as the diagonal line, and then a rectangular area is selected from the full-level road network map. This rectangular area is the initial target map. The purpose of this initial target map is to ensure that it can completely cover the starting point, end point and all passing points on the path to be planned, while keeping the area as small as possible, so that the subsequent optimal path acquisition operation can be performed in a more precise area, reducing unnecessary search range and calculation. Figure 4 , Figure 4 A schematic diagram of an initial target map provided in an embodiment of the present application, Figure 4 The map in the middle dotted rectangle is the initial target map. Figure 4 S is the starting point, G is the ending point, and A, B and C are the passing points.
[0098] It should be noted that the method of determining a rectangle as the initial target map based on the diagonal line is simple and easy, and can ensure that the initial target map is reasonably covered. Of course, the initial map can also be determined as other shapes according to the situation.
[0099] A4: Expanding the initial target map according to the target expansion area to obtain the first target map.
[0100] The purpose of expanding the initial target map is to avoid situations where the route is unreachable. For example, if a via point is located on a small island and the road network of the island only surrounds a small part, directly using the initial target map may result in an inability to find a valid path to reach the point. Therefore, by increasing the target expansion area to expand the scope of the initial target map, it can be ensured that more potential feasible paths are included, thereby avoiding missing accessible routes due to map range limitations. The final first target map will cover the relevant area more comprehensively, improving the integrity and reliability of path planning. Figure 5 , Figure 5 A schematic diagram of a first target map provided in an embodiment of the present application, Figure 5 The map in the solid rectangle is the first target map, and the map in the dotted rectangle is the initial target map. Figure 5 S is the starting point, G is the ending point, and A, B and C are the passing points.
[0101] In a possible implementation, the target expansion area may be, but is not limited to, set to 30% of the initial target map area.
[0102] S202: Determine a target road grade of the first target map based on the area of the first target map.
[0103] Determining the target road level of the first target map based on the area of the first target map is a process of adjusting the road network detail level according to the size of the map coverage. This process defines road network level combinations corresponding to different area thresholds to ensure that the most appropriate road network information is considered during path planning.
[0104] Specifically, when the area of the first target map is less than or equal to the first exploration area, the target road level will include all five levels of roads (first to fifth road levels), which means that within the smallest map range, as detailed road network information as possible is required. As the map area increases, if the area is between the first exploration area and the second exploration area, the target road level will only include the first four levels of roads (first to fourth road levels), omitting the lowest fifth road level. When the area increases further, exceeding the second exploration area but not exceeding the third exploration area, the target road level will only include the first three levels of roads (first to third road levels). If the area continues to increase, exceeding the third exploration area but not exceeding the fourth exploration area, the target road level will only include the first two levels of roads (first and second road levels). Finally, when the area exceeds the fourth exploration area, the target road level will only include the highest first road level, which generally means that within a very large map range, only the highest level of roads need to be considered.
[0105] In one possible implementation, the first exploration area may be but not limited to 10 square kilometers, the second exploration area may be but not limited to 50 square kilometers, the third exploration area may be but not limited to 100 square kilometers, and the fourth exploration area may be but not limited to 500 square kilometers.
[0106] In this way, the road levels included can be dynamically adjusted according to the actual area of the first target map, which not only ensures the accuracy of path planning, but also avoids wasting computing resources on unnecessary details. Such a strategy helps to optimize the algorithm for obtaining the optimal path so that it can run efficiently at different map scales.
[0107] S203: Hide the road network in the first target map that is irrelevant to the target road level to obtain a second target map.
[0108] Hiding the road network irrelevant to the target road grade in the first target map to obtain the second target map is a process of streamlining the road network information, which aims to optimize the efficiency and accuracy of obtaining the optimal path according to the area of the current map and the required road grade.
[0109] Specifically, when the road level of the first target map includes all five levels of roads (first to fifth road levels), no road network hiding is performed, that is, road information of all levels is retained;
[0110] When the road levels of the first target map include only the first four levels (the first to fourth road levels), the road network corresponding to the fifth road level is hidden, that is, the road information of the lowest level is removed;
[0111] When the road levels are reduced to only the first three levels (the first to third road levels), in addition to hiding the road network corresponding to the fifth road level, the road network corresponding to the fourth road level is also hidden to further simplify the road network structure;
[0112] When the road levels of the first target map are further reduced to only include the first two levels (the first and second road levels), it is necessary to hide the road networks corresponding to the fifth, fourth and third road levels, and only retain the road information of the highest two levels;
[0113] Finally, when the road level only includes the first road level, the road networks corresponding to the fifth, fourth, third and second road levels need to be hidden, and only the highest level first road level information is retained.
[0114] For example, Figure 6 is a simulated full-level road network diagram. After hiding the road network corresponding to the fifth road level, we can get Figure 7 The road network diagram of the fourth and fifth road levels can be obtained by hiding the road network corresponding to the fourth and fifth road levels. Figure 8 Road network diagram. Figure 6-Figure 8 In the figure, the orange lines are the road network corresponding to the first road level, the red lines are the road network corresponding to the second road level, the green lines are the road network corresponding to the third road level, the blue lines are the road network corresponding to the fourth road level, and the yellow lines are the road network corresponding to the fifth road level.
[0115] In this way, the road network information irrelevant to the target road level can be dynamically hidden according to the actual area of the first target map and the required road level. The second target map obtained in this way will be more streamlined, thereby improving the efficiency of obtaining the optimal path and ensuring that appropriate road network details can be provided on maps of different scales.
[0116] S204: In the second target map, based on the road network of the target road level and the shortest distance exploration principle, a transit sequence of the passing points is gradually explored from the starting point to the end point.
[0117] This step uses a step-by-step search strategy to determine the best path from the starting point to the end point based on the streamlined road network information. First, the shortest distance from each known road node to other nodes (i.e., the exploration distance) is determined, and then starting from the starting point, the next node with the shortest distance to the current node is selected as the transfer point in sequence until the end point is reached. This process ensures that the path from the starting point to the end point and the order of its transfer points, i.e., the transfer order, are planned based on the shortest path while considering the specific road level.
[0118] See also Fig. 9 , Fig. 9 A method flow chart of a transit sequence exploration method provided in an embodiment of the present application, specifically, in the second target map, the transit sequence of gradually exploring the via points from the starting point to the end point based on the road network of the target road level and the shortest distance exploration principle can be achieved by the following steps:
[0119] B1: sequentially taking known road nodes in the second target map as exploration nodes.
[0120] Known road nodes in the second target map are selected one by one as exploration nodes to execute steps B2-B4.
[0121] B2: When the target road level includes the road level to which the exploration node belongs, the distance from the exploration node to each of the other known road nodes is determined in the second target map; when the target road level does not include the road level to which the exploration node belongs, the road network corresponding to the road level to which the exploration node belongs is expanded in the second target map, and the distance from the exploration node to each of the other known road nodes is determined in the second target map with the road network of the road level to which the exploration node belongs expanded.
[0122] When the target road level includes the road level to which the exploration node belongs: If the target road level already includes the road level to which the current exploration node belongs, the existing road network information can be used directly in the second target map to calculate the distance from the node to all other known road nodes. This means that no additional road network expansion is required, and distance calculation can be performed directly based on the existing road network.
[0123] When the target road level does not include the road level to which the exploration node belongs: If the target road level does not include the road level to which the current exploration node is located, the road level to which the node belongs needs to be expanded in the second target map. This means adding road information that was not originally considered in the target road level. On the expanded map, the distance from the exploration node to all other known road nodes is calculated.
[0124] For example, assuming that the target road level is the first road level and the second road level, the second target map only includes the road network corresponding to the first road level and the road network corresponding to the second road level. If the road level to which the exploration node belongs is the third road level, that is, the target road level does not include the road level to which the exploration node belongs, then the road network corresponding to the third road level is expanded in the second target map, and the distance from the exploration node to each other known road node is determined in the new second target map including the road network corresponding to the first road level, the road network corresponding to the second road level, and the road network corresponding to the third road level.
[0125] Furthermore, there may be multiple different paths from an exploration node to another known road node, each with its own unique length.
[0126] Example 1: For example, there are two highways (highways belong to the roads in the first road level network) from the exploration node to the via point A: Highway 1 and Highway 2, and there are three country roads (country roads belong to the roads in the fifth road level network): Country Road 1, Country Road 2 and Country Road 3. The distance of Highway 1 (i.e. the distance from the exploration node to the via point A) is 70 kilometers, the distance of Highway 2 (i.e. the distance from the exploration node to the via point A) is 75 kilometers, the distance of Country Road 1 (i.e. the distance from the exploration node to the via point A) is 90 kilometers, the distance of Country Road 2 (i.e. the distance from the exploration node to the via point A) is 94 kilometers, and the distance of Country Road 3 (i.e. the distance from the exploration node to the via point A) is 93 kilometers.
[0127] B31: If there is a distance between the exploration node and a known road node, the distance is used as the exploration distance from the exploration node to the known road node.
[0128] If there is only one feasible path from the exploration node to a known road node, then the distance of this path is directly used as the exploration distance between the two nodes. In this case, there is no other choice and the optimal path acquisition process will continue using this unique distance value.
[0129] B32: If there are multiple distances between the exploration node and a known road node, the shortest distance is selected from the multiple distances as the exploration distance from the exploration node to the known road node.
[0130] If there are multiple different paths from the exploration node to the same known road node, each path will have a corresponding distance. It is necessary to select the one with the shortest distance from these possible paths. This shortest distance is considered the exploration distance between the two nodes because it represents the most efficient path from the exploration node to the target node.
[0131] Example 2: Taking Example 1 as an example, there are 5 paths from the exploration node to the via point A in Example 1. These 5 paths correspond to 5 distances of 70 kilometers, 75 kilometers, 90 kilometers, 94 kilometers, and 93 kilometers. Among these 5 distances, 70 kilometers is the shortest. Therefore, 70 kilometers is used as the exploration distance from the exploration node to the via point A.
[0132] B4: Traverse and search for the exploration distance from the exploration node to all the known road nodes.
[0133] Using the method of step B2, B31 or B32, for a given exploration node, calculate the exploration distance from it to all known road nodes, that is, traverse all known road nodes to find out the exploration distances between them and the exploration node.
[0134] B5: Repeat the above steps of determining the distance from the exploration node to other known road nodes and filtering the exploration distance until the exploration distances from all exploration nodes to all other known road nodes are found.
[0135] Repeat steps B1, B2, and B31 or B32 until the distances from all exploration nodes to all other known road nodes are found. In this process, if the distance from a certain exploration node to a certain known road node has been calculated, the distance from the exploration node to the known road node will not be recalculated to avoid repeated calculations, saving time and computing resources. This ensures that the distances from all exploration nodes to known road nodes are found, while avoiding unnecessary repeated calculations and improving computing efficiency.
[0136] In a possible implementation, if there is an exploration node, and the path to the target road node cannot be determined after traversing all roads in the second target map, the straight-line distance between the exploration node and the target road node is calculated. Then, N times the straight-line distance between the exploration node and the target road node is used as the exploration distance between the exploration node and the target road node, where N is a value between 1 and 5.
[0137] For example, suppose there is an exploration node A and the target road node is E. In the second target map, all possible roads are traversed, but it is found that no road can directly or indirectly connect node A and node E. This means that there is no feasible path from A to E in the existing road network.
[0138] In this case, we need to calculate the straight-line distance between node A and node E. Assume that the straight-line distance calculated using some measurement tool (such as the Global Positioning System (GPS)) is 10 kilometers. Next, we need to determine the value of N. N is a number between 1 and 5 that determines how many times the exploration distance should be the straight-line distance. Assume that N=3 is randomly selected. Then, we multiply the straight-line distance by N to get the exploration distance. In this example, the exploration distance would be 10 kilometers * 3 = 30 kilometers.
[0139] B6: Based on the exploration distance, starting from the starting point in the second target map, explore the via point with the smallest exploration distance from the starting point as the transit point of the starting point, and then start from the transit point to query the via point whose exploration distance with the transit point meets the distance requirement as the transit point of the transit point, and continue to query the transit points of each via point until all the transit points are queried and stop, and the order of exploring the transit points is used as the transit order.
[0140] Based on the exploration distance, starting from the starting point in the second target map, find the via point with the smallest exploration distance from the starting point as the transfer point of the starting point. Then, starting from the transfer point, query the via point whose exploration distance with the transfer point meets the distance requirement as the transfer point of the transfer point. Continue to query the transfer points of each via point until the transfer points of all via points are queried, and then use the order of the transfer point query as the transfer order. In other words, this process is the process of gradually determining the transfer points on the map according to the exploration distance until the transfer points of the starting point and all via points are found. In this way, the transfer order between the starting point and the via points can be established.
[0141] For example, suppose there are several nodes (road intersections): A (starting point), B, C, D, E (end point). The exploration distance from A to all other nodes has been calculated as follows:
[0142] Exploration distance from A to B: 5 km;
[0143] Exploration distance from A to C: 10 km;
[0144] Exploration distance from A to D: 15 km;
[0145] Exploration distance from A to E: 20 kilometers.
[0146] First, determine the transit point of the starting point: starting from A, check all available via points (B, C, D, E), and choose the one with the smallest exploration distance as the first transit point. In this example, B is the node with the smallest exploration distance (5 kilometers), so B becomes the first transit point of starting point A.
[0147] Then start from the first transit point to query the next transit point: Now start from B, check all available transit points again, and select the node whose exploration distance with B meets the preset requirements as the transit point of B. Assuming the preset requirement is that the distance is less than or equal to 10 kilometers, the nodes that can be selected are C (the exploration distance from B to C is 6 kilometers) and E (the exploration distance from B to E is 14 kilometers). Since C's distance is shorter and meets the requirements, C becomes B's transit point.
[0148] Then iterate the query until all the passing points are determined as transfer points: Next, starting from C, repeat the above process. Assuming that the exploration distance from C to D is 8 kilometers, and the exploration distance from C to E is 12 kilometers, and these distances meet the preset requirements, then D can become the transfer point of C. Finally, starting from D, it is found that only E meets the preset requirements (the exploration distance from D to E is 7 kilometers), so E becomes the transfer point of D.
[0149] Finally, determine the transfer order: When all the transit points are determined as transfer points, the transfer order is determined according to their exploration order. In this example, the transfer order is A->B->C->D->E.
[0150] S205: Connecting the starting point, the plurality of via points and the end point in sequence according to the transit order obtained by exploration to obtain an initial path.
[0151] Once all the transfer points (i.e., via points) in the path from the starting point to the end point and their transfer order are determined, these points can be connected in sequence to form an initial path.
[0152] S206: Utilizing an annealing algorithm to continuously optimize the initial path based on the nodes in the initial path and the transfer sequence to obtain an optimal path.
[0153] After the initial path is obtained, the annealing algorithm can be used to optimize it.
[0154] The annealing algorithm is a heuristic optimization algorithm. The annealing algorithm is derived from the annealing process of matter. When using the annealing algorithm to optimize the initial path, there is first an initial path, which contains a series of nodes and transfer sequences. The annealing algorithm simulates the movement of particles during the cooling process and gradually adjusts the nodes and transfer sequences in the path to find the state with the lowest energy (i.e., the shortest total path length), thereby determining an optimal path.
[0155] See also Fig.10 , Fig.10A method flow chart of a method for path optimization using an annealing algorithm provided in an embodiment of the present application. Specifically, the annealing algorithm is used to continuously optimize the initial path based on the nodes in the initial path and the transfer sequence, and obtaining the optimal path can be achieved by the following steps:
[0156] C1: Randomly select two known road nodes that meet the preset node interval number in the initial path to exchange positions and obtain an alternative path.
[0157] In the initial path, two known road nodes that meet the preset node interval number are randomly selected and their positions are exchanged to generate a new path, called an alternative path. This step simulates the random movement of atoms during the annealing process.
[0158] In a possible implementation, randomly selecting two known road nodes that meet a preset node interval number in the initial path to exchange positions and obtain an alternative path can be achieved by the following steps:
[0159] First, a known road node in the initial path is randomly selected as the node to be exchanged, and then the target exchange node of the node to be exchanged is randomly searched forward or backward according to the transfer order based on the number of node intervals. Finally, the node to be exchanged and the target exchange node are exchanged to obtain the replaceable path.
[0160] Specifically, to generate an alternative path, the following operations are required:
[0161] Randomly select the node to be exchanged: First, randomly select a known road node from the initial path as the node to be exchanged. This node will become the starting point for trying to change its position to explore a new path.
[0162] Find the target exchange node: Next, with the node to be exchanged as the center, according to the preset number of node intervals, a random search is performed forward or backward in a certain transfer order (which may be the order on the path) to find the target exchange node. This number of node intervals may be a fixed number of steps, or a dynamic value based on some rules. For example, if you decide to search forward, you will start from the node to be exchanged and move along the path until you reach the predetermined number of node intervals. If you decide to search backward, the same operation will be performed in reverse. Regarding the number of node intervals, if the preset number of node intervals is 3, there must be at least 3 other nodes between the node to be exchanged and the target exchange node.
[0163] Position exchange: Once the target exchange node is found, the positions of the node to be exchanged and the target exchange node are exchanged. This means that the order of the two nodes in the initial path will be reversed.
[0164] Get an alternative path: By swapping the positions of these two nodes, a new path, the alternative path, can be obtained. This new path will be used to compare with the initial path to evaluate whether the total length of the path or other optimization objectives have been improved.
[0165] This process simulates the perturbation operation in the annealing algorithm, which is a way for the algorithm to explore the solution space. By randomly exchanging node positions, the algorithm is able to discover new path configurations, which helps avoid falling into local optimal solutions and potentially find better global optimal solutions.
[0166] C2: Calculate the total path lengths of the initial path and the alternative path respectively.
[0167] The total lengths of the initial path and the alternative paths were calculated separately to assess their quality.
[0168] Specifically, first, the distances between all adjacent pairs of nodes on the initial path can be found from the known exploration distances between any two points. This means that for each pair of consecutive nodes on the initial path, the distance between them is found. Then, these distances are accumulated to get the total length of the initial path. Next, the same operation is performed for the alternative path.
[0169] Likewise, since the alternative path is obtained by swapping two nodes in the initial path, the path length is the same as the initial path except for the path segment between the two nodes that were swapped. This means that we only need to focus on the new path segment between the two nodes. We need to find the distance of the new path segment between the two swapped nodes and add it to the length of the rest of the path to get the total length of the alternative path.
[0170] For example, assume that there is an initial path consisting of 5 nodes: A, B, C, D, E. The exploration distance between any two points is known in advance, where A is the starting point, E is the end point, and B, C, and D are all passing points.
[0171] Calculation of the total length of the initial path:
[0172] (1) Find the exploration distances between adjacent pairs of nodes: the exploration distance from A to B is 3, the exploration distance from B to C is 4, the exploration distance from C to D is 5, and the exploration distance from D to E is 6.
[0173] (2) Cumulative distance: The total length of the initial path = 3 + 4 + 5 + 6 = 18.
[0174] Now, suppose that an alternative path is obtained by swapping the positions of two nodes in the initial path, for example, swapping the positions of nodes B and D, and obtaining a new path order of: A, D, C, B, E.
[0175] Calculation of the total length of the replaceable path: (1) Determine the changed part: The two nodes being exchanged are B and D, so the new path segments that need to be paid attention to are A to D and C to B.
[0176] (2) Find the distance of the new path segment: The exploration distance from A to D is 8, and the exploration distance from C to B is 1.
[0177] (3) Cumulative total length: The path lengths of the other parts are the same as the initial path, i.e., the distance from B to C is 4, and the distance from D to E is 6. The total length of the alternative path = 8 + 4 + 1 + 6 = 19.
[0178] C3: Based on the total path length of the initial path and the total path length of the alternative path, determine the target path and obtain the change temperature.
[0179] The total lengths of the initial path and the alternative path are compared, and if the alternative path is better (i.e., the total length is shorter), it is used as the target path.
[0180] In the simulated annealing algorithm, temperature is a control parameter that determines the probability of accepting a poor solution. As the algorithm proceeds, the temperature gradually decreases, reflecting the transition from random search to local search. Every time a new target path is accepted, a temperature reduction is performed. The purpose of temperature reduction is to gradually reduce the probability of accepting a poor solution, so that the algorithm eventually converges to an optimal solution or a near-optimal solution.
[0181] In a possible implementation, the selection of the target path and the adjustment of the temperature can be achieved by the following steps:
[0182] (1) Select the target path:
[0183] If the total length of the initial path is greater than the total length of the alternative path, this means that the alternative path is a better solution (for example, in the traveling salesman problem, a shorter total length means a more efficient travel route). In this case, the alternative path is set as the target path.
[0184] Conversely, if the total length of the initial path is less than or equal to the total length of the alternative path, then the initial path is at least as good as the alternative path, or better, and therefore the initial path is retained as the target path.
[0185] (2) Adjust the temperature:
[0186] In the simulated annealing algorithm, temperature is a control parameter that affects the probability of the algorithm accepting a poor solution. As the algorithm progresses, the temperature is gradually reduced to reduce this probability and guide the algorithm to converge to the optimal solution.
[0187] If the total length of the initial path is greater than the total length of the alternative path, that is, a better solution is found, the initial temperature will be reduced at a slower first cooling rate to obtain the change temperature. This is because a better solution has been found and it shows that the algorithm is moving in the right direction, so the cooling rate can be slightly slowed down to allow more time to explore the solution space.
[0188] If the total length of the initial path is less than or equal to the total length of the alternative path, that is, no better solution is found, the initial temperature will be reduced at a faster second cooling rate to obtain a variable temperature. This is because no improvement may mean that the algorithm is trapped in a local optimal solution, so it is necessary to reduce the temperature faster to increase the probability of accepting a new solution, thereby having a chance to jump out of the local optimal solution.
[0189] In summary, this process determines whether to update the target path by comparing the total length of the two paths, and adjusts the temperature at different rates according to the change in path length. Such a strategy helps to balance the exploration and development capabilities of the algorithm, thereby increasing the possibility of finding the global optimal solution.
[0190] It should be noted that the initial temperature is usually set higher at the beginning so that the algorithm has more room to explore at the beginning. As the temperature decreases, the algorithm gradually becomes more conservative and is more inclined to accept paths that are close to the current optimal solution.
[0191] C41: If the changed temperature is less than the temperature threshold, determining the target path as the optimal path.
[0192] If the current change in temperature (i.e. the lowered temperature) is less than the preset temperature threshold, the current target path is determined to be the optimal path, which means that the algorithm has reached a lower energy state and can stop searching.
[0193] C42: If the change temperature is greater than or equal to the temperature threshold, the target path is reset as the initial path, the change temperature is reset as the initial temperature, and the steps of obtaining alternative paths, calculating the total length of the path, determining the target path, and obtaining the change temperature are repeated until the latest change temperature is less than the temperature threshold, and the latest target path is determined as the optimal path.
[0194] If the change temperature is still greater than or equal to the temperature threshold, reset the current target path to the new initial path, reset the change temperature to the new initial temperature, and then repeat steps C1 to C3 until the latest change temperature is less than the temperature threshold. The purpose of this is to continue exploring the solution space to find a better path.
[0195] Based on the description of S201-S205, an embodiment of the present application provides an efficient path planning method for finding the optimal path among multiple known road nodes. The method first determines a first target map containing a full-level road network, and selects a suitable target road level based on the map area. Next, the road network that is irrelevant to the target road level is hidden to obtain a simplified second target map. In the second target map, the shortest distance principle is adopted to gradually explore the transit sequence of the via points from the starting point to the end point. By means of segmented query, the starting point, via points and end point are connected in sequence to form an initial path. Then, the initial path is further optimized using an annealing algorithm to obtain the optimal path. This method avoids the high computational overhead of global search, and is particularly suitable for situations with a large number of nodes. By simplifying the map and segmented query, the computational complexity is significantly reduced, and the efficiency of obtaining the optimal path in a large-scale road network is improved.
[0196] Based on the method for obtaining an optimal path provided in the above method embodiment, the embodiment of the present application also provides an optimal path obtaining device, which will be described below in conjunction with the accompanying drawings.
[0197] See also Fig.11 As shown, Fig.11 A schematic diagram of an optimal path acquisition device provided in an embodiment of the present application. Fig.11 As shown, the optimal path acquisition device includes:
[0198] The first determining unit 1101 is used to determine a first target map from a full-level road network map according to a plurality of known road nodes; the plurality of known road nodes include a starting point, an end point, and a plurality of via points on a path to be planned; the first target map is an area map covering the starting point, the end point, and the plurality of via points;
[0199] A second determining unit 1102, configured to determine a target road grade of the first target map based on the area of the first target map;
[0200] A road network hiding unit 1103, configured to hide the road network in the first target map that is irrelevant to the target road level, to obtain a second target map;
[0201] An exploration unit 1104 is used to gradually explore the transit sequence of the via points from the starting point to the end point in the second target map based on the road network of the target road level and the shortest distance exploration principle;
[0202] A connection unit 1105, configured to sequentially connect the starting point, the plurality of via points and the end point according to the transfer sequence obtained by exploration to obtain an initial path;
[0203] The third determining unit 1106 is used to continuously optimize the initial path based on the nodes in the initial path and the transfer sequence by using an annealing algorithm to obtain an optimal path.
[0204] In a possible implementation, the third determining unit 1106 specifically includes:
[0205] A first acquisition unit is used to randomly select two known road nodes that meet a preset node interval number in the initial path to exchange positions and acquire an alternative path;
[0206] A total path length calculation unit, used to calculate the total path lengths of the initial path and the replaceable path respectively;
[0207] A first integration unit is used to determine a target path based on the total path length of the initial path and the total path length of the replaceable path, and obtain a change temperature; the change temperature is obtained by reducing the temperature based on the initial temperature, and the temperature is reduced once each time a target path is obtained;
[0208] a fourth determining unit, configured to determine the target path as the optimal path if the changed temperature is less than a temperature threshold;
[0209] The second integrated unit is used to reset the target path as the initial path and the change temperature as the initial temperature if the change temperature is greater than or equal to the temperature threshold, and repeatedly execute the steps of obtaining alternative paths, calculating the total length of the paths, determining the target path and obtaining the change temperature until the latest change temperature is less than the temperature threshold, and determine the latest target path as the optimal path.
[0210] In a possible implementation manner, the first acquiring unit specifically includes:
[0211] A second acquisition unit is used to randomly select a known road node in the initial path as a node to be exchanged;
[0212] A first query unit is used to randomly search for a target switching node of the node to be exchanged forward or backward according to the transit order based on the number of node intervals and the node center;
[0213] The node switching unit is used to exchange the positions of the node to be switched and the target switching node to obtain the replaceable path.
[0214] In a possible implementation, the first integration unit specifically includes:
[0215] a first setting unit, configured to set the alternative path as the target path if the total path length of the initial path is greater than the total path length of the alternative path;
[0216] a second setting unit, configured to set the initial path as the target path if the total path length of the initial path is less than or equal to the total path length of the replaceable path;
[0217] A first temperature reducing unit, for reducing the initial temperature at a first cooling rate to obtain the changed temperature if the total path length of the initial path is greater than the total path length of the replaceable path;
[0218] The second temperature reduction unit is used to reduce the initial temperature to obtain the changed temperature according to a second cooling rate if the total path length of the initial path is less than or equal to the total path length of the replaceable path; the first cooling rate is less than the second cooling rate.
[0219] In a possible implementation, the first determining unit 1101 specifically includes:
[0220] A third acquisition unit is used to acquire the longitude and latitude of each known road node;
[0221] a coordinate determining unit, configured to determine a first coordinate based on a maximum longitude and a maximum latitude among all longitudes and latitudes, and to determine a second coordinate based on a minimum longitude and a minimum latitude among all longitudes and latitudes;
[0222] An initial target map drawing unit is used to select a rectangular map from the full-level road network map using the line between the first coordinate and the second coordinate as a diagonal line, and use the rectangular map as the initial target map; the initial target map is a full-level road network map determined in the full-level road network map that covers a starting point, an end point, and a plurality of via points and has a minimum area;
[0223] The map expansion unit is used to expand the initial target map according to the target expansion area to obtain the first target map.
[0224] In a possible implementation, the exploration unit 1104 specifically includes:
[0225] A third setting unit is used to sequentially use known road nodes in the second target map as exploration nodes;
[0226] a distance determination unit, for determining the distance from the exploration node to each of the other known road nodes in the second target map when the target road level includes the road level to which the exploration node belongs;
[0227] A third integrated unit, when the target road level does not include the road level to which the exploration node belongs, is used to expand the road network corresponding to the road level to which the exploration node belongs in the second target map, and determine the distance from the exploration node to each of the other known road nodes in the second target map in which the road network of the road level to which the exploration node belongs is expanded; there are one or more distances between the exploration node and any one of the known road nodes;
[0228] a fourth setting unit, for, if there is a distance between the exploration node and one of the known road nodes, using the distance as the exploration distance from the exploration node to the known road node;
[0229] a fifth setting unit, for selecting the shortest distance from the multiple distances as the exploration distance from the exploration node to the known road node if there are multiple distances between the exploration node and the known road node;
[0230] A second query unit, used for traversing and searching the exploration distance from the exploration node to all the known road nodes;
[0231] A repeating execution unit, used for repeatedly executing the above steps of determining the distance from the exploration node to each other known road node and screening the exploration distance until the exploration distances from all the exploration nodes to all other known road nodes are found; if the exploration distance from the exploration node to a certain known road node has been searched, the exploration distance from the exploration node to the known road node will not be searched again;
[0232] A transit sequence exploration unit is used to start from the starting point in the second target map based on the exploration distance, explore the via point with the smallest exploration distance from the starting point as the transit point of the starting point, and then start from the transit point to query the via point whose exploration distance with the transit point meets the distance requirement as the transit point of the transit point, continuously query the transit points of each via point until the transit points of all via points are queried and stop, and the order of exploring the transit points is used as the transit sequence.
[0233] In a possible implementation manner, the device further includes:
[0234] a straight-line distance calculation unit, for calculating the straight-line distance between the exploration node and the target road node if there is an exploration node and a path to the target road node cannot be determined after traversing all roads in the second target map;
[0235] The sixth setting unit is used to use N times the straight-line distance between the exploration node and the target road node as the exploration distance between the exploration node and the target road node; N takes a value between 1 and 5.
[0236] In a possible implementation, the road grades include a first road grade, a second road grade, a third road grade, a fourth road grade and a fifth road grade with increasing road network density in sequence;
[0237] The relationship between the area of the first target map, the target road level and the hidden road network includes:
[0238] When the area of the first target map is less than or equal to the first exploration area, it is determined that the target road level of the first target map includes the first road level, the second road level, the third road level, the fourth road level and the fifth road level, and the road network is not hidden;
[0239] When the area of the first target map is greater than the first exploration area and less than or equal to the second exploration area, determining that the road level of the first target map includes the first road level, the second road level, the third road level and the fourth road level, and hiding the road network corresponding to the fifth road level;
[0240] When the area of the first target map is greater than the second exploration area and less than or equal to the third exploration area, determining that the road level of the first target map includes the first road level, the second road level, and the third road level, and hiding the road network corresponding to the fifth road level and the road network corresponding to the fourth road level;
[0241] When the area of the first target map is greater than the third exploration area and less than or equal to the fourth exploration area, determining that the road level of the first target map includes the first road level and the second road level, and hiding the road network corresponding to the fifth road level, the road network corresponding to the fourth road level, and the road network corresponding to the third road level;
[0242] When the area of the first target map is larger than the fourth exploration area, it is determined that the road level of the first target map includes the first road level, and the road network corresponding to the fifth road level, the road network corresponding to the fourth road level, the road network corresponding to the third road level, and the road network corresponding to the second road level are hidden.
[0243] In addition, an embodiment of the present application further provides a processor for running a computer program, and when the program is running, the method for obtaining the optimal path as described above is executed.
[0244] The embodiment of the present application is directed to a known starting point, end point, and multiple via points. First, a first target map containing a road network of all levels is determined. Then, the target road level is determined based on the area of the first target map, and the road network unrelated to the level is hidden to form a second target map. In the second target map, based on the road network of the target road level and the principle of shortest distance, the transit sequence of the via points to reach the end point is gradually explored from the starting point. The starting point, via points, and end point are connected in this order to obtain an initial path. Then, based on the annealing algorithm, the nodes and transit sequence in the initial path are further determined to obtain the optimal path.
[0245] This application uses a segmented query method to construct the initial path, and only queries the passing points that meet the distance requirements as transfer points each time, avoiding the high computational overhead of global search. This application is particularly efficient when there are a large number of nodes. By determining two target maps and hiding irrelevant road networks, the search range is limited to the map of the target road level, significantly reducing the nodes and edges that need to be processed, thereby reducing the computational complexity. Therefore, when processing large-scale road networks, the performance consumption of the algorithm is significantly reduced.
[0246] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0247] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for obtaining an optimal path, characterized in that: The method comprises: Determine a first target map from a full-level road network map according to a plurality of known road nodes; the plurality of known road nodes include a starting point, an end point, and a plurality of via points on the path to be planned; the first target map is an area map covering the starting point, the end point, and the plurality of via points; determining a target road grade of the first target map based on an area of the first target map; Hiding the road network irrelevant to the target road level in the first target map to obtain a second target map; In the second target map, based on the road network of the target road level and the shortest distance exploration principle, the transit sequence of the via points is gradually explored from the starting point to the end point, and the starting point, the plurality of via points and the end point are sequentially connected according to the explored transit sequence to obtain an initial path; The initial path is continuously optimized based on the nodes in the initial path and the transfer sequence using an annealing algorithm to obtain an optimal path.
2. The method according to claim 1, characterized in that The method of obtaining an optimal path based on the nodes in the initial path and the transfer sequence by using an annealing algorithm includes: Randomly select two known road nodes that meet a preset node interval number in the initial path to exchange positions, and obtain an alternative path; Calculating the total path lengths of the initial path and the alternative path respectively; Based on the total path length of the initial path and the total path length of the replaceable path, a target path is determined, and a change temperature is obtained; the change temperature is obtained by reducing the temperature based on the initial temperature, and the temperature is reduced once each time a target path is obtained; If the change temperature is less than the temperature threshold, the target path is determined as the optimal path; if the change temperature is greater than or equal to the temperature threshold, the target path is reset as the initial path, and the change temperature is reset as the initial temperature, and the steps of obtaining an alternative path, calculating the total length of the path, determining the target path, and obtaining the change temperature are repeated until the latest change temperature is less than the temperature threshold, and the latest target path is determined as the optimal path.
3. The method according to claim 2, characterized in that The randomly selecting two known road nodes that meet the preset node interval number in the initial path to exchange positions and obtain an alternative path includes: Randomly select a known road node in the initial path as a node to be exchanged; Taking the node to be exchanged as the center and according to the number of node intervals, randomly searching forward or backward for a target exchange node of the node to be exchanged in accordance with the transfer order; The positions of the node to be exchanged and the target exchange node are exchanged to obtain the replaceable path.
4. The method according to claim 2, characterized in that: The step of determining a target path based on the total path length of the initial path and the total path length of the replaceable path, and obtaining a change temperature, comprises: If the total path length of the initial path is greater than the total path length of the alternative path, the alternative path is set as the target path; if the total path length of the initial path is less than or equal to the total path length of the alternative path, the initial path is set as the target path; If the total path length of the initial path is greater than the total path length of the replaceable path, the initial temperature is reduced according to a first cooling rate to obtain the changed temperature; if the total path length of the initial path is less than or equal to the total path length of the replaceable path, the initial temperature is reduced according to a second cooling rate to obtain the changed temperature; the first cooling rate is less than the second cooling rate.
5. The method according to claim 1, characterized in that The step of determining the first target map from the full-level road network map according to the plurality of known road nodes comprises: Get the longitude and latitude of each known road node; Determine the first coordinate based on the maximum longitude and the maximum latitude among all the longitudes and the latitudes, and determine the second coordinate based on the minimum longitude and the minimum latitude among all the longitudes and the latitudes; According to the first coordinates and the second coordinates, an initial target map is selected from the full-level road network map; the initial target map is a full-level road network map determined in the full-level road network map that covers a starting point, an end point, and a plurality of via points and has a minimum area; The initial target map is expanded according to the target expansion area to obtain the first target map.
6. The method according to claim 1, characterized in that In the second target map, based on the road network of the target road level and the shortest distance exploration principle, the transit sequence of the via points is gradually explored from the starting point to the end point, including: sequentially taking known road nodes in the second target map as exploration nodes; When the target road level includes the road level to which the exploration node belongs, the distance from the exploration node to each of the other known road nodes is determined in the second target map; when the target road level does not include the road level to which the exploration node belongs, the road network corresponding to the road level to which the exploration node belongs is expanded in the second target map, and the distance from the exploration node to each of the other known road nodes is determined in the second target map with the road network of the road level to which the exploration node belongs expanded; there are one or more distances between the exploration node and any one of the known road nodes; If there is one distance between the exploration node and one of the known road nodes, the distance is used as the exploration distance from the exploration node to the known road node; if there are multiple distances between the exploration node and one of the known road nodes, the shortest distance is selected from the multiple distances as the exploration distance from the exploration node to the known road node; Traversing and searching the exploration distance from the exploration node to all the known road nodes; Repeat the above steps of determining the distance from the exploration node to each other known road node and screening the exploration distance until the exploration distances from all exploration nodes to all other known road nodes are found; if the exploration distance from the exploration node to a known road node has been found, the exploration distance from the exploration node to the known road node will not be searched again; Based on the exploration distance, starting from the starting point in the second target map, explore the via point with the smallest exploration distance from the starting point as the transit point of the starting point, and then start from the transit point to query the via point whose exploration distance with the transit point meets the distance requirement as the transit point of the transit point, and continue to query the transit points of each via point until all the transit points are queried and stop, and the order of exploring the transit points is used as the transit order.
7. The method according to claim 6, characterized in that The method further comprises: If there is an exploration node and a path to the target road node cannot be determined after traversing all roads in the second target map, then the straight-line distance between the exploration node and the target road node is calculated; The N times of the straight-line distance between the exploration node and the target road node is used as the exploration distance between the exploration node and the target road node; N is a value between 1 and 5.
8. The method according to any one of claims 1 to 7, characterized in that The road grades include a first road grade, a second road grade, a third road grade, a fourth road grade and a fifth road grade with increasing road network density; The relationship between the area of the first target map, the target road level and the hidden road network includes: When the area of the first target map is less than or equal to the first exploration area, it is determined that the target road level of the first target map includes the first road level, the second road level, the third road level, the fourth road level and the fifth road level, and the road network is not hidden; When the area of the first target map is greater than the first exploration area and less than or equal to the second exploration area, determining that the road level of the first target map includes the first road level, the second road level, the third road level and the fourth road level, and hiding the road network corresponding to the fifth road level; When the area of the first target map is greater than the second exploration area and less than or equal to the third exploration area, determining that the road level of the first target map includes the first road level, the second road level, and the third road level, and hiding the road network corresponding to the fifth road level and the road network corresponding to the fourth road level; When the area of the first target map is greater than the third exploration area and less than or equal to the fourth exploration area, determining that the road level of the first target map includes the first road level and the second road level, and hiding the road network corresponding to the fifth road level, the road network corresponding to the fourth road level, and the road network corresponding to the third road level; When the area of the first target map is larger than the fourth exploration area, it is determined that the road level of the first target map includes the first road level, and the road network corresponding to the fifth road level, the road network corresponding to the fourth road level, the road network corresponding to the third road level, and the road network corresponding to the second road level are hidden.
9. An optimal path acquisition device, characterized in that: The device comprises: A first determination unit is used to determine a first target map from a full-level road network map according to a plurality of known road nodes; the plurality of known road nodes include a starting point, an end point, and a plurality of via points on a path to be planned; the first target map is an area map covering the starting point, the end point, and the plurality of via points; a second determining unit, configured to determine a target road grade of the first target map based on an area of the first target map; A road network hiding unit, used for hiding the road network irrelevant to the target road level in the first target map to obtain a second target map; An exploration unit, configured to gradually explore the transit sequence of the via points from the starting point to the end point in the second target map based on the road network of the target road level and the shortest distance exploration principle; A connecting unit, configured to connect the starting point, the plurality of via points and the end point in sequence according to the transfer sequence obtained by exploration to obtain an initial path; The third determining unit is used to continuously optimize the initial path based on the nodes in the initial path and the transfer sequence by using an annealing algorithm to obtain an optimal path.
10. A processor, characterized in that: Used to run a computer program, which, when running, executes the method for obtaining the optimal path as described in any one of claims 1 to 8.
Citation Information
Cited By
Intelligent escort path planning management method and system based on Internet of Things and big data
CN121352180A
Intelligent escort path planning management method and system based on internet of things and big data
CN121352180B
