Global path optimization method based on maze map
By converting the real map into a maze map and using the maze path optimization algorithm, the problems of large amount of calculation and low efficiency in complex path planning are solved, and more efficient and accurate path planning is achieved.
Patent Information
- Application Number
- CN202411105771.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-13
- Publication Date
- 2024-12-03
AI Technical Summary
Existing path planning algorithms have high computational volume, low efficiency and accuracy when processing complex real maps, especially in urban road construction and complex crossings and obstacles, it is difficult to effectively plan paths.
Preprocess the real map, convert it into a maze map, and use the maze path optimization algorithm to find the shortest path between the starting point and the end point, and finally map the result back to the real map, through binarization processing, marking point extraction and Manhattan distance calculation Simplify path planning by following the steps.
It improves the efficiency and accuracy of complex path planning, transforms problems that depend on human experience into mathematical problems, and achieves more efficient global path optimization.
Smart Images

Figure CN119067277A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of path planning technology, and in particular relates to a global path optimization method based on a maze map. Background Art
[0002] The shortest path problem is the most basic problem in traffic distribution. It refers to the path with the smallest total impedance between a pair of nodes. Almost all traffic flow distribution methods use it as a basic sub-process and call it repeatedly. At present, the complexity of urban road construction (including numerous intersections and alleys) poses a challenge to map-based route planning solutions. On the one hand, real maps include complex routes and numerous obstacles (such as buildings), which requires human experience when planning traffic records; on the other hand, most path planning algorithms can only be applied to simple real maps. For complex real maps (such as intersections, alleys and obstacles, and complex road planning), there are problems such as large amount of calculation, low efficiency and accuracy. Summary of the invention
[0003] In view of this, the purpose of the present application is to provide a global path optimization method based on a maze map, which simplifies complex problems by preprocessing the real map and performing path optimization on the preprocessed maze map, and converts the path planning problem that relies on human experience into a mathematical problem for solving. The more complex the road planning, the higher the efficiency of the global path optimization, and the higher the accuracy of the optimization result.
[0004] The present application provides a global path optimization method based on a maze map, comprising:
[0005] Preprocess the real map to obtain a maze map containing the starting and ending positions of the path to be optimized;
[0006] Using a maze path optimization algorithm, the maze map is subjected to path optimization processing to obtain the shortest path between the starting point and the end point;
[0007] The shortest path is mapped into a real map to obtain an optimal path in the real map.
[0008] Furthermore, the real map is preprocessed to obtain a maze map containing the starting point and end point of the path to be optimized, including:
[0009] Binarize the real map to obtain a simulation map, and mark the intersections and the starting and ending positions of the path to be optimized in the simulation map; wherein the intersections include: T-intersections, crossroads and dead ends;
[0010] Extracting the marking point layer of the simulation map, and connecting the marking points of each intersection according to the road direction of the simulation map to obtain a marking map;
[0011] The marked map is converted into a matrix, and according to the corresponding positions of the marked points in the matrix, a maze map including the starting point and the end point of the path to be optimized is obtained.
[0012] Furthermore, the real map is binarized to obtain a simulated map, including:
[0013] identifying roads and obstacles in the real map;
[0014] The roads are marked in white and the obstacles are marked in black to obtain the simulation map.
[0015] Furthermore, converting the marking map into a matrix includes:
[0016] Representing the marked points in the marked map as number 1, and representing the blanks in the marked map as number 0;
[0017] Convert the label map into a matrix with 1s and 0s as matrix elements.
[0018] Furthermore, obtaining a maze map including the starting point and the end point of the path to be optimized according to the corresponding position of the marked point in the matrix includes:
[0019] For each marking point, based on the position of the marking point in the matrix and the positions of other marking points in the matrix, obtain the Manhattan distance between the marking point and other marking points;
[0020] Obtain the Manhattan distance line of the marked point based on other marked points with the smallest Manhattan distance to the marked point;
[0021] Set all the matrix elements where the Manhattan distance line passes to 0, and set the other matrix elements to 1;
[0022] Based on the matrix after digital flipping, a maze map is drawn in the form of black squares with number 1 and white squares with number 0, and the starting point and end point of the path to be optimized are marked in the maze map.
[0023] Furthermore, the maze map is subjected to path optimization processing by using a maze path optimization algorithm to obtain the shortest path between the starting point and the end point, including:
[0024] Traverse all white areas of the maze map to find all air chambers; wherein the air chambers are white squares;
[0025] For each of the air chambers, record the position of the air chamber in the maze map, as well as the position of the only white square around the air chamber in the maze map, and change the air chamber from a white square to a black square to update the maze map;
[0026] All white areas of the updated maze map are traversed until the maze map displays the shortest path between the starting point and the end point.
[0027] Further, traversing all white areas of the maze map to find all air chambers includes:
[0028] For each white square, if there are only three black squares in the four directions of the white square, namely, the top, bottom, left and right, the white square is considered to be an air chamber.
[0029] Otherwise, it is determined that the white square is not an air chamber.
[0030] The global path optimization method based on the maze map provided in the present application simplifies complex problems by preprocessing the real map and performing path optimization on the preprocessed maze map, and converts the path planning problem that needs to rely on human experience into a mathematical problem for solving. The more complex the road planning, the higher the efficiency of the global path optimization, and the higher the accuracy of the optimization result. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A flowchart of a global path optimization method based on a maze map provided in an embodiment of the present application is shown;
[0032] Figure 2 An example of a simulation map provided by an embodiment of the present application is shown;
[0033] Figure 3 A schematic diagram of a marking point layer of a simulation map provided in an embodiment of the present application is shown;
[0034] Figure 4 An example of a maze map provided by an embodiment of the present application is shown;
[0035] Figure 5 A schematic diagram showing the first and second rounds of searching for an air chamber in a maze provided by an embodiment of the present application is shown;
[0036] Figure 6 A schematic diagram of a maze obtained after all air chambers provided in an embodiment of the present application are filled is shown;
[0037] Figure 7 An example of an updated maze map provided by an embodiment of the present application is shown;
[0038] Figure 8 The shortest path between the starting point and the end point in the maze map provided by the embodiment of the present application is shown;
[0039] Fig. 9 A schematic diagram of the optimal path in a real map provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the technical solution more clear, the technical solution is further described in detail below in conjunction with specific implementation methods. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the technical solution.
[0041] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of a global path optimization method based on a maze map provided in an embodiment of the present application. Figure 1 As shown, the method comprises:
[0042] S101, preprocessing the real map to obtain a maze map including the starting point and end point positions of the path to be optimized.
[0043] In specific implementation, the following steps can be used to obtain a maze map containing the starting and ending positions of the path to be optimized:
[0044] Step 1011: binarize the real map to obtain a simulation map, and mark the intersections and the starting and ending positions of the path to be optimized in the simulation map.
[0045] The intersections include: T-intersections, crossroads and dead ends.
[0046] In this step, first, the real map is binarized, the purpose of which is to distinguish between passable roads and impassable obstacles. The obstacles here are usually buildings. Of course, obstacles can also be other objects that hinder passage, and this application does not make any limitation here.
[0047] In specific implementation, the simulation map can be obtained through the following steps:
[0048] Step 201: Identify roads and obstacles in the real map.
[0049] Step 202: Mark the roads in white and the obstacles in black to obtain the simulation map.
[0050] In this step, different marking colors are used to distinguish the road from the obstacle. Specifically, the road is marked in white and the obstacle is marked in black. Of course, other colors can also be used for marking, and this application does not make any limitation here. Figure 2 , Figure 2 Shown is an example of a simulation map provided in an embodiment of the present application.
[0051] Secondly, mark the intersections in the simulation map and the starting and ending positions of the path to be optimized. Here, the intersections are usually marked in the form of points, and there are many options for marking the starting and ending positions of the path to be optimized, but they must be distinguished from the markings of the intersections to avoid recognition errors in subsequent operations. For example, it can be a directional mark, such as an arrow.
[0052] Step 1012: extract the marking point layer of the simulation map, and connect the marking points of each intersection according to the road direction of the simulation map to obtain a marking map.
[0053] In this step, since the marking of the intersection is performed in a layer outside the simulation map, that is, the simulation map is in one layer and the marking points of the simulation map are in another layer, the marking point layer of the simulation map can be extracted separately. Figure 3 , Figure 3 The diagram shows a marking point layer diagram of a simulation map provided by an embodiment of the present application. According to the road direction of the simulation map, the marking points of each intersection are connected to obtain a marking map, which does not show obstacles in the real map, but only uses connecting lines to indicate the passable roads, so as to simplify the complex real map into a combination of points and lines, and can more intuitively display the passable roads.
[0054] Step 1013: convert the marked map into a matrix, and obtain a maze map including the starting point and end point positions of the path to be optimized according to the corresponding positions of the marked points in the matrix.
[0055] In specific implementation, the marking map can be converted into a matrix by the following steps:
[0056] Step 301: Represent the marked points in the marked map as number 1, and represent the blank spaces in the marked map as number 0.
[0057] In this step, the number 1 is used to represent the marked points in the marked map, that is, each intersection, and the number 0 is used to represent the blank position in the marked map. Here, the reason for only converting the marked points into numbers but not the connecting lines into numbers is that the positions of the marked points will not change with the conversion of the representation form, that is, the positions of the marked points in the marked map and in the matrix are one-to-one corresponding, while the connecting lines between the two points can contain multiple forms and are not one-to-one corresponding; in addition, according to the construction principle of the matrix, the connecting lines of each point in the matrix should be parallel to the four sides of the matrix, and the connecting lines in the marked map obtained based on the real map cannot meet this requirement.
[0058] Step 302: Convert the marking map into a matrix using 1 and 0 as matrix elements.
[0059] In this step, the starting point of the path to be optimized in the marked map is stacked to the end point in order to obtain the position of each marked point in the matrix. Here, the marked map represented by irregular connecting lines is converted into a mathematical matrix with a regular shape represented by numbers, thereby converting a complex road planning problem into a mathematical problem.
[0060] In specific implementation, the maze map including the starting point and end point of the path to be optimized can be obtained through the following steps:
[0061] Step 401: For each marker point, based on the position of the marker point in the matrix and the positions of other marker points in the matrix, obtain the Manhattan distance between the marker point and other marker points.
[0062] In this step, Manhattan distance is a geometric term used in geometric metric space to indicate the sum of the absolute wheelbases of two points in the standard coordinate system, that is, the distance between the two points in the north-south direction plus the distance between the two points in the east-west direction. Since the position of the marked point in the matrix is equivalent to the coordinate position in the coordinate system, for each marked point, the Manhattan distance of the marked point to other marked points can be calculated by using the position of the marked point in the matrix and the positions of other marked points in the matrix.
[0063] Step 402: Obtain the Manhattan distance line of the marked point based on other marked points that have the smallest Manhattan distance to the marked point.
[0064] In this step, since there are many Manhattan distances between the marker point and other marker points, and the two nearest marker points can be connected to form a road, it is necessary to find the marker point with the smallest Manhattan distance to determine the marker point closest to the marker point from many other marker points, and based on the determined marker point closest to the marker point, obtain the Manhattan distance line of the marker point, that is, construct the distance line between the marker point and the nearest marker point in the north-south direction and the distance line in the east-west direction; then, the Manhattan distance lines of each marker point are parallel or perpendicular to each other.
[0065] Step 403: Set the matrix elements where all Manhattan distance lines pass to 0, and set the other matrix elements to 1.
[0066] In this step, the location where the Manhattan distance line passes is the passable road. Therefore, the matrix elements of all the locations where the Manhattan distance line passes are set to the same number 0, and the other matrix elements are set to the number 1. That is, the passable roads and impassable obstacles can be distinguished in the matrix. At this point, all the marked points and connecting lines in the marked map are converted into matrices.
[0067] Step 404: based on the digitally flipped matrix, a maze map is drawn in the form of black squares with number 1 and white squares with number 0, and the starting point and the end point of the path to be optimized are marked in the maze map.
[0068] In this step, the number 0 represents a passable road, and the number 1 represents an impassable obstacle. When drawing a maze map, since it is easier to show a white path against a black background, the embodiment of the present application uses white squares to draw the area represented by the number 0, and uses black squares to draw the area represented by the number 1, so as to obtain a maze map. Of course, other color combinations can also be used to draw a maze map, and the present application does not make any limitation on this. Furthermore, according to the starting and ending positions of the path to be optimized in the marked map, the starting and ending positions of the path to be optimized are marked in the drawn maze map. Here, please refer to Figure 4 , Figure 4 Shown is an example of a maze map provided in an embodiment of the present application.
[0069] Next, we will combine Figure 5 and Figure 6 This paper introduces the maze path optimization algorithm. This method uses the physical principle that air in a closed space repels water to process the maze. Specifically:
[0070] Suppose there is a sealed maze with only one entrance and one or more exits. The maze is filled with gas, and then the entrance is quickly flooded with water. Due to the effect of the gas, the gas in some maze dead ends will squeeze out the water, causing the water to flow along the maze path to the exit. The algorithm enhances the display of navigable paths in the maze by finding all the inaccessible "air chambers" and forming an air area (i.e., an inaccessible area).
[0071] Based on the above idea, the present application embodiment proposes a maze path optimization algorithm. First, a maze consisting of black and white squares is defined, wherein black squares represent impassable paths and white squares represent passable paths.
[0072] Next, execute the maze path optimization algorithm: Step 1, traverse all white areas of the maze to find all air chambers; the air chamber is a white square. Further, the method to determine whether a white area is an air chamber is: there are only three black squares in the four directions of the white square: the top, bottom, left, and right. Figure 5 , Figure 5 Shown are schematic diagrams of the first and second rounds of searching for an air chamber in a maze provided by an embodiment of the present application, wherein the left side is a schematic diagram of the first round of searching for an air chamber in a maze.
[0073] The second step is that since the air chamber is generally developed on the position of the previous air chamber, after finding the air chamber, it is necessary to record the position of the air chamber in the maze and the position of the only white square around the air chamber, and change the air chamber from white square to black square to fill the air chamber and update the maze.
[0074] Step 3: Use the same method as the first step to determine the air chamber, and traverse the updated maze in each round to find all the air chambers that meet the conditions until the accessible paths in the maze are displayed. Figure 5 and Figure 6 , Figure 5 On the right is a schematic diagram of the second round of searching for the air chamber in the maze. Figure 6 Shown is a schematic diagram of a maze obtained after all the air chambers provided in the embodiment of the present application are filled.
[0075] The above-mentioned maze path optimization algorithm is applied to the global path optimization method of the embodiment of the present application, that is, the following steps are performed:
[0076] S102: Utilize a maze path optimization algorithm to perform path optimization processing on the maze map to obtain the shortest path between the starting point and the end point.
[0077] In specific implementation, the shortest path between the starting point and the end point can be obtained by the following steps:
[0078] Step 501, traverse all white areas of the maze map to find all air chambers; wherein the air chambers are white squares.
[0079] In specific implementation, all air chambers are found by the following method:
[0080] For each white square, when there are only three black squares in the four directions of the white square, namely, the top, bottom, left and right, the white square is determined to be an air chamber; otherwise, the white square is determined not to be an air chamber.
[0081] Step 502: for each of the air chambers, record the position of the air chamber in the maze map, as well as the position of the only white square around the air chamber in the maze map, and change the air chamber from a white square to a black square to update the maze map.
[0082] As an example, see Figure 7 , Figure 7 Shown is an example of an updated maze map provided by an embodiment of the present application.
[0083] Step 503: traverse all white areas of the updated maze map until the maze map displays the shortest path between the starting point and the end point.
[0084] As an example, see Figure 8 , Figure 8 The figure shows the shortest path between the starting point and the end point in the maze map provided in the embodiment of the present application.
[0085] S103: Map the shortest path to a real map to obtain an optimal path in the real map.
[0086] As an example, see Fig. 9 , Fig. 9 Shown is a schematic diagram of the optimal path in a real map provided in an embodiment of the present application.
[0087] The above contents are only preferred embodiments of the present invention. For ordinary technicians in this field, many changes can be made in the specific implementation methods and application scopes based on the ideas of the technical content. As long as these changes do not deviate from the concept of the present invention, they all fall within the scope of protection of this patent.
Claims
1. A global path optimization method based on a maze map, characterized in that: The method comprises: Preprocess the real map to obtain a maze map containing the starting and ending positions of the path to be optimized; Using a maze path optimization algorithm, the maze map is subjected to path optimization processing to obtain the shortest path between the starting point and the end point; The shortest path is mapped into a real map to obtain an optimal path in the real map.
2. The method according to claim 1, characterized in that The real map is preprocessed to obtain a maze map containing the starting point and end point of the path to be optimized, including: Binarize the real map to obtain a simulation map, and mark the intersections and the starting and ending positions of the path to be optimized in the simulation map; wherein the intersections include: T-intersections, crossroads and dead ends; Extracting the marking point layer of the simulation map, and connecting the marking points of each intersection according to the road direction of the simulation map to obtain a marking map; The marked map is converted into a matrix, and according to the corresponding positions of the marked points in the matrix, a maze map including the starting point and the end point of the path to be optimized is obtained.
3. The method according to claim 2, characterized in that The process of binarizing the real map to obtain the simulated map includes: identifying roads and obstacles in the real map; The roads are marked in white and the obstacles are marked in black to obtain the simulation map.
4. The method according to claim 2, characterized in that The converting the label map into a matrix comprises: Representing the marked points in the marked map as number 1, and representing the blanks in the marked map as number 0; Convert the label map into a matrix with 1s and 0s as matrix elements.
5. The method according to claim 4, characterized in that The step of obtaining a maze map including the starting point and the end point of the path to be optimized according to the corresponding positions of the marked points in the matrix includes: For each marker point, based on the position of the marker point in the matrix and the positions of other marker points in the matrix, obtain the Manhattan distance between the marker point and other marker points; Obtain the Manhattan distance line of the marked point based on other marked points with the smallest Manhattan distance to the marked point; Set all the matrix elements where the Manhattan distance line passes to 0, and set the other matrix elements to 1; Based on the matrix after digital flipping, a maze map is drawn in the form of black squares with number 1 and white squares with number 0, and the starting point and end point of the path to be optimized are marked in the maze map.
6. The method according to claim 5, characterized in that The maze map is subjected to path optimization processing by using a maze path optimization algorithm to obtain the shortest path between the starting point and the end point, including: Traverse all white areas of the maze map to find all air chambers; wherein the air chambers are white squares; For each of the air chambers, record the position of the air chamber in the maze map, as well as the position of the only white square around the air chamber in the maze map, and change the air chamber from a white square to a black square to update the maze map; All white areas of the updated maze map are traversed until the maze map displays the shortest path between the starting point and the end point.
7. The method according to claim 6, characterized in that The described traverses all white areas of the maze map to find all air chambers, including: For each white square, if there are only three black squares in the four directions of the white square, namely, the top, bottom, left and right, the white square is considered to be an air chamber. Otherwise, it is determined that the white square is not an air chamber.
