Keywords

1 Introduction

Firefly algorithm (FA) [1] is a new intelligent algorithm. It is proposed by Yang in 2008. Firefly algorithm simulates the biological characteristics of fireflies, such as luminosity, mutual attraction and movement, and searches for partners in a certain range. After several moves, the algorithm achieves the purpose of optimization. Firefly algorithm is simple, with few parameters and fast convergence speed. It is applied to optimal configuration of distributed power [2], train operation adjustment [3], no-wait flowshop scheduling [4], path planning [5], assessment of groundwater quality [6] and other problems, and successfully solved the production problem. It is an excellent intelligent stochastic algorithm.

The shortcomings of FA are slow convergence speed, easy to fall into local optimum, strong correlation between optimization results and parameters. Researchers have made various improvements to it. In 2014, Yu et al. proposed a step setting strategy based on individual best position and global best position [7], and in 2015, they proposed a nonlinear dynamic adjustment step strategy [8], which improved the search quality of the Firefly algorithm. In 2018, Wang [9] et al. proposed a new algorithm based on local uniform search and variable step size (UVFA), which reduces the time complexity of the standard Firefly algorithm, improves the convergence accuracy and enhances the robustness of the algorithm.

Researchers have proposed many personalized hybrid algorithms for various swarm intelligence algorithms to obtain good performance of optimization problems. For example, A hybrid algorithm based on Firefly algorithm and Differential Evolution [10], A hybrid algorithm based on Particle Swarm and Fireworks [11], A hybrid swarm intelligence optimization for benchmark models by blending PSO with ABC [12], Obstacle avoidance path planning of intelligent mobile based on Improved Fireworks-Ant Colony hybrid algorithm [13], Glowworm-Particle Swarm hybrid Optimiza [14], A hybrid optimization algorithm of Cuckoo Search and DE [15], A Hybrid Optimization algorithm based on Artificial Swarm and Differential Evolution [16].

This paper optimizes the search process of standard FA by using the strong exploitation ability of Fireworks algorithm (FWA) [17], embeds the explosive search process into the standard FA. An improved Firefly algorithm hybrid with Fireworks is proposed. Although the mechanism of Firefly algorithm and Fireworks algorithm is different, but the algorithm is parameterized, the interface can be interoperable, and the unique parameters can be constant quantization.

2 Firefly Algorithm

The standard Firefly algorithm is a heuristic algorithm based on the glowing and courtship behavior of fireflies. It is used to solve the stochastic optimization problem. The algorithm handles the bioluminescence and photoluminescence behavior of firefly, making the algorithm simple, efficient and practical. Three hypotheses are proposed. Firstly, all fireflies are unisex. So, one firefly will be attracted to other fireflies regardless of their sex. Secondly, attractiveness is proportional to their brightness. Thus, for any two flashing fireflies, the less bright one will move toward the brighter one. The attractiveness is proportional to the brightness and they both decrease as their distance increases. If there is no brighter one than a particular firefly, it will move randomly. Thirdly, the brightness of a firefly is affected or determined by the landscape of the objective function. For a minimization problem, the brightness can be reciprocal of objective function. It means that a brighter firefly has a smaller objective function value.

In FA, the main formulas include relative luminance formula, relative attractiveness formula and position update formula [18].

The luminance formula is:

$$ I({\text{r}}) = I_{0} {\text{e}}^{ - \gamma r} $$
(1)

where is the maximum fluorescence brightness of fireflies, i.e. the fluorescence brightness at r = 0, which is related to the value of the objective function, the better the value of the objective function, the higher the brightness of the firefly itself; γ is the intensity absorption coefficient to reflect the weakening characteristics of light intensity, in most cases, γ ∈ [0.01, 100]; r is usually the Euclidean distance between fireflies i and j.

The attractiveness can be calculated as follows:

$$ \beta ({\text{r}}) = \beta_{0} {\text{e}}^{{ - \gamma r^{2} }} $$
(2)

where β0 is the attractiveness at r = 0, and γ is the absorption coefficient of light intensity.

The movement of a firefly Xj, which is attracted to another brighter firefly Xi, is determined by

$$ x_{j} ({\text{t}} + 1) = x_{j} ({\text{t}}) + \beta (x_{\text{i}} (t) - x_{j} (t)) + \alpha \varepsilon_{j} $$
(3)

