An Improved Moth-Flame Optimization Algorithm with Adaptation Mechanism to Solve Numerical and Mechanical Engineering Problems

Moth-flame optimization (MFO) algorithm inspired by the transverse orientation of moths toward the light source is an effective approach to solve global optimization problems. However, the MFO algorithm suffers from issues such as premature convergence, low population diversity, local optima entrapment, and imbalance between exploration and exploitation. In this study, therefore, an improved moth-flame optimization (I-MFO) algorithm is proposed to cope with canonical MFO’s issues by locating trapped moths in local optimum via defining memory for each moth. The trapped moths tend to escape from the local optima by taking advantage of the adapted wandering around search (AWAS) strategy. The efficiency of the proposed I-MFO is evaluated by CEC 2018 benchmark functions and compared against other well-known metaheuristic algorithms. Moreover, the obtained results are statistically analyzed by the Friedman test on 30, 50, and 100 dimensions. Finally, the ability of the I-MFO algorithm to find the best optimal solutions for mechanical engineering problems is evaluated with three problems from the latest test-suite CEC 2020. The experimental and statistical results demonstrate that the proposed I-MFO is significantly superior to the contender algorithms and it successfully upgrades the shortcomings of the canonical MFO.

The MFO algorithm is an effective problem solver that is widely applied for real-world optimization problems. However, MFO is prone to being trapped in local optimum and suffers premature convergence due to its loss of population diversity and imbalance between the two tendencies of exploration and exploitation. Therefore, many variants have been proposed to boost the MFO algorithm, which can be categorized in improved algorithms based on using new search strategies or operators and hybrid-based improvements with other algorithms. Figure 1 shows the classification of SI algorithms and MFO variants.
(ANN-MFO) was proposed by Singh et al. [112] to solve multi-objective problems in magnetic abrasive finishing of aluminum. Chen et al. [96] introduced SMFO to improve the exploration capability of MFO by integrating it with the sine cosine strategy. An enhanced MFO algorithm was proposed by MP Dang et al. [113] which is a hybridization of MFO and three different methods to solve the design problem of a flexure hinge. Mittal [114] brought up an enhanced moth-flame optimization by integrating MFO and variable neighborhood search to boost search capabilities and convergence accuracy of the canonical MFO. In a recent study, Abd Elaziz et al. [115] proposed the FCHMD algorithm which is a hybridization of Harris hawks optimizer and MFO. In this algorithm, fractional-order Gauss and 2xmod1 chaotic maps are used to generate the initial population. Moreover, the FCHMD algorithm ameliorates premature convergence and stagnation in local optima by applying evolutionary population dynamics. Ahmed et al. [116] brought up DMFO-DE which is a discrete hybrid algorithm developed by integrating differential evolution and MFO to encounter the local optima problem and ameliorate the convergence speed and prevent the local optima problem. Li et al. [117] proposed the ODSFMFO algorithm which consists of an improved flame generation mechanism based on opposition-based learning (OBL) and differential evolution (DE) algorithm, and an enhanced local search mechanism based on shuffled frog leaping algorithm (SFLA) and death mechanism.
Based on the above review on MFO and its proposed variants, the most serious drawbacks of MFO are premature convergence, getting stuck in local optimum, low population diversity, and deficient balance between exploration and exploitation. Therefore, in this study, the improved moth-flame optimization (I-MFO) algorithm is proposed to encounter MFO's shortcomings by introducing a memory mechanism and an adapted version of the wandering around search (WAS) strategy [57], called AWAS strategy, to the canonical MFO.  Many algorithms have been proposed by using new search strategies or operators in the canonical MFO. Li et al. [92] proposed the LMFO algorithm by employing the Lévyflight strategy to increase the population diversity. Savsani et al. [93] proposed the effective non-dominated moth-flame optimization algorithm (NS-MFO) to solve multi-objective problems using the elitist non-dominated sorting method. The opposition-based mothflame optimization (OMFO) [107] presents an opposition-based scheme in the canonical MFO to avoid local optimum and increase global exploration. In the EMFO [94], the Gaussian mutation (GM) was added to MFO to increase the diversity. In LGCMFO [100], Xu et al. used new operators such as Gaussian mutation (GM), Lévy mutation (LM), and Cauchy mutation (CM) to boost exploration and exploitation capabilities and encounter the local optima trapping of the MFO. In addition, Hongwei et al. [99] presented the chaosenhanced moth-flame optimization (CMFO) with ten chaotic maps to cope with the MFO deficiency. Sapre et al. [108] brought up OMFO to cope with premature convergence and local optima trapping by proposing a combination of opposition-based, Cauchy mutation and evolutionary boundary constraint handling. In 2020, Kaur et al. [97] proposed E-MFO by adding a Cauchy mutation (CM) to improve the distribution of the algorithm in the search space. An improved moth-flame optimization (IMFO) [98] algorithm proposes a new flame generation strategy and divides optimization iterations into three phases to encounter low population diversity and enhance MFO's search balance, respectively. An improved MFO algorithm called QSMFO was proposed by [109] to boost MFO's exploitation capabilities while enhancing the exploration rate by introducing the simulated annealing strategy and quantum rotation gate, respectively.
Some variants proposed hybrid-based improvements to the MFO algorithm to boost its performance. MFOGSA [83] is a combination of MFO with gravitational search algorithm (GSA) to utilize MFO's exploration and GSA's exploitation capabilities. Bhesdadiya et al. [110] proposed a hybrid PSO-MFO algorithm to solve optimization problems. SA-MFO [111] combines MFO with simulated annealing (SA) to overcome local optima trapping and low convergence rate. Khalilpourazari et al. [95] proposed WCMFO to encounter MFO's entrapping at local optima and low convergence rate, while taking advantage of the water cycle algorithm (WCA). A combination of MFO and artificial neural network (ANN-MFO) was proposed by Singh et al. [112] to solve multi-objective problems in magnetic abrasive finishing of aluminum. Chen et al. [96] introduced SMFO to improve the exploration capability of MFO by integrating it with the sine cosine strategy. An enhanced MFO algorithm was proposed by MP Dang et al. [113] which is a hybridization of MFO and three different methods to solve the design problem of a flexure hinge. Mittal [114] brought up an enhanced moth-flame optimization by integrating MFO and variable neighborhood search to boost search capabilities and convergence accuracy of the canonical MFO. In a recent study, Abd Elaziz et al. [115] proposed the FCHMD algorithm which is a hybridization of Harris hawks optimizer and MFO. In this algorithm, fractional-order Gauss and 2xmod1 chaotic maps are used to generate the initial population. Moreover, the FCHMD algorithm ameliorates premature convergence and stagnation in local optima by applying evolutionary population dynamics. Ahmed et al. [116] brought up DMFO-DE which is a discrete hybrid algorithm developed by integrating differential evolution and MFO to encounter the local optima problem and ameliorate the convergence speed and prevent the local optima problem. Li et al. [117] proposed the ODSFMFO algorithm which consists of an improved flame generation mechanism based on opposition-based learning (OBL) and differential evolution (DE) algorithm, and an enhanced local search mechanism based on shuffled frog leaping algorithm (SFLA) and death mechanism.
Based on the above review on MFO and its proposed variants, the most serious drawbacks of MFO are premature convergence, getting stuck in local optimum, low population diversity, and deficient balance between exploration and exploitation. Therefore, in this study, the improved moth-flame optimization (I-MFO) algorithm is proposed to encounter MFO's shortcomings by introducing a memory mechanism and an adapted version of the wandering around search (WAS) strategy [57], called AWAS strategy, to the canonical MFO.

