## 4 Optimization Techniques and Procedures
### _Moth-Flame Optimization Algorithm (MFO)_  
The moth-flame optimization (MFO) algorithm takes inspiration from the navigational mechanism (i.e., transverse orientation) of moths during night flights. The moth flies by maintaining a fixed angle relative to the moon. Since the moon is so far away from the moth, this mechanism assures the linear flight of moths. Although a lateral orientation is practical, moths are often trapped to repeatedly circle many close artificial or natural point light sources until they are exhausted. This behavior of moths is shown in Figure 6.  
Mathematical Formulation of the MFO Algorithm  
According to the MFO algorithm, the moth is considered the candidate solution to the problem. The variables are represented by the positions of the moths in the solution space. Moths can fly in the solution space by changing the position vectors. Since this algorithm is a swarm-based intelligence optimization algorithm, the position vectors of the moth population can be represented in the following matrix (Equation (15)):  
\[\text{M}=\left[ \begin{array}{ccc}m_{1,1}&\cdots&m_{1,d}\\ \vdots&\ddots&\vdots\\ m_{n,1}&\cdots&m_{n,d}\end{array} \right] \tag{15}\]  
where \(n\) is the number of moths and \(d\) represents the number of dimension variables to be solved. The following array represents the list of fitness value vectors corresponding to all moths:  
\[\text{OM}=\left| \begin{array}{c}OM_{1}\\ \vdots\\ OM_{n}\end{array} \right| \tag{16}\]  
Each moth updates its position with the corresponding unique flame to avoid the algorithm being trapped in the optimal local value, which significantly supports the algorithm's exploration ability. Hence, the flame positions in the solution space corresponding to its moths are represented in the following array (Equation (6)):  
\[\text{F}=\left[ \begin{array}{ccc}f_{1,1}&\cdots&f_{1,d}\\ \vdots&\ddots&\vdots\\ f_{n,1}&\cdots&f_{n,d}\end{array} \right] \tag{17}\]  
Figure 6: Spiral flight path of moths near artificial or natural point light sources [20]. For these flames, the corresponding column of the fitness value vectors is represented as follows:  
\[\text{OF}=\left| \begin{array}{c}OF_{1}\\ \vdots\\ OF_{n}\end{array} \right| \tag{18}\]  
The position update strategies for both the moth and flame matrices are different during the iteration process. The moths are the solution points that move within the solution space, and the flames are the best solution points obtained by moths iteratively so far. The best solutions of the moths are updated to the positions of the flames in the next iteration. With this approach, the MFO algorithm can find the optimal global solution. The position update behavior of each moth relative to a flame is expressed mathematically by the following equation:  
\[M_{i}=S\big{(}M_{i},F_{j}\big{)} \tag{19}\]  
where \(M_{i}\) is the \(i\)th moth, \(F_{j}\) is the \(j\)th flame, and S is the spiral function. The spiral function's initial point should start from the position of the moth, and the endpoint should be at the position of the flame. The range fluctuation of the spiral function should not exceed the boundaries of the search space. According to the above conditions, the logarithmic spiral function of the moth's flight path is defined as in Equation (20):  
\[S\big{(}M_{i},F_{j}\big{)}=D_{i}*e^{bt}*\cos(2\pi\text{t})+F_{j} \tag{20}\]  
where \(D_{i}\) is the linear distance of the \(i\)th moth for the \(j\)th flame and \(b\) is an index of the shape of the logarithmic spiral. The magnitude of \(t\) is represented by Equation (21), where \(a\) is represented by Equation (22):  
\[t=(a-1)*rand+1 \tag{21}\]  
The path coefficient \(t\in[r,1]\) represents the distance between the moth and the flame's position in the next optimization iteration. The variable \(r\) decreases linearly from \(-1\) to \(-2\) as the number of iterations in the optimization iteration increases.