A Novel Hybrid Firefly Algorithm Based on the Vector Angle Learning Mechanism

The firefly algorithm (FA) is one of the swarm intelligence algorithms which can solve global optimization problems accurately. In the traditional FA, the position of each firefly can only be updated by the brightness of other fireflies around it. As a result, it is simple to update the firefly position but easy to fall into local optimum. In this paper, a novel hybrid firefly algorithm based on the vector angle learning mechanism (HFA-VAL) is proposed, which can combine the advantages of both the firefly algorithm (FA) and differential evolution (DE) by the vector angle learning mechanism. HFA-VAL employs vector angle parameters to adaptively adjust the moving step length of firefly in order to avoid falling into local optimum. In the evolutionary process, the difference method is used to update the dominant leader, so as to improve the moving direction of other fireflies and expand the search ability. In order to understand the strengths and weaknesses of HFA-VAL, several experiments are carried out on 25 benchmark functions in CEC2005. Experimental results show that the performance of HFA-VAL algorithm is better than other the-state-of-art algorithms.


I. INTRODUCTION
Single objective optimization problem is to choose the optimal solution from all possible choices of a problem according to a certain index. Generalized optimization includes mathematical programming, graph theory and network, combinatorial optimization, inventory theory, decision theory, queuing theory, optimal control, etc. It is widely used in various fields such as management [1], economic planning [2], engineering design [3], system control [4] and other fields.
A swarm intelligence algorithm is proposed to solve the single objective optimization problem. The firefly algorithm (FA) is one of the swarm intelligence algorithm inspired by firefly blinking behavior. The firefly algorithm (FA) was proposed by Professor Yang Xin of Cambridge University [5]. In recent years, it has become very popular and many people have optimized and improved it.
The associate editor coordinating the review of this manuscript and approving it for publication was Xiangtao Li . FA has been widely used in various fields. The discrete firefly algorithm (DFA) is proposed by Xaphakdy et al. [6] to optimize the resource allocation in femtocell network. The efficiency of network system is reduced by reducing cross layer and common layer interference when users use the same resource block (RBS). It solves the resource optimization and allocation management in the coverage of microcellular network. A new hybrid model is proposed by Riahi-Madvar et al. [7], which the mixture of the firefly algorithm (FA) and the adaptive neuro fuzzy inference system (ANFIS) with the maximum difference subset selection to predict the longitudinal dispersion coefficient. The performance of the new ANFIS-Firefly Algorithm (FFA) model is significantly improved compared with the former ANFIS model, and it is emphasized that the optimization of swarm intelligence algorithm plays an important role in enhancing ANFIS estimation. The Firefly Ivan algorithm introduced by Singgih et al. [8] into the UAV path planning problem to satisfy the photographic quality of target nodes and edges while minimizing the longest UAV path. This problem is described VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ as a mixed integer linear programming (MILP) model. Using FA, a better solution than MILP model is obtained in a given time. Tang et al. [9] proposes a model to predict the green consumption behavior of college students which bases on K-nearest neighbor and takes the firefly algorithm (FA) as the core of optimization. It can improve the classification performance and the adaptive model can also be better applied to prediction. FA is used by Samman et al. [10] to reduce the power loss and improve the distribution voltage distribution. It can simplify the network into a simplified network diagram, and not only reduces the calculation time, but also improves the consistency of the solution. A decentralized PID controller for TITO system is designed by FA [11]. The parameters of both PID controllers are adjusted by FA at the same time to avoid multi-dimensional nonlinear problem. Li et al. [12] proposes an improved firefly algorithm to locate the distribution center of logistics UAV. By discretizing the standard firefly algorithm and neglecting the step factor, the algorithm introduces the disturbance mechanism and the probability selection formula which is based on the improved formula of firefly position update. It jumps out of the local optimal value and improves the accuracy of the algorithm. Wang et al. [13]proposes a firefly algorithm with domain attraction and a hierarchical attractive firefly algorithm is also proposed [14]. FA has been improved by a large number of scholars and experts. Sudarsan Nandy analyzes the optimization algorithm of FA [15]. And a neural network modeling method based on FA that can improve the accuracy of neural network and the convergence speed is proposed. It the challenge of local optimization and steps size factor parameter setting in the full attraction model of the FA. Zhao et al. [16] introduces level-based attraction and variable step size to FA. It balances the detection and development ability of the algorithm, and improved the accuracy of the algorithm. Alhroob et al. [17] proposes an adaptive fuzzy map method based on the fireflies algorithm, in which is used for the accumulation of big data speed and decentralized decision making. It reduces the number of iterations, at the same time minimizes the execution time, this is of great significance to the input of fuzzy logic system. Huang et al. [18] proposes an improved maximum power point tracking algorithm which is suitable for partial shading photovoltaic system by combining the neighborhood attracting firefly algorithm (NAFA) and the simplified firefly algorithm (SFA), and realized the tracking of the global best point. In addition, the method reduces the sampling events and redundant propagation, thus it accelerates the tracking speed, reduced the energy loss and oscillation in the sampling process, and improved the tracking speed and tracking accuracy. Wang et al. [19] uses the firefly algorithm to estimate water demand. Firefly algorithm is also used to solve large-scale global optimization problems [20]. Wu et al. (2020) [21] proposes an improved firefly algorithm ADFA for global continuous optimization. It can solve the single peak problem effectively, because it has the advantages of strong global search ability and fast iteration. But for other functions such as multimodal function, too fast searching makes the firefly fall into local optimal, because there are multiple local optimal values in the function. In order to solve this problem, HFA-VAL is proposed in this paper.
The main contributions of this paper are as follows: 1) The leader firefly is composed of three optimal fireflies, and the updated difference algorithm is used to make the algorithm go out of the local optimal in the iterative process.
2) The vector angle learning mechanism is used to control the step factor adaptively, and the convergence speed of the algorithm is improved.
In MATLAB 2015, 25 benchmark functions in CEC2005 test set have been used to test. The experimental results show that the algorithm in this paper is superior to other swarm intelligence algorithms. The structure of this paper is as follows: The second part describes some basic algorithms and better algorithms of firefly, the third part introduces in detail updated leader firefly algorithm that proposed in this paper, the fourth part is the experimental part, compares the fireflies in the proposed algorithm with other algorithms and carries out the parameter validity experiment, the fifth part is the summary of this paper, the sixth part is references.