Proposed Algorithm
The proposed improved moth-flame optimization (I-MFO) algorithm is boosted using a moth memory mechanism and the adapted wandering around search (AWAS) strategy to Entropy 2021, 23, 1637 6 of 30 overcome the mentioned shortcomings of the canonical MFO algorithm. The moth memory mechanism is inspired by moths' behavior in nature in remembering their experiences [118], which is defined by Definition 1. Moreover, the AWAS strategy is introduced in Definition 2, to possibly escape the trapped moths from the local optima and alleviate the premature convergence. The pseudo-code and the flowchart of the proposed I-MFO are shown in Algorithm 1 and Figure 2, respectively.
Then, to possibly free the trapped moth Mi (t + 1) from the local optimum, its new position is computed by Equation (5), where Fgbest j (t) is the jth dimension of the global best flame, ri is a random number between interval (0, 1), Mrj (t) is the value of a random moth position. The flight length fli (t) for moth Mi is computed by Equation (6), where δ1 and δ2 are defined by the user, NF is the number of flights determined randomly in [1, D], and q is the current flight number. In fact, using AWAS strategy with the random NF provides advantage through which the trapped moth Mi can be moved to a better position.
Defining the moth memory Mbest and Fbest using Definition 1. 8 While t ≤ MaxIt 9 Updating F and OF by the best N moths from F and current M.

