Skip to main content
. 2021 Dec 6;23(12):1637. doi: 10.3390/e23121637
Algorithm 1. The pseudo-code of I-MFO
Algorithm of improved moth-flame optimization (I-MFO)
Input: Maximum iterations (MaxIt), Number of moths (N), and Dimension size (D).
Output: The best flame position and its fitness value.
1 Begin
2   Randomly distributing M moths in the D-dimensional search space.
3   Calculating moths’ fitness (OM).
4   Set t = 1.
5   OF ← sort (OM).
6   F  ← sort (M).
7   Defining the moth memory Mbest and Fbest using Definition 1.
8    While tMaxIt
9     Updating F and OF by the best N moths from F and current M.
10     Updating flame_no using Equation (3)
11     For i = 1: N
12       Computing the distance between moth Mi (t) and flame Fj (t) using Equation (2).
13       Updating the position of Mi (t) using Equation (1).
14       Computing the fitness value of Mi (t) and update OMi (t).
15       If Fbesti (t) < OMi (t)
16         Selecting a random moth Mr (t).
17         Updating the position of Mi (t) using AWAS defined in Definition 2.
18         Updating the fitness value OMi (t).
19        End if
20      Updating the moth memory Mi using Definition 1.
21      End for
22     Updating the position and fitness value of the global best flame.
23     t = t + 1.
24    End while