Three-Dimensional Path Planning Method for Autonomous Underwater Vehicle Based on Modified Firefly Algorithm

Path planning is a classic optimization problem which can be solved by many optimization algorithms. The complexity of threedimensional (3D) path planning for autonomous underwater vehicles (AUVs) requires the optimization algorithm to have a quick convergence speed. This work provides a new 3D path planning method for AUV using a modified firefly algorithm. In order to solve the problem of slow convergence of the basic firefly algorithm, an improved method was proposed. In the modified firefly algorithm, the parameters of the algorithm and the randommovement steps can be adjusted according to the operating process. At the same time, an autonomous flight strategy is introduced to avoid instances of invalid flight. An excluding operator was used to improve the effect of obstacle avoidance, and a contracting operator was used to enhance the convergence speed and the smoothness of the path. The performance of the modified firefly algorithm and the effectiveness of the 3D path planning method were proved through a varied set of experiments.


Introduction
AUVs are in strong demand within both military and civil fields.More and more research institutions are carrying out research into AUVs.Path planning is one of the key technologies in autonomous decision-making for AUVs, and it has become one of the most talked about issues in the AUV field.Many methods for AUV path planning have been put forward and most of the AUV operating environments were assumed to be two-dimensional.For example, some researchers proposed a path planning method using artificial potential field methods [1,2].Chen et al. brought forward a global path planning method for AUV based on the sparse  * search algorithm [3].Some novel optimization algorithms, such as the genetic algorithm (GA) and ant colony optimization (ACO), were also used to solve the problems of AUV path optimization [4,5].Although these methods were proved effective in solving path planning problems, they inevitably face some problems in practical applications because the AUV working environment is a 3D marine space.
3D path planning is a classical optimization problem.With the development of optimization algorithms, many researchers apply new optimization algorithms to solve the path planning problem in recent years.Swarm intelligence (SI) belongs to an artificial intelligence (AI) discipline that became increasingly popular over the last decade, and it refers to a research field that is concerned with a collective behavior within self-organized and decentralized systems.Nowadays, swarm intelligence has formed one of the hottest topics in the developments of new algorithms inspired by nature.And methods of swarm intelligence are used to solve traditional NP problems and their excellent performance and great potential have been proved in many practical applications [6].In recent years, SI-based algorithms are also applied for solving 3D path planning problem.For example, a 3D path planning method based on the ACO was proposed by Liu et al. [7,8].Particle swarm optimization (PSO) was also used to solve the problem of 3D path optimization [9][10][11].These works prove that it is feasible to solve 3D path planning problems using SI-based algorithm.
Firefly algorithm (FA) is a more promising SI-based optimization algorithm based on firefly social features put forward by Dr. Yang in 2008.Although this algorithm is similar Mathematical Problems in Engineering to other bioinspired algorithms, it is relatively simple both in theory and in implementation.One of its most prominent advantages is that global communications can run based on individual exercise at the same time as random motion [12].The existing research results showed that the algorithm was very effective in dealing with a lot of optimization problems, and it had gradually been applied to some kinds of optimization fields with good results [13][14][15][16][17][18][19][20][21].As a new optimization algorithm, the basic FA has some drawbacks in convergence speed and stability.Some improvements have been put forward recently.For example, Dr. Yang added Levy flight to the random part of the FA formulation and Levyflight firefly algorithm (LFA) was constructed.Experimental result showed that the improved algorithm was more effective in searching for global best values [22,23].Farahani et al. made some improvements to the random motion part of FA to ensure the random step is larger in the initial period, in order to avoid falling into local optima.The random step was reduced after several iterations to make the algorithm converge to the global minimum rapidly.Meanwhile, the movement style of FA was improved and directed movement was proposed.Experimental results showed that the improved FA had better performance than the basic FA [24].dos Santos Coelho and de Andrade Bernert used chaotic sequences to adjust the parameters of FA, and the improved algorithm had better results in optimizing benchmark test functions of reliability and redundancy allocation [25].Liu et al. made some improvements to ensure parameters of FA adjusted according to the iteration numbers.Compared to the basic FA, the performance and convergence speed were improved [26].Farahani et al. put forward a new FA that increases convergence speed using Gaussian distribution to move all fireflies to global best in each iteration.The modified algorithm was tested on five standard functions.And experimental results showed that the modified FA had better performance than the basic firefly algorithm [27].Fister et al. proposed a comprehensive review of the FA.The status of applications within various application areas was summarized.At the same time, the review showed that FA was simple, flexible, and versatile, which was very efficient in solving a wide range of diverse real-world problems [20].
In this paper, a modified FA and a 3D path planning method based on the new algorithm are proposed.The length of random steps and parameters of the algorithm are designed to be adjusted according to the distance between two fireflies and the iteration times.The autonomous flight strategy has been introduced to avoid invalid flight.An excluding operator and a contracting operator have been used to improve the effect of obstacle avoidance, the speed of convergence, and the smoothness of the path.The paper is organized as follows.Section 2 analyzes the performance of basic FA.Section 3 develops a modified FA.A 3D path planning method is proposed in Section 4. Experiments in Section 5 prove the performance of the modified FA and the path planning method.Finally, Section 6 contains the main conclusions and describes some problems that warrant further research.

