An Improved Spherical Vector and Truncated Mean Stabilization Based Bat Algorithm for UAV Path Planning

Unmanned aerial vehicles have a wide range of applications. An intelligent optimization algorithm based on the traditional bat algorithm (BA) is investigated in this paper for UAV flight path planning in a static complex environment. The primary goal of this work is to develop a safer flight path while considering the feasibility of the UAV and the requirements for safe operation. This research proposes an improved spherical coordinate and truncated average stable strategy-based bat optimization algorithm (TMS-SBA). The algorithm uses the UAV’s motion space to encode the operator, and by substituting a new bat for the worst of the old one after each iteration to increase population diversity, the algorithm can converge quickly in a complex environment while maintaining stable operation. In addition, the flight path is smoothly generated by using B-spline curves to make the planned path suitable for UAV. MATLAB simulation experiments show that, compared with other traditional swarm intelligent algorithms, TMS-SBA can successfully generate feasible and effective optimal solutions in complex environments and plan shorter, safer, and more accessible flight paths for UAV.


I. INTRODUCTION
With the continued maturity of unmanned aerial vehicle (UAV) technology, it is now possible to deploy UAV to fulfill some challenging and hazardous tasks. In fact, UAVs play an important role in the military and daily lives of many countries. As a type of contemporary aviation equipment, the UAV has been extensively employed in several industries, including search and rescue, mapping, and forestry [1]. Path planning and optimization have always been crucial components of UAV operation throughout the history of UAV research. Flight path planning is usually described as an optimization problem. The UAV needs to find the shortest path with low cost, strong security, and high computational efficiency under various constraints, such as environmental The associate editor coordinating the review of this manuscript and approving it for publication was Qichun Zhang . and human threats. Traditional algorithms such as the A* algorithm [2], [3], the artificial potential field [4], [5], and linear programming [6] have been proposed by previous scholars to solve the problem of path planning. However, when these methods are used in UAV path planning, problems such as high computational complexity and easy falls into local minima will often occur [7]. Similarly, the complexity and threat of the flight environment also have an impact on UAV path planning.
It has been established that determining the optimal flight path can be regarded as an NP-hard problem [8]. In order to reduce the complexity of the problem, many researchers use a swarm intelligence algorithm to solve the path planning problem. Swarm intelligence (SI) technology is derived from research on the swarm behavior of social insects, represented by ants and bees [9]. It has good performance in solving various optimization problems in the real world, such as parameter estimation, neural network training, the knapsack problem, and so on. Various swarm intelligence algorithms inspired by nature have been developed, such as Genetic Algorithm (GA) [10], Particle Swarm Optimization (PSO) [11], [12], [13], [14], [15], Bat Algorithm (BA) [16], Artificial Bee Colony (ABC) [17], [18], Differential Evolution (DE) [19], and Grey Wolf Optimization Algorithm (GWO) [20]. These SI-based algorithms perform well in dealing with UAV reconnaissance paths while comprehensively considering complex terrain and other constraints to achieve global optimality.
However, these metaheuristic algorithms also have unavoidable problems. Here is a theorem called ''No Free Lunch'' (NFL), which was put forth by David H. Woolpert and William G. Ready in 1997 [21]. It has been logically proved that there is no single meta-heuristic algorithm that can perfectly solve all optimization problems. To put it another way, a particular swarm intelligence algorithm may be effective in resolving a particular optimization problem, but it is ineffective in resolving other optimization problems. In order to find a more ideal solution, people began to try to improve different intelligent algorithms to adapt to the UAV path planning problem. For example, [22] proposed a Voronoi graph-based vibration genetic algorithm to effectively solve the shortest path problem; [23] suggested an aging-based ant colony optimization algorithm (ABACO); and to address the path planning issue, [24] proposed the spherical vector-based particle swarm optimization algorithm (SPSO). Therefore, more and more algorithms have been discovered that can effectively solve the UAV path planning problem.
Recently, as one of the swarm intelligence algorithms, the bat algorithm (BA) has attracted scholars' attention due to its advantages in dealing with optimization problems. The Bat Algorithm [25] is an intelligent optimization algorithm based on the predation behavior and echolocation abilities of bats, first proposed by Xin-She Yang in 2010. BA can be used in many scenarios. Reference [26] mentioned the use of BA to detect brain abnormalities on magnetic resonance images. Reference [27] apply BA to the operation management of microgrid (MG). In [28], BA is used to solve the shop scheduling problem. The BA algorithm has been widely employed in many engineering procedures because it has a straightforward structure, fewer parameters, and superior robustness when compared to other intelligent algorithms. However, BA also has several drawbacks, such as a simple propensity to settle for the local optimal solution, which severely restricts BA's ability to advance. Therefore, some improvements to BA can improve the algorithm's performance to a large extent, so that the Bat algorithm can better adapt to the problem of UAV route planning. Reference [29] combined BA with the differential evolution algorithm (DE) to mutate bats using the evolutionary operator of DE. Reference [30] combined the artificial bee colony algorithm into BA to get the solution quickly. Reference [31] used the food search mechanism of the Drosophila algorithm (FOA) to improve the local search ability of BA. Reference [32] proposed a path planning problem using chaos strategy to improve BA, while [33] used bat algorithm to calculate multiple UAV. Compared with the traditional BA algorithm, these algorithms have a great improvement in solving singleconstrained UAV path planning but still need to consider the maneuverability characteristics and environmental factors of the UAV. In an environment of high dimensions, it is often difficult to use oneself to find the global optimal position. Similarly, the application of the BA algorithm to three-dimensional path planning is in its infancy, with few resources available. On this basis, a bat configuration space algorithm based on the truncated average strategy (TMS-SBA) is proposed. The algorithm uses the configuration space of UAV to encode, making it possible to generate the initial solution in the high-dimensional space quickly. At the same time, the truncated mean stability strategy was used to enhance the diversity of the bat population and improve convergence efficiency. When the algorithm falls into a local optimum, the expansion coefficient is introduced to expand the search space. The algorithm is easy to implement, and the effectiveness and robustness of the algorithm have been proven by numerical experiments. The main contributions of this paper are summarized as follows: 1) A spherical vector bat algorithm based on a truncated mean stability strategy was proposed to solve the problem of three-dimensional path planning for UAV. This algorithm can operate stably in the search space with many path nodes and has good convergence.
2) The precise expression of the objective function is given in order to address the problem of UAV flight safety. This function transforms path planning into an optimization problem and imposes constraints on the above problems. The B-spline strategy is used to smooth the path curve. 3) In comparison to other conventional algorithms, the TMS-SBA approach produces better experimental results when used to solve the UAV path planning problem. The remainder of this essay is organized as follows: the UAV route planning problem, including route representation, objective function, and various restrictions in practical circumstances, is discussed in Section 2. Section 3 explains the basic principle of the bat algorithm. The detailed implementation of the proposed TMS-SBA algorithm is described in Section 4. Section 5 provides a comparison between the classical algorithm and the experimental results. Finally, the sixth part summarizes the whole paper and looks forward to future work.