12
Computing the distance between moth M i (t) and flame F j (t) using Equation (2). 13 Updating the position of M i (t) using Equation (1). 14 Computing the fitness value of M i (t) and update OM i (t). 15 If Selecting a random moth M r (t). 17 Updating the position of M i (t) using AWAS defined in Definition 2. 18 Updating the fitness value OM i (t). 19 End if 20 Updating the moth memory M i 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 Definition 2 (AWAS strategy). Consider TM (t) = {M 1 , . . . , M i , . . . } as a finite set of moths trapped in the current iteration t such that M i could not dominate its Mem i (OM i (t) > Fbest i ). Then, to possibly free the trapped moth M i (t + 1) from the local optimum, its new position is computed by Equation (5), where F gbest j (t) is the jth dimension of the global best flame, r i is a random number between interval (0, 1), M rj (t) is the value of a random moth position. The flight length fl i (t) for moth M i is computed by Equation (6), where δ 1 and δ 2 are defined by the user, NF is the number of flights determined randomly in [1, D], and q is the current flight number. In fact, using AWAS strategy with the random NF provides advantage through which the trapped moth M i can be moved to a better position.

Numerical Experiment and Analysis
In this section, the performance of the proposed I-MFO has been evaluated using the CEC 2018 [102] benchmark. Moreover, the proposed algorithm was compared with the state-of-the-art metaheuristic algorithms including SA [37], CGA [42], GWO [58], WOA [67], ChOA [59], AOA [55], canonical MFO [74], and its variants such as LMFO [92], WCMFO [95], and SMFO [96]. The parameter settings of comparative algorithms are adjusted as in their original papers and are reported in Table 1. The obtained results are  reported in Tables 2-4, where the bold values show the winner algorithm. Furthermore, at the end of each table, the symbols W, T, and L demonstrate the number of wins, ties, and losses of each algorithm, respectively. Table 1. Parameter settings of the I-MFO and other contender algorithms.

Benchmark Test Functions and Experimental Environment
The performance of the proposed algorithm is evaluated using the CEC 2018 benchmark functions with various dimensions of 30, 50, and 100. This benchmark contains 29 test functions with a diverse set of characteristics: unimodal, simple multimodal, hybrid, and composition. Test functions F 1 and F 3 are unimodal functions and they are adequate for evaluating the exploitation of algorithms. Test functions F 4 -F 10 are multimodal with many local optima which are suitable to assess the exploration abilities of algorithms. Test functions F 11 -F 20 are hybrid and F 21 -F 30 are composition functions that can evaluate the local optima avoidance ability and balance between exploration and exploitation.
Due to the randomization of SI algorithms and to guarantee that the comparisons are fair, all experiments for each function are repeated 30 times separately on a laptop with characteristics: Intel Core i7-10750H CPU (2.60 GHz) and 24 GB of memory. The MATLAB programming language version R2020a and Windows 10 operating system were used to conduct all experiments. All algorithms were run under the same conditions, with the population size (N) 100 and the maximum number of iterations (MaxIt) (D × 10 4 )/N.

Exploitation and Exploration Analysis
In this experimental evaluation, the unimodal functions F 1 and F 3 are considered to assess the exploitation abilities, while the multimodal test functions F 4 -F 10 are dedicated to evaluating the exploration capabilities.

