多目标无序飞蛾火焰优化算法(MOMFO)

Posted 这是一个很随便的名字

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了多目标无序飞蛾火焰优化算法(MOMFO)相关的知识,希望对你有一定的参考价值。

【Matlab源码】

飞蛾是花哨的昆虫,与蝴蝶家族高度相似。基本上,自然界中有超过 160,000 种这种昆虫。它们一生中有两个主要里程碑:幼虫和成虫。幼虫通过茧转化为蛾。关于飞蛾最有趣的事实是它们在夜间的特殊导航方法。它们已经进化到可以利用月光在夜间飞行。他们利用一种称为横向定向的机制进行导航。在这种方法中,飞蛾通过保持相对于月球的固定角度飞行,这是一种非常有效的以直线路径长距离飞行的机制。由于月亮离飞蛾很远,这种机制保证了直线飞行。同样的导航方法可以由人类完成。假设月亮在天空的南边,一个人想往东走。如果他走路时保持左侧的月亮,他就可以直线向东移动。

尽管横向定向很有效,但我们通常会观察到飞蛾围绕灯盘旋飞行。事实上,飞蛾被人造光欺骗并表现出这种行为。这是由于横向定向的效率低下,只有在光源很远时才有助于直线移动。当飞蛾看到人造光时,它们试图与光保持相似的角度以直线飞行。然而,由于这种光与月球非常接近,因此与光源保持相似的角度会导致飞蛾无用或致命的螺旋飞行路径。这是MFO的主要灵感。 

使用 MFO 解决多目标问题 
代码:

function f = NSMFO(D,M,LB,UB,Pop,SearchAgents_no,Max_iteration,ishow)
%% Non Sorted Moth-flame Optimization Algorithm (NSMFO)

% f - optimal fitness
% X - optimal solution
% D  Dimensional of problem at hand   
% M Number of objective function
% Moth_pos is a matrix consists of all individuals
% SearchAgents_no is number of individual in Moth_possystem
% LB lower boundary constraint
% UB upper boundary constraint
%% Algorithm Variables
K = D+M;
Moth_pos = Pop(:,1:K+1);
Moth_pos_ad = zeros(SearchAgents_no,K);
%% Optimization Circle
Iteration = 1;
while Iteration<=Max_iteration % for each generation    
    for i = 1:SearchAgents_no   %  (Moth for each individual)
        j = floor(rand()* SearchAgents_no) + 1;
        while j==i
            j = floor(rand()* SearchAgents_no) + 1;
        end
        SF=round(1+rand); %% Scaling factor to perform best coverage in MFO
        % randomly select the best organism from first non-dominated front of Moth_pos
        Ffront = Moth_pos((find(Moth_pos(:,K+1)==1)),:); % first front
        ri =  floor(size(Ffront,1)*rand())+1; % ri is random index
        sorted_population = Moth_pos(ri,1:D);
     
         Flame_no=round(SearchAgents_no-Iteration*((SearchAgents_no-1)/Max_iteration));
         sorted_population1 = Moth_pos(Flame_no,1:D);
         
        % Calculate new solution 
        Moth_posNew1 = Moth_pos(i,1:D)+rand(1,D).*(sorted_population-SF.*Moth_pos(i,1:D));
        % Handling constraints
        Moth_posNew1 = bound(Moth_posNew1(:,1:D),UB,LB); 
        % Evaluate function at Moth_posNew1 
        Moth_posNew1(:,D + 1: K) = evaluate_objective(Moth_posNew1(:,1:D));
        % For the first trail Moth_posNew1
        dom_less = 0;
        dom_equal = 0;
        dom_more = 0;
        for k = 1:M
            if (Moth_posNew1(:,D+k)<Moth_pos(i,D+k))
                dom_less = dom_less + 1;
            elseif (Moth_posNew1(:,D+k)== Moth_pos(i,D+k))
                dom_equal = dom_equal + 1;
            else
                dom_more = dom_more +1;
            end
        end % end for k
        if dom_more == 0 && dom_equal ~= M %  If trial vector Moth_posNew1 dominates
            % target vector Xi. Replace Xi by Moth_posNew1 in current Moth_possystem and
            % add Xi to advanced population 2
            Moth_pos_ad(i,1:K) = Moth_pos(i,1:K); % add Xi to advanced Moth_pos
            Moth_pos(i,1:K) = Moth_posNew1(:,1:K); % replace Xi by Moth_posNew1            
        else % else Add Xi (trial vector) to advanced Moth_pos
            Moth_pos_ad(i,1:K)= Moth_posNew1;
        end % end if
        dom_equal = 0;
        dom_more = 0;
        for k = 1:M
                dom_more = dom_more +1;           
        end % end for k
        if dom_more == 0 && dom_equal ~= M %  If trial vector Moth_posNew1 dominates
            Moth_pos_ad(j,1:K) = Moth_pos(j,1:K); % add Xi to advanced Moth_pos
        end % end if
        j = floor(rand()* SearchAgents_no) + 1;
        while j==i
            j = floor(rand()* SearchAgents_no) + 1;
        end      
        for i=1:size(Moth_pos,1)
            if i<=Flame_no % Update the position of the moth with respect to its corresponsing flame
        % Calculate new solution 
        a=-1+Iteration*((-1)/Max_iteration);

运行结果:

获取完整MOMFO算法: https://ai.52learn.online/code/19

以上是关于多目标无序飞蛾火焰优化算法(MOMFO)的主要内容,如果未能解决你的问题,请参考以下文章

多目标优化求解基于matlab飞蛾扑火算法 (NSMFO)求解多目标优化问题 含Matlab源码 2312期

多目标优化求解基于matlab飞蛾扑火算法 (NSMFO)求解多目标优化问题 含Matlab源码 2312期

优化算法飞蛾优化算法 (MFO)含Matlab源码 1081期

机器学习实战应用案例100篇(十四)-飞蛾扑火优化算法从原理到实战应用案例

lssvm预测基于飞蛾扑火算法改进的最小二乘支持向量机lssvm预测

lssvm预测基于飞蛾扑火算法改进的最小二乘支持向量机lssvm预测