1 INTRODUCTION

Artificial fish swarm algorithm is a swarm intelligence algorithm based on animal autonomous body model proposed by Li et al. [1]. Later, Li et al. [2] further modified the fish swarm algorithm by introducing survival and competition mechanism. The algorithm has good convergence effect in the early stage, but in the late stage the algorithm tends to fall into the vicinity of the local optimal, resulting in slow searching speed and low solution accuracy. Scholars have raised many improvement methods to do with these problems. According to the distance between artificial fish and optimal solution, Qiu et al. [3] set the changing speed and used it to replace the step size, so as to improve the accuracy on the premise of ensuring the speed. Neshat et al. [4] reviewed the development of artificial fish swarm algorithm and various methods combining AFSA with other optimization algorithms and then described the application of this algorithm in various fields. Luan et al. [5] adopted relative base reinforcement learning algorithm to initialize the position of artificial fish and adjusted the parameters of artificial fish by Cauchy distribution and normal distribution. Geng et al. [6] combined the frog jump algorithm and fish swarm algorithm, and the mixed algorithm with higher accuracy and faster convergence rate was applied to parameter identification. In order to better solve the robot path planning problem, Zhang et al. [7] put forward an improved fish swarm algorithm on the basis of direction operator and immune algorithm. Kong et al. [8] adjusted the step size of artificial fish according to the spectral peak of stochastic resonance. Zheng et al. [9] combined the fish swarm algorithm with particle swarm optimization algorithm and used the hybrid algorithm to detect weak signals adaptively. Wang et al. [10] took advantage of the merits of simulated annealing algorithm and genetic algorithm to modify the deficiencies of fish swarm algorithm. In the PID neural network control method, Mai [11] used fish swarm algorithm to optimize the parameters to shorten the response time and enhance control ability of vehicle. Yang et al. [12] introduced differential evolution algorithm to enhance the local solving ability of fish swarm algorithm.

In 2010, Tan [13] proposed a new swarm intelligence algorithm, fireworks algorithm (FWA), inspired by the phenomenon of fireworks explosion. Cao et al. [14] introduced elite individual chaotic search and dynamic radius factor based on logical adaptive function into the fireworks algorithm, selected excellent sparks by using the tournament strategy based on fitness value, and applied the modified algorithm to discrete scheduling problem. Reddy et al. [15] established a smart grid model with the goals of cost and carbon emissions and proposed a binary fireworks algorithm to solve the grid scheduling problem. Xue et al. [16] proposed fireworks algorithm based on binary reverse points and tested it with the multidimensional backpack problem. Zhang et al. [17] proposed the concept of pioneer sparks and solved the problems in mapping by using mirror mapping rule. Mo et al. [18] improved the diversity of population through the adoption of “elite–random” strategy and integrated the bat algorithm into fireworks algorithm by using a collaborative optimization way so as to make the reformative algorithm can automatically adjust the step length and enhance local search capability. Cai et al. [19] introduced the idea of quantum evolutionary algorithm into fireworks algorithm to enhance the degree of fireworks’ variation, applied variable neighborhood search for further optimization, and finally used CVRP model for simulation analysis. Xue et al. [20] applied quantum behavior to explosive operator to optimize the performance of fireworks algorithm and used the algorithm to solve the path problem of mobile robot. Liu et al. [21] combined principal component analysis with fireworks algorithm and used it to determine the conversion rate of acropropyl aldehyde. Zeng Min et al. [22] replaced Gaussian variation with Cauchy variation and selected the optimal individuals by elist-random selection method, making performance of the improved algorithm better.

In view of the problems existing in the late stage of fish swarm algorithm, the explosion and Gaussian mutation sparks in the fireworks algorithm are introduced into the fish swarm algorithm, so as to make the information exchange between individuals better, increase the variation degree of fish and make the artificial fish can display stronger search capability. The mapping and selection operations in the fireworks algorithm are used to make all individuals within the defined scope. FWA-artificial fish swarm algorithm (FWA-AFSA) is put forward and applied to four typical functions.