II. RELATED WORK
This section introduces the algorithm ideas of FA [5] and ADFA [21], and their respective performance.

A. THE FIREFLY ALGORITHM
FA is a population intelligence algorithm [5], which is proposed by Professor Xin She Yang of Cambridge University. The main purpose of firefly flash is to act as a signal to attract other fireflies. Its core idea is that fireflies distributed in the solution space emit light of different brightness based on the size of adaptability. The fireflies with low brightness will be attracted by the fireflies with high brightness. The attraction is proportional to the brightness, and the brightness decreases with the increase of distance. The position of the firefly is regarded as its corresponding solution, and the brightness is the fitness of the solution. The individuals with high brightness continuously attract the individuals with low brightness for iteration. At the end of the iteration, the position of the individuals with the highest brightness is the optimal feasible solution. It can effectively solve the single objective optimization problem.
The steps of the classical firefly algorithm are as follows: 1) Initialize the parameters of the algorithm, including the number of iterations and the size of firefly population. 2) In the solution space, fireflies at different positions are randomly generated, and their initial brightnesses (fitness value of objective function) are calculated. 3) Update the positions of fireflies, calculate the relative brightness of fireflies and other fireflies, move to fireflies with greater attraction than themselves, and complete a single iteration of a single firefly. The relative brightness of fireflies is directly proportional to the original brightness, and inversely proportional to the distance between fireflies and the absorption coefficient of light intensity. The relative brightness of fireflies at r is calculated as follows: I 0 is the brightness (fitness) of firefly at the light source (r = 0),which is related to the problem to be optimized. γ is the light intensity absorption coefficient, which indicates the light absorption ability of air. The updated formula of firefly under the attraction of another firefly brighter than it is as follows: x j and x i are the spatial positions of fireflies i and j, α is the step factor, rand is the random factor obeying uniform distribution on [0, 1]. β is the attraction between fireflies, and its calculation formula follows (3).
β 0 is the attraction at the light source (r = 0), which is the maximum attraction, r ij is the Euclidean distance between firefly i and j. λ is the light intensity absorption coefficient, which indicates the light absorption ability of air. 4) Perform stp 3 for all fireflies to complete an update of the entire firefly population. 5) Determine the appropriate termination conditions according to the problem to be optimized, and judge whe-ther the termination conditions are met. If not, repeat stp 3. 6) If the termination condition is satisfied, the brightest firefly is the optimal solution of the problem to be optimized. FA is a powerful group intelligence algorithm, which has a good effect in solving the problem of function optimization.

