Abstract
In this paper, a lens learning sparrow search algorithm (LLSSA) is proposed to improve the defects of the new sparrow search algorithm, which is random and easy to fall into local optimum. The algorithm has achieved good results in function optimization and has planned a safer and less costly path to the threedimensional UAV path planning. In the discoverer stage, the algorithm introduces the reverse learning strategy based on the lens principle to improve the search range of sparrow individuals and then proposes a variable spiral search strategy to make the follower's search more detailed and flexible. Finally, it combines the simulated annealing algorithm to judge and obtain the optimal solution. Through 15 standard test functions, it is verified that the improved algorithm has strong search ability and mining ability. At the same time, the improved algorithm is applied to the path planning of 3D complex terrain, and a clear, simple, and safe route is found, which verifies the effectiveness and practicability of the improved algorithm.
1. Introduction
In recent decades, swarm intelligence algorithms have been gradually explored by researchers. The main principles of these algorithms are mostly to solve some optimization problems by simulating or revealing some natural phenomena or processes, such as Particle Swarm optimization (PSO) [1], Grey Wolf Optimizer (GWO) [2], Beetle Swarm Optimization (BSO) [3]. The sparrow search algorithm (SSA) is a group of intelligence algorithms proposed by Xue and Shen [4] in 2020 to simulate the feeding process of sparrows. It has few parameters, simple principles, and easy implementation and is superior to other algorithms in many optimization functions. However, for some complex optimization problems, the algorithm has some problems, such as low search accuracy and slow convergence rate. After the sparrow search algorithm was put forward, many scholars studied and applied it carefully and made improvements. Xin et al. [5] proposed a chaotic sparrow search algorithm (CSSA), which uses tent mapping based on random variables to initialize the population, so as to make the individual position of sparrows more evenly distributed and improve the diversity of the population; in the process of optimization, disturbance and mutation mechanism are used to prevent the algorithm from falling into the local extremum state and improve the global search performance of the algorithm. The effectiveness and feasibility of the algorithm are verified by 12 test functions and image segmentation problems. In addition, they also proposed an improved sparrow search algorithm for image segmentation [6]. Bird swarm algorithm (BSA) [7] is used to optimize the sparrow search algorithm. The benchmark function and multithreshold image segmentation based on interclass variance and Kapur’s entropy verify that the improved algorithm has strong search ability and development ability. Mao et al. [8] proposed an improved sparrow search algorithm which combined Cauchy mutation and reverse learning. At first, a sin chaotic mechanism with infinite folding times is used to initialize the population, and the global optimal solution of the previous generation is introduced into the position updating formula, which speeds up the information exchange of the algorithm. At the same time, the adaptive weight strategy is introduced to coordinate the local and global search ability. Then, the fusion of Cauchy mutation and reverse learning strategy is introduced to make disturbance mutation in the optimal position to produce new solutions with higher quality, which improves the ability of the algorithm to jump out of the local optimum. Eight test functions are used to verify that the algorithm has been greatly improved in global optimization. Liu et al. [9] proposed a modified sparrow search algorithm with application for 3D route planning for UAV. Chaos strategy is introduced to enhance the diversity of the population, and adaptive inertia weight is used to balance the convergence speed and exploration ability of the algorithm. Finally, Cauchy Gauss mutation strategy is used to get rid of the stagnation ability of the later algorithm. Through the comparison of several algorithms in 3D path planning, the improved sparrow search algorithm has strong search ability and the planned route is relatively safe.
Currently, research on sparrow search algorithm has been proposed successively, but the proposed algorithms lack a global improvement mechanism. Although the mapping mechanism is uniform, it is not stable under the sparrow search algorithm with good global results, and it increases the workload of the population. Therefore, a search mechanism with global vision and flexibility is needed to improve the search ability of the sparrow search algorithm. For the above analysis, a lens learning sparrow search algorithm (LLSSA) is proposed. This algorithm uses a reverse learning strategy based on lens learning strategy in the discoverer location update formula to improve the algorithm's vision in the optimal space. A variable spiral search strategy is proposed to enable followers to search in more detail and flexibility. Finally, the current solution is refined by fusing simulated annealing algorithm to find a higher quality solution. Through 15 standard test functions, the effectiveness of LLSSA is verified, and a distinct, simple, and satisfying route is found in the complex threedimensional path planning.
2. Sparrow Search Algorithm
During the food search process, the sparrow population is divided into two roles: discoverer and follower, which conduct behavioral strategies separately. Discoverers are generally 0.2 of the population size and are the guides of the individual population, leading other individuals in the search for things, so the role of the discoverer is crucial in the population. They have a wide search range. The location update formula for the discoverer is as follows:
In formula (1), represents the current number of iterations and is the maximum number of iterations. denotes the current position of the ith sparrow in the jth dimension. is a random number between 0 and 1. is a random number from a normal distribution. L represents a 1 × D matrix with all elements 1. and respectively represent warning and safety values, and , . When , this indicates that the community environment is in a safe state at this time, no predators are found around, and the discoverers can search for food on a wide scale. When is greater than or equal to , this indicates that the individuals within the cluster have found a predator and issued an alarm so that all individuals of the population will make antipredation behavior and the discoverer will lead the follower to a safe location.
To obtain good quality food, the followers would closely follow the discoverers. Some of these followers oversee the discoverers and those discoverers with high rates of predation for food, thus increasing their own nutrition. The positional update for the followers is described below:
In (2), is the optimal position currently occupied by the discoverer, and denotes the current worst position. is a matrix of 1 × D in which an element is only 1 or  1, with . When , it indicates that the sparrow population is aware of danger, at which point they make antipredation behavior, and the mathematical expression is as follows:
In (3), is the current global optimum. is the control step size parameter and is a random number obeying a normal distribution with mean 0 and variance 1. is a random number, and K represents the direction in which the sparrow moves while also controlling the moving step size. indicates the fitness value of the current sparrow individuals. and are the optimal and worst fitness values within the current search scope, respectively. is the smallest real number, preventing the occurrence of 0 in the denominator. When indicates that the current sparrow is at the boundary of the population and vulnerable to predator attack, the location needs to be adjusted. , which indicates that individual sparrow in the interior of the population is aware of the danger and need to be close to other sparrows to avoid the danger.
3. Inverse Learning Strategy Based on Lens Imaging
It is because of the broad search range and flexible search methods that discoverers can lead the group to find good food. Once the discoverer is trapped in the local optimum, the performance of the overall algorithm will be degraded, so improving the search horizon of the discoverer is particularly important. General learning strategies have achieved good results in some optimization algorithms, but have little effect on the performance of the algorithm, because the general learning strategies carry out reverse solutions in local space, which enriches the diversity of the population, but the search scope is narrow and loses flexibility. In order to improve the searching ability of the discoverer, a reverse learning strategy based on lens imaging [10] is proposed and applied to the individual update position formula of the discoverer. The application of this strategy allows new individuals to be acquired for each iteration, resolving the problems left over from previous general learning strategies. The principle is described as follows.
Definition 1. (reverse point). Set as a point in Ddimensional space, and ; then, the reverse point of is , and .
Definition 2. (base point). Suppose there are several points , for any point with its reverse point to . Euclidean distances are and , so and and is called the base point of and when .
Using onedimensional space as an example, assume that an individual with a height of is projected as (the globally optimal individual) on the coordinate axis, and a lens with a focal length of is placed at the base position (the midpoint of [a, b] in the figure). An image with a height of can be obtained through the lens imaging process, and its projection on the coordinate axis is . At this time, is such that gives rise to new individuals through a back learning strategy based on the principles of lens imaging. The diagram is shown in Figure 1.
As shown in Figure 1, the globally optimal individual is giving its corresponding reversal point , obtained from the principle of lens imaging:Let , k be the scaling factor, and the inverse point obtained upon transformation isIt follows that when k = 1,Form (6) is called general reverse learning strategy. From the above formulas, it can be seen that general learning strategy is only a specific case of lens imaging learning strategy, and the new individuals obtained by general reverse learning strategy are fixed each time. In highdimensional complex functions, new individuals with fixed ranges are also likely to fall into local optimum with monotonicity; by adjusting the parameter k, new individuals based on lenses imaging learning strategies are dynamic, which improves population diversity. Extending the formula to Ddimensional space is available:In (7), versus are the jth dimension components of versus , and and represent the jth dimension components at the upper and lower bounds of the decision variable, respectively.
4. Variable Spiral Search Strategy
While it is convenient for followers to follow the discoverer in updating their location, it is easy for followers to search blindly and singularly. Inspired by the rotation of the whale algorithm, this paper introduces a variable spiral location update strategy, which allows followers to have a variety of search paths to better update the location, while balancing the global and local search of the algorithm. The spiral search diagram is shown in Figure 2.
In the follower location update process, the helix parameter cannot be a fixed shape, which results in monotonous search methods and the possibility of falling into local optimum, thus weakening the search ability of the algorithm. The parameter is designed as an adaptive variable to dynamically adjust the spiral shape of follower search, which expands the follower’s ability to explore unknown areas, makes the algorithm search more efficient, and improves the algorithm's global search performance. The formula for the variable spiral position update strategy is as follows:
The parameter Z changes according to the number of iterations. The change of Z is determined by the exponential function based on in formula (8), and the size and amplitude of the helix are dynamically adjusted according to the nature of cos function. is the coefficient of change, which is 5 in this paper. Here, L is a uniformly distributed random number of [−1, 1]. Follower location updates range from large to small, find more quality solutions in the early stage, reduce the increase of search useless work in the later stage, and improve the global optimal search performance of the algorithm. At the same time, according to the spiral characteristics, the optimization accuracy of the algorithm is improved.
5. Simulated Annealing Algorithm
Simulated annealing algorithm, derived from the principle of solid annealing, is a probabilitybased algorithm and a stochastic global optimization algorithm proposed by Metropolis et al. [11]. The simulated annealing algorithm is a classical algorithm and has been studied extensively. Its principle is not described here. The simulated annealing algorithm combines with the improved sparrow algorithm. The simulated annealing algorithm is used to refine the solution found by the sparrow search algorithm each time. It uses the sudden jump of the simulated annealing to get rid of the interference of local optimum and extracts the solution each time. The algorithm has good judgment ability and improves the quality of each solution and tends to be global.
6. Lens Learning Sparrow Search Algorithm
Sparrow search algorithm has deficiencies in the case of multidimensional complex functions. Therefore, this paper presents a lens learning sparrow search algorithm. This algorithm applies the reverse learning strategy based on the principle of lenses to the discoverer stage of sparrow search, improving the diversity of the population and expanding the search range of individual sparrows. In the follower search phase, a variable spiral search strategy is introduced, which makes the follower search more detailed and flexible. Finally, this algorithm is combined with the simulated annealing algorithm, and the previously found solutions are filtered again to obtain the optimal solution. The algorithm works as follows.(1)Initialize the population location, number, and number of iterations.(2)Calculate the fitness function of each group to get the corresponding maximum and minimum values to determine the best and worst position.(3)Calculate the alert value and update the location of the discoverer based on the alert value.(4)Use Levy flight to update the location of the discoverer.(5)Update the position of followers.(6)Perform another sinecosine search of the follower's location and update the location.(7)Update the locations of sparrows that are aware of danger.(8)Perform simulated annealing operation, as follows:(9)Determine the of each particle at the current temperature , and the formula is as follows:(10)Determine a new global optimal value from the current sparrow individual .(11)Determine whether the termination condition is met or not; if not, return to step (2). If so, proceed to the next step.(12)Output best position and minimum cost. The specific pseudocode is as follows (Algorithm 1).

