Improved A* Navigation Path-Planning Algorithm Based on Hexagonal Grid

: Navigation systems are extensively used in everyday life, but the conventional A* algorithm has several limitations in path planning applications within these systems, such as low degrees of freedom in path planning, inadequate consideration of the effects of special regions, and excessive nodes and turns. Addressing these limitations, an enhanced A* algorithm was proposed using regular hexagonal grid mapping. First, the approach to map modeling using hexagonal grids was described. Subsequently, the A* algorithm was refined by optimizing the calculation of movement costs, thus allowing the algorithm to integrate environmental data more effectively and flexibly adjust node costs while ensuring path optimality. A quantitative method was also introduced to assess map complexity and adaptive heuristics that decrease the number of traversed nodes and increase the search speed. Moreover, a turning penalty measure was implemented to minimize unnecessary turns on the planned paths. Simulation results confirmed that the improved A* algorithm exhibits superior performance, which can dynamically adjust movement costs, enhance search efficiency, reduce turns, improve overall path planning quality, and solve critical path planning issues in navigation systems, greatly aiding the development and design of these systems and making them better suited to meet modern navigation requirements.


Introduction
Navigation systems are crucial tools for travel, and path planning is a fundamental aspect of their functionality.The primary objective of path planning is to identify a feasible and optimized route from the starting point to the endpoint [1].In practice, complex terrain and traffic conditions often lead to disparities between planned paths and actual road conditions.Consequently, the development of advanced path-planning methods has emerged as a prominent topic in academic research.
Existing path-planning methods are primarily composed of two main components: (1) the construction of abstract maps and (2) the path-search algorithm [2].Map construction encompasses various techniques, including graphical representation [3], navigation mesh representation [4,5], and the grid method [6,7].Currently, most navigation systems use graphical representations that rely on vector-based road networks for path planning.However, this approach involves pre-set traversable paths with limited degrees of freedom.Notably, certain passable areas, such as grasslands, squares, and mountains, were excluded from the planning scope despite applying to various scenarios.
In contrast, the navigation mesh abstracts the original map into a collection of triangular meshes, utilizing the connection relationships between the triangular meshes for path planning [8].Although this method provides a more accurate representation of a map, its structure is complex and challenging to implement and modify, and the construction process consumes a considerable amount of memory.Consequently, it is primarily used in 3D scenes, such as video games [9].
The grid method divides a scene evenly into a series of grids by considering each grid as a node in an abstract graph.Subsequently, the search algorithm navigates through the abstract graph [10].This approach provides significant flexibility, covers the entire traffic area effectively, and addresses all aspects within the realm of path planning.Its principle is straightforward, and its implementation is relatively simple.
In a two-dimensional plane, squares, equilateral triangles, and regular hexagons uniformly cover all areas [11].Conventional grid-based methods rely on square grids.Figure 1 illustrates the movement pattern in different grid maps, where the blue nodes indicate the current node, the white nodes indicate the neighboring nodes and the black arrows indicate the directions of movement.As illustrated in Figure 1, in a square grid, the target can move from the current node to a neighboring node in either four or eight directions.If a diagonal movement is not allowed, there are only four directions: forward, backward, left, and right, each with a movement cost of one unit.The 8-directional square grid map includes four diagonal directions, resulting in two different movement costs: 1 unit and √ 2 units.Therefore, when calculating the paths based on this map, it is necessary to determine the category of the forward direction, which makes the calculation extremely complex.However, the hexagonal grids feature only six target directions, each with a movement cost of one unit.
ISPRS Int.J. Geo-Inf.2024, 13, x FOR PEER REVIEW 2 of 15 construction process consumes a considerable amount of memory.Consequently, it is primarily used in 3D scenes, such as video games [9].The grid method divides a scene evenly into a series of grids by considering each grid as a node in an abstract graph.Subsequently, the search algorithm navigates through the abstract graph [10].This approach provides significant flexibility, covers the entire traffic area effectively, and addresses all aspects within the realm of path planning.Its principle is straightforward, and its implementation is relatively simple.
In a two-dimensional plane, squares, equilateral triangles, and regular hexagons uniformly cover all areas [11].Conventional grid-based methods rely on square grids.Figure 1 illustrates the movement pattern in different grid maps, where the blue nodes indicate the current node,the white nodes indicate the neighboring nodes and the black arrows indicate the directions of movement.As illustrated in Figure 1, in a square grid, the target can move from the current node to a neighboring node in either four or eight directions.If a diagonal movement is not allowed, there are only four directions: forward, backward, left, and right, each with a movement cost of one unit.The 8-directional square grid map includes four diagonal directions, resulting in two different movement costs: 1 unit and √2 units.Therefore, when calculating the paths based on this map, it is necessary to determine the category of the forward direction, which makes the calculation extremely complex.However, the hexagonal grids feature only six target directions, each with a movement cost of one unit.2, the path exhibits a zigzag pattern with lower smoothness in a 4-neighbor square grid map.In an 8-neighbor square grid map, although the path is smoother, diagonal crossings may cause the map to approach or even contact obstacles, potentially leading to collisions in practical scenarios.However, hexagonal grid maps do not have these limitations.The paths on the hexagonal grid maps demonstrated smoother trajectories devoid of any rigid sensations.Compared to the 8-neighbor square map, the planned path in the hexagonal grid maintained a greater distance from the obstacles.Additionally, each node possesses a single adjacency type with neighboring nodes, which simplifies the algorithm's implementation and enhances search efficiency.Therefore, this study investigates the adoption of hexagonal grid maps over conventional square-grid maps to enhance the A* algorithm.
Various algorithms have been applied in the field of pathfinding, including breadthfirst search (BFS) [12], depth-first search (DFS) [13], the Dijkstra algorithm [14], genetic algorithms [15], ant colony algorithms [16], and the A* algorithm [17].Among the algorithms described above, the A* algorithm is a heuristic pathfinding method that merges the best features of Dijkstra's and greedy algorithms.Renowned for its effectiveness in solving optimal path problems in static environments [18], as early as 1984, Pearl discussed the completeness and optimality of the A* algorithm in his book Intelligent Search Strategies for Computer Problem Solving.However, issues such as a fixed heuristic function and the limited impact of heuristics often limit the adaptability of the A* algorithm to the   2, the path exhibits a zigzag pattern with lower smoothness in a 4-neighbor square grid map.In an 8-neighbor square grid map, although the path is smoother, diagonal crossings may cause the map to approach or even contact obstacles, potentially leading to collisions in practical scenarios.However, hexagonal grid maps do not have these limitations.The paths on the hexagonal grid maps demonstrated smoother trajectories devoid of any rigid sensations.Compared to the 8-neighbor square map, the planned path in the hexagonal grid maintained a greater distance from the obstacles.Additionally, each node possesses a single adjacency type with neighboring nodes, which simplifies the algorithm's implementation and enhances search efficiency.Therefore, this study investigates the adoption of hexagonal grid maps over conventional square-grid maps to enhance the A* algorithm.Since the introduction of the A* algorithm in 1968, scholars worldwide have continuously researched and optimized it.Current improvements to the A* algorithm primarily focus on optimizing distance calculation methods, enhancing heuristic functions, and secondary path optimization.The optimization of distance calculation methods [19,20] involves refining the estimation methods for the distance between the current point and the Various algorithms have been applied in the field of pathfinding, including breadthfirst search (BFS) [12], depth-first search (DFS) [13], the Dijkstra algorithm [14], genetic algorithms [15], ant colony algorithms [16], and the A* algorithm [17].Among the algorithms described above, the A* algorithm is a heuristic pathfinding method that merges the best features of Dijkstra's and greedy algorithms.Renowned for its effectiveness in solving optimal path problems in static environments [18], as early as 1984, Pearl discussed the completeness and optimality of the A* algorithm in his book Intelligent Search Strategies for Computer Problem Solving.However, issues such as a fixed heuristic function and the limited impact of heuristics often limit the adaptability of the A* algorithm to the influence of special areas on the movement costs during path searches.These issues also result in the traversal of many unnecessary nodes, accompanied by the creation of numerous turning points.
Since the introduction of the A* algorithm in 1968, scholars worldwide have continuously researched and optimized it.Current improvements to the A* algorithm primarily focus on optimizing distance calculation methods, enhancing heuristic functions, and secondary path optimization.The optimization of distance calculation methods [19,20] involves refining the estimation methods for the distance between the current point and the destination.By fully and rationally using the destination's location information, this approach reduces the path length and enhances the efficiency of the algorithm.However, this method prioritizes distance cost as the main criterion and overlooks the impact of special terrain on robot mobility.Enhancements to the heuristic function [19][20][21][22][23][24] involve weighting the components of the heuristic or incorporating new guiding metrics that address issues such as slow search speeds and excessive node traversals.However, these improvements lack adaptability to different maps and often result in suboptimal solutions in complex environments.Secondary path optimization [25] involves the additional processing of paths planned by the A* algorithm, which shortens the path length and improves smoothness.However, this approach requires the design of additional path-smoothing methods, thereby increasing the complexity of the algorithm and reducing the pathfinding efficiency.Moreover, the aforementioned improvements did not consider the impact of special terrain on the algorithm but rather focused more on obstacles.
In practical applications, maps often encompass unique terrains, rendering the aforementioned algorithmic enhancements inadequate for complex environments.To address this issue, the current study emphasizes the use of regular hexagonal grid maps and integrates terrain information to guide navigation pathfinding.This integration aims to enhance algorithmic efficiency and improve the smoothness of the planned paths.Thus, conventional A* algorithms, constrained by their inability to accommodate special terrain, excessive node traversals, and numerous inflection points on raster maps, were adapted.An improved A* algorithm was proposed, featuring an enhanced heuristic function with newly designed elements and the incorporation of environmental information.This refinement not only preserves the optimality of the planned path but also enhances efficiency, environmental adaptability, and path quality.

Conventional A* Algorithm
Pathfinding algorithms can be classified into blind and heuristic categories based on whether they use heuristics.Blind algorithms conduct searches based on predetermined strategies without considering the characteristics of the map or destination.Examples include the breadth-first search (BFS) and Dijkstra's algorithm.However, heuristic algorithms utilize estimated costs to reach the destination, calculating heuristic values to expedite the search.Representative examples include greedy and A* algorithms.The most typical one is the greedy algorithm, which selects the node with the minimum estimated cost to reach the destination at each expansion step.The A* algorithm combines the features of both Dijkstra's and Greedy's algorithms with its heuristic function, defined as where n represents the node currently traversed during the search process; g(n) represents the cost from the starting point to the current node; h(n) represents the estimated cost from the current node to the destination, which serves as the heuristic value in the A* algorithm; and f (n) is the heuristic function of the A* algorithm.
S(i) represents the distance movement for the corresponding node.For example, S(n) represents the actual distance of a single step from the parent node (n − 1) to the current node n.Therefore, g(n) is the sum of the distances for each segment of the planned path.In a hexagonal grid where the distance between adjacent nodes is uniform, you can set S(i) = 1 to facilitate the operation of the algorithm.
Heuristic algorithms require the calculation of distances between nodes, and the distance calculation involves the assistance of a coordinate system.Common hexagonal grid coordinate systems include cubic, offset, and axial coordinates.Among these, the cubic coordinate system is easy to understand, and its distance calculation formula is simple and clear.Therefore, a cubic coordinate system was adopted for the distance calculation.In contrast to the xand y-axes in the Cartesian coordinates for square grid maps (as shown in Figure 3), the cubic coordinate system has three axes: q, r, and s, representing the grid coordinates as (q, r, s).
where n represents the node currently traversed during the search process; g(n) represents the cost from the starting point to the current node; h(n) represents the estimated cost from the current node to the destination, which serves as the heuristic value in the A* algorithm; and f(n) is the heuristic function of the A* algorithm.
S(i) represents the distance movement for the corresponding node.For example, S(n) represents the actual distance of a single step from the parent node (n − 1) to the current node n.Therefore, g(n) is the sum of the distances for each segment of the planned path.In a hexagonal grid where the distance between adjacent nodes is uniform, you can set S(i) = 1 to facilitate the operation of the algorithm.
Heuristic algorithms require the calculation of distances between nodes, and the distance calculation involves the assistance of a coordinate system.Common hexagonal grid coordinate systems include cubic, offset, and axial coordinates.Among these, the cubic coordinate system is easy to understand, and its distance calculation formula is simple and clear.Therefore, a cubic coordinate system was adopted for the distance calculation.In contrast to the x-and y-axes in the Cartesian coordinates for square grid maps (as shown in Figure 3), the cubic coordinate system has three axes: q, r, and s, representing the grid coordinates as (q, r, s).
Common distance calculation methods include the Euclidean, Manhattan, and diagonal distances, among which the Manhattan distance, also known as a taxicab or city block distance, measures the total absolute difference along each axis between two points in a grid-based environment.In hexagonal grids, it is intuitive to measure the distance between two nodes by using the number of steps per unit.Therefore, the Manhattan distance was used to estimate the movement costs and calculate the distance from the current node to the destination.Common distance calculation methods include the Euclidean, Manhattan, and diagonal distances, among which the Manhattan distance, also known as a taxicab or city block distance, measures the total absolute difference along each axis between two points in a grid-based environment.In hexagonal grids, it is intuitive to measure the distance between two nodes by using the number of steps per unit.Therefore, the Manhattan distance was used to estimate the movement costs and calculate the distance from the current node to the destination.
For grid A with coordinates (q 1 , r 1 , s 1 ) and grid B with coordinates (q 2 , r 2 , s 2 ), the Manhattan distance between A and B is expressed as: During the search process of the A* algorithm, each time it finds the node with the smallest heuristic function value for expansion, the specific steps of the algorithm are as follows: (1) Create OpenList and ClosedList collections; add the starting point to the OpenList, and set the starting point's g(n) = 0. (2) Find the node with the smallest f (n) value in the OpenList.If the OpenList is empty, the search fails, and the search ends.(3) Add the node to the ClosedList and traverse all neighbor nodes of the current node that are not in the ClosedList.
a If the neighbor node is not on OpenList, let the neighbor node's movement cost g(n + 1) equal g(n) + 1, and set the current node as the parent node of this neighbor node.b If the neighbor node is in OpenList and the calculated g(n) from the current node to this neighbor node is smaller than the previously calculated g(n) from the parent node, then update the value of g(n), and the current node is set as the parent node of this neighbor node; if it is greater, then it is not updated.
(4) Repeat Steps 2 and 3 until the node found in Step 2 is the endpoint.
The parent node was traced sequentially from the endpoint.If the parent node is the starting point, it ends, and the path planning result is obtained.
A flowchart of the A* algorithm is shown in Figure 4.

Improved A* Algorithm
The conventional A* algorithm is not influenced by special terrain.During the path search process, problems such as a high number of traversed nodes, numerous turning points, and a large total turning angle occur.The algorithm is enhanced by implementing

Improved A* Algorithm
The conventional A* algorithm is not influenced by special terrain.During the path search process, problems such as a high number of traversed nodes, numerous turning points, and a large total turning angle occur.The algorithm is enhanced by implementing a flexible cost strategy, an adaptive heuristic function, turning the penalty function, and incorporating the impact of special terrain into the path search.While ensuring path optimality, this approach reduces the number of traversed nodes, enhances algorithm efficiency, and enables quick and stable planning of inflection points and total turning angles, resulting in a more reasonable navigation path.

Flexible Setting of Costs
The conventional grid method typically defines two attributes: passability and inaccessibility.In practical applications, path planning maps contain some special areas, such as grasslands and hills, which are often included.These areas are traversable; however, because of their specific characteristics, distance cannot be used directly as the cost of movement in these areas.Therefore, we define the grid nodes in three states: (1) Ordinary nodes, (2) nodes in special areas, and (3) obstacle nodes.The node states are stored when abstracting maps.As the algorithm traverses a new node, if the node is a regular node, the movement cost for that node is determined by the distance, specifically set to one.If the node is located within a special area, the transit cost is determined by considering both the distance and the effects of the special area.If a node is an obstacle node, it is not expanded.Further improvements include enhancing the calculation method for g(n) and introducing the influencing factor K into the heuristic function.K represents the difficulty of passing through a special area.If node i is situated in a region influenced by factor K, then the single-step movement cost S ′ (i) from the node i's parent node to node i is defined as follows: The constant term 1 represents the basic distance cost of moving to node i; the overall movement cost, or the difficulty of passage, is directly proportional to K. When K = 0, the node is considered ordinary, and when K = 1, the cost of moving to node i is twice that of moving to an ordinary node.When the K value is sufficiently large, node i can be considered located in an impassable obstacle.
Moreover, a path node may be located at the intersection of multiple areas, and the impact of these areas on the cost calculation of the node must be comprehensively considered.If m special areas are superimposed at the location of node i, the expression for where K j represents the influencing factor for the special area j, and this formula is used to calculate the cost g ′ (n) of moving to the current node after being affected.

Adaptive Heuristics
By incorporating the influence of the parent node (n − 1), the heuristic value from the parent node is added to the current node's heuristic function, increasing the overall proportion of the heuristic value within the heuristic function.This enhancement can accelerate search speed, traverse fewer nodes during the search, and reduce computational load.However, excessively high search speeds may lead to the emergence of locally optimal solutions.To enable the algorithm to accelerate the search speed on simpler maps and adopt a more cautious approach for complex maps, it is necessary to adjust the heuristic weight based on map information, allowing it to adaptively control the search speed.If the number of nodes in the current map is x, the number of obstacle nodes is y, there are m types of special areas, and the number of nodes with corresponding area properties is ε, with corresponding special area influence factors represented by K, all these parameters determined by map information, then the improved heuristic expression h ′ (n) is as follows: In the above equation, 1 − α represents the adaptive weight multiplier for the heuristic, and α denotes the map complexity, with a value range of [0, 1].When the extent of obstacles and special areas is large, the complexity of the map increases, reducing the heuristic value and consequently slowing the search speed.
To verify the impact of the adaptive heuristic values on the search speed, an experiment was conducted on a 30 × 30 hexagonal grid map, and the results are displayed in Figures 2 and 5. Figure 5a shows the search results using the conventional A* algorithm; Figure 5b shows the search results when only the heuristic value from the parent node is introduced; and Figure 5c presents the search results after introducing the adaptive heuristic proposed in this study.In the figures, gray nodes represent ordinary nodes, black nodes represent obstacle nodes, light blue nodes denote path nodes, and orange nodes indicate nodes traversed during the search.The black triangle marks the starting point of the path, and the black pentagon marks the endpoint of the path.And the dark blue line is the planned path.The calculated value of α is 0.276.A comparison of the search results is presented in Table 1   The results indicate that, after introducing the heuristic value from the parent node, there is a significant reduction in the number of nodes traversed.As the time required to traverse each node remains the same, the search speed is also improved.However, the planned path loses optimality.However, after incorporating adaptive heuristic values into the heuristic function, the algorithm maintains path optimality, and the number of traversed nodes is significantly reduced, thereby demonstrating the feasibility of this approach.However, there is still redundancy in the turning points across the various algorithms, necessitating further optimization and improvement.

