# Adaptive Mutation Dynamic Search Fireworks Algorithm
## 2 Dynamic Search Fireworks Algorithm
### Explosion Operator  
Each firework explodes and generates a certain number of explosion sparks within a certain range (explosion amplitude). The numbers of explosion sparks (Equation (2)) are calculated according to the qualities of the fireworks.  
For each firework \(X_{i}\), its explosion sparks' number is calculated as follows:  
\[S_{i}=m\times\frac{y_{\text{max}}-f(X_{i})+\varepsilon}{\sum\limits_{i=1}^{N} \left(y_{\text{max}}-f(X_{i})\right)+\varepsilon} \tag{2}\]  
where \(y_{\text{max}}=\text{max}\) (\(f(X_{i})\)), \(m\) is a constant to control the number of explosion sparks, and \(\varepsilon\) is the machine epsilon to avoid \(S_{i}\) equal to 0.  
In order to limit the good fireworks that do not produce too many explosive sparks, while the poor fireworks do not produce enough sparks, its scope \(S_{i}\) is defined as.  
\[S_{i}=\left\{\begin{array}{ll}round(a\times m),&S_{i}<a\times m\\ round(b\times m),&S_{i}>b\times m\\ round(S_{i}),&otherwise\end{array}\right. \tag{3}\]  
where \(a\) and \(b\) are fixed constant parameters that confine the range of the population size.  
In dynFWA, fireworks are divided into two types: non-core fireworks and core firework, and the core firework (CF) is the firework with the best fitness, and is calculated by Equation (4).  
\[X_{CF}=\text{min}f(x_{i}) \tag{4}\]The calculations of the amplitude of the non-core fireworks and the core firework are different. The non-core fireworks' explosion amplitudes (except for CF) are calculated just as in the previous versions of FWA:  
\[A_{i}=A\times\frac{f(X_{i})-y_{\min}+\varepsilon}{\sum\limits_{i=1}^{N}{(f(X_{i} )-y_{\min})+\varepsilon}} \tag{5}\]  
where \(y_{\min}=\min f(X_{i})\), \(A\) is a constant to control the explosion amplitude, and \(\varepsilon\) is the machine epsilon to avoid \(A_{i}\) equal to 0.  
However, for the CF, its explosion amplitude is adjusted according to the search results in the last generation:  
\[A_{CF}(t)=\left\{\begin{array}{ll}A_{CF}(1)&t=1\\ C_{r}A_{CF}(t-1)&f(X_{CF}(t))=f(X_{CF}(t-1))\\ C_{a}A_{CF}(t-1)&f(X_{CF}(t))<f(X_{CF}(t-1))\end{array}\right. \tag{6}\]  
where \(A_{CF}(t)\) is the explosion amplitude of the CF in generation \(t\). In the first generation, the CF is the best among all the randomly initialized fireworks, and its amplitude is preset to a constant number which is usually the diameter of the search space.  
Algorithm 1 describes the process of the explosion operator in dynFWA.  
```
Calculate the number of explosion sparks \(S_{i}\) Calculate the non-core fireworks of explosion amplitude \(A_{i}\) Calculate the core firework of explosion amplitude \(A_{CF}\) Set \(z=rand\) (1, \(d\)) For \(k=1\):\(d\) do  If \(k\in z\) then  If \(X_{i}^{k}\) is core firework then \(X_{i}^{k}=X_{i}^{k}+\) rand (0, \(A_{CF}\))  Else \(X_{i}^{k}=X_{i}^{k}+\) rand (0, \(A_{i}\))  If \(X_{i}^{k}\) out of bounds \(X_{i}^{k}=X_{min}^{k}+\mid X_{i}^{k}\mid\%\left(X_{max}^{k}-X_{min}^{k}\right)\)  End if  End if  End for
```  
**Algorithm 1**Generating Explosion Sparks  
Where the operator % refers to the modulo operation, and \(X_{min}^{k}\) and \(X_{max}^{k}\) refer to the lower and upper bounds of the search space in dimension \(k\).