CN113532458A - Path searching method based on AStar algorithm - Google Patents

Path searching method based on AStar algorithm Download PDF

Info

Publication number
CN113532458A
CN113532458A CN202110698514.9A CN202110698514A CN113532458A CN 113532458 A CN113532458 A CN 113532458A CN 202110698514 A CN202110698514 A CN 202110698514A CN 113532458 A CN113532458 A CN 113532458A
Authority
CN
China
Prior art keywords
path
map
nodes
node
wall
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110698514.9A
Other languages
Chinese (zh)
Inventor
姚俊峰
洪湘
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen University
Original Assignee
Xiamen University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen University filed Critical Xiamen University
Priority to CN202110698514.9A priority Critical patent/CN113532458A/en
Publication of CN113532458A publication Critical patent/CN113532458A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01CMEASURING DISTANCES, LEVELS OR BEARINGS; SURVEYING; NAVIGATION; GYROSCOPIC INSTRUMENTS; PHOTOGRAMMETRY OR VIDEOGRAMMETRY
    • G01C21/00Navigation; Navigational instruments not provided for in groups G01C1/00 - G01C19/00
    • G01C21/26Navigation; Navigational instruments not provided for in groups G01C1/00 - G01C19/00 specially adapted for navigation in a road network
    • G01C21/34Route searching; Route guidance
    • G01C21/3446Details of route searching algorithms, e.g. Dijkstra, A*, arc-flags, using precalculated routes

