CN103971008A - Improved heuristic A * algorithm - Google Patents

Improved heuristic A * algorithm Download PDF

Info

Publication number
CN103971008A
CN103971008A CN201410210514.XA CN201410210514A CN103971008A CN 103971008 A CN103971008 A CN 103971008A CN 201410210514 A CN201410210514 A CN 201410210514A CN 103971008 A CN103971008 A CN 103971008A
Authority
CN
China
Prior art keywords
algorithm
node
improved
labyrinth
evaluation function
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
CN201410210514.XA
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.)
Inspur Electronic Information Industry Co Ltd
Original Assignee
Inspur Electronic Information Industry Co Ltd
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 Inspur Electronic Information Industry Co Ltd filed Critical Inspur Electronic Information Industry Co Ltd
Priority to CN201410210514.XA priority Critical patent/CN103971008A/en
Publication of CN103971008A publication Critical patent/CN103971008A/en
Pending legal-status Critical Current

Links

Landscapes

  • Processing Or Creating Images (AREA)

Abstract

The invention provides an improved heuristic A * algorithm. The optimized number of the directions of search motion is four, the block distance is used as an evaluation function, the speed of calculation is increased, and simplicity of calculation is improved. A sort algorithm in an OPEN table is improved, and the advantage that the overall performance is improved by sacrificing partial performance is achieved. In addition, by using the improved evaluation function, in order to meet the requirement for monotonicity, although the data structure of a chain table cannot be completely abandoned, but because the OPEN table and a CLOSED table do not need to be modified, a two-dimensional array can be used for carrying out marking so that the heuristic A * algorithm can query whether a node has been extended for use or not, and speed performance can be remarkably increased.

Description