Local Optima Avoidance Evaluation
This experimental evaluation is benchmarking the ability of the proposed algorithm against the contender algorithms in terms of local optima avoidance and striking a balance between exploration and exploitation by considering hybrid and composition function results. The obtained results tabulated in Tables 3 and 4 indicate that the proposed I-MFO algorithm is superior to the contender algorithms in dimensions 30, 50, and 100. The main reason is that the AWAS strategy helps trapped moths to escape the local optima and obtain a better position by changing random dimensions of trapped moths with dimensions of the best flame and a random moth's position. The random moth causes the trapped moth to explore the search space and increases the population diversity while considering the best flame enhances the exploitation capabilities of the algorithm simultaneously. Furthermore, Figure 4 visualizes the comparison of fitness distribution using box and whiskers diagrams in which almost all diagrams demonstrate that the proposed I-MFO can find the best solutions during the optimization process. It verifies that I-MFO can provide satisfactory equilibration between exploration and exploitation.
results. The obtained results tabulated in Tables 3 and 4 indicate that the proposed I-MFO algorithm is superior to the contender algorithms in dimensions 30, 50, and 100. The main reason is that the AWAS strategy helps trapped moths to escape the local optima and obtain a better position by changing random dimensions of trapped moths with dimensions of the best flame and a random moth's position. The random moth causes the trapped moth to explore the search space and increases the population diversity while considering the best flame enhances the exploitation capabilities of the algorithm simultaneously. Furthermore, Figure 4 visualizes the comparison of fitness distribution using box and whiskers diagrams in which almost all diagrams demonstrate that the proposed I-MFO can find the best solutions during the optimization process. It verifies that I-MFO can provide satisfactory equilibration between exploration and exploitation.

I-MFO Overall Effectiveness
The overall effectiveness (OE) [50] of the I-MFO and other contender algorithms is computed by using results reported in Tables 2-4. The OE results tabulated in Table 5 are calculated using Equation (7), where N indicates the number of test functions and L is the number of losses of each algorithm. The results reveal that I-MFO with overall effectiveness of 92% is the most effective algorithm for all dimensions: 30, 50, and 100.