II. MATHEMATICAL MODEL IN UAV PATH PLANNING
Path planning is a crucial part of UAV safe route planning, which is utilized to identify the best flying path while keeping in mind restrictions such as terrain height, radar threat, smoothing cost, fuel, and the shortest path. The objective function and mathematical model of it can be explained as follows: VOLUME 11, 2023 A. FLIGHT PATH REPRESENTATION In the three-dimensional frame Sg − OXYZ , the origin of coordinate O is placed at a certain point on the ground, and the X , Y , and Z axes are taken as three orthogonal directions, with the X and Y axes being on the horizontal plane and the Z axes being on the vertical direction. The beginning point and target point are denoted by the points S(x s , y s , z s ) T and T (x t , y t , z t ) T , respectively. On the basis of satisfying the constraints, route planning will then produce a secure path from S to T . A point set formed of N path nodes except S and T , that is, L = (S, P 1 , . . . P N , T ), can be used to represent the UAV route. Because the UAV can generate multiple paths, each path L i corresponds to N waypoints, and each waypoint has a path node with the coordinates P ij = (x ij , y ij , z ij ) on the search map. So we can have two paths of the Euclidean distance between nodes as D ij = − −−−− → P i.j P i,j+1 .

B. OVERALL COST FUNCTION
By taking into account the optimality, efficiency, and safety criteria connected to a path L i , the overall cost function can be constructed as follows: where ω k is the weight coefficient, and F 1 (L i ) to F 3 (L i ) are the costs associated with fuel, threat, and flight height, respectively. The decision variable is L i , which includes a list of n waypoints P ij = (x ij , y ij , z ij ). The following is a detailed breakdown of how various cost functions are calculated:

1) FUEL COSTS
Considering the constraints of optimal path planning for UAV, we assume that the fuel cost per unit distance is the same, so the fuel distance and path length are positively correlated, and the related cost function F 1 (L i ) can be expressed as (2), where ρ i is fuel consumption per kilometer.
2) THREAT COSTS When discussing UAV path planning, it is unavoidable to bring up the threat situation. For some complex and changeable terrain, there are often multiple threats, such as radar, climate, and missiles. These threats will affect the safe operation of drones. Assume that all threats are included in the set K , and that each threat is represented by a cylinder with a unique radius, the central coordinate of which is C k (as shown in Fig.1). Equation (3) represents the likelihood of different dangers to the UAV: (3) where the threat probability posed by the UAV's kth threat source is P k (d k ). The length between the UAV and the threat source is indicated by d k . Minimum and maximum ranges of the threat are d kmin and d kmax , respectively. The associated threat cost for a given path segment is proportional to its distance, d k , from C k . Each path is separated into an average of five segments for convenience of calculation, and the threat cost is determined separately for each discrete segment of each path. The hazard cost for this segment is predicated on the average value of the discrete segments. We may determine the price using the following (4): In the equation above, u stands for the number of threatening circles, d m,k (j) denotes the distance between the kth threat center and the mth point on the segment.

3) ALTITUDE COSTS
Flight height is often restricted to two extremes: minimum altitude and maximum altitude. This is because in some military applications, UAVs must hide behind the landscape and cannot fly too high, but they also run the risk of collapsing into mountains at low altitudes [24]. The minimum height depends on the terrain. The likelihood of the UAV being destroyed is 1 if its flying height is lower than its peak height; conversely, it is 0. Let the minimum and maximum heights be h min and h max , respectively. A waypoint P ij associated altitude cost is calculated as follows: where h ij is the flight altitude relative to the ground. In this paper, the altitude is restricted by setting a penalty item so that it can always maintain a relatively stable state and avoid the collision caused when the flight altitude is too low. Sum H ij over all waypoints to get the height cost: Given the need to generate a UAV-safety route, this paper introduces yaw and pitch angle constraints to constrain the UAV's path: In this formula, ψ max is the maximum pitch angle, and φ max is the maximum yaw angle, and ψ k and φ k are respectively the pitch angle and yaw angle of the waypoint P k . Under the above definition, the cost function F is completely determined and can be used as input in the path planning process, which is conducive to the calculation of the simulation experiment below.

III. CLASSICAL BAT ALGORITHM
The classic bat algorithm is a swarm intelligence algorithm. The social interactions of bats and their use of echolocation for hunting and avoiding obstacles served as the basis for their search approach. In addition, the bat algorithm is a promising method that, to some extent, combines the benefits of the PSO and GA algorithms [34].
Some bats in the wild use their sight and smell in addition to echolocation to locate food and avoid predators. Even the sounds and frequencies that bats produce are dynamic. The purpose of this paper is to study and simulate the flight path of the UAV in three-dimensional space, so this paper idealizes some of the echoic characteristics of bats for the sake of simplicity, assuming that their movements are entirely echorelated and that they can automatically change the wavelength and frequency of their transmitted pulses when in pursuit of prey. They fly at position X i with a speed of V i . Let a fixed frequency of f min , a loudness of A 0 , and a pulse frequency of r ∈ [0, 1] that is constantly adjusted according to the distance from the target. It is important to note that loudness is not a fixed value, it ranges from the smallest constant, A min to A 0 . The revised formula for the velocity V t i , frequency f i , and position X t i of the ith bat in a state with time step t is as follows: The best solution to the current time step is X w . Where β ∈ [0, 1] is a random value.Frequency is a random constant. Regarding the local search section, it uses a random number where A t is the average loudness of all bats at time step t and the random number ε ∈ [−1, 1]. Equations (14) and (15) are used to update when the fitness f (X t i ) is smaller than the fitness of the current optimal solution f (X w ): where α, ι, r 0 are constants. Based on the analysis above, Fig.2 and Algorithm 1 describe the main portion of the traditional bat algorithm.

IV. IMPORVED BAT ALGORITHM
The standard BA algorithm is enhanced in order to find the global optimal solution of the BA more quickly and precisely, and a spherical coordinate system is constructed to solve the flight path based on the maneuvering characteristics of the UAV configuration space, thus significantly reducing the search space. On the other hand, considering that the BA algorithm is still unable to overcome the problem of falling into local optimality when solving optimization problems, the truncated mean problem strategy is adopted in this paper to replace bats with the worst fitness values to increase the diversity of the population.

A. CONFIGURATION SPACE CODING
When determining the three-dimensional path of a UAV, the swarm intelligence algorithm frequently searches in the cartesian coordinate system, which is inefficient and difficult to solve the constraint conditions. The configuration space of the UAV can be regarded as a spherical space; therefore, the main function of using the spherical vector in the BA algorithm is to represent the attitude of the camera. The amplitude, elevation, and azimuth components of the UAV in the configuration space are used to limit the speed, yaw angle, and pitch angle of the UAV, and the relationship between path points is used to reduce the search space and accelerate the convergence. The complexity of UAV flying is decreased, and the convergence rate is accelerated by addressing the problem in configuration space and mapping it to cartesian space. We encode each path L i for the UAV flight path L = (S, p 1 , . . . , p N , T ) stated in Part 2.1, where P ij = (x ij , y ij , z ij ) is the number of waypoints on the path L i , and N trajectory segments make up the path. A spherical coordinate system is constructed for P ij , including amplitude r, elevation ψ, and yaw angle φ.
The formula for the conventional spherical coordinate transformation is given in (16), where d ij stands for the sphere's radius. On the basis of this, spherical coordinates are created for each path node, turning it into a distinct entity.
x ij = d ij sinψ ij cosφ ij y ij = d ij sinψ ij sinφ ij z ij = d ij cosψ ij (16) As shown in Fig.3, a sphere is constructed on each path node, where r is the amplitude of the UAV, which is related to both the sphere radius of the path node and the path length. The three elements of each waypoint P ij = (r ij , φ ij , ψ ij ) are Algorithm 1 Classical BA Algorithm Require: Ensure: Initialization. Set the generate counter t = 1, the amount of bat populations np, initialize A 0 , V 0 , r, and the maximum number of iterations T max . Get the fitness of each bat f (X 0 i ). for t = 1 : T max do for i = 1 : np do Update frequency by (10); Update bat speed by (11); Update bat locations by (12); if rand 1 > r t i then Produce a new solution X new instead of X t ;  bound in the following ways to adhere to the prior limitations: where φ max and ψ max are the maximum angles of yaw and elevation, respectively. Then, for a complete path L, it is expressed in the form of a spherical coordinate sequence as shown in (18).
Since the UAV is in configuration space, its velocity also has three components related to spherical coordinates. To limit the bat speed at each path node, we can similarly set upper and lower bounds on the UAV speed, as shown in (19): where α is a random number on [0,1]. We denote the spherical vector of the waypoint on L i as xS and the velocity update as vS, then the iterative equation of a bat's velocity and position at time step t can be updated as follows: Calculating the fitness value, which is the corresponding cost function of each path, is important when determining the individual and global optimum of the bat population. At this point, the flight route computed above must be remapped to cartesian space. Due to the interdependence of path nodes, the following formula can be used to determine the decoding mode of each path node coordinate: Based on this, we obtained the basic principle of the SBA algorithm, which is more conducive to dealing with angle and velocity constraints between adjacent path nodes. This algorithm enables individual bats to converge to the optimal position faster but also faces the problem of falling into local optimality. In view of this situation, the algorithm was further improved in this paper.

B. STRATEGY FOR TRUNCATED MEAN STABILIZATION
The SBA algorithm is produced in the analysis above by solving the BA algorithm in a spherical coordinate system. To address the issue of bat populations being prone to falling into local optimum, a population stabilization strategy was proposed to increase population diversity while avoiding falling into local optimum. The purpose of the truncated mean stabilization strategy is to compute the sample average by removing the same number of extreme values from both ends of the sample. Without reducing the number of samples, this method can replace the worst sample value. The number of samples to be eliminated is usually a percentage of the sample or a fixed number. Reference [35] proposed a multi-scale quantum harmonic oscillator algorithm based on a truncated average stabilization strategy. The algorithm demonstrated that it is possible to broaden the diversity of particles by employing the truncated average strategy. Therefore, this paper used it to develop a new algorithm (TMS-SBA).
First of all, the SBA algorithm is used to obtain the location, speed, and other specific information of the bat population, then the fitness value of each bat is sorted, a certain proportion of bat individuals are selected to obtain the average value of their positions, and the bat individuals with the highest fitness, namely the so-called worst bats, are replaced. As the number of iterations increased, the bats with the worst fitness scores were replaced each time, increasing the diversity of the population. The fitness value here can be replaced by the cost function: Let X = (X 1 , X 2 , . . . , X T max ), where X i is the set of bat population position vectors after the ith iteration, then the specific strategy to truncate the average stability is as follows: Mark the location of the bat population as b 1 , b 2 , . . . , b np after one iteration X . Each bat's fitness value is determined; sort it from smallest to largest, and the one with the highest value is designated as b worst , and we get b 1 , b 2 , . . . , b worst . After selecting a random value β ∈ (0, 1), the number of bats we choose to intercept can be set to k. Here is the formula for calculating k: where np is the number of bat populations, then the position of the truncated particle is going to be b k , b k+1 , . . . , b np−k . So the truncated average vector of the bat's position can be obtained by: We replace b worst with b replace , and the new bat position vector obtained can be written as b 1 , b 2 , . . . , b replace . Figure 4 shows the flow of truncating the mean stability policy. Through iteration after iteration, a new bat is generated each time without regard to locally optimal information. The bats with the worst fitness in the bat population are replaced each time, so as to increase the bat population, improve the convergence performance of the algorithm, and reduce the possibility of the algorithm falling into the local optimal to a certain extent.
Similarly, considering an extreme case where the algorithm's fitness value does not change over multiple iterations, it means that the algorithm is falling into local optimality and all bat individuals have the same fitness value. In this case, this paper adopts a strategy of expanding the search space. Initialization. Set np, T max , A 0 , V 0 , r, the generate counter t = 1, and constant b limit = 0. Get coordinate information for the search map. for i = 1 : np do Create an initial path L 0 inew in a spherical coordinate system, where the number of path nodes is the search space dimension D.
The cost function f for each bat is calculated in Cartesian space and set to the fitness value. Initializes the global optimal location. end for for t = 1 : T max do for i = 1 : np do The speed and position of each bat are calculated on the UAV configuration space.
Update the velocity and position by (20) and (21) if rand 1 > r t i then Get a new solution X new ; end if The position information is mapped to the Cartesian coordinate system using (22), and then calculate the new solution's fitness The path cost is calculated by greedy criterion and the original path is replaced by the optimal path.
Update the optimal solution end for Choose the optimal solution as the final result. Save the best path associated with the global optimal solution L new End The detection is performed after each iteration of the algorithm. If b replace = b worst , expanding the search space with the aid of the expansion coefficient w [35] may aid in the population's departure from the local optimal. The primary component of TMS-SBA is described in Fig.5 and Algorithm 2.

