Dynamic adaptive security path planning based on A* algorithm

Aiming at the problems of large memory consumption, long operation time and low security of traditional A * algorithm, a dynamic adaptive improved algorithm based on A * algorithm is proposed. Firstly, according to the heuristic function of the proportion of obstacles in the map, the adaptive dynamic weighting is carried out to shorten the search time. Secondly, the jump point search (JPS) algorithm is integrated to remove a large number of redundant points and improve the running speed of the algorithm. Finally, according to the relative position of the starting point and the target point, the obstacles are expanded dynamically to keep a safe distance between the planned path and the obstacles. In order to verify the effect, the improved algorithm is tested in different sizes and different proportion of obstacles. The results show that the improved algorithm is efficient and safe in global path planning.


Introduction
Mobile robot technology was a hot research field in recent years and the system was usually composed of environmental perception, decision making and planning, behavior control and execution and other modules [1]. In decision making and planning module, path planning problem has long been the attention of the researchers, and become one of the hot research areas.
Path planning is given a known or unknown environment, planning out a path from starting point to target point without collision safety, generally can be divided into the global path planning [2][3][4] and local path planning [5][6][7]. This paper mainly studies the global path planning based on A * algorithm. Dijkstra algorithm is a typical single-source shortest path algorithm. Although this algorithm can search the optimal path, its efficiency is very low. Reference [8] proposed the JPS algorithm, which reduced a large number of redundant points generated by the traditional A* algorithm and improved the running speed. However, the security of the path could not be guaranteed and the path might not be the optimal path. Reference [9] proposed the algorithm of static weighting and JPS fusion, which accelerated the search speed, but the path security performance was low. Reference [10] improved the heuristic function and shortened the path length, but the running time was longer. Reference [11] proposed the SD-JPS algorithm, which guaranteed the path security by introducing the node domain matrix, but increased the running time of the algorithm.
To sum up, this paper proposes an improved A* algorithm based on the traditional A* algorithm, which performs adaptive dynamic weighted processing according to the heuristic function of the proportion of the number of obstacles in the map. The obstacles are dynamically expanded and the JPS algorithm is fused to reduce redundant points, so a path with high safety performance can be obtained quickly. Finally, the risk assessment function is used to evaluate the security of the path and the experimental simulation results verify the security and reliability of the proposed algorithm.

Introduction to the traditional A* algorithm
The principle of the traditional A* algorithm is to continuously access the nodes surrounding the current point from the starting point, add the surrounding nodes to the set of nodes to be scanned, calculate generation value of the node and update the node with the smallest generation value that is the current node, and then repeat the previous process until the target node is found. Its cost function is shown in Eq. (1): Where, n represents the node currently evaluated, f(n) represents the total cost function of the current node, g(n) represents the cost function from the starting point to the current evaluation node, and h(n) represents the cost function from the current evaluation node to the target point.
In general, the number of nodes evaluated by the traditional A* algorithm is relatively large, and the overall efficiency is low. When planning the path, many redundant points will be generated.

Dynamic adaptive weighting
Since the heuristic function of the traditional A* algorithm has a significant impact on the number of nodes to be evaluated, this paper weighs the exploratory function dynamically. When the current point is far from the target point, it moves faster to the target point. When it is close to the target point, it dynamically adjusts weighting, reduces job expedition and improves search range. The optimization process is as follows: h(n) is dynamically weighted by exponential function, and the processed function is expressed by h(n), as shown in Eq. (2): When the value of m increases, the value of H(n, m) will become smaller and the enlightening of the function will decrease. When the value of m becomes smaller, that is, the proportion of obstacles on the map decreases, the heuristic function increases, and the search efficiency improves.

Building an environment map
In the research field of mobile robot, there are many methods of environment map construction, which can be roughly divided into the following types: geometric map, topological map, grid map and hybrid map. This paper uses this method to construct the map, as shown in Figure 1. The black networks represent obstacles and the white networks represent areas that can be crossed.
During the operation of mobile robot, there are usually 4 or 8 neighborhood moving directions. In order to ensure the precision and flexibility of mobile robot movement, this paper adopts the 8neighborhood movement direction, as shown in Figure 2.

Search strategy
In the traditional A* algorithm, the number of nodes evaluated is influenced by the heuristic function h(n). In order to reduce the time of path planning, this paper integrates JPS algorithm, reduces the number of evaluation nodes and search area, and improves the operation efficiency. The flow chart of the improved algorithm is shown in Figure 3.