where xj(t + 1) is the position of firefly xj after the move of t + 1; α is a random value with the range of [0, 1]; and ε is a Gaussian random number with the range of [0, 1].

FA steps are shown in Algorithm 1.

figure a

In the algorithm, individuals exchange information by fluorescence to form a positive feedback mechanism, which ensures that the whole population can find the optimal solution with a higher probability.

3 Proposed Approach

3.1 Domain Search Model

In the standard FA, the attraction between fireflies is random. If the number of attractions is too large, it will cause repeated oscillations and increase the time cost. If the number of attraction is too small, it will miss the best value and premature convergence. Therefore, attracting quantity and search scope has become an important factor. If the local optimal value is found first and then iterate, the performance of the optimization algorithm can be achieved by promoting the global optimization with the local optimal value. That is, by enhancing the local exploitation capacity to promote the overall exploration capability.

Based on the above considerations, an optimal solution is obtained in the domain with radius ri1. After iteration, the optimal solution is regarded as the optimal individual in the population, which is regarded as the central point and searched radially with radius ri2. The second optimal value is obtained, and then the solution is regarded as the individual of the population and the individual as the central point and the radius as the ri3 radiation search, and so on. This radial search is similar to the fireworks and sparks generated when the fireworks explode. The fireworks are the individual of the parent population and the sparks are the children of the iterated update population.

Domain search is performed in D-dimensional space, and the search process in two-dimensional space is shown in Figs. 1(a) to (d). Firefly individual Fi1 is a better individual obtained for the first time. Based on this individual as a benchmark and radius ri1 as a domain, the better individual Fj1 is obtained and Fj1 as the next generation Fi2. After the iteration, Fi2 is taken as the center and ri2 is taken as the radius to search the domain. The optimal value Fj2 is obtained, and Fj2 is taken as the Fi3 after the iteration. Fi3 as the center and ri3 as the radius of the domain search, get a better value of Fj3, so iterate on until the optimal or the maximum number of evaluations.

Fig. 1.
figure 1

The search model for 2D space domain

3.2 Fireworks Search Strategy

Based on the above model, the process of searching neighborhood by using Firefly algorithm is introduced, and the standard FA is improved. In the Firefly algorithm, the explosion radius and the number of sparks produced by each fireworks explosion are calculated according to their fitness values relative to other fireworks in the fireworks population. For the fireworks \( x_{i} \), the Ai of the explosion radius is calculated as follows:

$$ {\text{A}}_{\text{i}} = \hat{A} \times \frac{{f\left( {x_{i} } \right) - y_{\hbox{min} } + \varepsilon }}{{\sum\limits_{i = 1}^{N} {\left( {f\left( {x_{i} } \right) - y_{\hbox{min} } } \right) + \varepsilon } }} $$
(4)

where \( y_{\hbox{min} } = \hbox{min} (f(x_{i} )),(i = 1,2, \ldots ,N) \), it is the minimum fitness value of the current population. It is a constant used to adjust the size of the explosion radius.

The number of exploding sparks Si of fireworks \( x_{i} \) is calculated as follows:

$$ {\text{S}}_{\text{i}} = {\hat{\text{S}}} \times \frac{{y_{\hbox{max} } - f\left( {x_{i} } \right) + \varepsilon }}{{\sum\limits_{i = 1}^{N} {\left( {y_{\hbox{max} } - f\left( {x_{i} } \right)} \right) + \varepsilon } }} $$
(5)

where \( {\text{y}}_{\hbox{max} } = \hbox{max} (f(x_{i} )),(i = 1,2, \ldots ,N) \), it is the fitness maxima of the current population. \( {\hat{\text{S}}} \) is a constant that adjusts the number of explosions. \( \varepsilon \) is the smallest part of a machine to avoid zero operation.

In the improvement of FA, formula (4) is used to calculate the radius of neighborhood search, and formula (5) is used to calculate the number of fireflies within the radius.

3.3 An Improved Firefly Algorithm Hybrid with Fireworks

Based on the idea of neighborhood search model, a firework-type neighborhood search operator is added to the standard FA. At the same time. An improved Firefly algorithm hybrid with Fireworks (FWFA) is proposed using the above population generation method. After each search of the standard FA, the number of fireflies within the search radius and radius is calculated, and then a firework search is conducted to generate new firefly individuals, and finally the population is updated to complete a search. The algorithm steps are shown in Algorithm 2. The difference between the algorithm and the standard FA is 13 to 16 rows.