V. RESULT A. PATH SMOOTHING
When the TMS-SBA method is used to address the UAV route planning problem, considering that the generated path is usually difficult to fly accurately, the B-spline curve smoothing strategy is adopted to dynamically smooth the flight path. B-spline is a generalization of Bessel curves, allowing us to build accurate models for more general geometry. The B-spline curve has many excellent properties, such as geometric invariance and convexity preservation. Similarly, it only needs a few variables to define the complex curve path. Suppose there are n + 1 control points c i (i = 0, 1 . . . , n) and a node vector u, b-spline curve can be defined as: where M i,k (u) is B-spline basis function of degree k, also called harmonic function, its recursive formula can be expressed as follows: (27) The smoothing of the path using the B-spline approach is shown in Fig.6. Because the degree of the polynomial cannot be raised no matter how many points are added, the B-spline is better suited to dealing with three-dimensional path problems than the Bezier curve.

B. UAV PATH PLANNING PROBLEM
In this section, the TMS-SBA algorithm is simulated in a three-dimensional environment. Not only the parameters of the algorithm are compared and analyzed, but also the TMS-SBA algorithm is compared with other traditional evolutionary algorithms to verify the feasibility and effectiveness of the algorithm in UAV path planning. In addition, the software used in this paper is MATLAB R2018a, and the experimental simulation is carried out under the computer processor Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz,.80GHZ, 64-bit Windows 10 operating system. This work constructs four three-dimensional flight scenes, namely three simple flat terrain scenes and one relatively complex scene, in an effort to simulate the real flight environment as closely as possible. Data clusters are employed in complex situations to replicate the altitudes of mountains and establish the range and quantity of threats depending on geographic information. This paper first discusses the algorithm's performance in a simple environment. Setting the start node S(200, 100, 0) and target node T (800, 800, 150) of all paths. For comparison, set the maximum number of iterations to 200. We conducted 50 simulation tests on each algorithm to ensure the accuracy of the experiment. Table 1 shows the threat center and radius of the three threat areas in a simple environment, according to the hypothesis. The threat area is set as a cylinder, which the UAV cannot circumnavigate. Because the terrain is relatively flat, the flight parameters are set as h min = 0, h max = 200. The drone mission area is 1,000 kilometers long and 1,000 kilometers wide. Table 2 shows the comparison results between the TMS-SBA algorithm and the BA, PSO, and ABC algorithms in the simple environment. Where n is the number of control path nodes. Mean, std, worst, and optimal represent the average fitness value (average cost function value), standard deviation, worst fitness value, and optimal fitness value, respectively. Fig.7-Fig.9 shows the optimal UAV route generated by the above four algorithms in scenarios 1, 2 and 3, respectively, in n = 10 and 50 independent operations. Part (a) shows a three-dimensional view of the drone route in the digital terrain, where the cylinder represents the threat area. Part (b) is a two-dimensional top view of (a) in the contour map. As can be seen, all algorithms can generate viable paths that meet the path length, threat, height requirements, and constraint requirements. However, their optimality varies from scenario to scenario. It can be observed that scenario 1 has good convergence for the four algorithms due to the small number of threat areas, with slightly different fitness values. The average of the total running time of each algorithm on all functions is regarded as the average running time, due to the existence of truncated mean strategy and spherical coordinate transformation, the CPU running time of TMS-SBA is slightly slower than that of the other three algorithms. The PSO algorithm has the best performance when generating a simple path, and the average cost function value is 480.2139.
In scenario 2, we slightly increased the number of threat areas in the space, making the whole search space complicated. As can be seen from Fig.8, TMS-SBA generated VOLUME 11, 2023    a feasible path with the minimum cost function, the average fitness value was 487.7242, and the standard deviation of the algorithm was 8.093, showing good performance. While the results of BA, PSO, and ABC can better meet the path planning requirements, PSO is more likely to fall into the local optimal value during an iteration, which will result in additional threat costs; the ABC algorithm's convergence speed is sluggish. At the same time, in 50 experiments, BA is easy to fall into the local optimal solution and cannot jump out, so the worst fitness value is 1023.137. The  standard deviation of the BA algorithm is the largest, and its performance is not stable.
In Scenario 3, we set up nine threat areas, which made it much more challenging to search the region. It can be seen that TMS-SBA can develop the initial solution quickly and can approach the ideal solution with an average fitness value of 489.6649. However, as the threat area grows, PSO and BA's ability to find the best solution suffers, and they become more vulnerable to the impact of extreme values in their own populations. The ABC algorithm tends to generate more average pathways as a result of the compromise between various bee types; hence, the performance is decent. Meanwhile, in scenario 3, the time to initialize the path increases due to the complexity of the environment. Since TMS-SBA is generated in the spherical coordinate system of the UAV, and the coordinates of each path node are related to each other, the time to generate the initial solution is much shorter than the other three algorithms. The results show that TMS-SBA can reach the optimal value in most cases.
In order to make it easier for us to observe the behavior of the variables more precisely, Fig.10 displays the change curves of the fitness values of the four algorithms with each iteration. It is clear that the four algorithms function well in scenario 1's comparatively straightforward context. The quality of the solution, however, degrades as the scene's complexity rises due to PSO's shortcomings in global search. The population of BA is also vulnerable to early convergence because of the existence of super bats. Although ABC can find the average path, the convergence happens slowly. Finally, the TMS-SBA algorithm has more advantages in the search space since it is stored in a spherical coordinate system and is directly bound by the turning angle in the cost function. Additionally, TMS-SBA avoids the scenario of premature convergence to the precocity solution like BA and increases the diversity of the population by truncating the mean stability strategy, making it perform well in most situations. Fig.11 shows the box diagram of the four algorithms in 50 experiments. It can be seen that TMS-SBA produces the fewest outliers, is more stable overall, and performs well in most cases.
The effects of each variable on the functionality of the TMS-SBA algorithm should be discussed. The algorithm proposed in this paper is based on multiple variables, in which the spatial dimension, the number of iterations, and the number of populations all have an impact on the optimal path of the algorithm. Therefore, we carried out experiments to VOLUME 11, 2023   analyze the influence of each parameter on the algorithm. We chose BA for comparative analysis in the comparison experiment because TMS-SBA is an improvement over BA, and we let the two algorithms choose the same parameters and other algorithms for auxiliary comparison. Scenario 2, of moderate complexity, is used as an example for clarity. Table 3 shows the impact of different iterations on the overall change. As can be seen from the data in Fig.10 and table, TMS-SBA can find a better solution after about 50 iterations, while BA and PSO perform generally, because they are easy to fall into local optimals and not easy to get rid of, and the convergence speed of the ABC algorithm is slow. In summary, the TMS-SBA algorithm has a significant advantage in convergence speed. Table 4 shows the influence of different population numbers on the algorithm, and the number of iterations is set to 200. It can be seen that with the increase in population, the ability of TMS-SBA and BA to find the optimal solution becomes stronger, but the required iteration time also increases. For BA, with a population size of 50, it is easy to fall into the limitation of local search solutions, resulting in the illegal finding of appropriate paths. For TMS-SBA, the phase strategy can make it jump out of the influence of a larger  fitness value and make the search for solutions more stable. In this paper, if the impact of time cost is taken into account, better results can be obtained faster if the population is set at around 200, and 200 to 500 is more appropriate if a solution of higher quality is to be obtained stably.    Table 5 shows the effect of different path nodes n on the algorithm. What you need to know is that the dimension of the search space depends on n, which is d = 3n. From table 5, as you can see, the four algorithms have basically the same search ability in low-dimensional space. Because BA, PSO, and ABC have weak searching abilities in highdimensional space, with the increase of path nodes, the optimal path is often unable to be generated or only a poor path can be generated. On the other hand, due to its own coding characteristics, the convergence rate of TMS-SBA is almost not affected, and it performs well in high-dimensional space.