Landscapes

  • Engineering & Computer Science (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Automation & Control Theory (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Traffic Control Systems (AREA)

Abstract

The invention provides a path searching method based on an AStar algorithm in the technical field of map path planning, which comprises the following steps: s10, randomly planning a path by using a Prime algorithm, and generating a maze scene based on the path; step S20, converting the maze scene into a Grid map; step S30, searching dead roads in the Grid map and eliminating the dead roads; step S40, searching adjacent points of each map node in the Grid map; step S50, calculating f (n) values of the adjacent points, and sorting the adjacent points based on the f (n) values; step S60, storing each sequenced adjacent point to an Open list based on a small stub algorithm; step S70, performing path search based on each adjacent point stored in the Open list by using an AStar algorithm. The invention has the advantages that: the efficiency of path search has greatly been promoted.

Description

Path searching method based on AStar algorithm
Technical Field
The invention relates to the technical field of map path planning, in particular to a path searching method based on an AStar algorithm.
Background
The path search is to search out a path which can reach a destination in a set scene, and is widely applied to scenes such as automatic driving, maze route finding and the like. The path search generally adopts an AStar algorithm (heuristic search algorithm), but taking a maze path-finding scene as an example, the traditional AStar algorithm has the following disadvantages:
1. when the adjacent point of the current node is searched, nodes in 8 directions (8 × 45 °) around the node are required to be searched every time, and when the distance between the starting node and the target node is longer and the number of walls is larger, the number of nodes required to be searched is larger, so that the searching efficiency is low; 2. each time, a node with the minimum value of f (n) is required to be selected as a next searching node, an Open list is required to be traversed repeatedly, a large amount of generated but not-yet-accessed node information is stored in the Open list, and the repeated traversal causes that the efficiency of selecting the minimum value of f (n) is not high; wherein, (n) represents an evaluation function of the node n, (f) (n) g (n) + h (n), g (n) represents an actual cost from the initial node to the n node in the state space, and h (n) represents an estimated cost of the best path from the node n to the target node; 3. a lot of dead roads exist in a maze path-finding scene, so that the AStar algorithm is easy to move to the dead roads in the path-finding process, and a large number of redundant nodes are traversed.
Therefore, how to provide a path search method based on the AStar algorithm to improve the efficiency of path search becomes a problem to be solved urgently.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a path searching method based on an AStar algorithm, so that the efficiency of path searching is improved.
The invention is realized by the following steps: a path searching method based on an AStar algorithm comprises the following steps:
s10, randomly planning a path by using a Prime algorithm, and generating a maze scene based on the path;
step S20, converting the maze scene into a Grid map;
step S30, searching dead roads in the Grid map and eliminating the dead roads;
step S40, searching adjacent points of each map node in the Grid map;
step S50, calculating f (n) values of the adjacent points, and sorting the adjacent points based on the f (n) values;
step S60, storing each sequenced adjacent point to an Open list based on a small stub algorithm;
step S70, performing path search based on each adjacent point stored in the Open list by using an AStar algorithm.
Further, the step S10 specifically includes:
s11, randomly planning a path by using a Prime algorithm, wherein the path consists of a plurality of square path nodes;
s12, sequentially and randomly selecting one path node to be added into a wall queue;
step S13, judging whether only 3 path nodes exist in the upper, lower, left and right directions adjacent to the path nodes in the wall queue, if so, adding the 3 path nodes into the wall queue; if not, deleting the path nodes in the wall queue;
and step S14, initializing the path nodes in the wall queue into a wall, and generating a maze scene.
Further, in step S10, the path has a start path node and a target path node.
Further, the step S20 is specifically:
and equally dividing the maze scene into equal-size squares based on the size of the path nodes to obtain a plurality of map nodes, and setting the wall attribute of each map node based on the maze scene to complete the conversion of the Grid map.
Further, the wall attribute is used for identifying whether the map node is a wall.
Further, the step S30 is specifically:
sequentially judging each map node in the Grid map, if 3 adjacent map nodes are walls, if so, indicating that the map nodes are dead roads, setting the map nodes as the walls, and entering step S40; if not, the explanation is not a dead link, and the flow proceeds to step S40.
Further, the step S40 is specifically:
and searching the adjacent points of each map node in the Grid map based on four directions, namely the upper direction, the lower direction, the left direction and the right direction.
The invention has the advantages that:
when the adjacent points of each map node in the Grid map are searched, only the upper direction, the lower direction, the left direction and the right direction are searched, and compared with the traditional method of searching 8 directions, the nodes needing to be searched are greatly reduced; storing the adjacent points to an Open list through a small stub algorithm, wherein the adjacent point on the top of the stub is the adjacent point with the minimum value of f (n), and the Open list does not need to be traversed repeatedly; by searching dead roads in the Grid map and setting map nodes corresponding to the dead roads as walls, the phenomenon that the AStar algorithm walks to the dead roads in the road searching process to traverse redundant map nodes is avoided, and finally the efficiency of path searching is greatly improved.
Drawings
The invention will be further described with reference to the following examples with reference to the accompanying drawings.
Fig. 1 is a flowchart of a path searching method based on the AStar algorithm according to the present invention.
Detailed Description
The technical scheme in the embodiment of the application has the following general idea: simplifying the search direction of each map node adjacent point in the Grid map; storing the adjacent points to an Open list through a small stub algorithm, wherein the adjacent point on the top of the stub is the adjacent point with the minimum value of f (n), and the Open list does not need to be traversed repeatedly; and searching and eliminating dead roads in the Grid map so as to improve the efficiency of path search.
Referring to fig. 1, a preferred embodiment of a path searching method based on the AStar algorithm of the present invention includes the following steps:
step S10, randomly planning a path by using a Prime Algorithm (random Prime' S Algorithm Algorithm), and generating a maze scene based on the path;
step S20, converting the maze scene into a Grid map;
step S30, searching dead roads in the Grid map and eliminating the dead roads;
step S40, searching adjacent points of each map node in the Grid map;
step S50, calculating f (n) values of the adjacent points, and sorting the adjacent points based on the f (n) values;
step S60, storing each sequenced adjacent point to an Open list based on a small stub algorithm; optimizing the storage structure of the Open list by using a small stub algorithm;
a binary heap is a heap implemented with a complete binary tree, and a small root heap is a binary heap where the values of non-terminal nodes are less than or equal to the values of its left and right children. In the Open list, each time the adjacent point with the minimum value of f (n) is expected to be found, the Open list is stored by using a small stub, and the top element of the stub is the adjacent point with the minimum value of f (n).
When adding the adjacent point into the Open list, firstly inserting the adjacent point into the last position of the binary tree, then sequencing upwards, searching the father node, and if the f (n) value of the current adjacent point is smaller than that of the father node, exchanging with the father node until the insertion is completed. And when the f (n) value of the subnode is smaller, the adjacent point is exchanged with the subnode.
Step S70, performing path search based on each adjacent point stored in the Open list by using an AStar algorithm.
The step S10 specifically includes:
s11, randomly planning a path by using a Prime algorithm, wherein the path consists of a plurality of square path nodes;
s12, sequentially and randomly selecting one path node to be added into a wall queue;
step S13, judging whether only 3 path nodes exist in the upper, lower, left and right directions adjacent to the path nodes in the wall queue, if so, adding the 3 path nodes into the wall queue; if not, deleting the path nodes in the wall queue;
and step S14, initializing the path nodes in the wall queue into a wall, and generating a maze scene.
In step S10, the path has a start path node and a target path node.
The step S20 specifically includes:
and equally dividing the maze scene into equal-size squares based on the size of the path nodes to obtain a plurality of map nodes, and setting the wall attribute of each map node based on the maze scene to complete the conversion of the Grid map. In specific implementation, all the map nodes can be stored by using the CellQueue queue, and the searched map nodes can be stored by using the CellList. The Grid map comprises a starting map node and a target map node.
The wall attribute is used for identifying whether the map node is a wall or not; if the wall attribute is not identified as a wall, the corresponding map node is a road; only one of the adjacent points in the upper, lower, left and right directions of the road is the road.
The step S30 specifically includes:
sequentially judging each map node in the Grid map, if 3 adjacent map nodes are walls, if so, indicating that the map nodes are dead roads, setting the map nodes as the walls, and entering step S40; if not, the explanation is not a dead link, and the flow proceeds to step S40.
The step S40 specifically includes:
searching adjacent points of each map node in the Grid map based on four directions, namely an upper direction, a lower direction, a left direction and a right direction; by simplifying the searching direction, the map nodes needing to be searched are greatly reduced, and the efficiency of path searching is further improved.
The pseudo code of the improved AStar algorithm is as follows:
initializing a Grid map according to a maze scene, and storing wall attributes into the Grid map;
setting a starting map node and a target map node of the Grid map;
optimizing a search area, and setting dead roads in the Grid map as walls;
initializing a small root heap openSet according to the size of the Grid map;
initializing a hash list closSet;
adding the starting map node into openSet;
Figure BDA0003129484560000051
Figure BDA0003129484560000061
in summary, the invention has the advantages that:
when the adjacent points of each map node in the Grid map are searched, only the upper direction, the lower direction, the left direction and the right direction are searched, and compared with the traditional method of searching 8 directions, the nodes needing to be searched are greatly reduced; storing the adjacent points to an Open list through a small stub algorithm, wherein the adjacent point on the top of the stub is the adjacent point with the minimum value of f (n), and the Open list does not need to be traversed repeatedly; by searching dead roads in the Grid map and setting map nodes corresponding to the dead roads as walls, the phenomenon that the AStar algorithm walks to the dead roads in the road searching process to traverse redundant map nodes is avoided, and finally the efficiency of path searching is greatly improved.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.

Claims (7)

1. A path search method based on an AStar algorithm is characterized in that: the method comprises the following steps:
s10, randomly planning a path by using a Prime algorithm, and generating a maze scene based on the path;
step S20, converting the maze scene into a Grid map;
step S30, searching dead roads in the Grid map and eliminating the dead roads;
step S40, searching adjacent points of each map node in the Grid map;
step S50, calculating f (n) values of the adjacent points, and sorting the adjacent points based on the f (n) values;
step S60, storing each sequenced adjacent point to an Open list based on a small stub algorithm;
step S70, performing path search based on each adjacent point stored in the Open list by using an AStar algorithm.
2. The method of claim 1, wherein the method comprises: the step S10 specifically includes:
s11, randomly planning a path by using a Prime algorithm, wherein the path consists of a plurality of square path nodes;
s12, sequentially and randomly selecting one path node to be added into a wall queue;
step S13, judging whether only 3 path nodes exist in the upper, lower, left and right directions adjacent to the path nodes in the wall queue, if so, adding the 3 path nodes into the wall queue; if not, deleting the path nodes in the wall queue;
and step S14, initializing the path nodes in the wall queue into a wall, and generating a maze scene.
3. The method of claim 1, wherein the method comprises: in step S10, the path has a start path node and a target path node.
4. The method of claim 2, wherein the method comprises: the step S20 specifically includes:
and equally dividing the maze scene into equal-size squares based on the size of the path nodes to obtain a plurality of map nodes, and setting the wall attribute of each map node based on the maze scene to complete the conversion of the Grid map.
5. The method of claim 4, wherein the method comprises: the wall attribute is used for identifying whether the map node is a wall or not.
6. The method of claim 1, wherein the method comprises: the step S30 specifically includes:
sequentially judging each map node in the Grid map, if 3 adjacent map nodes are walls, if so, indicating that the map nodes are dead roads, setting the map nodes as the walls, and entering step S40; if not, the explanation is not a dead link, and the flow proceeds to step S40.
7. The method of claim 1, wherein the method comprises: the step S40 specifically includes:
and searching the adjacent points of each map node in the Grid map based on four directions, namely the upper direction, the lower direction, the left direction and the right direction.
CN202110698514.9A 2021-06-23 2021-06-23 Path searching method based on AStar algorithm Pending CN113532458A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110698514.9A CN113532458A (en) 2021-06-23 2021-06-23 Path searching method based on AStar algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110698514.9A CN113532458A (en) 2021-06-23 2021-06-23 Path searching method based on AStar algorithm

Publications (1)

Publication Number Publication Date
CN113532458A true CN113532458A (en) 2021-10-22

Family

ID=78096504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110698514.9A Pending CN113532458A (en) 2021-06-23 2021-06-23 Path searching method based on AStar algorithm

Country Status (1)

Country Link
CN (1) CN113532458A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116705679A (en) * 2023-03-27 2023-09-05 合肥新晶集成电路有限公司 Conveying path planning method, planning system, crown block conveying method and conveying system
CN116764225A (en) * 2023-06-09 2023-09-19 广州三七极梦网络技术有限公司 Efficient path-finding processing method, device, equipment and medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017173990A1 (en) * 2016-04-07 2017-10-12 北京进化者机器人科技有限公司 Method for planning shortest path in robot obstacle avoidance
CN108444488A (en) * 2018-02-05 2018-08-24 天津大学 Based on etc. steps sample A* algorithms unmanned local paths planning method
CN110487295A (en) * 2019-09-06 2019-11-22 中国计量大学 A kind of time-optimized smooth A* algorithm
CN112327856A (en) * 2020-11-13 2021-02-05 云南电网有限责任公司保山供电局 Robot path planning method based on improved A-star algorithm

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017173990A1 (en) * 2016-04-07 2017-10-12 北京进化者机器人科技有限公司 Method for planning shortest path in robot obstacle avoidance
CN108444488A (en) * 2018-02-05 2018-08-24 天津大学 Based on etc. steps sample A* algorithms unmanned local paths planning method
CN110487295A (en) * 2019-09-06 2019-11-22 中国计量大学 A kind of time-optimized smooth A* algorithm
CN112327856A (en) * 2020-11-13 2021-02-05 云南电网有限责任公司保山供电局 Robot path planning method based on improved A-star algorithm

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JEONG K, LEE J, KIM J.: "A Study on New Virtual Reality System in Maze Terrain", INTERNATIONAL JOURNAL OF HUMAN–COMPUTER INTERACTION, vol. 34, no. 2, 11 April 2018 (2018-04-11), pages 129 - 145 *
杨正宏: "数据结构", 30 June 2001, 中国铁路出版社, pages: 71 - 75 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116705679A (en) * 2023-03-27 2023-09-05 合肥新晶集成电路有限公司 Conveying path planning method, planning system, crown block conveying method and conveying system
CN116705679B (en) * 2023-03-27 2023-11-07 合肥新晶集成电路有限公司 Conveying path planning method, planning system, crown block conveying method and conveying system
CN116764225A (en) * 2023-06-09 2023-09-19 广州三七极梦网络技术有限公司 Efficient path-finding processing method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN113532458A (en) Path searching method based on AStar algorithm
CN113467456B (en) Path planning method for specific target search under unknown environment
JP7156385B2 (en) Method, apparatus and system for determining reachable paths between two nodes
CN107644070B (en) Data indexing method, data query method and electronic equipment
CN111814664B (en) Method, device, computer equipment and storage medium for identifying labels in drawing
CN110909961B (en) BIM-based indoor path query method and device
CN106557574B (en) Target address matching method and system based on tree structure
CN107121146A (en) Optimum path planning method based on road chain depth
Efentakis et al. SALT. A unified framework for all shortest-path query variants on road networks
CN111104471B (en) Mode database information compression method and system based on jumping point path search
CN108446357A (en) A kind of mass data spatial dimension querying method based on two-dimentional geographical location
CN115167474A (en) Mobile robot path planning optimization method
CN112150610A (en) Retaining wall modeling method and system based on dimension marking
CN114485611B (en) Three-dimensional space shortest path planning method and device based on Beidou grid codes
CN104866903A (en) Most beautiful path navigation algorithm based on genetic algorithm
CN115562273A (en) Mobile robot path planning method and system based on hybrid improved ant colony algorithm
CN114491200A (en) Method and device for matching heterogeneous interest points based on graph neural network
Xu et al. An efficient algorithm for environmental coverage with multiple robots
CN112269848A (en) Crowdsourcing trajectory data fusion method and device
WO2016107439A1 (en) Road data storage method and device
CN110765073A (en) File management method, medium, device and apparatus for distributed storage system
KR100859710B1 (en) The method for searching, saving, deleting data using of data structures, SKIP CLOUDS
CN111985366B (en) Method and device for identifying road center line and pile number
CN112148030A (en) Underwater glider path planning method based on heuristic algorithm
CN114674336A (en) Path planning method based on line segments

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination