金枪鱼群优化(Tuna Swarm Optimization,TSO)是期刊“Computational Intelligence and Neuroscience”(IF:1.8)的2021年智能优化算法
01.引言
金枪鱼群优化(Tuna Swarm Optimization,TSO)的主要灵感来自于金枪鱼群体的合作觅食行为。模拟金枪鱼群体的两种觅食行为,包括螺旋觅食和抛物线觅食,以开发一种有效的元启发式算法。在一组基准函数和几个真实的工程问题上,通过与其他元算法的比较,对TSO的性能进行了评估。使用灵敏度、可扩展性、稳健性和收敛性分析,并结合Wilcoxon秩和检验和Friedman检验。仿真结果表明,TSO算法的性能优于其他比较算法。
02.优化算法的流程
03.论文中算法对比图
04.部分代码
function [Tuna1_fit,Tuna1,Convergence_curve]=TSO(Particles_no,Max_iter,Low,Up,Dim,fobj)
Tuna1=zeros(1,Dim); Tuna1_fit=inf;
T=initialization(Particles_no,Dim,Up,Low);
Iter=0;
aa=0.7;
z=0.05;
while Iter<Max_iter
C=Iter/Max_iter;
a1=aa+(1-aa)*C;
a2=(1-aa)-(1-aa)*C;
for i=1:size(T,1)
Flag4ub=T(i,:)>Up;
Flag4lb=T(i,:)<Low;
T(i,:)=(T(i,:).*(~(Flag4ub+Flag4lb)))+Up.*Flag4ub+Low.*Flag4lb;
fitness(i)=fobj(T(i,:));
if fitness(i)<Tuna1_fit
Tuna1_fit=fitness(i); Tuna1=T(i,:);
end
end
%---------------- Memory saving-------------------
if Iter==0
fit_old=fitness; C_old=T;
end
for i=1:Particles_no
if fit_old(i)<fitness(i)
fitness(i)=fit_old(i); T(i,:)=C_old(i,:);
end
end
C_old=T; fit_old=fitness;
%-------------------------------------------------
t=(1-Iter/Max_iter)^(Iter/Max_iter);
if rand<z
T(1,:)= (Up-Low)*rand+Low;
else
if 0.5<rand
r1=rand;
Beta=exp(r1*exp(3*cos(pi*((Max_iter-Iter+1)/Max_iter))))*(cos(2*pi*r1));
if C>rand
T(1,:)=a1.*(Tuna1+Beta*abs(Tuna1-T(1,:)))+a2.*T(1,:); %Equation (8.3)
else
IndivRand=rand(1,Dim).*(Up-Low)+Low;
T(1,:)=a1.*(IndivRand+Beta*abs(IndivRand-T(i,:)))+a2.*T(1,:);%Equation (8.1)
end
else
TF = (rand>0.5)*2-1;
if 0.5>rand
T(1,:)=Tuna1+rand(1,Dim).*(Tuna1-T(1,:))+TF.*t^2.*(Tuna1-T(1,:));%Equation (9.1)
else
T(1,:) =TF.* t^2.*T(1,:);%Equation (9.2)
end
end
end
for i=2:Particles_no
if rand<z
T(i,:)= (Up-Low)*rand+Low;
else
if 0.5<rand
r1=rand;
Beta=exp(r1*exp(3*cos(pi*((Max_iter-Iter+1)/Max_iter))))*(cos(2*pi*r1));
if C>rand
T(i,:)=a1.*(Tuna1+Beta*abs(Tuna1-T(i,:)))+a2.*T(i-1,:);%Equation (8.4)
else
IndivRand=rand(1,Dim).*(Up-Low)+Low;
T(i,:)=a1.*(IndivRand+Beta*abs(IndivRand-T(i,:)))+a2.*T(i-1,:);%Equation (8.2)
end
else
TF = (rand>0.5)*2-1;
if 0.5>rand
T(i,:)=Tuna1+rand(1,Dim).*(Tuna1-T(i,:))+TF*t^2.*(Tuna1-T(i,:)); %Equation (9.1)
else
T(i,:) = TF*t^2.*T(i,:);%Equation (9.2)
end
end
end
end
Iter=Iter+1;
Convergence_curve(Iter)=Tuna1_fit;
end
04.本代码效果图
获取代码请关注MATLAB科研小白的个人公众号(即文章下方二维码),并回复智能优化算法本公众号致力于解决找代码难,写代码怵。各位有什么急需的代码,欢迎后台留言~不定时更新科研技巧类推文,可以一起探讨科研,写作,文献,代码等诸多学术问题,我们一起进步。