Basic Firefly Algorithm and Its Performance Analysis
The FA is derived from the simplification and simulation of firefly group behavior.It has three idealized constraints which are derived from firefly features.(1) The firefly is not gender-specific.And they will fly to more attractive and larger brightness companion regardless of its gender.(2) Firefly attractive size is proportional to its brightness.And its brightness decreases with the distance between individuals.If there is no brighter or more attractive one, then it will flight randomly.
(3) The brightness or attractiveness of a firefly is determined by the specified value of the objective function [12].For the maximization problem, the luminous intensity is proportional to the value of the objective function.Based on the above three rules, the execution process of firefly algorithm is shown in Figure 1.
The core of FA is that the absolute brightness of fireflies represents the value of objective function and the position of the fireflies represents the solution of the problem to be solved.The relative brightness is gained by comparing two fireflies and it is associated with attraction.One firefly is attracted by a brighter one and adjusts its position according to this attraction.Only the brightest firefly moves randomly.The formula of FA is as follows: where  0 stands for the biggest attraction and  is the absorption coefficient which controls the change in light intensity and determines the speed of convergence. is the random coefficient which controls the range of movement.  is the artesian distance between firefly  and firefly ⋅ ⃗   is the random vector decided by Gauss distribution [12].
As described in formula (1), the changing position of a firefly depends on its attraction to brighter fireflies and their random movement.At the initial period of algorithm running, fireflies are randomly distributed within the search area.The distance between each of them is greater, while   (  ) is small and the range of movement is small, so the exploring ability of FA is insufficient with slower convergence.At the later stage of the algorithm running, fireflies gather around the optimal insect, the distance between each other is smaller, and   (  ) is bigger.At the same time, random motion is still taking place which is not useful for the convergence of the algorithm [13].
In addition, the position updating of one firefly is affected by other brighter fireflies, some of which may not be necessarily useful for solving the problem, and this may make the new location of the firefly far away from the optimal solution (we call this behavior invalid flight).Although invalid flight may be improved by the influence of other fireflies in the following movements, it will slow down the search process and reduce the speed of convergence.Thus, in order to improve the ability of basic FA to solve practical problems, some changes are necessary.

A Modified Firefly Algorithm
There are two important parameters in the formula for the position updating: the absorption coefficient  and the random coefficient .The smaller the , the greater the attraction between two fireflies and the faster the convergence speed.The range of random movement is larger and the convergence speed is slower, with a bigger .In practical optimization problems, generally global search helps the algorithm converge to an area quickly and then a local search helps obtain a high precision solution.Reference [26] proposed an adaptive FA in which  and  were adjusted with the iteration times, and its performance was better than that of the basic FA.Because the random movement step is 1 and the changing range of the random part is −0.5 to 0.5, the convergence speed is very slow in solving problems with a large range.In order to solve this problem, we proposed a new FA in which the random movement step was designed to be the distance between two fireflies.The position updating formula of the new FA is as follows: (  ), (), and () can be obtained as follows: where ⃗   and ⃗   stand for the spatial positions of fireflies  and ;  is the whole iteration time;   >   , where   and   are the initial and ultimate value of , respectively;   <   , where   and   are the initial and ultimate value of , respectively.
As seen in formula (3), the attraction between two fireflies is small when the distance between them is great.Attraction therefore does not play an important role in position updating.However, as the random movement step is big, fireflies move within a big range to explore a larger search space.When the distance among fireflies is small, the random movement step reduces and the random movement range is small.Attraction therefore begins to play a more important role in position updating.Fireflies move to the brightest one quickly and the algorithm comes to convergence at a great speed.
In addition, in order to avoid invalid flight, we introduced the autonomous flight strategy (AFS).The new position of a firefly should be judged before it moves.The firefly will move and update the position if the new position is useful for solving the problem.Otherwise, the firefly will stay at the current position.