7. Effectiveness Analysis
In order to better see the advantages of the improved strategy, the SPHEREFUNCTION function is taken as an example to analyze the effectiveness of the strategy of the LLSSA algorithm. Let the number of populations and the number of iterations be 50 and 10, respectively, and the individual distribution map after 10 iterations of each algorithm is obtained. The specific distribution maps are shown in Figures 3 and 4.
It can be seen from Figures 3 and 4 that the particles of LLSSA converge faster, most of the individuals are close to the optimal value, and the search range is wider, which is beneficial to jump out of the local optimum, while the particles of SSA converge slower, and the search range is smaller, which is easy to fall into the local optimum state in the highdimensional complex function. This shows that LLSSA has flexibility in the optimization mechanism and verifies the effectiveness of the three strategies.
8. Time Complexity Analysis
For an algorithm, time complexity is an important consideration, and it is also an important means of judging the amount of calculations of an algorithm. Suppose the population size of the algorithm is P, the maximum number of iterations is M, and the dimension of the problem is D. From a macro point of view, the SSA algorithm is the same as other intelligent optimization algorithms, with a time complexity of O ( × M × D), while the LLSSA algorithm does not add extra cycles in the optimization process, so in the entire algorithm, time complexity did not increase.
From a micropoint of view, suppose the ratio of discoverers is r, the calculation time of introducing reverse learning based on the lens principle is t_{1}, the calculation time of the variable spiral search strategy is t_{2}, and the calculation time of using the simulated annealing algorithm to update the optimal solution is t_{3}. It can be seen from the pseudocode of the algorithm that the LLSSA algorithm adds O (M × × r × t1 × D) in the discoverer phase and O (M × (1 − r) × × t2 × D) in the follower position update phase. O (M × t3) is added in the update stage of the optimal solution. It can be seen that the LLSSA algorithm has increased O (M × ( × D(r(t1 − t2) + t2)) + t3) compared with the SSA algorithm. However, it has not been improved in the order of magnitude, and the optimization efficiency and accuracy of the algorithm can be effectively improved. Therefore, the increased time complexity is significant and worthwhile.
9. Performance Testing
In order to further verify the feasibility and effectiveness of the improved sparrow search algorithm, this paper selects 15 standard test functions to verify its optimization performance. The specific information is shown in Table 1. In order to ensure the fairness of the experiment, all the algorithms are run on the computer with MATLAB 2018b, Windows 10 operating system, and 8g memory. The number of iterations of each algorithm is 200 and the number of population is 50. The initial temperature is t = 50, λ = 0.75, and the parameters of PSO algorithm are C_{1} = C_{2} = 2, = 0.729.
At the same time, in order to exclude the contingency of each algorithm and enhance persuasion, the three indexes of optimal value, average value, and standard deviation of each algorithm's search result are counted, and the three indexes are used to judge the optimization ability and stability of each algorithm.
As can be seen from Table 2, the LLSSA algorithm has the best search performance in F_{1–7}, F_{1011}, F_{15} and has better search ability than other algorithms. In the F_{9} function, BSO is the best. In F_{1314}, BSO can find the best one, but its stability is poor, and the optimization results on other functions are extremely poor. Therefore, BSO has some limitations in function optimization. LLSSA achieves good results on many function problems. It is inferior only to BSO in F_{9}, which shows that LLSSA has strong optimization ability. Other algorithms have achieved poor optimization results. Therefore, the introduction and fusion of simulated annealing make the sparrow search algorithm have strong local judgment ability, balance the local and global search, and improve the search ability of the algorithm.
To describe the convergence of each algorithm in each function, the average convergence of each algorithm in each function is counted, and the specific convergence effect is shown in Figure 5. From Figure 5, it can be clearly seen that LLSSA has excellent convergence performance in F15, F8, F1112, F14 functions, which all have advantages in accuracy and speed. However, among F67, F910, F15 functions, the convergence accuracy is high and the speed is slow, while it has advantages in other functions, but it is not significant. Generally speaking, LLSSA overcomes the limitations of the original algorithm search mechanism, has a reliable optimization scheme, and has greater advantages in speed and accuracy.
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(i)
(j)
(k)
(l)
(m)
(n)
(o)
Comparing algorithms based on mean and standard deviation alone is not enough. To be more persuasive, statistical tests are needed to verify that the proposed improved algorithm has significant improvement advantages over other existing algorithms. To determine whether each result of LLSSA is statistically significantly different from the best results of other algorithms, the Wilcoxon rank sum test was used at the 5% significance level. The values calculated in the Wilcoxon rank sum test between LLSSA and other algorithms are given in Table 3 for all the benchmark functions. When , the HO hypothesis can be considered rejected, indicating a significant difference between the two algorithms. When , it can be assumed that the HO hypothesis is accepted, indicating that the difference between the two algorithms is not obvious; that is, the optimization performance of the two algorithms is equal. Therefore, an algorithm with equivalent performance in each function is marked as N/A, indicating that it is not applicable. The algorithm differences table is shown in Table 3.
From Table 3, there is a big difference between each algorithm and LLSSA as a whole. Only on the first two unimodal functions, the basic SSA itself can find the optimal value. Therefore, there is no significant difference between LLSSA, SSA, and CSSA, but only on the F10 function, the value is greater than 0.05. The experimental results show that BSO has better optimization ability on this function.
10. Application and Analysis
The proposal and improvement of an algorithm are ultimately to be implemented in the actual project. Since the development of intelligent optimization algorithms, the improvement of multiple algorithms has been successfully applied to specific applications; for example: literature [12] proposed a novel metaheuristic based on integrating chaotic maps into a Henry gas solubility optimization algorithm, which achieved good results in welding beams and cantilever beams. Reference [13] proposed an adaptive metaheuristic algorithm based on decomposition in order to solve the multitarget complex problem in UAV flight. The above authors have all proposed suitable algorithms in actual problems. Therefore, this paper applies the LLSSA algorithm to the UAV path planning of threedimensional complex terrain to verify the feasibility and practicability of the LLSSA algorithm.
In recent years, the problem of UAV path planning has been widely favored by researchers. UAV path planning is also one of the problems of automatic control. Common path planning methods include genetic algorithm [14], particle swarm and ant colony algorithm [15], artificial potential field method [16], and gray wolf algorithm, but for complex highdimensional problems such as path planning, the functions of these algorithms are limited. Many factors considered are difficult for each algorithm. For complex path planning problems, the algorithm is very easy to meet the current minimum cost and give up the overall plan, lack of autonomous learning. Therefore, researchers have made different improvement measures for the deficiencies of each algorithm to make the optimized path more ideal. Aiming at the problem of path planning in threedimensional complex terrain, this paper proposes to integrate the improved sparrow search algorithm with the simulated annealing algorithm, so that the algorithm avoids the local optimal solution in the solving process and finds a clear and simple path with the smallest cost function.
10.1. Cost Function Design
Cost function is an indispensable part of route planning. The more reasonable the cost function is set, the closer it is to the real demand. The cost function designed in this paper is as follows: represents the total cost of the path, and , , and represent the total length cost, total height cost, and smoothness cost of the path, respectively. , , and are the corresponding weights. In this paper, , , .
The cost function can be used to evaluate the quality of the generated path, which is the basis of iterative evolution of algorithm population. The performance of cost function determines the efficiency and quality of algorithm implementation, and it is also the performance index of path planning. In order to better evaluate the path quality, this paper constructs the fitness function [17–19] by comprehensively considering the height cost, length cost, and smoothness cost of the path. Suppose each path is composed of points. x, y are the point coordinates of the terrain projected on the horizontal plane, and z is the height corresponding to the point coordinates on the horizontal plane.
10.2. Path Length Cost
Path length is one of the most important indicators to evaluate the quality of a path. The shorter the path is, the less energy and time consumption the UAV will take to fly. The cost of introducing path length is as follows:
10.3. High Cost
The stable flight height of the UAV is also an important part of the UAV track planning process. For most aircraft, the flight height should not change much. Stable flight height helps to reduce the burden on the control system and save more fuel. Therefore, the cost of introducing track elevation is
10.4. Smoothness Cost
When an UAV is making a turn, it needs to consume some energy due to the air resistance and at the same time exerts some pressure on the body. The smaller the turning angle, the greater the pressure generated and the more energy consumed, making the flight inefficient. Therefore, the smoothness of flight is also a key factor in the cost of flight. represents the degree of deviation between the previous position and this position, and describes the cumulative sum of the degree of deviation of the connected nodes in the entire path. It is used to simulate the turbulence during the flight of the UAV. The smaller the turbulence, the higher the safety inside and outside the UAV.
11. Simulation Experiment and Analysis
In order to verify the feasibility and practicability of the fusion algorithm to optimize the effect of UAV, it is compared with SAPSO, PSO, SSA, and CSSA. The parameters of each algorithm are set as follows: the number of population is 100, the number of iterations is 400, the initial temperature T is 25, λ = 0.99, and the specific experimental model parameters are shown in Table 4. In order to enhance the persuasion of the experiment and reduce the interference of accidental events, each algorithm runs 10 times independently and counts the minimum value, average value, and the worst value of each planned route. The optimal roadmap of each algorithm is shown in Figure 6, the performance index of each algorithm is shown in Table 5, and the average cost function convergence diagram is shown in Figure 7.
(a)
(b)
(c)
(d)
(e)
As you can see from Figures 6 and 7 and Table 4, the LLSSA and SAPSO algorithms optimize the UAV's path to be the simplest and clearest. The CSSA, SSA, and PSO optimization routes appear to be distorted, obviously falling into a local optimal state. From the performance index table of each algorithm, LLSSA has better convergence accuracy and stability than SAPSO, and other algorithms have poorer stability, with the worst cost value exceeding 50. From the average cost convergence graph, it can be seen that the LLSSA algorithm has extremely fast convergence speed and accuracy. It found a path with the least cost before 50 iterations. The route found by the SSA algorithm is poor, complex, and costly, indicating that the SSA algorithm has limitations in solving such complex multidimensional functions. At the same time, it also shows that in complex path planning problems, the algorithm will meet the current minimum cost and fall into a local optimal state. Therefore, a flexible and judging search mechanism is needed to make the algorithm get rid of the constraints of the complex environment.
Similarly, in order to further verify the feasibility and significance of the algorithm on the UAV route, Wilcoxon test as described above is conducted among the algorithms, and the rank sum test results are shown in Table 6.
It can be seen from Table 6 and the above comprehensive situation that the algorithm that introduces the simulated annealing strategy has a greater advantage in route planning. The performance of the PSO algorithm and the CSSA algorithm is equivalent, and the SSA algorithm is the worst. Applicable to SSA algorithm, a flexible search mechanism and judgment strategy should be added to make the improved SSA algorithm stand out.
12. Conclusion
In this paper, aiming at the problem that the sparrow search algorithm falls into the local optimum and depends on the initial population in the optimization process, the reverse learning strategy based on the lens principle and the variable cosine search strategy are introduced, which are applied to the stage of discoverer and follower, respectively, making the search method more flexible and careful. Then the simulated annealing algorithm is fused to extract the optimal solution. Through the test of standard test function, it can be seen that LLSSA has good optimization ability and convergence effect. It is applied to the path planning of UAV in threedimensional complex terrain. Through the comparison of CSSA, SSA, SAPSO, and PSO optimization UAV route planning, it shows that LLSSA optimization UAV path is the simplest and clearest, and the cost is the least. Through the planning route index table and the average cost function convergence diagram, it shows that LLSSA has good stability, so its application in UAV path planning has high reliability. It can be seen that in the process of sparrow optimization, if the leading discoverer is limited, the whole algorithm will be paralyzed, and the solution found each time is not necessarily reliable. Therefore, it is extremely important to effectively improve the discoverer's search mechanism and judgment ability. It can be seen from the above experiments that LLSSA relies on the judgment ability of simulated annealing algorithm in complex terrain path planning problems. Although this method can improve the quality of route optimization, it does not necessarily have a good effect in simple path planning problems, and it increases the calculation time, which is still a challenge in multiple complex environments. In the next step, we apply it to the path planning of multimission UAV.
Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that they have no conflicts of interest.
Acknowledgments
This work was financially supported by the Regional Foundation of the National Natural Science Foundation of China (no. 61561024).