Improved heuristic A * algorithm
Technical field
The present invention relates to NPC(Non-Player Character in computer game) intellectuality and the auxiliary computing power of behavior, be specifically related to a kind of improved heuristic A * algorithm, in game, big map automatic seeking footpath and search are calculated the even design of three-dimensional map of two dimension.
Background technology
Along with the development of computer hardware technique, computer game industry development, audient crowd sharply increases, and has just like become the centre sphere of computer technology application.Meanwhile, people are to NPC(Non-Player Character in game) the intelligent degree of behavior and auxiliary computing power wherein proposed increasing requirement.And wherein, due to the area of map is large and environment in the reason such as influence factor, it is often unsatisfactory that Game Map Seeking Route problem solves.
Meanwhile, search is also a basic problem of artificial intelligence, is reasoning inalienable part.A* algorithm is a kind of typical heuristic search algorithm, is at home and abroad all widely applied to and in game, solves Game Map Seeking Route problem.But traditional A* algorithm application is in the time of particular problem, conventionally due to the restriction of problem etc., need to improve and optimize.
A series of deficiencies in view of traditional A* algorithm:
1) space requirement is too large, and OPEN and CLOSED table is can be along with the expansion of search volume increasing until can not meeting spatial demand, and can greatly extend search time;
2) when problem do not exist separate time, A* algorithm can be exhaustive likely;
3), for the A* algorithm that does not meet monotonicity, having entered state node in CLOSED table may repeatedly be shifted out.
Since A* algorithm is suggested, its succinct effectively characteristic has attracted numerous researchers' interest, and traditional A* algorithm can be thought pervasive, just seem that for the solution of particular problem some is not all roses, therefore proposed the scheme of a lot of improvement algorithms for A* algorithm different aspect and in the face of particular problem people.
Summary of the invention
The improvement strategy of the present invention to traditional A* algorithm, and proved theoretically the improved superiority of do.In order to utilize better the characteristic of maze problem itself, the present invention has done following improvement to A* algorithm.
(1) only allow the motion of four basic orientation, up and down.As indicated in table 3.1, for eight, to for motion, except final path can be owing to allowing oblique movement have natural minimizing, performance can not obtain any raising, even may bring the reduction of performance.And the minimizing of this path is also can be in the end carry out to four-way path that simple process is approximate to be obtained---this needs path of traversal.And, only use four basic orientation, be conducive to improvement after this.
Table 1 eight to the performance comparison of four-way motion
(2) adopt city block distance as evaluation function.Because do not allow oblique movement, so Euclidean distance is just no longer on probation, and city block distance calculates more easy, and speed is faster.And obvious evaluation function now meets monotonicity.
(3) node in OPEN table is first carried out to ascending sort by size, while equating, by ascending sort.Although this has certain performance loss, can not cover the advantage that whole improvement forms.
(4) because evaluation function meets monotonicity, so node enter after CLOSED table, can again not be chosen as follow-up, although this can not make algorithm abandon completely and maintain CLOSED table by the mode of chained list, but because without CLOSED table is modified, whether be expanded already use so can adopt two-dimensional array to carry out mark for algorithm queries node, and the obvious speed of this inquiry mode is more quick.
(5) due to sequencing schemes in (3), can prove, the node being added in OPEN table can not obtain less value by other nodes, thereby there is not the problem of nodal information in amendment OPEN table, therefore can carry out mark with the two-dimensional array in (4), reach higher performance.
Prove:
A) because algorithm only allows the motion of four basic orientation, thereby whole labyrinth can be regarded a bigraph (bipartite graph) as, and in bigraph (bipartite graph), all loop length are even number.In even from start node to labyrinth, a certain pel exists more than a paths, and in these paths, the absolute value of the length difference of any two must be even number.
B) establish in OPEN table and have a node , its father node is , and by another abutment points make 's value reduces.Due to node 's can not change, so must have
(3-3)
Again ? be selected as afterwards expanding node, have
(3-4)
I) when time, due to formula (3-5), so ? be expanded contradiction before.
Ii) when time, from a)
(3-5)
Thereby
(3-6)
Because algorithm adopts city block distance as evaluation function, so have
(3-7)
(3-8)
Wherein for the computing that takes absolute value, for getting x coordinate computation, for getting y coordinate computation.
(3-9)
Again with all with adjacent, arrive distance be 2, thereby
(3-10)
With (3-4) formula contradiction.
The invention has the beneficial effects as follows:
The above-mentioned shortcoming that the present invention is directed to traditional A* algorithm is improved, and the direction number of having optimized searching moving is four, uses city block distance as evaluation function, has improved speed and the simplification calculated.Improve sort algorithm in OPEN table, sacrificed a part of performance and bring the advantage that overall improvement forms.In addition by using improved evaluation function, and meet the demand of monotonicity, although can not abandon the data structure of chained list completely, but because without OPEN table and CLOSED table are modified, whether expanded and used already for algorithm queries node so can use two-dimensional array to carry out mark, thus the speed ability of significantly improving.
Brief description of the drawings
Accompanying drawing 1 is Function Decomposition figure;
Accompanying drawing 2 is system surface chart;
Accompanying drawing 3 is starting point and terminal common labyrinth map far away;
Accompanying drawing 4 is the nearer common labyrinth map of starting point and terminal;
Accompanying drawing 5 is not for substantially there is no the labyrinth map of obstacle;
Accompanying drawing 6 is without separating labyrinth map;
Accompanying drawing 7 is sought footpath result figure for the present invention;
Accompanying drawing 8 is for labyrinth of the present invention is without the design sketch of separating.
Embodiment
Footpath system is sought in labyrinth:
Whole system can be divided into three subsystems, is respectively map making subsystem, data display subsystem of footpath subsystem is sought in labyrinth, and the function that will realize just can be divided in the middle of three subsystems.Final Function Decomposition figure as shown in Figure 1.
In Main form module, as shown in Figure 2, internal system represents map with two-dimensional array.
Seek footpath algorithm:
Improved A* algorithm
The data structure using
Two data structures that A* algorithm uses
Int map[MAP_HEIGHT] [MAP_WIDTH]; // for flag node, IN_CLOSED represents to be added in CLOSED table, and IN_OPEN represents to be added in OPEN table
Arthmetic statement:
(1) initialization OPEN table and CLOSED table, initialization two-dimensional array map is full 0, starting point be put in OPEN table, and calculate , this coordinate position element of mark map is IN_OPEN.
(2) if OPEN table, for empty, unsuccessfully exits, problem is without solution.
(3) from OPEN table heading element delete, and join in CLOSED, this node coordinate element of mark two-dimensional array map is IN_CLOSED.
(4) if for target successfully exits.
(5) expansion , generate whole descendant nodes, to each descendant node be handled as follows:
If a) in CLOSED table or OPEN table (this coordinate position that is two-dimensional array map is not 0), do not deal with, turn 6);
B) calculate ;
C) first press ascending order, if equate to press again ascending order is by node join OPEN table, and its former generation is pointed to , this node coordinate element of mark two-dimensional array map is IN_OPEN;
(6) turn (2).
Map type can be divided into four kinds, represent respectively a type, wherein the first is starting point and terminal common labyrinth (as Fig. 3) relatively far apart, the second is the common labyrinth (as Fig. 4) that starting point and terminal are separated by nearer, the third is for substantially there is no the labyrinth (as Fig. 5) of obstacle, and the 4th kind is without separating labyrinth (as Fig. 6).Provide respectively the Search Results (as Fig. 7 and Fig. 8) of the first and the 4th kind of more representative map.

