Introduction

The path planning algorithms search for the collision-free path between the start and end points while satisfying the evaluation metrics1. These algorithms are classified as the classical approaches, heuristic algorithms, AI-based and bio-inspired approaches2. The A* search algorithm is one of the most popular path planning algorithms, which has the benefits of fast path searching and computational speed34. However, the A* search algorithm requires more search nodes and space for the complicated environment, which reduces search efficiency and wastes the computational resources5. The A* algorithm faces the challenges of redundant nodes during expansion, and sharp turning paths during path planning6.

This paper proposes a novel dynamic search algorithm based on the A* algorithm, which considers obstacle density as the dynamic heuristic function, named Obstacle Density-based Dynamic Exponential A* Algorithm (ODDEA*). The proposed ODDEA* algorithm aims to obtain the optimal path without excessive redundant nodes, and it achieves fast computational speed. Its main contributions are as below:

  • A novel dynamic exponential heuristic function based on Obstacle Density to enhance the search ability.

  • The proposed ODDEA* algorithm uses local dynamic penalty, adaptive weight adjustment, and multi-variable fusion to reduce the redundant search space.

  • It is developed based on the Chebyshev distance, and computational experiments were performed on different sizes of grid maps.

This paper is organised as follows. Section “Related work” provides a review of the related work, and “Preliminary knowledge” explains the A* algorithm. The proposed ODDEA* algorithm is presented in “Obstacle density-based dynamic exponential A* Algorithm (ODDEA*)”. The computational experiments and the comparison analysis are in “Computational experiments”, and the paper is concluded in “Conclusion”.

Related work

The A* algorithm is one of the popular graph search algorithms. A shorter path can be achieved by connecting line segments between two path points to improve the A* algorithm for path planning7. The filter function is employed to avoid irregular paths and large turning angles, and integrated with the cubic B-spline interpolation to smooth the path, using the Euler and Manhattan distances for estimating the cost3.

4 presents an improved A* algorithm by expanding the search directions to 12 directions to reduce the total path length and inflection points. An improved multi-objective A* algorithm for robot path planning using the Euclidean distance is presented to reduce the number of random points, path length, and process time8. Five-neighborhood and eight-neighborhood searches are used with weight coefficient improvement as an improved A* algorithm6.

The A* algorithm is combined with the artificial potential field (APF) method for a home cleaning robot using the Euclidean distance1. Another combination algorithm of global and local path planning is ASL-DWA, which combines A* and the Dynamic Window Approach (DWA), with the hybrid heuristic function of point-to-line distance and Euclidean distance5. An adaptive A* algorithm can reduce redundant points, and it is integrated with DWA as a fusion algorithm9.

A dynamic anti-collision A* algorithm is introduced in10 for complex scenarios, which considers time factors and the navigation risk cost. R5DOS model is combined with the A* algorithm to visit fewer nodes and to modify the hop search algorithm11.12 uses a guideline and key points for the bidirectional search to solve the problem that the A* algorithm requires a large memory space. A bidirectional alternating search strategy is combined with the A* algorithm to improve search efficiency13.

For AGV path planning, a modified cost function based on diverse turning angles is proposed with the artificial potential field method to address the challenges of turning points and angles14. For a hybrid A* algorithm, the Voronoi field potential is employed for the safety-enhanced design, and a multi-stage dynamic optimisation strategy is used for the efficiency-enhance design15.

Additionally, for robot path planning, there are many heuristic algorithms used to generate the optimal path. Inspired by Particle Swarm Optimisation (PSO) and Simulated Annealing (SA), PSO-SA is proposed to get rid of the local optimum and enhance the search efficiency16. Multi-Objective PSO is enhanced with a fuzzy inference system for car-like robot path planning17. The Ant Colony Optimisation (ACO) algorithm is improved by an ant communication mechanism and path selection rules18, and19 presents a new heuristic mechanism for the ACO algorithm. The sampling-based approach is also used in robot path planning, such as the Rapidly-exploring Random Tree Star (RRT*) algorithm2021.

Reinforcement learning is a recent trend in path planning.22 incorporates Q-learning and the APF method to enhance performance and learning speed. An improved Dyna-Q algorithm utilises the Dyna architecture, combining reactive navigation, Simulated Annealing (SA), and heuristic search with Q-learning23. Long Short-Term Memory (LSTM) is used to optimise the network structure of the Deep Deterministic Policy Gradient (DDPG) algorithm to enhance the moving speed24. The transformer structure is introduced into imitative reinforcement learning to enhance the policy neural networks for feature extraction25.

However, the A* algorithm is widely used in industrial applications due to its completeness of path generation and fast computational speed. The A* algorithm faces the challenges of large turning angles or sharp turning paths, redundant nodes during expansion, and large search spaces. This paper aims to address these problems, and it uses a dynamic heuristic function to guide the robot to achieve the shortest path safely.

Problem statement

Figure 1
figure 1

The 5x5 grid map.

The grid map is employed to represent the environment, as shown in Fig. 1. The white grids stand for the accessible area, while the black grids represent the obstacles. They are modelled as a binary map, where 1 indicates obstacles, while 0 denotes accessible areas. The sizes of the grid maps in the computational experiments include 20x20, 40x40, and 60x60 maps. M stands for the map matrix in Eq.(1), and the grid at the ith row and the jth column is represented in Eq.(2).

$$\begin{aligned} \textbf{M} = \begin{bmatrix} m_{1,1} & m_{1,2} & \cdots & m_{1,j} \\ m_{2,1} & m_{2,2} & \cdots & m_{2,j} \\ \vdots & \vdots & \ddots & \vdots \\ m_{i,1} & m_{i,2} & \cdots & m_{i,j} \end{bmatrix} \end{aligned}$$
(1)
$$\begin{aligned} m_{i,j} \in \{0,1\} \end{aligned}$$
(2)

Preliminary knowledge

A* algorithm

A* is a heuristic search algorithm, which introduces information related to the target point to improve the search efficiency, and it weighs the estimated cost and known cost to explore the path. The traditional A* algorithm uses Eq.(3) as the heuristic function to find the optimal path.

$$\begin{aligned} f(n) = h(n) + g(n) \end{aligned}$$
(3)

where h(n) is the heuristic cost from the current path point to the goal, and g(n) represents the cost from the start to the current path point.

Heuristic function

There are three commonly used heuristic functions: Manhattan distance, Euclidean distance, and Chebyshev distance. The difference between the three heuristic functions is shown in Fig. 2.

Figure 2
figure 2

Three heuristic functions.

The traditional A* algorithm supports four search directions, using Manhattan distance, which allows vertical and horizontal movement. As a result, it may overestimate the actual distance because of expanding to more nodes and overestimating the cost in the oblique direction. Manhattan distance between nodes \(S(x_{s},y_{s})\) and \(T(x_{T},y_{T})\) is calculated based on Eq.(4). It is suitable for simple scenarios, such as city blocks.

$$\begin{aligned} d(S, T) = \left| x_{s} - x_{T} \right| + \left| y_{s} - y_{T} \right| \end{aligned}$$
(4)

The Euclidean distance calculates the straight-line distance between two nodes, and it is suitable for a barrier-free environment or continuous space. It supports moving in any direction, but it may result in lower calculation efficiency in large-scale scenarios due to the square root involved. It is calculated by Eq.(5).

$$\begin{aligned} d(S, T)=\sqrt{\left( x_s-x_T\right) ^2+\left( y_s-y_T\right) ^2} \end{aligned}$$
(5)

The Chebyshev distance allows horizontal, vertical, and diagonal movements for 8-neighbour searching. It supports free diagonal movement and is suitable for AGV path planning. It is implemented in this paper as the heuristic function, in Eq.(6).

$$\begin{aligned} d(S, T)=max(\left| x_{s} - x_{T}\right| , \left| y_{s} - y_{T}\right| ) \end{aligned}$$
(6)

Obstacle density-based dynamic exponential A* Algorithm (ODDEA*)

For mobile robots, path planning faces the challenges of estimating the density and types of obstacles, and giving a reasonable path to pass through obstacles to reach the target smoothly26. This paper proposes a new heuristic function based on the consideration of obstacle density and a dynamic exponential weight heuristic function to improve the A* algorithm, called the Obstacle Density-based Dynamic Exponential A* Algorithm (ODDEA*). The flowchart of the ODDEA* algorithm is shown in Fig. 3.

The proposed ODDEA* algorithm adjusts the weight of the heuristic function based on the obstacle density, and it uses the Chebyshev distance. The Chebyshev distance supports eight-directional movement on two-dimensional grid maps and efficiently estimates the movement cost from a node to the target, thus reducing the possibility of redundant search. It uses multi-variable fusion, adaptive weight adjustment, and local dynamic penalty, and h(n) is determined by Eq. (7).