Turn Penalty
The formation of redundant turning was due to the low stability of the algorithm during the search process.When faced with multiple paths having the same movement  The results indicate that, after introducing the heuristic value from the parent node, there is a significant reduction in the number of nodes traversed.As the time required to traverse each node remains the same, the search speed is also improved.However, the planned path loses optimality.However, after incorporating adaptive heuristic values into the heuristic function, the algorithm maintains path optimality, and the number of traversed nodes is significantly reduced, thereby demonstrating the feasibility of this approach.However, there is still redundancy in the turning points across the various algorithms, necessitating further optimization and improvement.

Turn Penalty
The formation of redundant turning was due to the low stability of the algorithm during the search process.When faced with multiple paths having the same movement cost, the algorithm fails to select a route with a smaller number of turning points and a smaller total turning angle.Therefore, this study proposes the incorporation of a penalty term to suppress the formation of turning points, thus enabling the algorithm to maintain the direction of path progression and avoid turning.
The direction of the path progression is shown in Figure 6, where the blue node represents the current node, the orange node represents the parent node of the current node, and the gray nodes are the neighboring nodes of the current node, which will be traversed in the next iteration.When traversing a new node, there are six directions for expansion, which, compared to the previously planned route, yields four outcomes: 1. Continue along the previous route; 2. The new node direction differed from the previous path direction by 60°; and 3.The new node direction differed from the previous path direction by 120°.It can be observed that the turning angle of the route is related to the angle θ between the previous path direction and the new node direction.Assume that the current node is n, its parent node is (n − 1), and the new node is (n + 1), then the angle θ is calculated as: where a is the vector from the current node to the new node, and b is the vector from the parent node to the current node.Add a penalty value of punish(n + 1) to each new node; punish(n + 1) = β(1 − Cosθ); the value range of the penalty value is [0,2a].The factor β serves as a penalty intensity coefficient, with the penalty intensity being directly proportional to the value of β.Accordingly, the algorithm prioritizes the expansion of new nodes, where the direction of progression remains unchanged, to minimize the number of turns during the search and reduce the number of turning points.

Final Improved Algorithm
To enable the conventional A* algorithm to adapt to the influence of complex maps, prioritize planning paths in areas with low traffic difficulty, enhance search speed, reduce the number of traversed nodes, and minimize turning points and angles, this study proposes a flexible setting of movement costs, adaptive heuristics, and a turning penalty strategy, ultimately resulting in an improved A* algorithm.First, a regular hexagonal grid map is used for abstraction; the special terrain influence factor information is stored in the map, When traversing a new node, there are six directions for expansion, which, compared to the previously planned route, yields four outcomes: 1. Continue along the previous route; 2. The new node direction differed from the previous path direction by 60 • ; and 3.The new node direction differed from the previous path direction by 120 • .It can be observed that the turning angle of the route is related to the angle θ between the previous path direction and the new node direction.Assume that the current node is n, its parent node is (n − 1), and the new node is (n + 1), then the angle θ is calculated as: where a is the vector from the current node to the new node, and b is the vector from the parent node to the current node.Add a penalty value of punish(n + 1) to each new node; punish(n + 1) = β(1 − cos θ); the value range of the penalty value is [0, 2a].The factor β serves as a penalty intensity coefficient, with the penalty intensity being directly proportional to the value of β.Accordingly, the algorithm prioritizes the expansion of new nodes, where the direction of progression remains unchanged, to minimize the number of turns during the search and reduce the number of turning points.