B. AN IMPROVED FIREFLY ALGORITHM
In solving the single objective optimization problem, FA often falls into the local optimum and the iteration speed is not satisfactory. So ADFA is proposed by Alhroob et al. [17].
Levy flight firefly algorithm is used in ADFA to adjust the update step size. Levy flight firefly strategy not only enhances the ability of local space development, but also increases the ability of global search. It applies the randomness of Levy flight rather than the traditional Gaussian distribution or uniform random distribution.
The way of firefly position updating has changed.
Among them, α is the randomization parameter, ⊗ is the Hadamard product. The term sign(rand0.5) provides random direction, while the random step size comes from Levy flight firefly.
The random distribution of Levy flight firefly accords with the following formula: The updated formula for Levy flight firefly is as follows: ν and µ agree with the Gaussian distribution, and φ is calculated as follows: τ is Euler's second integral, η = 1.5. Because Levy flight firefly ignores the local development capability, the method of updating step size parameter of logarithmic spiral path is also proposed in ADFA.
The updated formula is as follows: l is the random vector of D dimension in [0, 1], β 0 is a constant with a value of 1, and e b·l ⊗ cos(2π · l) is the mathematical expression formula of logarithmic spiral path.
In order to balance the two renewal formulas, ADFA proposes an adaptive switch as follows: Apply the double helix update mode if µ ≤ R t Apply the Levy update pattern if µ ≥ R t The R t update method is as follows: f * is the fitness function value of the optimal firefly in the t-th iteration, lg(·) = log 10 (·). · is the floor function. The adaptive parameter is updated as follows: Compared with the original algorithm of firefly, ADFA has stronger ability of global exploration and local development.

III. A NOVEL HYBRID FIREFLY ALGORITHM BASED ON THE VECTOR ANGLE LEARNING MECHANISM
This section introduces the inspiration of HFA-VAL update, its update formula and advantages. VOLUME 8, 2020 A. UPDATE LEADER STRATEGY ADFA has strong global exploration ability and local development ability, but it is easy to skip the global optimal value in the process of updating. In this paper, an update leader strategy is proposed to prevent the optimal value from being lost by saving the optimal fireflies of three generations, and updates it with DE algorithm. This algorithm not only enhances the global exploration but also prevents the loss of the optimal value. Some functions have many peaks, so we need to adopt a strategy to jump out of the local optimum. In this paper, a differential algorithm is used to update the leader fireflies. Five fireflies are randomly selected from all fireflies, and their random dimensions are used to complete the variation of the leader fireflies. The reason why the leader fireflies are updated instead of all fireflies is that updating a large number of fireflies will affect the iteration speed of the algorithm. In order to prevent the loss of the optimal value during the update process, the optimal fireflies of the third generation are kept.
In the update process, when the step size is too large, the optimal value found may be lost. In order to solve the problem, the leader update strategy keeps the optimal firefly of three generations so that the optimal value is not easily lost. Meanwhile, the leader firefly of the last three generations will make the search space scope clearer and the iteration speed faster. Multimodal function has multiple locally optimal values. When searching the solution space, the searching range of updating the global optimal value with the traditional method may fall into the local optimal value and cannot be broken. No fireflies learn from bad fireflies, so they get closer and closer to the best fireflies, but the bad fireflies have a better range. Using the difference algorithm to update the firefly will expand the search range of fireflies, so that the fireflies are not easy to fall into the local optimal. The leader fireflies are updated as follows: F is the random number of [0, 1], and x r1 , x r2 , x r3 , x r4 , x r5 is the randomly selected firefly.