The rest of this paper is as follows: Section 2 elaborates FWA- artificial fish swarm algorithm. Section 3 provides the searching process of the reformative artificial fish swarm algorithm, FWA-AFSA. Section 4 tests the algorithm with four functions, and the simulation results are shown and explained in detail. At last, conclusion is made in Section 5.

2 FWA-AFSA

The fireworks algorithm makes the adaptability of the group in the environment better and better by transmitting information, in order to get the global optimal solution. In the practical application of fireworks algorithm, the objective function is used to represent fitness value of fireworks, and each firework represents a solution to the problem. The process of finding extreme value is the process of producing sparks from fireworks explosion. The fitness value of fireworks with better quality is smaller, and the fitness value of fireworks with worse quality is larger. Fireworks algorithm mainly includes four parts: explosion operator, Gaussian mutation operator, mapping rule, and selection strategy. When optimization effect of fish swarm algorithm is poor, the introduction of fireworks algorithm can not only ensure that population is full of variation, but also take into account global and local search. In this paper, the artificial fish swarm algorithm is optimized by setting the parameter \(\lambda \) with constant or minimal change of the optimal solution and using fireworks algorithm. The specific ideas are as follows: (1) The number of times that the solution obtained by the basic fish swarm algorithm is constant or changes very little is \(\gamma \). When \(\gamma \) reaches \(\lambda \), the current optimal state is directly saved to the next generation, and explosion and Gaussian mutation operations are performed on some artificial fish in other states; (2) Through mapping rules, it is guaranteed that the artificial fish after explosion and Gaussian mutation will never exceed the range to be solved. (3) The selection strategy is performed on artificial fish to eliminate individuals with poor states. And combine the preferred artificial fish into the next iterative process with the previously reserved optimal state.

(1) Explosion operator: The calculation formulas of spark number \({{S}_{i}}\) and explosion radius \({{R}_{i}}\) generated by explosion of fireworks \({{X}_{i}}\) are shown in Eqs. (1) and (2), respectively. In these two formulas, \(m\) is a constant used to constrain the number of sparks generated, the fitness value of \({{X}_{i}}\) is \(f\left( {{{X}_{i}}} \right)\), \({{Y}_{{{\text{worst}}}}}\) and \({{Y}_{{{\text{best}}}}}\) represent the current worst and best fitness values respectively, \(\xi \) is a very small number to prevent the denominator from being 0, \({{R}_{0}}\) represents the maximum range of explosion radius.

$${{S}_{i}} = m\frac{{{{Y}_{{{\text{worst}}}}} - f\left( {{{X}_{i}}} \right) + \xi }}{{\sum\limits_{i = 1}^N {\left( {{{Y}_{{{\text{worst}}}}} - f\left( {{{X}_{i}}} \right)} \right) + \xi } }},$$
(1)
$${{R}_{i}} = {{R}_{0}}\frac{{f\left( {{{X}_{i}}} \right) - {{Y}_{{{\text{best}}}}} + \xi }}{{\sum\limits_{i = 1}^N {\left( {f\left( {{{X}_{i}}} \right) - {{Y}_{{{\text{best}}}}}} \right) + \xi } }}.$$
(2)

In order to ensure that the number of sparks with good adaptability is not too much, the number of sparks with poor adaptability is not too small, and the number of sparks produced by the explosion is an integer, it is necessary to use formula (3) to control the number of explosion sparks. \({\text{round}}\left( {} \right)\) is an integer function; a and b are two preset constants, usually \(a = 0.04\), \(b = 0.8\) [20]; am is the product of a and m, and bm is the product of b and m.