Claims (3)

1. improved heuristic A * algorithm, is characterized in that comprising:
(1) only allow the motion of four basic orientation, up and down;
(2) adopt city block distance as evaluation function;
(3) node in OPEN table is first carried out to ascending sort by size, while equating, by ascending sort;
(4) because evaluation function meets monotonicity, so node can not be chosen as follow-uply entering again after CLOSED table, can adopt two-dimensional array to carry out mark and whether be expanded already use for algorithm queries node, thus the speed ability of significantly improving;
(5) due to sequencing schemes in (3), can prove, the node being added in OPEN table can not obtain less value by other nodes, thereby does not have the problem of nodal information in amendment OPEN table, therefore can carry out mark with the two-dimensional array in (4).
2. method according to claim 1, it is characterized in that because algorithm only allows the motion of four basic orientation, thereby whole labyrinth can be regarded a bigraph (bipartite graph) as, and in bigraph (bipartite graph), all loop length is even number.
3. method according to claim 1, it is characterized in that labyrinth seeks footpath system and can be divided into three subsystems, be respectively map making subsystem, data display subsystem of footpath subsystem is sought in labyrinth, and the function that will realize just can be divided in the middle of three subsystems.
CN201410210514.XA 2014-05-19 2014-05-19 Improved heuristic A * algorithm Pending CN103971008A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410210514.XA CN103971008A (en) 2014-05-19 2014-05-19 Improved heuristic A * algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410210514.XA CN103971008A (en) 2014-05-19 2014-05-19 Improved heuristic A * algorithm

Publications (1)

Publication Number Publication Date
CN103971008A true CN103971008A (en) 2014-08-06

Family

ID=51240496

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410210514.XA Pending CN103971008A (en) 2014-05-19 2014-05-19 Improved heuristic A * algorithm

Country Status (1)

