使用Salp Swarm 算法(SSA)解决多目标问题

Posted 这是一个很随便的名字

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用Salp Swarm 算法(SSA)解决多目标问题相关的知识,希望对你有一定的参考价值。

【Matlab源码】

 

Salps属于Salpidae科,身体呈透明桶状。它们的组织与水母高度相似。它们的运动方式也与水母非常相似,在水母中,水被泵入身体作为向前移动的推进力。

关于这种生物的生物学研究处于早期里程碑,主要是因为它们的生活环境极难进入,而且很难将它们留在实验室环境中。这篇论文中有趣的salps最有趣的行为之一是它们的蜂拥行为。在深海中,salps 经常形成一个称为salp 链的群。这种行为的主要原因还不是很清楚,但一些研究人员认为,这样做是为了通过快速协调变化和觅食来实现更好的运动。

使用 SSA 解决多目标问题(MSAA)

代码:



clc;
clear;
close all;

% Change these details with respect to your problem%%%%%%%%%%%%%%
ObjectiveFunction=@ZDT1;
dim=5;
lb=0;
ub=1;
obj_no=2;

if size(ub,2)==1
    ub=ones(1,dim)*ub;
    lb=ones(1,dim)*lb;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

max_iter=100;
N=200;
ArchiveMaxSize=100;

Archive_X=zeros(100,dim);
Archive_F=ones(100,obj_no)*inf;

Archive_member_no=0;

r=(ub-lb)/2;
V_max=(ub(1)-lb(1))/10;

Food_fitness=inf*ones(1,obj_no);
Food_position=zeros(dim,1);

Salps_X=initialization(N,dim,ub,lb);
fitness=zeros(N,2);

V=initialization(N,dim,ub,lb);
iter=0;

position_history=zeros(N,max_iter,dim);

for iter=1:max_iter
    
    c1 = 2*exp(-(4*iter/max_iter)^2); % Eq. (3.2) in the paper
    
    for i=1:N %Calculate all the objective values first
        Salps_fitness(i,:)=ObjectiveFunction(Salps_X(:,i)');
        if dominates(Salps_fitness(i,:),Food_fitness)
            Food_fitness=Salps_fitness(i,:);
            Food_position=Salps_X(:,i);
        end
    end
    
    [Archive_X, Archive_F, Archive_member_no]=UpdateArchive(Archive_X, Archive_F, Salps_X, Salps_fitness, Archive_member_no);
    
    if Archive_member_no>ArchiveMaxSize
        Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no);
        [Archive_X, Archive_F, Archive_mem_ranks, Archive_member_no]=HandleFullArchive(Archive_X, Archive_F, Archive_member_no, Archive_mem_ranks, ArchiveMaxSize);
    else
        Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no);
    end
    
    Archive_mem_ranks=RankingProcess(Archive_F, ArchiveMaxSize, obj_no);
    % Archive_mem_ranks
    % Chose the archive member in the least population area as food`
    % to improve coverage
    index=RouletteWheelSelection(1./Archive_mem_ranks);
    if index==-1
        index=1;
    end
    Food_fitness=Archive_F(index,:);
    Food_position=Archive_X(index,:)';
    
    for i=1:N
        
        index=0;
        neighbours_no=0;
        
        if i<=N/2
            for j=1:1:dim
                c2=rand();
                c3=rand();
                %%%%%%%%%%%%% % Eq. (3.1) in the paper %%%%%%%%%%%%%%
                if c3<0.5
                    Salps_X(j,i)=Food_position(j)+c1*((ub(j)-lb(j))*c2+lb(j));
                else
                    Salps_X(j,i)=Food_position(j)-c1*((ub(j)-lb(j))*c2+lb(j));
                end
                %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
            end
        elseif i>N/2 && i<N+1
            
            point1=Salps_X(:,i-1);
            point2=Salps_X(:,i);
            
            Salps_X(:,i)=(point2+point1)/(2); % Eq. (3.4) in the paper
        end
        
        Flag4ub=Salps_X(:,i)>ub';
        Flag4lb=Salps_X(:,i)<lb';
        Salps_X(:,i)=(Salps_X(:,i).*(~(Flag4ub+Flag4lb)))+ub'.*Flag4ub+lb'.*Flag4lb;
        
    end
    
    display(['At the iteration ', num2str(iter), ' there are ', num2str(Archive_member_no), ' non-dominated solutions in the archive']);
    
end

figure

Draw_ZDT1();

hold on

plot(Archive_F(:,1),Archive_F(:,2),'ro','MarkerSize',8,'markerfacecolor','k');

legend('True PF','Obtained PF');
title('MSSA');

set(gcf, 'pos', [403   466   230   200])

 运行结果:

获取完整代码:https://ai.52learn.online/code/26

 

以上是关于使用Salp Swarm 算法(SSA)解决多目标问题的主要内容,如果未能解决你的问题,请参考以下文章

Salp Swarm 算法(SSA)求解单目标优化问题

Salp Swarm 算法(SSA)求解单目标优化问题

单目标优化求解基于matlab松鼠优化算法求解单目标优化问题(SSA)含Matlab源码 1855期

单目标优化求解基于matlab松鼠优化算法求解单目标优化问题(SSA)含Matlab源码 1855期

优化算法多目标麻雀搜索优化算法(MSSA)含Matlab源码 1366期

优化算法多目标麻雀搜索优化算法(MSSA)含Matlab源码 1366期