$$\begin{aligned} h(n)=\max \left( \left| x_n-x_g\right| ,\left| y_n-y_g\right| \right) \cdot \left( 1+\lambda \cdot e^{\beta \cdot D(n)}\right) \end{aligned}$$
(7)

where D(n) denotes the normalized obstacle density within a radius R around node n (with \(D(n) \in [0, 1]\)), \(\lambda\) represents the density-sensitive coefficient (\(\lambda > 0\), controlling the strength of density influence), and \(\beta\) denotes the exponential decay coefficient (\(\beta > 0\), indicating the nonlinearity degree of the density response).

Figure 3
figure 3

The flowchart of the ODDEA* algorithm.

The ODDEA* algorithm dynamically adjusts the weight of the Chebyshev heuristic function based on the density of surrounding obstacles, as demonstrated in Algorithm 1. When the robot moves to an area with a high density of obstacles, D(n) in its surrounding environment will increase significantly, as \(D(n) \rightarrow 1\). Therefore, \(e^{\beta \cdot D(n)}\) will increase significantly to guide the path planning process away from areas with dense obstacles. When the robot moves into an area with a low density of obstacles, \(D(n) \rightarrow 0\). In this case, the heuristic function returns to the Chebyshev distance, thereby maintaining the efficiency of searching for the shortest path. The exponential function is used to achieve a nonlinear amplification of the density effect. Compared with the linear obstacle-density method, it addresses the problem of response hysteresis in high-density obstacle areas and insufficient risk differentiation in high-risk areas.

Algorithm 1
figure a

ODDEA* Algorithm

Computational experiments

The computational experiments utilize Python 3.11, running on an Intel i5-13600KF processor with 32GB of memory and a GeForce RTX 4070 graphics card. Three different scales of small, medium, and large two-dimensional grid maps are constructed in “The small-size map”, “The medium-size map”, “The large-size map” separately. The comparison analysis includes the Theta* algorithm27, the A* algorithm, the Bidirectional A* algorithm28, and the proposed ODDEA* algorithm. Each algorithm runs 20 times to obtain the average performance for comparison. Additionally, we generate 40x40 random maps 50 times for comparison. In the experiments, the proposed ODDEA* algorithm uses the parameters R is 2, \(\lambda\) is 0.5, and \(\beta\) is 2.0 for the small-size map, R is 2, \(\lambda\) is 0.6, and \(\beta\) is 3.0 for the medium-size map, and R is 2, \(\lambda\) is 0.7, and \(\beta\) is 3.0 for the large-size map.

The small-size map

The simulation results of different algorithms on a small-size grid map are shown in Table 1 and Fig. 4, and the best performance is highlighted in bold. Figure 4 presents the 5th path for each algorithm. For the planning time, the ODDEA* algorithm costs 62.44% of the A* algorithm. The Theta* algorithm produces the shortest path while requiring the second-least computation time. In terms of the number of expanded nodes, the traditional A* algorithm has a search coverage rate of 62.50% due to the invalid expansion in multiple directions in the search strategy of the heuristic function. In contrast, the ODDEA* algorithm based on the Chebyshev obstacle-density-weighted heuristic function expands only 76 search nodes on a 20\(\times\)20 map, which is 30.40% of the traditional A* algorithm.

Table 1 The small-size grid map (20\(\times\) 20).
Figure 4
figure 4

The simulation results of the small-size grid map (a) The Theta* algorithm 27. (b) The A* algorithm. (c) The BA* algorithm 28. (d) The ODDEA* algorithm.

The medium-size map

Table 2 and Fig. 5 demonstrate the simulation data of the algorithms for comparison analysis on a medium-size map. For the path length, the Theta* is 55.59, the traditional A* algorithm is 58.67, the ODDEA* algorithm is 62.18, and the Bidirectional A* algorithm is 59.84. The search time of the traditional A* algorithm is 12.18ms, while the search time of the proposed ODDEA* algorithm is 5.27ms, which is 43.27% of the traditional A* algorithm. The planning time of the Theta* algorithm ranks second only to the ODDEA* algorithm, and the Theta* algorithm achieves the shortest path length.