B. VECTOR ANGLE PARAMETER
Vector Angle is based on the modeling of firefly with phase angle (θ). The phase angle of each firefly is a one-dimensional variable, so each firefly is simulated by a vector with an angle, which transforms the firefly algorithm into an adaptive (triangular), balanced, and non-parametric meta-heuristic algorithm. The vector angle parameter is proposed to replace the logarithm helix parameter in the original ADFA and improve the convergence ability with the method of updating the leader. In order to balance the exploration and development capabilities of FA, an adaptive switch is proposed by ADFA, and the step size is controlled by levy flight firefly algorithm or vector angle parameters. The ADFA has made some changes to the standard FA framework in order to incorporate adaptive switches. An adaptive switch is established for the performance of logarithmic spiral path and the capacity of adaptive switch. Whether the step size is controlled by the levy flight parameters or by the logarithmic spiral parameters, ADFA always uses adaptive parameters to control. There exists reverse search when the logarithmic spiral parameter is used to self-adapt the step size. In the original algorithm, this would expand the search range beyond the local optimal value, but in this paper, DE algorithm is used to update the leader firefly, so it is not necessary to conduct a reverse search. Logarithmic spiral parameters are improved to vector angle parameters, and reverse search is removed to speed up iteration. The vector angle parameter is a random variable whose upper bound is carefully designed so that the search speed is not so fast that the optimal value is lost.
The formula is as follows: in Eq13 exp(x) = e x , ee is calculated as: ee = abs(cos(θ)) aa (14) θ is a random numbers from [0, 2π], the updated formula for aa is: The updating formula of firefly position is: The pseudo code and flow chart of the algorithm are FIG 1 and TAB 1.

C. COMPLEXITY ANALYSIS
Experimental results show that the speed of HFA-VAL algorithm is better than ADFA algorithm.In the location update stage, Step3 shall update and iterate the first three fireflies for 3 times, Step4 shall update and iterate the remaining fireflies for n-3 times, n is the number of fireflies, and the algorithm complexity of HFA-VAL single iteration is O(2n 2 ). If the number of iterations of Hfa-Val is K, the asymptotic upper bound of algorithm complexity is O(K N 2 ).

IV. NUMERICAL SIMULATIONS
In this section, we used matlab 2015b to test the new firefly algorithm proposed in this paper in CEC2005 test set and compared it with other algorithms. We also verifed the effectiveness of the new firefly strategy.

A. EXPERIMENTAL SETTINGS
In the experimental parameter setting, all parameters of the firefly algorithm were set to the same value. The random parameter a = 0.2, the fixed light absorption coefficient r= 1, and the attraction at r=0, b0 = 1. In addition, the test  dimension was 50, and two conditions set for experiment termination, namely, the maximum number of iterations was reached and the optimal value do not change in the 50 iterations. The number of fireflies was set to 30. For the particle swarm optimization algorithm, the population number was set to 30, the random parameter c1=0.2, c2=0.2, the maximum speed vmax=0.8, the test dimension was 50. The experimental termination conditions were set to reach the maximum number of iterations and met the requirement that the optimal value did not change in the 50 iterations. All algorithms were given a random initial position.