Country Link
CN (1) CN103971008A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462805A (en) * 2014-12-02 2015-03-25 厦门飞游信息科技有限公司 Map path-searching method and equipment based on A* algorithm and computing terminal
CN105844364A (en) * 2016-04-08 2016-08-10 上海派毅智能科技有限公司 Service robot optimal path program method based on heuristic function
WO2017041730A1 (en) * 2015-09-09 2017-03-16 北京进化者机器人科技有限公司 Method and system for navigating mobile robot to bypass obstacle
CN107687859A (en) * 2017-09-06 2018-02-13 电子科技大学 Most short method for searching based on A star algorithms
CN108108410A (en) * 2017-12-12 2018-06-01 苏州蜗牛数字科技股份有限公司 A kind of online game labyrinth ground drawing generating method
CN109144067A (en) * 2018-09-17 2019-01-04 长安大学 A kind of Intelligent cleaning robot and its paths planning method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0854353A2 (en) * 1997-01-15 1998-07-22 Zexel Corporation Route determination in a vehicle navigation system
CN1734238A (en) * 2005-09-15 2006-02-15 北京工业大学 Two-step multi-path optimization method for central controlled vehicle information system
US20060241854A1 (en) * 2005-04-20 2006-10-26 Ihung Tu Route determination method and apparatus for navigation system
CN101833699A (en) * 2009-03-12 2010-09-15 北京博懋易通科技有限公司 Heuristic route segment path-finding method for ship route design
CN102645228A (en) * 2012-04-12 2012-08-22 清华大学 Trafficability route-finding algorithm of vehicle navigation system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP0854353A2 (en) * 1997-01-15 1998-07-22 Zexel Corporation Route determination in a vehicle navigation system
US20060241854A1 (en) * 2005-04-20 2006-10-26 Ihung Tu Route determination method and apparatus for navigation system
CN1734238A (en) * 2005-09-15 2006-02-15 北京工业大学 Two-step multi-path optimization method for central controlled vehicle information system
CN101833699A (en) * 2009-03-12 2010-09-15 北京博懋易通科技有限公司 Heuristic route segment path-finding method for ship route design
CN102645228A (en) * 2012-04-12 2012-08-22 清华大学 Trafficability route-finding algorithm of vehicle navigation system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
周小镜: "基于改进A*算法的游戏地图寻径的研究", 《中国优秀硕士学位论文全文数据库》 *
邱磊: "基于A*算法的游戏地图寻路实现及性能比较", 《陕西科技大学学报》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462805A (en) * 2014-12-02 2015-03-25 厦门飞游信息科技有限公司 Map path-searching method and equipment based on A* algorithm and computing terminal
CN104462805B (en) * 2014-12-02 2017-05-31 厦门飞游信息科技有限公司 A kind of map road-seeking method based on A* algorithms, equipment and computing terminal
WO2017041730A1 (en) * 2015-09-09 2017-03-16 北京进化者机器人科技有限公司 Method and system for navigating mobile robot to bypass obstacle
CN105844364A (en) * 2016-04-08 2016-08-10 上海派毅智能科技有限公司 Service robot optimal path program method based on heuristic function
CN107687859A (en) * 2017-09-06 2018-02-13 电子科技大学 Most short method for searching based on A star algorithms
CN108108410A (en) * 2017-12-12 2018-06-01 苏州蜗牛数字科技股份有限公司 A kind of online game labyrinth ground drawing generating method
CN109144067A (en) * 2018-09-17 2019-01-04 长安大学 A kind of Intelligent cleaning robot and its paths planning method
CN109144067B (en) * 2018-09-17 2021-04-27 长安大学 Intelligent cleaning robot and path planning method thereof

Similar Documents

Publication Publication Date Title
CN103971008A (en) Improved heuristic A * algorithm
CN111504325B (en) Global path planning method based on weighted A-algorithm of enlarged search neighborhood
Abd Algfoor et al. A comprehensive study on pathfinding techniques for robotics and video games
CN108775902A (en) The adjoint robot path planning method and system virtually expanded based on barrier
WO2018176596A1 (en) Unmanned bicycle path planning method based on weight-improved particle swarm optimization algorithm
CN105843222B (en) A kind of six-wheel/leg robot complex motion paths planing method
Abrams et al. Finding topology in a factory: configuration spaces
CN103336526A (en) Robot path planning method based on coevolution particle swarm rolling optimization
CN101739509B (en) Path navigation method for large-scale virtual crowd
CN103544249B (en) A kind of method for indexing scattered point cloud space of historic building
CN104715507B (en) A kind of three-dimensional geographical entity method for auto constructing based on patch
Kuffner Efficient optimal search of uniform-cost grids and lattices
Zhang et al. A-star algorithm for expanding the number of search directions in path planning
CN102306106A (en) Method and system for automatically generating navigation chart in virtual space, and pathfinding method and system
Zou et al. Dynamic skyline queries in large graphs
Shan et al. A dynamic RRT path planning algorithm based on B-spline
Mthabela et al. RRT based path planning for mobile robots on a 3D surface mesh
CN113325834A (en) Path planning method of improved A-x algorithm based on graph preprocessing
Franklin et al. Voronoi diagrams with barriers and on polyhedra for minimal path planning
CN109977455A (en) It is a kind of suitable for the ant group optimization path construction method with terrain obstruction three-dimensional space
CN114509085B (en) Quick path searching method combining grid and topological map
Huang et al. A grid based trajectory indexing method for moving objects on fixed network
CN105242669A (en) Mobile robot path planning method based on weighted average distance vision fish school algorithm
Jan et al. A new maze routing approach for path planning of a mobile robot
CN112362073B (en) Navigation path modeling and shortest path solving method based on convex hull characteristics

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20140806

WD01 Invention patent application deemed withdrawn after publication