Final Improved Algorithm
To enable the conventional A* algorithm to adapt to the influence of complex maps, prioritize planning paths in areas with low traffic difficulty, enhance search speed, reduce the number of traversed nodes, and minimize turning points and angles, this study proposes a flexible setting of movement costs, adaptive heuristics, and a turning penalty strategy, ultimately resulting in an improved A* algorithm.First, a regular hexagonal grid map is used for abstraction; the special terrain influence factor information is stored in the map, and α is calculated.The expression for the improved A* algorithm's heuristic function f ′ (n) is as follows:

Algorithm Simulation
To verify the performance of the improved A* algorithm proposed in this study, we simulated it using the Unreal Engine 5 (UE5), version 5.0.3.UE5 is a powerful game development engine increasingly used by researchers for developing navigation systems, making it an excellent software tool for the experiments conducted in this study.We constructed an experimental map of size 30 × 30, which included 191 obstacle nodes and 248 grassland nodes, with the influence factor K set to 1. Through calculations using Equation ( 7), the complexity α of this map was determined to be 0.  First, we conducted experiments on the magnitude of the penalty intensity coefficient β under the premise of introducing flexible cost settings and adaptive heuristics.The search results for the algorithms with different β values are listed in Table 2.  From the analysis of the experimental results, the introduction of a turning penalty reduces both the number of turning points and the total turning angle.When β exceeds 0.5, the number of nodes traversed increases because of the excessive penalty, causing the algorithm to traverse more nodes where the direction of progression has not changed rather than nodes closer to the destination.When β is between 0.5 and 1, the path exhibits First, we conducted experiments on the magnitude of the penalty intensity coefficient β under the premise of introducing flexible cost settings and adaptive heuristics.The search results for the algorithms with different β values are listed in Table 2. From the analysis of the experimental results, the introduction of a turning penalty reduces both the number of turning points and the total turning angle.When β exceeds 0.5, the number of nodes traversed increases because of the excessive penalty, causing the algorithm to traverse more nodes where the direction of progression has not changed rather than nodes closer to the destination.When β is between 0.5 and 1, the path exhibits the fewest turning points and the smallest total turning angle, with a 41% reduction in the number of turning points and a 54% reduction in the number of redundant turning points, demonstrating significant optimization effects.Therefore, we select a value of 0.5 for β in the improved algorithm described in this study.
To evaluate the effectiveness of the proposed algorithm, we conducted simulations for comparison with the conventional A* algorithm, an algorithm featuring flexible cost settings, an algorithm with an adaptive heuristic, and the algorithms described in [19,20].These simulations were performed on the map designed in the previous section.The resultant paths generated by each algorithm are depicted in Figure 8, where gray indicates ordinary nodes, light green denotes grassland nodes, light blue highlights the paths identified by the algorithms, orange marks ordinary nodes traversed during the search, and green signifies grassland nodes traversed.A comparative analysis of these algorithms is presented in Table 3, which lists their performance metrics.It can be observed that the conventional A* algorithm only determines the shortest distance path between the start and end points, traversing long distances through grassy areas, which increases the overall movement cost and loses optimality.After adopting a flexible cost-setting method, the algorithm identifies the path with the lowest cost and achieves optimality; however, owing to the influence of special terrains, the number of traversed nodes and turning points significantly increases.The introduction of adaptive heuristic values maintains path optimality while substantially reducing the number of traversed nodes.However, the A* algorithm already exhibits redundancy in the number of turning points and angles, and the introduction of adaptive heuristic values adds three more turning points, necessitating further optimization.
The algorithm mentioned in [19] uses the average of the Manhattan and Euclidean distances for distance calculation.Although this visually accelerates the approach to the destination, it also results in excessive turning points.Additionally, by incorporating parent node information into the heuristic calculation, a significant reduction in the number of traversed nodes was observed, which was 59.0% lower than that of the A* algorithm with flexible cost settings, significantly enhancing the search speed.However, this was achieved at the expense of sacrificing the optimality and stability of the algorithm.From Figure 8d, it is evident that the algorithm chooses to move across grassy areas in the early part of the path, increasing the movement cost by three and adding three additional turning points, thereby losing path optimality.
The algorithm in [20] introduced the orientation information of the target node into the heuristic function.It first calculates the cosine of the angle between the direction of advance and the target direction, using this cosine value to either increase or decrease the cost based on the presence of obstacles in the forward direction, thus quickly circumventing them.The algorithm in reference [18] is shown to find the optimal path, reducing the number of turning points and the total turning angle by more than half, although the decrease in the number of traversed nodes is minimal, resulting in lower search efficiency.
The improved A* algorithm proposed in this study determines the optimal path on maps with special regions, showing a substantial improvement over the flexible cost-setting A* algorithm in terms of the number of traversed nodes, turning points, and turning angles.Compared to the algorithm in [19], although it traverses more nodes, it plans an optimal path with fewer turning points.Relative to the algorithm in [20], it has more turning points, but the number of nodes traversed differs significantly, demonstrating a significant improvement in the pathfinding efficiency.The analysis in Table 3 shows that the improved A* algorithm outperforms the conventional A* algorithm.Specifically, the improved A* algorithm reduces the overall movement cost by six, a decrease of 9.1% while maintaining path optimality, and reduces the average number of nodes traversed by 21.8%, with an average decrease in the number of turning points and the total turning angle of 25.0%.
To validate the performance of the improved algorithm for different obstacles and grassland areas, we conducted a simulation using a 30 × 30 map.On this map, obstacles and grass nodes are generated at random locations based on different probabilities.The conventional A*, flexible cost setting, and improved algorithms presented in this study were simulated under the same starting conditions.The results are summarized in Table 4. Experiments where the obstacle generation probability was set to 0.2 and 0.4, with a grass generation probability of 0, did not include results for the flexible cost-setting algorithm.This is because the flexible cost-setting algorithm is identical to the A* algorithm when no grass is present.Therefore, those results were omitted.Conventional A* algorithm plans shorter paths but ignores the impact of grassy areas, resulting in higher movement costs.By contrast, the improved algorithm maintained the minimum movement cost even when facing changes in obstacles and grassy areas.When the number of obstacles and grass nodes was low, the proposed algorithm discussed in this paper traversed fewer nodes and planned paths with significantly fewer turning points than the flexible cost-setting algorithm.This is because the map was not particularly complex at this stage, with paths less obstructed by obstacles and grassy areas.The adaptive heuristic and turning penalty strategies enabled the algorithm to rapidly approach the endpoint, effectively enhancing search efficiency.As the probability of generating obstacles and grass increased, making the map more complex, the difference in the number of nodes traversed and the turning points between the improved and flexible cost-setting algorithms decreased.When the obstacle and grass probabilities reached 0.4, the map became sufficiently complex (complexity exceeded 0.5), making the algorithm more cautious than the conventional A* algorithm during path searches.It traverses more nodes than the flexible cost-setting algorithm to ensure that it determines the path with the lowest movement cost.When the map complexity is high, the space for path selection decreases, making turning points unavoidable.However, the paths planned by the improved algorithm consistently had fewer or equal turning points than those planned by the flexible cost-setting algorithm, enabling smoother path planning.
These experimental analyses demonstrated that the improved A* algorithm can adapt to complex mapping environments.It exhibited good adaptability and stability when faced with maps containing different numbers of obstacles and special terrain.It can plan optimal paths with higher search efficiency and fewer turning points and angles, making it more suitable for path planning in navigation systems.