C. ANALYSIS OF SIMULATION RESULTS
The mean and variance of 20 tests in the experiment were taken as the final result of Experiment IV-C.
A conclusion can be drawn by comparison: 1) The hybrid learning mechanism (HFA-VAL) of the firefly algorithm that based on vector angle is superior to other algorithms in solving the single peak problem. 2) For the multimodal problem of mixed component function, the performance of HFA-VAL algorithm is second only to other functions. VOLUME 8, 2020 There are unimodal, multimodal and mixed functions in the test set. For the unimodal function HFA-VAL has the ability of rapid iteration to find the global optimal solution as soon as possible. For multi-peak function, the updated leader strategy by HFA-VAL can jump out of the local optimal value. For the mixed function, HFA-VAL can balance the exploration ability and mining ability to ensure the iteration speed and prevent the local optimal. Function 11 is shifted rotated weierstrass function, which has the property of multi-modal,shifted,rotated,nonseparable, scalable,and continuous but differentiable only on a set of points. It has several local optima in the solution space, and often falls into local optima when HFA-VAL is used to search the solution space. When using DE to update, the leader firefly has a greater chance to jump out of the local optimal, but the process of jumping out of the local optimal will reduce the speed of iteration. Because the Weierstras function has many local optima, and the distance between the local optimal solutions is small. If HFA-VAL leader strategy is used to update the step size, the adaptive step size is relatively long, so the fitting is not very good. Therefore, the HFV algorithm does not rotate the Weierstrass function as well as other algorithms. Function 12 is Schwefel's Problem expanded functions, which has two similar local optima. It has the characteristics of multi-modal shifted non-separable and scalable. Because of the HFA-VAL adaptive step size is too long and the convergence speed is too fast, the result will hover between the two local optimal advantages. In function 12, HFA-VAL is slightly worse than other algorithms.    unimodal function has no local optimal value, so the faster the convergence speed, the easier it is to get the optimal solution.Vector Angle parameters accelerate the search speed of firefly, so for unimodal function, vector Angle parameters are helpful to find the optimal solution of unimodal function. Multimodal functions(F6-F14) have multiple local optimal solutions in the solution space. Too slow firefly searching will affect the iteration efficiency, too fast will fall into the local optimal value. Although too fast firefly searching will make it easier to search for the optimal value of unimodal function, however it is not a good thing for multimodal functions. So it is very important to balance the exploration and development ability of fireflies. The adaptive step size of vector Angle parameter is helpful for fireflies to get rid of local optimal value. The hybrid function(F15-F25) is not only composed of one function, but also has more properties. The vector Angle VOLUME 8, 2020 parameter adaptive step size can speed up the iteration speed and find the optimal value more easily.
In a large number of experimental data, two groups of data with typical characteristics have been selected and analyzed. According to TAB 6 and FIG 4, it is not difficult to draw a conclusion that the vector Angle parameter is valid under the same iteration times.

E. LEADER UPDATE STRATEGY EFFECTIVENESS
The effectiveness of updating the leader strategy is verified by two groups of experiments. One group adopt the updated leader strategy, while the other group does not. In order to keep the other parameters consistent, the two groups conduct 20 experiments in 25 functions of CEC2005 test function, and calculate the mean value and variance.
The results show that most of the experimental results are better with the updated leader strategy, but a few of them are less effective. Updating the leader strategy increases the probability of firefly jumping out of local optimal, but also reduces the speed of firefly iteration. The update leader strategy uses DE algorithm to learn from other poor fireflies, which improves the possibility of jumping out of the local optimal solution in the solution space. It enhances the development ability of the algorithm and makes most functions in the test set get better solution results. For a small number of functions, the local optimal value is close but far away, and the iteration speed of updating the leader strategy does not support seeking the optimal value. Therefore, this paper uses the vector Angle parameter adaptive step size to improve the iteration speed of the algorithm. It enhances HFA -VAL development capability and balances the imbalance between development and exploration capability caused by the updated leader's over-strong strategic exploration capability.
From a large number of experimental data, two groups of data with typical characteristics have been selected and analyzed. According to tab6 and fig 4, it can be concluded that under the same environment and iteration times, the leader updating strategy is effective.

V. CONCLUSION
Original firefly algorithm is not good enough at the iterative speed and accuracy, so a novel hybrid firefly algorithm based on the vector angle learning mechanism is introduced in this paper.
First of all, this algorithm retains the optimal firefly of the original firefly algorithm and keeps the optimal value for three generations. And the DE algorithm is used to update the algorithm. Secondly, the algorithm in this paper can expand the search space and speed up the search for the optimal firefly, and can ensure that when the algorithm is about to fall into the local optimal, jump out of the local optimal. Thirdly, in the update of other fireflies, this paper adopts directional Angle parameter to adaptive control the step size of firefly search, which not only guarantees the iteration speed in the early stage, but also avoids losing the optimal value in the later stage. Finally, among the 25 benchmark functions in the CEC2005 test set, the test results are superior to other algorithms.
In the following studies, the optimization scheme can be proposed to improve the processing strategy of fireflies outside the search range, classify fireflies into different functional populations, or carry out better updating strategies for other fireflies. The HFA-VAL algorithm proposed in this paper promotes the development of swarm intelligence algorithm and helps to find the target solution in the solution space. It is hoped that the algorithm proposed in this paper can solve practical problems more conveniently.