3) NUMBER OF PATH NODES
Similarly, this paper analyzes algorithm performance in complex environments. The data cluster is employed in the search space to imitate the height of a mountain, and the threat area is set in accordance with the topography. Table 6 displays the related values. The range of height constraints for UAVs expands as the complexity of the terrain does. Table 7 shows the results after 50 independent runs of the four algorithms, in which the number of iterations is set to 200, the population is set to 500, N = 10, the start node S = (200, 200, 0), and the target node T = (800, 800, 150). The flight height at this time is h min = 100 and h max = 300. As you can see, TMS-SBA can generate a good flight path while avoiding the impact of threat areas and mountain heights. Due to the limitation of the flight height, it is more difficult for PSO, BA, and ABC to generate the optimal path, and the path cannot be generated, which can also be seen from the data of the standard deviation. Fig.12 and Fig.13 show the threedimensional image and top view of the UAV route generated by four algorithms in a complex environment. It can be seen that the path of TMS-SBA is more stable and smooth than that of other traditional evolutionary algorithms. Fig.14 shows the convergence curves of the four functions. The convergence rate of TMS-SBA is fast enough.
Finally, it is necessary to discuss the influence of the truncated mean stability strategy on the algorithm. We run TMS-SBA and SBA without a truncated mean stability strategy in parallel in the same environment. The conditions of other parameter variables are unchanged, and the initialization paths of the two algorithms are the same. Fig.15 shows the convergence curves of the two algorithms in the same environment. It can be seen that, compared with SBA algorithm, TMS-SBA algorithm can generate optimal fitness value path in most cases, while SBA algorithm is easy to fall into local optimal value, resulting in unstable results. TMS-SBA may occasionally be affected by local solutions, but in the process of iteration, bats with the worst fitness values are replaced by bats with an average fitness value, which increases the diversity of the population and thus can avoid falling into a local optimal state in most cases.