3D Path Planning for AUV Using
the Modified Firefly Algorithm where  , = ( , ,  , ,  , ) stands for the ()th route point and it corresponds to the ()th dimension of the position for the ()th firefly.
In addition, as the brightness represents the quality of a firefly, it corresponds to the path quality in the path planning problem.The brightest firefly represents the optimal path.

Cost Function.
There are many criteria for evaluating a candidate path.Generally, the smaller the path length is, the better it is.Additionally, in order to ensure the safety of AUV, the path should be away from obstacles, so we used the path length   and risk value   to evaluate the candidate path.The cost function of path planning can be calculated as follows: where So the aim of path planning is to find a path which can satisfy min().The calculating methods of every cost part are as follows.

Path Length.
If a path has  route points, its length can be calculated by the following formula: where (  ,   ,   ), 1 ≤  < , stands for the coordinates of the ()th route point,  SP 1 stands for the distance Mathematical Problems in Engineering between the start point and the first route point, represents the distance between the ()th route point and the ( + 1)th route point, and     stands for the distance between the destination point and the last route point.

Risk Value.
A path holds risks if it passes through obstacles.So the risk value can be judged by how much of a path contains obstacles.In order to calculate the risk value easily, we selected  evaluating points in every path segment.
The whole risk value can therefore be judged by calculating how many route points and evaluating points which are in obstacles.For example, if there are  1 route points and  2 evaluating points in obstacles, the risk value can be calculated as follows: where  > 0 stands for the cost coefficient.

Excluding Operator.
As the path planning space is 3D and contains many obstacles, it is inevitable that some points on the path will come into contact with obstacles in the process of searching.Sometimes these points would come out of the obstacles at last, but it will cost much time.In order to reduce searching time and increase the success rate of obstacle avoidance, it is necessary to help these points avoid obstacles quickly.An excluding operator is used here to make this easier.A path point inside an obstacle will be excluded to the surface of obstacle's plane [11].Figure 2 shows how the excluding operator works.In Figure 2,  is a plane on the surface of one obstacle and ⃗  stands for the normal direction of .  is a path point inside the obstacle.In order to ensure safety,   should move out of the obstacle using an excluding operator.

𝑃 󸀠
is on plane  which stands for the new position of   after it is excluded from obstacles.The position of    and the displacement of   can be calculated using the following formula:

Contracting
Operator.The generation of a safe path should be done through the cooperation of every path point.Without taking path knowledge into account, the planning process will take a long time, especially in path planning with many dimensions.A path generated by FA only may be unsmooth, so a contracting operator is used to manage the cooperation of route points and to make the path smoother [11].Figure 3 shows how the contracting operator works.
In Figure 3,   −1 is the route point before   and   +1 is the route point after   .On the assumption that   −1 and   +1 are fixed,   will be pulled by these two points and the direction of the resultant force is   →     −1 +   →     +1 .Theoretically, with the pulling force,   will move to    .In fact, because it is affected by air resistance,   can only move to    .The displacement of   and its real position can be calculated by the following formula: where  →    is the displacement vector of   with pulling forces from   −1 and   +1 and  ∈ (0, 1) is the resistance coefficient.The path planning flow based on the modified FA is as follows: firstly, initializing path parameters and modeling the operating environment and then searching for the optimum path using modified FA, using an excluding operator to avoid obstacles and a contracting operator to optimize the path.These steps should be repeated until a satisfactory path is found.The detailed workflow is shown in Figure 4.   algorithms with extreme influence in optimization field, and research on them is relatively mature.FA has some qualities in common with these two algorithms.In order to verify the performance of the modified FA (AMFA) proposed in this paper, we used four algorithms (basic FA, AMFA, PSO, and GA) to solve six classic test functions.The four classic test functions are as follows.
Parameters of these four algorithms are set as follows.
GA: binary encoding was used and the binary digit was 20.The roulette wheel selection method and single point crossover were used.Crossover probability was defined as   = 0.6, mutation probability was described as   = 1/, and  was the dimension of the optimization function.
In order to compare the optimization performance of these algorithms fairly and sufficiently, they were used to solve the four test functions in both small and wide ranges.The population size of every algorithm was set to 40 and the dimension of the testing function was set to 30.Each algorithm was run 30 times independently, and the number of fitness evaluations was limited to 60,000.