Conclusions
This study focused on path planning within navigation systems and conducted a comparative analysis between square and regular hexagonal grid maps.This study proposed

Figure 1 .
Figure 1.Movement pattern in different grid maps.

Figure 2
Figure2illustrates the path on different grid maps, where blue indicates the path nodes, black indicates the obstacle nodes and the black arrows indicate the routes.As depicted in Figure2, the path exhibits a zigzag pattern with lower smoothness in a 4-neighbor square grid map.In an 8-neighbor square grid map, although the path is smoother, diagonal crossings may cause the map to approach or even contact obstacles, potentially leading to collisions in practical scenarios.However, hexagonal grid maps do not have these limitations.The paths on the hexagonal grid maps demonstrated smoother trajectories devoid of any rigid sensations.Compared to the 8-neighbor square map, the planned path in the hexagonal grid maintained a greater distance from the obstacles.Additionally, each node possesses a single adjacency type with neighboring nodes, which simplifies the algorithm's implementation and enhances search efficiency.Therefore, this study investigates the adoption of hexagonal grid maps over conventional square-grid maps to enhance the A* algorithm.Various algorithms have been applied in the field of pathfinding, including breadthfirst search (BFS)[12], depth-first search (DFS)[13], the Dijkstra algorithm[14], genetic algorithms[15], ant colony algorithms[16], and the A* algorithm [17].Among the algorithms described above, the A* algorithm is a heuristic pathfinding method that merges the best features of Dijkstra's and greedy algorithms.Renowned for its effectiveness in solving optimal path problems in static environments[18], as early as 1984, Pearl discussed the completeness and optimality of the A* algorithm in his book Intelligent Search Strategies for Computer Problem Solving.However, issues such as a fixed heuristic function and the limited impact of heuristics often limit the adaptability of the A* algorithm to the

