A list,

Moth-flame Optimization Algorithm (MFO) is a new intelligent optimization algorithm proposed by Seyedali Mirjalili In 2015 [1]. The algorithm has the characteristics of strong parallel optimization ability, good global performance and not easy to fall into the local extreme value, which has gradually attracted the attention of the academic and engineering circles.

Moths fly at night using a special navigation mechanism of lateral positioning. In this mechanism, the moths fly by maintaining a fixed Angle to the moon. Since the moon is so far away, the moths use this approximately parallel light to keep flying in a straight line. While this navigation mechanism is very effective for moths, there are many artificial or natural point light sources that are very close to the moths compared to the moon, and when the moths are still flying at a fixed Angle to the light source, the navigation fails and a deadly spiral flight path is created.

In THE MFO algorithm, the moth is assumed to be a candidate solution to the problem, and the variable to be solved is the location of the moth in space. So by changing its own position vector, a moth can fly in one, two, three, and even higher dimensions. Since MFO algorithm is essentially a swarm intelligence optimization algorithm, the moth population can be expressed in the matrix as follows:FIG. 1. Logarithmic spiral and space around the flame formula (6) simulates the spiral flight path of the moth. It can be seen that the next update position of the moth is determined by the flame around it. As shown in Figure 1, the coefficient T TT in the helical function represents the distance between the next position of the moth and the flame (t =−1 t=-1t=−1 represents the closest position to the flame, while t=1t= 1t=1 represents the farthest position). The spiral equation shows that moths can fly around the flames rather than just in the space between them, thus guaranteeing the global search and local development capability of the algorithm. FIG. 2 shows the position update model of moths around a flame. When a moth (blue horizontal line) around a flame (green horizontal line), if updated moths (black) horizontal position of the fitness value is superior to the contemporary fire, its updated location will be selected as the location of the next generation of flame (such as label 2), so the moth has local development ability. This model has the following characteristics:

1) By modifying the parameter T tt, a moth can converge to any neighborhood of the flame. 2) The smaller the T tt, the closer the moths are to the flame. 3) As the moth gets closer to the flame, the frequency of its renewal around the flame increases.Figure 2. Possible locations a moth can reach by using a logarithmic spiral according to the corresponding flame. The flame position updating mechanism described above ensures the local development capability of the moth around the flame. In order to improve the probability of finding a better solution, the current optimal solution is taken as the location of the next flame. Therefore, the flame position matrix F FF usually contains the currently found optimal solution. During the optimization process, each moth updates its position according to the matrix F FF. The path coefficient T tt in MFO algorithm is a random number in [r,1][r,1] [r,1], and the variable R decreases linearly in [-1, -2] according to the number of iterations in the optimization iteration process. By this process, the moth will more precisely approach the flame in its corresponding sequence as the iterative process progresses. After each iteration, the flame positions were reordered according to the fitness value to obtain the updated flame sequence, as shown in Figure 3. In the next generation, moths update their positions according to the flames in the sequence corresponding to them.2 Algorithm Flow1) MFO algorithm was initialized, and parameters such as input optimal power flow control variable dimension D, moth population search size n, maximum iteration number T and logarithmic spiral shape constant B were set. 2) The variable to be obtained was initialized, the moth position was randomly generated in the search space, and the corresponding fitness value of each moth was evaluated. 3) The spatial position of moths was arranged in the order of increasing fitness value and assigned to the flame as the spatial position of the flame in the first generation. 4) Use Equation (5) to update the position of the current generation of moths. 5) Reorder the fitness values of the updated moth position and flame position, and select the spatial position with better fitness value to update the position of the next generation flame. 6) Use the adaptive mechanism of Formula (8) to reduce the number of flames. 7) Return to Step 6) Enter the next generation until the number of iterations meets the algorithm requirements. 10) Output and display the optimization results, and the program ends.

Ii. Source code

clear all
clc
SearchAgents_no=30;
Function_name='F1';
Max_iteration=1000;
[lb,ub,dim,fobj]=Get_Functions_details(Function_name);

[Best_score,Best_pos,cg_curve]=MFO(SearchAgents_no,Max_iteration,lb,ub,dim,fobj);
figure('Position'[284 214 660 290])
subplot(1.2.1);
func_plot(Function_name);
title('Test function')
xlabel('x_1');
ylabel('x_2');
zlabel([Function_name,'(x_1,x_2)'])
function [lb,ub,dim,fobj] = Get_Functions_details(F)

switch F
    case 'F1'
        fobj=@F1;
        lb=- 100.;
        ub=100;
        dim=30;
    case 'F2'
    fobj=@F2;
    lb=- 100.;
    ub=100;
    dim=30;
    case 'F3'
    fobj=@F3;
    lb=- 100.;
    ub=100;
    dim=30;
    case 'F4'
    fobj=@F4;
    lb=- 100.;
    ub=100;
    dim=30;
    case 'F5'
    fobj=@F5;
    lb=- 30;
    ub=30;
    dim=30;
    case 'F6'
    fobj=@F6;
    lb=- 100.;
    ub=100;
    dim=30;
    case 'F7'
    fobj=@F7;
    lb=1.28;
    ub=1.28;
    dim=30;
    case 'F8'
    fobj=@F8;
    lb=- 500.;
    ub=500;
    dim=30;
    case 'F9'
    fobj=@F9;
    lb=5.12;
    ub=5.12;
    dim=30;
    case 'F10'
    fobj=@F10;
    lb=- 32;
    ub=32;
    dim=30;
    case 'F11'
    fobj=@F11;
    lb=- 600.;
    ub=600;
    dim=30;
    case 'F12'
    fobj=@F12;
    lb=- 50;
    ub=50;
    dim=30;
    case 'F13'
    fobj=@F13;
    lb=- 50;
    ub=50;
    dim=30;
    case 'F14'
    fobj=@F14;
    lb=65.536;
    ub=65.536;
    dim=2;
    case 'F15'
    fobj=@F15;
    lb=- 5;
    ub=5;
    dim=4;
    
    case 'F16'
    fobj=@F16;
    lb=- 5;
    ub=5;
    dim=2;
    
    case 'F17'
    fobj=@F17;
    lb=[- 5.0];
    ub=[10.15];
    dim=2;
    
    case 'F18'
    fobj=@F18;
    lb=2 -;
    ub=2;
    dim=2;
    
    case 'F19'
    fobj=@F19;
    lb=0;
    ub=1;
    dim=3;
    
    case 'F20'
    fobj=@F20;
    lb=0;
    ub=1;
    dim=6;
    
    case 'F21'
    fobj=@F21;
    lb=0;
    ub=10;
    dim=4;
    
    case 'F22'
    fobj=@F22;
    lb=0;
    ub=10;
    dim=4;
    
    case 'F23'
    fobj=@F23;
    lb=0;
    ub=10;
    dim=4;
    
end
end
function o = F1(x)
o = sum(x.^2);
end
function o = F2(x)
    o=sum(abs(x))+prod(abs(x));
end
Copy the code

Third, the operation result

Fourth, note

Version: 2014 a