Experiments in a Small
Range.The range of every test function is shown in Table 1.Table 2 shows the results of simulation for every algorithm.In order to observe the iterative process of the algorithm, the curves of the six test functions are shown in Figures 5 to 10.
Experimental results in Table 2 show that the precision of solution obtained by AMFA is much better than that of FA.Meanwhile, Figures 5-10 show that the convergence speed of AMFA is quicker than that of FA.So we can conclude that the performance of AMFA is better than that of FA and the method proposed here is effective in improving the performance of basic FA.The performance and convergence speed of AMFA are better than those of PSO and GA.Although the solution precision of Sphere obtained by AMFA is not the best, it is valid.Meanwhile, the solution of Sphere  Sphere ([−5.12,5.12], dimension = 30) obtained by AMFA is found to be zero 22 times.We can therefore conclude that AMFA is an effective algorithm for solving problems with a small range.

Experiments in a Wide
Range.The range of every test function is shown in Table 3. Table 4 shows the results of simulation for every algorithm.In order to observe the iterative process of the algorithm, the curves of the six test functions are shown in Figures 11-16.Experimental results in Table 4 show that the precision of solution obtained by AMFA is the most effective for solving all six test functions.Additionally, it can find the global optimum every time.Figures 11 to 16 show that the convergence speed of AMFA is the quickest of the four algorithms.So we can conclude that the method proposed here is effective in improving the performance of basic FA and AMFA is powerful in solving problems with a wide range.

Experiments of Path Planning.
In order to simulate the real sailing environmental space of AUV, a maritime space Rastrigin ([−5.12,5.12], dimension = 30) with a horizontal area about 2 ∘ × 2 ∘ was selected as the experiment environment for AUV path planning.The terrain was generated by interpolation with elevation data extracted from electric chart.In order to observe the obstacle avoidance  capability of the method, the actual lengths of the horizontal and vertical coordinates were reduced (1852 × 60)/1000 times.The resistance coefficient was 0.9553 and parameters of AMFA were the same as in the experiments described above.Because the population size of AMFA was 40 and  the dimension of every firefly was set to 30, the number of candidate paths was 40 and every path should have 30 path points.
In order to verify the performance of the new algorithm, two experiments were designed here.In the first experiment, depths of the starting point and destination Figures 17 and 18 show that there are many obstacles in the environmental space.The line represents the path found by AMFA, the black dot is the starting point, and the red dot stands for the destination in the figures.From the results of the experiments we can conclude that the path planning method using AMFA can find the optimal path in the complex environmental space, and the paths in both experiments are smooth and do not path through obstacles.The experimental results prove that the path planning method proposed here is feasible and AMFA can be used in solving 3D path planning problem.

Conclusions
This paper presents a 3D path planning method based on a modified FA.The performance of the modified FA and the path planning method was verified through simulation.The simulation results show that the modified FA has a quick convergence speed and the path planning method based on it can find an effective path in a 3D environment.However, as a new SI-based algorithm, the firefly algorithm still has imperfections from a theoretical research point of view and its mathematical theory also needs to be studied and proved.Additionally, it has been assumed that the operating environment is static and obstacle information is known before the path planning method is begun.In reality, the marine environment is dynamic and AUVs will face many sudden threats while in action.Finally, many constraints for AUVs such as the maximal turning angle and the maximal sailing depth must be taken into account.Therefore further research is required to conclude how to plan a practical path for AUVs in the real dynamic marine environment.

Figure 2 :
Figure 2: Sketch map of excluding operator.

Figure 3 :
Figure 3: Sketch map of contracting operator.

5. 1 .
Experiments Using Modified FA.Genetic algorithm (GA) and particle swarm optimization (PSO) are two classic

Table 2 :
Experimental results in a small range.

Table 4 :
Experimental results in wide range.