figure b

4 Simulation Experiments

4.1 Experimental Setup and Benchmark Function

In this paper, 28 standard test functions in CEC2013 are used to analyze and verify the convergence rate and the quality of the FWFA. The test functions are shown in Table 1. See Reference [19] for a detailed description. The function f1–f5 is a unimodal peak function, which is used to test the optimization accuracy of the algorithm and the performance of the algorithm. The function f6–f20 is a basic multimodal function with multiple minimum values. The number of local optimum points increases exponentially with the increase of dimension, which is used to test the ability of the algorithm to jump out of local optimum. The function f21–f28 is a composition function with both unimodal peak and multimodal functions.

Table 1. The CEC’13 benchmark functions

The experimental hardware environment is Intel Core i7-4790 CPU@3.60 GHz processor, 8 GB memory, 64-bit operating system; the software environment is Windows 7 operating system, MATLAB R2016b version.

In the experiment, the dimension D of 28 test functions was set to 30, each function was run 30 times, the maximum number of iterations MaxFEs was set to D * 5000, and the population size was 50. The parameters of FA, WSSFA, VSSFA and FWFA are set in the same way. Among them, the attractiveness of firefly β0 is 1, the step factor α is 0.2, and the optical absorption factor γ is 1. The maximum number of sparks for standard FWA and FWFA is 40, the minimum spark number is 2, and the number of Gauss mutations is 5.

4.2 Results

In order to directly evaluate the performance of FWFA, the standard FA, the improved WSSFA [7], the improved VSSFA [8], the standard FA and the FWFA are compared, and the Wilcoxon rank sum test [20], the specific data as shown in Table 2. At the bottom of the table, the Wilcoxon’s rank sum test results at a 0.05 significance level between FWFA and others are summarized, in which the symbol “−”, “+”, and “≈” represent that the performance of the related algorithm is worse than, better than and similar to that of FWFA, respectively. The rough part is the average error optimal value in the comparison algorithm.

Table 2. Experimental results of FA, WSSFA, VSSFA, FWA, and FWFA for all test functions at D = 30

Comparing with standard FA, WSSFA and VSSFA, FWFA has absolute advantages over standard FA, WSSFA and VSSFA in 28 functions. Compared with standard FWA, FWFA achieves excellent results in 20 test functions, and the results of the other 8 functions are similar, and the average error values depend on. There is a slight advantage. Overall, the FWFA is ideal.

In order to analyze whether there are significant differences in the overall distribution of multiple independent samples, Friedman test is used to rank the rank mean of each sample. As shown in Table 3, the rank also reflects the performance of the algorithm. The smaller the rank mean, the better the performance of the algorithm [21].

Table 3. Average rankings based on the Friedman test

In order to intuitively reflect the convergence process of FWFA and other comparison algorithms, two functions are selected from single peak function, multi-peak function and composite function to display here, as shown in Fig. 2. The abscissa coordinates of the graph indicate the evaluation times of the function, and the upper bound is 15000; the ordinate coordinates represent the mean value of the test function in 30 experiments, with one value for each interval of a certain interval. The graphs (a) to (f) are convergence curves of algorithms FA, WSSFA, VSSFA, FWA and FWFA running on six test functions, respectively.

Fig. 2.
figure 2

Convergence curves of five algorithms on functions f1, f5, f10, f15, f23, f27

From Fig. 2, it is found that the convergence speed of FWFA is faster than that of the algorithm in all test functions, and the final value is nearest to the target value. Therefore, the algorithm FWFA significantly improves the performance of the standard FA, which is the best of several comparison algorithms.

5 Conclusion

Based on the standard FA, An improved Firefly algorithm hybrid with Fireworks is proposed in this paper, which uses idea of the neighborhood search, refers to the search characteristics of Fireworks algorithm, adds the fireworks local search operator, and changes the population generation method of the standard Firefly algorithm. The improved FWFA is compared with the standard FA, WSSFA, VSSFA and standard FA. The results show that the FWFA has excellent search ability in solving unimodal functions, multimodal functions and composition functions problems. It is proved that the FWFA is effective in improving the standard FA.