Convergence Behavior Analysis
In this section, the convergence behavior of I-MFO is assessed and compared with contender algorithms on some selected functions with dimensions 30, 50, and 100. The convergence curves of the best fitness values obtained by each algorithm on unimodal and multimodal test functions are plotted in Figure 5. Moreover, the convergence curves of hybrid and composition test functions are plotted in Figure 6.
Investigating convergence behaviors of the I-MFO reveals that it shows various convergence behaviors. The most common behavior is an accelerated descent with the fastest accurate solutions toward the promising area in the early iterations, which can be seen in 30D (F 5 , F 15  For some functions such as 30D (F 1 , F 7 , F 8 , F 18 , F 30 ), 50D (F 1 , F 8 , F 18 ), and 100D (F 1 , F 10 , F 18 , F 30 ), the I-MFO shows abrupt movements in the first half of iterations and very low variations for the second half, which proves the efficient balance between exploration and exploitation. Finally, for 30D (F 3 , F 7 , F 10 , F 12 F 20 ), 50D (F 3 , F 5 , F 8 , F 10 , F 12 , F 18 , F 20 ), and 100D (F 3 , F 12 , F 18 , F 20 ), the I-MFO starts its convergence with a steep descent slope and then changes to a gradual trend toward the optimum solutions until final iterations. This behavior demonstrates the ability of the I-MFO in escaping from the local optimum and taking advantage of the last iterations.

Population Diversity Analysis
In metaheuristic algorithms, the population diversity maintenance is important throughout the optimization process. The low diversity among search agents may cause the algorithm to plunge into the local optimum. In this experiment, the population diversity of the proposed I-MFO and contender algorithms is measured by a moment of inertia (I c ) [119], where the I c is the spreading of each individual from their mass center given by Equation (8) and the mass center c j for j = 1, 2 . . . D is calculated by Equation (9).
The presented population diversity measures the distribution of search agents, and the diversity's changing slope for the proposed algorithm and contender algorithms is plotted in Figure 7. This experiment is conducted on some CEC 2018 benchmark functions with dimensions 30, 50, and 100. Comparing the convergence curves in Figures 5 and 6 and the plotted diversity in Figure 8 reveals that I-MFO can effectively maintain diversification among solutions until the near-optimal solution is met.
The presented population diversity measures the distribution of search agents, and the diversity's changing slope for the proposed algorithm and contender algorithms is plotted in Figure 7. This experiment is conducted on some CEC 2018 benchmark functions with dimensions 30, 50, and 100. Comparing the convergence curves in Figures 5 and 6 and the plotted diversity in Figure 8 reveals that I-MFO can effectively maintain diversification among solutions until the near-optimal solution is met.

Sensitivity Analysis on the Number of Flight (NF) Parameter
As discussed in Definition 2, the NF parameter is the number of opportunities for each trapped moth to fly in the search space and possibly obtain a better position. Hence, in this experiment, the impact of considering different values for the NF parameter is evaluated and discussed. The plotted curves in Figure 8

Impact Analysis of Applying AWAS Strategy
In this experiment, the impact of applying the AWAS strategy is analyzed on some selected functions of the CEC 2018 benchmark for different dimensions 30, 50, and 100. The proposed AWAS strategy can ameliorate the MFO's weaknesses described in Section 2. To adequately assess the impact of applying the AWAS strategy, in this experiment we consider MFO, I-MFO, and its three variations including I-MFO-10%, I-MFO-40%, and I-MFO-80% which indicate the percentage of trapped moths that are randomly selected to possibly escape from the local optima using the proposed AWAS strategy.
The first row of Figure 9 indicates convergence curves for unimodal F1, where the I-MFO and its variations outperform the MFO for all dimensions. Specifically, for dimension 100, the I-MFO-10% offers superior outcomes while it has less computational cost compared to the I-MFO. The curves provided for multimodal F5 and F10 indicate that the I-MFO offers better solutions, while in the next ranks, I-MFO-80%, I-MFO-40%, and I-

Impact Analysis of Applying AWAS Strategy
In this experiment, the impact of applying the AWAS strategy is analyzed on some selected functions of the CEC 2018 benchmark for different dimensions 30, 50, and 100. The proposed AWAS strategy can ameliorate the MFO's weaknesses described in Section 2. To adequately assess the impact of applying the AWAS strategy, in this experiment we consider MFO, I-MFO, and its three variations including I-MFO-10%, I-MFO-40%, and I-MFO-80% which indicate the percentage of trapped moths that are randomly selected to possibly escape from the local optima using the proposed AWAS strategy.
The first row of Figure 9 indicates convergence curves for unimodal F 1 , where the I-MFO and its variations outperform the MFO for all dimensions. Specifically, for dimension 100, the I-MFO-10% offers superior outcomes while it has less computational cost compared to the I-MFO. The curves provided for multimodal F 5 and F 10 indicate that the I-MFO offers better solutions, while in the next ranks, I-MFO-80%, I-MFO-40%, and I-MFO-10% outperform the MFO. The hybrid test function is shown in the fourth row of Figure 9, where the I-MFO and its variations keep converging toward the global optimum with a steep slope until the final iterations. The I-MFO and its variations can also find better solutions for the composition functions F 22 and F 26 , wherein for these functions, as the number of dimensions grows, the significance of the AWAS strategy in guiding the population toward the global optimum region and avoiding local optima entrapment becomes clearer. Although the provided results demonstrate that the I-MFO with 100% of trapped moths applied to AWAS strategy mostly provides better solutions for different dimensions and search spaces, other variations of the I-MFO can also provide competitive performance while they have the advantage of lower computational cost compared to the I-MFO. MFO-10% outperform the MFO. The hybrid test function is shown in the fourth row of Figure 9, where the I-MFO and its variations keep converging toward the global optimum with a steep slope until the final iterations. The I-MFO and its variations can also find better solutions for the composition functions F22 and F26, wherein for these functions, as the number of dimensions grows, the significance of the AWAS strategy in guiding the population toward the global optimum region and avoiding local optima entrapment becomes clearer. Although the provided results demonstrate that the I-MFO with 100% of trapped moths applied to AWAS strategy mostly provides better solutions for different dimensions and search spaces, other variations of the I-MFO can also provide competitive performance while they have the advantage of lower computational cost compared to the I-MFO.

Statistical Analysis
In this section, the results obtained in the preceding section are first statistically analyzed using the non-parametric Friedman test. The Bonferroni and Tukey post hoc producers are then conducted to establish proper comparisons between the proposed algorithm and comparative algorithms.

Non-Parametric Friedman Test
The Friedman test is performed to rank the significance of the superiority algorithms statistically [120,121]. The obtained results for unimodal and multimodal test functions are tabulated in Table 6 and the results for hybrid and composition functions are reported in Table 7. This statistical analysis shows that the I-MFO is first rank on all test functions for dimensions of 30, 50, and 100.

Post Hoc Analysis
In the post hoc analysis [120], we evaluated the proposed hypothesis between the control method and the rest of the compared methods in Table 8 by employing Bonferroni and Tukey's multiple comparison producers. In this experiment, the level of significance is α = 0.05, which determines whether or not a hypothesis is acceptable by comparing the significant difference (p-value) between each pair of algorithms. Since gained p-values for all dimensions 30, 50, and 100 are less than α = 0.05, it reveals that there are significant differences between the performances of the I-MFO and other compared algorithms.

Statistical Analysis
In this section, the results obtained in the preceding section are first statistically analyzed using the non-parametric Friedman test. The Bonferroni and Tukey post hoc producers are then conducted to establish proper comparisons between the proposed algorithm and comparative algorithms.

Non-Parametric Friedman Test
The Friedman test is performed to rank the significance of the superiority algorithms statistically [120,121]. The obtained results for unimodal and multimodal test functions are tabulated in Table 6 and the results for hybrid and composition functions are reported in Table 7. This statistical analysis shows that the I-MFO is first rank on all test functions for dimensions of 30, 50, and 100.

Post Hoc Analysis
In the post hoc analysis [120], we evaluated the proposed hypothesis between the control method and the rest of the compared methods in Table 8 by employing Bonferroni and Tukey's multiple comparison producers. In this experiment, the level of significance is α = 0.05, which determines whether or not a hypothesis is acceptable by comparing the significant difference (p-value) between each pair of algorithms. Since gained p-values for all dimensions 30, 50, and 100 are less than α = 0.05, it reveals that there are significant differences between the performances of the I-MFO and other compared algorithms.  Figure 10. The radar graphs and bar charts of algorithms in different dimensions.

Applicability of I-MFO Algorithm to Solve Mechanical Engineering Problems
In this section, three constrained mechanical engineering problems from the latest testsuite CEC 2020 [103] are considered to evaluate the applicability of the I-MFO algorithm in real-world applications. To achieve a fair comparison, the algorithms were run 20 times with the population size (N) 20 and maximum iterations (MaxIt) (D × 10 4 )/N. In this experimental evaluation, the proposed algorithm and contender algorithms compete to solve three different problems that consist of a gas transmission compressor design problem, three-bar truss, and tension/compression spring design. P 1 : Gas transmission compressor design problem Minimization of the objective function using four design variables is the main goal of the gas transmission compressor design problem. This problem is illustrated and formulated in Figure 11 and Equation (10). The performance of the proposed algorithm is evaluated against the contender algorithms to solve this problem and the obtained results are tabulated in Table 9. As shown in this table, the I-MFO is superior in addressing this issue.
Minimize f (x) = 8.61 × 10 5 x Subject to (10) P1: Gas transmission compressor design problem Minimization of the objective function using four design variables is the main goal of the gas transmission compressor design problem. This problem is illustrated and formulated in Figure 11 and Equation (10). The performance of the proposed algorithm is evaluated against the contender algorithms to solve this problem and the obtained results are tabulated in Table 9. As shown in this  Figure 11. Gas transmission compressor design problem.  Figure 11. Gas transmission compressor design problem. In this problem, three constraints and two variables are utilized to formulate the objective function, which is the weight of the bar structures. The schematic and formulation of this problem are represented in Figure 12 and Equation (11), respectively. The proposed I-MFO algorithm and comparative algorithms are compared for solving this problem. The attained results from this experiment are tabulated in Table 10, in which the I-MFO algorithm outperforms other algorithms in approximating the optimal values for variables with minimum weight.
where l = 100 cm, p = 2KN cm 2 , and σ = 2KN Variable range 0 ≤ 1 ≤ 1 0 ≤ 2 ≤ 1 (11) Figure 12. Three-bar truss problem.   In the tension/compression spring design problem, the objective is to minimize the weight of the tension/compression spring by considering three variables and four constraints. As shown in Figure 13, the variables are wire diameter (d), the number of active coils (N), and mean coil diameter (D). The problem and its constraints are described in Equation (12) and results are reported in Table 11.
Minimize f (x) = x 2 1 x 2 (2 + x 3 ) Subject to g 1 (x) = 1 − In the tension/compression spring design problem, the objective is to minimize the weight of the tension/compression spring by considering three variables and four constraints. As shown in Figure 13, the variables are wire diameter (d), the number of active coils (N), and mean coil diameter (D). The problem and its constraints are described in Equation (12) and results are reported in Table 11.   Figure 13. Tension/compression spring design problem. The results of the mechanical engineering problems tabulated in Tables 9-11 demonstrate the fact that the I-MFO is superior to other algorithms for solving real-world mechanical engineering problems.

Conclusions and Future Works
The transverse orientation behavior of moths while encountering artificial lights is the main inspiration behind the MFO algorithm to successfully solve optimization problems. However, as with most of the SI algorithms, the MFO suffers from premature convergence, local optima entrapping, low population diversity, and imbalance between exploration and exploitation. These drawbacks make the MFO uncompetitive in solving complex and real-world optimization problems. Therefore, an improved version of the MFO named I-MFO is proposed to improve the MFO algorithm from the perspective of alleviating premature convergence, maintaining population diversity, avoiding local optima trapping, and striking a balance between exploration and exploitation.
To detect local optima-trapped moths, a memory mechanism is defined for each moth. Then, the adapted wandering around search (AWAS) strategy is introduced to possibly free detected trapped moths from local optima by changing their positions while considering the best flame and a random moth position. The CEC 2018 benchmark tasks were conducted to evaluate the performance of the I-MFO, where the reported results in Tables 2-4 and OE in Table 5 prove I-MFO's superior performance over 92% of test functions. The multimodal test function results reported in Table 2 are clear evidence of the fact that the I-MFO boosts exploration rate, especially in more complex problems. The hybrid and composition test function results tabulated in Tables 3 and 4 support the claim that the proposed I-MFO enhances the balance between exploration and exploitation, by which the I-MFO can get out of local optima effectively. The convergence curves also show the local optima avoidance ability and enhanced balance between exploration and exploitation. Moreover, it can be deduced from the population diversity plots that the I-MFO successfully maintains population diversity until a near-optimal solution emerges.
The sensitivity of the AWAS strategy and NF parameter is evaluated on some CEC 2018 benchmark functions for different dimensions, where the results reveal that although the I-MFO offers better solutions in most test functions, other variations of the I-MFO can also provide competitive outcomes for some functions and dimensions. The statistical efficiency of the I-MFO is investigated by the Friedman test and post-hoc analysis, which revealed that the proposed I-MFO outperforms other contender algorithms for various test functions. In the end, the outcomes of the mechanical engineering problems from the latest test-suite CEC 2020 demonstrate that the proposed I-MFO is applicable for solving realworld mechanical engineering problems. Although I-MFO provides competitive results for solving global optimization and engineering tasks, like most improvements, it consumes more time compared to the canonical MFO because it uses the AWAS strategy. Hence, in practice, the I-MFO may not be suitable for solving large-scale real-time problems. For future works, a multi-objective version of I-MFO can be developed for solving continuous multi-objective problems. Moreover, extending I-MFO to the discrete version for solving discrete optimization tasks such as the community detection problem is a worthwhile direction.