Security performance
In the moving robot's trajectory planning, with the trajectory speed and length planning, the trajectory safety is also more important. The obstacle widening method is a way to improve lane safety performance. In this paper, the obstacles are expanded dynamically according to the relative positions of the start point and target point to reduce space occupancy. The effect is as shown in Figure 4.   Figure 4. denotes the starting point, with coordinate (xs, ys). The triangular grid denotes the target point, with coordinate (xe, ye). The black grids denote obstacles, and the coordinates are (xo, yo). The gray grids denote the expansion. If ys = ye, as shown in Figure 4 (a), the grids at (xo -1, yo) and (xo +1, yo) are expanded. If xs = xe, then the grids at (xo, yo-1) and (xo, yo+1) are inflated. As shown in Figure 4 (b), xs -xe < 0 and ys -ye < 0, the grids at (xo -1, yo) and (xo, yo-1) are expanded. If xs -xe < 0 and ys -ye > 0, then the grids at (xo -1, yo) and (xo, yo+1) are expanded. Similarly, the other two directions are expanded in accordance with this method. The improved path basically keeps a safe distance from obstacles, which reduces the risk of collision and improves the safety performance. In order to evaluate the risk degree of mobile robots colliding with obstacles, this paper adopts the twodimensional Gaussian model [12] to establish a risk assessment function to evaluate the safety of the planned path. The function is shown in Eq. (5): Where, W represents the risk coefficient, M represents the total length of the path, N represents the total number of obstacles within the influence range of the path, δ(xc, xobs) represents the distance between each node in the path and the obstacles within the influence range of the node, and d represents the influence range of each node, The range representing the eight fields around the node. α and β represent the material parameters of the mobile robot and the obstacle. In this paper, α = 1, β = 2.

Simulation experiment and analysis
The simulation experiment in this paper is carried out on an Intel(R) Core (TM) i5-10400 six-core CPU and 8G RAM computer. In the process of experimental simulation, the algorithm running time, the number of nodes to be evaluated, the path security performance and the path length are compared. Taking the map size of 80  80 and the obstacle proportion of 15% as an example, the path comparison between the improved algorithm and the traditional A* algorithm is shown in Figure 5.
(a) Improved algorithm for path planning.
(b) Traditional A * path planning. Figure 5. Comparison chart of path planning. The blue grid denotes the final generated path and is marked with red lines, the orange grid denotes the nodes added to the Closed List, the light gray grid denotes the nodes added to the Open List, and the dark gray grid denotes the nodes where the obstacles have expanded. The upper left grid is the starting point and the lower right grid is the target point. The traditional A* algorithm takes 99.83ms to plan the path, the path length is 102, the number of evaluated nodes is 3069, and the risk coefficient is 31.92. The path planning time of the improved algorithm is 8.72ms, the path length is 109, the number of evaluated nodes is 39, and the risk coefficient is 24.09. Although the path length of the improved algorithm is 6.86% higher than that of the traditional A* algorithm, the running time, the number of evaluated nodes and the risk coefficient are reduced by 91.27%, 98.73% and 24.53% respectively. The efficiency and security of the planned route is improved, so the planned route is better.

Running time
The comparison of the running time of the traditional A* algorithm, JPS algorithm and the improved algorithm is shown in Figure 6. The red, green and blue bar charts represent the map sizes of 20×20, 40×40 and 80×80 respectively. In general, the running time of the improved algorithm in the three environments is lower than that of the traditional A* algorithm and JPS algorithm, especially with the growth of map size, the running efficiency of the improved algorithm is significantly improved.

Risk coefficient
The risk coefficient comparison among the traditional A* algorithm, JPS algorithm and the improved algorithm is shown in Figure 7. The red, green and blue bar charts represent the map sizes of 20×20, 40×40 and 80×80 respectively. In general, as the map size increases, the risk coefficient of these three algorithms increases, but the improved algorithm is always lower than the traditional A* algorithm and JPS algorithm.

Evaluation nodes
The comparison of evaluation nodes of traditional algorithm, JPS algorithm and improved algorithm is shown in Figure 8. In the Figure, the red, green and blue bar charts represent the map sizes of 20×20, 40×40 and 80×80 respectively. On the whole, the number of evaluation nodes increases with the growth of map size, and the number of evaluation nodes of the improved algorithm is generally smaller than that of JPS algorithm, much smaller than that of the traditional A* algorithm, which greatly reduces the memory overhead.

Path length
The comparison of path length among the traditional algorithm, JPS algorithm and improved algorithm is shown in Figure 9. In the Figure, the red, green and blue bar charts represent the map sizes of 20×20, 40×40 and 80×80 respectively. The results show that the optimized algorithm's path length is not shorter compared to the traditional A* algorithm and the JPS algorithm, but the overall performance is slightly better.

Conclusions
The search efficiency of the traditional A* algorithm is low, which results in a large number of redundant points, especially in the large map. When the number of obstacles increases, the safety of the path cannot be guaranteed. In this paper, an optimized A* algorithm is proposed to improve the heuristic function