Figure 1 .
Figure 1.Movement pattern in different grid maps.

Figure 2
Figure 2 illustrates the path on different grid maps, where blue indicates the path nodes, black indicates the obstacle nodes and the black arrows indicate the routes.As depicted in Figure2, the path exhibits a zigzag pattern with lower smoothness in a 4-neighbor square grid map.In an 8-neighbor square grid map, although the path is smoother, diagonal crossings may cause the map to approach or even contact obstacles, potentially leading to collisions in practical scenarios.However, hexagonal grid maps do not have these limitations.The paths on the hexagonal grid maps demonstrated smoother trajectories devoid of any rigid sensations.Compared to the 8-neighbor square map, the planned path in the hexagonal grid maintained a greater distance from the obstacles.Additionally, each node possesses a single adjacency type with neighboring nodes, which simplifies the algorithm's implementation and enhances search efficiency.Therefore, this study investigates the adoption of hexagonal grid maps over conventional square-grid maps to enhance the A* algorithm.
ISPRS Int.J. Geo-Inf.2024, 13, x FOR PEER REVIEW 3 of 15 influence of special areas on the movement costs during path searches.These issues also result in the traversal of many unnecessary nodes, accompanied by the creation of numerous turning points.

Figure 2 .
Figure 2. Path on different grid maps.

Figure 2 .
Figure 2. Path on different grid maps.

Figure 3 .
Figure 3. Diagram of cubic coordinate system.Figure 3. Diagram of cubic coordinate system.

Figure 3 .
Figure 3. Diagram of cubic coordinate system.Figure 3. Diagram of cubic coordinate system.

Figure 4 .
Figure 4. Flowchart of the A* algorithm.

Figure 5 .
Figure 5. Adaptive heuristic test results.(a) Conventional A* algorithm.(b) Introducing the influence of the parent node.(c) Introducing adaptive heuristics.

Figure 5 .
Figure 5. Adaptive heuristic test results.(a) Conventional A* algorithm.(b) Introducing the influence of the parent node.(c) Introducing adaptive heuristics.
35.The map and selection of the start and end points are shown in Figure 7.In the figure, gray nodes represent ordinary nodes, light green nodes represent grass nodes, and black nodes represent obstacle nodes.The black triangle marks the starting point of the path, and the black pentagon marks the endpoint of the path.ISPRS Int.J. Geo-Inf.2024, 13, x FOR PEER REVIEW 10 of 15 start and end points are shown in Figure 7.In the figure, gray nodes represent ordinary nodes, light green nodes represent grass nodes, and black nodes represent obstacle nodes.The black triangle marks the starting point of the path, and the black pentagon marks the endpoint of the path.

Figure 8 .
Figure 8. Results from different algorithms.(a) Conventional A* algorithm.(b) Improved algorithm for flexible cost setting.(c) Introduce adaptive heuristics.(d) The algorithm mentioned in reference [19].(e) The algorithm mentioned in reference [20].(f) Improved A* algorithm of this study.

Figure 8 .
Figure 8. Results from different algorithms.(a) Conventional A* algorithm.(b) Improved algorithm for flexible cost setting.(c) Introduce adaptive heuristics.(d) The algorithm mentioned in reference[19].(e) The algorithm mentioned in reference[20].(f) Improved A* algorithm of this study. .
nodes represent obstacle nodes, light blue nodes denote path nodes, and orange nodes indicate nodes traversed during the search.The black triangle marks the starting point of the path, and the black pentagon marks the endpoint of the path.And the dark blue line is the planned path.The calculated value of α is 0.276.A comparison of the search results is presented in Table1.

Table 1 .
Comparison of search results.

Table 1 .
Comparison of search results.

Table 2 .
Performance comparison of different β value algorithms.

Table 2 .
Performance comparison of different β value algorithms.

Table 3 .
Performance comparison of different algorithms.

Table 3 .
Performance comparison of different algorithms.

Table 4 .
Comparison of experimental results and data under different maps.