For the number of expanded nodes, the traditional A* algorithm has 1089 expanded nodes, which is 68.06% of the entire map. However, the proposed ODDEA* algorithm has only 214 search nodes, which is only 19.65% of the traditional A* algorithm, with a coverage rate of only 13.38%. For the Bidirectional A* algorithm, the number of expanded nodes is significantly reduced compared to the traditional A*, which is 58.86% of the traditional A*.

Table 2 The medium-size grid map (40x40).
Figure 5
figure 5

The simulation results of the medium-size grid map (a) The Theta* algorithm 27. (b) The A* algorithm. (c) The BA* algorithm 28. (d) The ODDEA* algorithm.

The large-size map

In terms of a large-size map, the path length is 90.47 for the traditional A* algorithm, 93.40 for the ODDEA* algorithm, 90.47 for the Bidirectional A* algorithm, and 84.91 for the Theta* algorithm. The planning time of the traditional A* algorithm is 36.10ms, while the ODDEA* algorithm takes 9.45ms, which is only 26.18% of the traditional A* algorithm and 58.70% of the Theta* algorithm. The Bidirectional A* algorithm takes 27.08ms, which is 75.01% of the traditional A* algorithm.

Considering the number of nodes to be expanded, the traditional A* algorithm’s number of expanded nodes reaches 2880, and the search coverage rate is 80.00% of the map, which consumes a lot of search space. The number of nodes expanded by the ODDEA* algorithm is only 315, and the search coverage rate reaches 8.75%, which is only 10.94% of the search coverage rate of the traditional A* algorithm. The Bidirectional A* algorithm’s coverage rate is also only 40.44%. The simulation results are indicated in Table 3 and Fig. 6.

Table 3 The large-size grid map (60\(\times\) 60).
Figure 6
figure 6

The simulation results of the large-size grid map (a) The Theta* algorithm 27. (b) The A* algorithm. (c) The BA* algorithm 28. (d) The ODDEA* algorithm.

Random maps

Each algorithm was used to generate 50 random maps on a medium-size grid map, and the average values of path length, planning time, expanded nodes, and search coverage rate were calculated, as shown in Table 4. Each algorithm has the same starting position (39, 0) and end point (0, 39), and uses the same heuristic function based on Chebyshev distance. The generated paths by each algorithm in the 20th and 40th maps are shown in Figs.7, 8, 9 and 10.

From the 50 random maps, the average path planning time for the proposed ODDEA* algorithm is 5.10ms, which is 41.26% of the A* algorithm, and it is the minimum planning time among the five algorithms. The average number of expanded nodes is 215.62, which is only 18.29% of the A* algorithm, and the coverage rate is only 13.48% of the map. The Theta* algorithm achieves the shortest path with 62.95% search coverage.

Table 4 40\(\times\) 40 random maps.
Figure 7
figure 7

The path generated by the Theta* algorithm in the 20th and 40th map.

Figure 8
figure 8

The path generated by the A* algorithm in the 20th and 40th map.

Figure 9
figure 9

The path generated by the BA* algorithm in the 20th and 40th map.

Figure 10
figure 10

The path generated by the ODDEA* algorithm in the 20th and 40th map.

Conclusion

The proposed ODDEA* algorithm dynamically adjusts the heuristic function based on obstacle density, and it guides the search direction to avoid invalid expansion. It can reduce the possibility of excessive redundant node expansion and has faster search ability than the traditional A* algorithm. The planning time of the ODDEA* algorithm is 53.87%, 55.54%, and 31.47% of the traditional A* algorithm in the small-size (20 \(\times\) 20), medium-size (40\(\times\) 40), and large-size (60\(\times\) 60) grid maps. For the search space, the ODDEA* algorithm only requires 30.40%, 19.65%, and 10.94% of the traditional A* algorithm in three different maps. For the 50 random maps, the average path planning time of the ODDEA* algorithm is 5.10ms, the average number of expanded nodes is 215.62, and the coverage rate is only 13.48%. Compared to the other algorithms (A*, BA*, Theta*) in the experiments, the ODDEA* algorithm has better performance in search ability.

However, the proposed ODDEA* may result in a longer path during planning, and its parameters need to be adjusted based on the environmental settings. In future work, reinforcement learning will be considered to enable the agent to choose the direction and strategy of movement through the perception of the surrounding environment and the current motion state of the robot, while the reward mechanism will be used to guide the robot’s behavior. By combining the global search capability of the improved A* algorithm with the dynamic adaptability of the reinforcement learning model, the neural network canbe trained to achieve fast convergence in complex environments.