## 7 Butterfly Optimization Algorithm and Improvements  
### Original BOA Algorithm  
BOA is a novel metaheuristic optimization technique that was inspired by butterfly foraging and butterfly mating [21]. The BOA algorithm's algorithmic representation of the biological system is based on three hypotheses:  
1. All butterflies attract each-other by emitting a scent. 2. Their flight is random or aimed to the best butterfly emitting more intense scent. 3. Butterfly stimulus strength is determined by the objective function value at the considered butterfly. There are three stages to BOA algorithm's optimization process: startup, iteration, and final optimization. In each execution of BOA, the initialization phase is conducted first, followed by iteration, and the algorithm is finished after the optimal solution has been identified in the final optimization phase. The objective function and solution space are specified during the phase of initialization. In this phase, the BOA parameters are initialized, and the method then generates a random initial butterfly population within the upper and lower bounds calculating and storing their fragrance and fitness values. The iteration phase of BOA follows the initialization step and with it is when the optimum solution is found via a series of iterations. During each iteration, the value of the objective function is calculated for each butterfly, and then the butterflies use that value to influence the amount of scent \(\varphi_{i}\) they produce in their current positions  
\[\varphi_{i}=cl^{a}, \tag{43}\]  
in which \(a\) denotes the power exponent chosen as \(a\in[0,1]\) and \(c\) is the sensory fragrance in the range \([0,1]\), and \(I\) is the stimulus intensity. The change in fragrance absorption is governed by the parameter \(a\) value. Given two limit scenarios, i.e., when \(a=1\), there is no absorption of scent, i.e., the same amount of fragrance is recognized by all butterflies. Consequently, a fragment butterfly can be discovered anywhere within the region, and a global solution can be reached. In contrast, when \(a=0\), the scent cannot be sensed by other butterflies, thus impacting the algorithm's optimization behaviour. The algorithm's convergence rate can be controlled by the value of the parameter \(c\), which is usually chosen based on the properties of the objective function to be optimized. The values of \(a\) and \(c\), have a considerable effect on the algorithm's convergence rate and optimization performance. The value of the stimulus intensity \(I\) depends on the objective function value at the considered butterfly, as follows  
\[I=f\Big{(}\mathbf{x}_{i}^{(G)}\Big{)}, \tag{44}\]  
where \(f\Big{(}\mathbf{x}_{i}^{(G)}\Big{)}\) is the objective function value of \(i\)th butterfly at \(G\)th generation. In the iteration phase, the BOA evaluates two steps, i.e., global and local search. The butterfly with the highest obj. function value, indicated by \(\mathbf{g}^{*}\), is moved in the step of global search using the formula  
\[\mathbf{x}_{i}^{(G+1)}=\mathbf{x}_{i}^{(G)}+\Big{(}r^{2}\times\mathbf{g}^{*}- \mathbf{x}_{i}^{(G)}\Big{)}\times\varphi_{i}, \tag{45}\]  
where \(r\in[0,1]\) is the randomly selected number. The next step, which deals with the local search, assumes movement of the butterfly in the vicinity of other neighbouring butterflies, as follows  
\[\mathbf{x}_{i}^{(G+1)}=\mathbf{x}_{i}^{(G)}+\Big{(}r^{2}\times\mathbf{x}_{j}^ {(G)}-\mathbf{x}_{k}^{(G)}\Big{)}\times\varphi_{i}, \tag{46}\]  
where \(\mathbf{x}_{j}^{(G)}\) and \(\mathbf{x}_{k}^{(G)}\) denote the appropriate butterflies taken from the solution space. In each iteration, switch probability \(p\) is used to choose between expressions in Equations (46) and (45) according to the expression  
\[\mathbf{x}_{i}^{(G+1)}=\left\{ \begin{array}{ll}\mathbf{x}_{i}^{(G)}+\left(r^{2 }\times\mathbf{g}^{*}-\mathbf{x}_{i}^{(G)}\right)\times q_{i},&\text{for $r_{p}<p$}\\ \mathbf{x}_{i}^{(G)}+\left(r^{2}\times\mathbf{x}_{j}^{(G)}-\mathbf{x}_{k}^{(G )}\right)\times q_{i},&\text{otherwise}\end{array} \right.