VI. CONCLUSION
In this study, we propose an improved TMS-SBA algorithm to solve the path planning problem of UAV, so that the UAV can obtain a safe and non-collision optimal path. The algorithm is based on a combination of the UAV's own motion space and search space. Meanwhile, a new truncated mean stability strategy is designed in this paper, which maintains the diversity of the population in the iterative process, improves the convergence performance, and prevents the algorithm from falling into the local optimal solution. This paper tested the performance of the algorithm in different threat areas and flight altitudes through four different scenarios and compared it with the performance of the classical evolutionary algorithms such as PSO, BA, and ABC. Experiments show that TMS-SBA can find the best flight path location information in most cases, and the performance is significantly better than the traditional evolutionary algorithm when there are more path nodes.
The algorithm parameters are compared and analyzed in this paper. As the population size grows, the algorithm's iteration time inevitably grows, and as the number of path nodes rises, the algorithm's stability also declines. TMS-SBA can perform stable and efficient computation in high-dimensional space. In terms of function optimization, TMS-SBA can produce better results with a lower standard deviation when compared to ABC, BA, and PSO. The flight scenario set forth in this paper can effectively make the UAV avoid the threat area. However, because the design in this paper cannot go over the top of the threat area in the face of a dense mountain and jungle environment, the path cost must be generated. At the same time, in contrast to other methods, the algorithm's general applicability isn't as great because it was created to take into account the features of the UAV configuration space. Therefore, further improvement is needed in the future work. In the following work, we will also extend our research to the problem of multi-UAV collaborative route planning.
MENG YANG is currently pursuing the master's degree with the School of Science, University of Shanghai for Science and Technology. His research interests include recommendation systems, optimization algorithms, and artificial intelligence. VOLUME 11, 2023