$${{S}_{i}} = \left\{ \begin{gathered} {\text{round}}\,(am),\,\,\,\,{{S}_{i}} < am \hfill \\ {\text{round}}\,(bm),\,\,\,\,{{S}_{i}} > bm,\,\,a < b < 1 \hfill \\ {\text{round}}\,({{S}_{i}}),\,\,\,\,\,\,{\text{else}} \hfill \\ \end{gathered} \right..$$
(3)

The realization process of explosion is as follows: select \(z\) dimensions in fireworks Xi randomly and offset the randomly selected dimension \(k \in \left\{ {1,2, \ldots ,\,z} \right\}\) to generate sparks according to Eq. (4). \(U\left( { - 1,\,\,1} \right)\) is the uniform distribution in the interval of \(\left[ { - 1,\,\,1} \right]\).

$$X_{i}^{k} = X_{i}^{k} + {{R}_{i}} \times U\left( { - 1,\,1} \right),$$
(4)

(2) Gaussian variation: The specific process is as follows: A firework \({{X}_{i}}\) is randomly selected from the population, and, then, a certain dimension k is randomly selected for Gaussian variation. The formula is expressed as:

$$X_{i}^{k} = X_{i}^{k}g.$$
(5)

In formula (5), \(g\) obeys a Gaussian distribution with a mean of 1 and variance of 1.

(3) Mapping rule: Explosion and Gaussian mutation may produce individuals outside the defined scope, which requires mapping rules to bring these individuals back to the defined scope. The formula is

$$X_{i}^{k} = X_{{\min }}^{k} + \left| {X_{i}^{k}} \right|\bmod \left( {X_{{\max }}^{k} - X_{{\min }}^{k}} \right),$$
(6)

where \(\bmod \) is the remainder function, \(X_{{\max }}^{k}\) and \(X_{{\min }}^{k}\), respectively, represent the maximum and minimum values of the kth dimension of the ith spark, and \(X_{i}^{k}\) represents the position of the spark \({{X}_{i}}\) that is out of range on the kth dimension.

(4) Selection strategy: The optimal individual is first retained into the next generation, and, then, other \(N - 1\) fireworks are randomly selected from the candidate set by means of roulette. The set of sparks produced by explosion and Gaussian mutation operator is set K, and the distance between any two fireworks is measured by Euclidean distance, as shown in formula (7). \(\left\| {{{X}_{i}} - {{X}_{j}}} \right\|\) represents the Euclidean distance between \({{X}_{i}}\) and \({{X}_{j}}\); \(D\left( {{{X}_{i}}} \right)\) represents the sum of distance between the firework \({{X}_{i}}\) and other fireworks.

$$D\left( {{{X}_{i}}} \right) = \sum\limits_{j = 1}^K {\left\| {{{X}_{i}} - {{X}_{j}}} \right\|} \,.$$
(7)

The probability that the firework \({{X}_{i}}\) is selected is:

$$p\left( {{{X}_{i}}} \right) = \frac{{D\left( {{{X}_{i}}} \right)}}{{\sum\limits_{j = 1}^K {D\left( {{{X}_{j}}} \right)} }}.$$
(8)

From Eq. (8), it can be seen that the more sparks around the firework \({{X}_{i}}\), the lower the probability of the firework being selected.

3 SEARCHING PROCESS

The optimization process of the FWA-artificial fish swarm algorithm is as follows:

Step 1. Initialize algorithms. The fireworks algorithm is initialized with the given number of explosive sparks m, the maximum explosion radius R0, the explosion number limiting factors a and b, and the number of Gaussian variation sparks number M.

Step 2. Set up a bulletin board to record status of artificial fish.

Step 3. Perform three basic behavior of artificial fish, including foraging, cluster, and follow.

Step 4. Depending on the state of artificial fish, decide whether to update the bulletin board, and its state takes a better one. If the bulletin board is updated very little or does not update for a certain number of times \(\gamma \), explosion, mutation, mapping, and selection operations are introduced, and proceed with step 5; otherwise, proceed with step 6.

Step 5. Fireworks algorithm is introduced, and \(\gamma \) becomes 0.

Step 6. Judge whether the termination condition is met or not. If so, the bulletin board’s value is output; otherwise, return to step 3 to continue running.

Figure 1 displays the program flowchart of FWA-artificial fish swarm algorithm.

Fig. 1.
figure 1

FWA-artificial fish swarm algorithm’s flowchart.

4 FUNCTION OPTIMIZATION SIMULATION

In order to test the performance of the modified algorithm, two-dimensional functions and multi-dimensional functions are independently tested 30 times by using MATLAB R2018a, and FWA-AFSA is compared with the basic fish swarm algorithm (AFSA) and the improved algorithm, DNA-AFSA, in literature [23]. Specific test functions are shown in Table 1.

Table 1. Testing function

According to references [20, 24, 25], parameter settings are as follows: artificial fish \(fishnum = 30\), maximum number of heuristics \(try\_number = 50\), visual field range \(visual = 2\), step size \(step = 0.3\), crowding factor \(\delta = 0.618\). The limiting factor of explosion number \(a = 0.04\), \(b = 0.8\).

4.1 The Two-Dimensional Eggcrate Function

Maximum iteration number \(maxgen = 200\), DNA cross probability \({{P}_{c}} = 0.9\), DNA variation probability \({{P}_{m}} = 0.01\). A constraint on the number of sparks produced by an explosion \(m = 6\), maximum explosion radius \({{R}_{0}} = 4\), the number of sparks in the Gaussian variation operation \(M = 5\), the threshold value of the maximum number of iterations without change \(max\_unchange = 10\). The results of 100 and 200 iterations are shown in Table 2. When the optimization accuracy is 0.01, Table 3 shows the results. The optimal coordinate movements of AFSA and FWA-AFSA are shown in Figs. 2 and 3, respectively. Figure 4 shows the optimal value of algorithms changes with the number of iterations, when the maximum number of iterations is 200.

Table 2. Comparison of three algorithms under fixed number of iterations
Table 3. Comparison of three algorithms under fixed precision
Fig. 2.
figure 2

Optimal coordinate movement chart of AFSA (Eggcrate function).

Fig. 3.
figure 3

Optimal coordinate movement chart of FWA-AFSA (Eggcrate function).

Fig. 4.
figure 4

Comparison of optimization curves (Eggcrate function).

4.2 The Two-Dimensional Schaffer Function

Maximum iteration number \(maxgen = 200\), DNA cross probability \({{P}_{c}} = 0.9\), DNA variation probability \({{P}_{m}} = 0.01\). A constraint on the number of sparks produced by an explosion \(m = 5\), maximum explosion radius \({{R}_{0}} = 5\), the number of sparks in the Gaussian variation operation \(M = 5\), the threshold value of the maximum number of iterations without change \(max\_{\kern 1pt} unchange = 10\). The results of 100 and 200 iterations are shown in Table 4.

Table 4. Comparison of three algorithms under fixed number of iterations

When the optimization accuracy is 0.001, Table 5 shows the results. The optimal coordinate movements of AFSA and FWA-AFSA are shown in Figs. 5 and 6, respectively. Figure 7 shows the optimal value of algorithms changes with the number of iterations, when the maximum number of iterations is 200.

Table 5. Comparison of three algorithms under fixed precision
Fig. 5.
figure 5

Optimal coordinate movement chart of AFSA (Schaffer function).

Fig. 6.
figure 6

Optimal coordinate movement chart of FWA-AFSA (Schaffer function).

Fig. 7.
figure 7

Comparison of optimization curves (Schaffer function).

4.3 The Ten-Dimensional Rosenbrock Function

Maximum iteration number \(maxgen = 2000\), DNA cross probability \({{P}_{c}} = 0.9\), DNA variation probability \({{P}_{m}} = 0.01\). A constraint on the number of sparks produced by an explosion \(m = 6\), maximum explosion radius \({{R}_{0}} = 4\), the number of sparks in the Gaussian variation operation M = 4, the threshold value of the maximum number of iterations without change \(\max \_unchange = 10\). The results of 1000 and 2000 iterations are shown in Table 6. When the optimization accuracy is 10, Table 7 shows the results. The optimal coordinate movements of AFSA and FWA-AFSA are shown in Figs. 8 and 9, respectively. Figure 10 shows the optimal value of algorithms changes with the number of iterations, when the maximum number of iterations is 2000.

Table 6. Comparison of three algorithms under fixed number of iterations
Table 7. Comparison of three algorithms under fixed precision
Fig. 8.
figure 8

Optimal coordinate movement chart of AFSA (Rosenbrock function).

Fig. 9.
figure 9

Optimal coordinate movement chart of FWA-AFSA (Rosenbrock function).

Fig. 10.
figure 10

Comparison of optimization curves (Rosenbrock function).

4.4 The Ten-Dimensional Griewank Function

Maximum iteration number \(maxgen = 2000\), DNA cross probability \({{P}_{c}} = 0.8\), DNA variation probability \({{P}_{m}} = 0.1\). A constraint on the number of sparks produced by an explosion \(m = 5\), maximum explosion radius \({{R}_{0}} = 4\), the number of sparks in the Gaussian variation operation \(M = 5\), the threshold value of the maximum number of iterations without change \(max\_{\kern 1pt} unchange = 10\). The results of 1000 and 2000 iterations are shown in Table 8. When the optimization accuracy is 0.0001, Table 9 shows the results. The optimal coordinate movements of AFSA and FWA-AFSA are shown in Figs. 11 and 12, respectively. Figure 13 shows the optimal value of algorithms changes with the number of iterations, when the maximum number of iterations is 2000.

Table 8. Comparison of three algorithms under fixed number of iterations
Table 9. Comparison of three algorithms under fixed precision
Fig. 11.
figure 11

Optimal coordinate movement chart of AFSA (Griewank function).

Fig. 12.
figure 12

Optimal coordinate movement chart of FWA-AFSA (Griewank function).

Fig. 13.
figure 13

Comparison of optimization curves (Griewank function).

From the analysis of the above results: (1) In the case of the same number of iterations, the optimal value, average value, and worst value of the basic fish swarm algorithm are relatively large, especially in the two-dimensional Eggcrate function and the ten-dimensional Rosenbrock function, indicating that it has low optimization accuracy. The experimental results of FWA-AFSA are smaller than that of AFSA and DNA-AFSA, which shows that FWA-AFSA can jump out of the local extremum and has higher optimization accuracy. Moreover, among the three algorithms, the standard deviation of FWA-AFSA is the smallest, indicating that FWA-AFSA has better stability. (2) In the case of fixed solving accuracy, the algorithm is easy to fall into local extreme value in the late stage, which makes it hard to achieve a very small precision, so the success rate of AFSA is low. And the success rate of FWA-AFSA can reach 100%, indicating that FWA-AFSA has higher reliability. Besides, FWA-AFSA’s average convergence algebra is less than that of AFSA and DNA-AFSA, so the faster convergence speed is proved. (3) These eight optimal coordinate movement charts display algorithms’ optimization process, which shows that artificial fish in AFSA are scattered around the definition domain, while artificial fish in FWA-AFSA are concentrated near the optimal value. (4) The optimization curves show that, compared with other algorithms, FWA-AFSA can converge faster and achieve a smaller solution result, which also indicates that FWA-AFSA has a faster convergence speed and a higher solution accuracy.

5 CONCLUSIONS

To enhance diversity of artificial fish and solve the problem that the basic fish swarm algorithm is difficult to find the global optimal solution, explosion, mutation, mapping, and selection operations in fireworks algorithm are introduced into the late stage of fish swarm algorithm. And a reformative fish swarm algorithm combined with fireworks algorithm is put forward. The functional simulation results show that compared with other algorithms, the proposed algorithm, FWA-AFSA, can jump out of the local extremum better and has best solving effects in convergence, accuracy, and stability. In the later research, we will use the FWA-AFSA to solve complex problems in practical life, such as path optimization and center location. And fireworks algorithm will be applied to the optimization study of other intelligent algorithms.