资源简介

粒子群模拟退火算饭,兼具二者特点,效率好,能实现,很实用

资源截图

代码片段和文件信息

function [xmfv]=SimuAPSO(fitnessNc1c2lamdaxminxmaxMD)
format  long ;
for i=1:N
    for j=1:D
        x(ij)=xmin(j)+rand*(xmax(j)-xmin(j));
        v(ij)=randn;
    end 
end
for i=1:N
    p(i)=fitness(x(i:));
    y(i:)=x(i:);
end
pg=x(N:);
for i=1:(N-1)
    if fitness(x(i:))        pg=x(i:);
    end
end
T=fitness(pg)/log(5);
for t=1:M
    groupFit=fitness(pg);
    for j=1:N
        %fv(j)=fitness(x(j:));
        Tfit(i)=exp(-(p(i)-groupFit)/T);
    end
    
    %fvag=sum(fv)/N;
    % fmin=min(fv);
    SumTfit=sum(Tfit);
    Tfit=Tfit/SumTfit;
    pBet=rand();
    for i=1:N
        ComFit(i)=sum(Tfit(1:i));
        if pBet<=ComFit(i)
            pg_plus=x(i:);
              break;
        end
    end
    C=c1+c2;
    ksi=2/abs(2-C-sqrt(C^2-4*C));
    for i=1:N
         %if fv(i)<= fvag
         %      w=wmin+(fv(i)-fmin)*(wmax-wmin)/(fvag-fmin);
         % else
   

评论

共有 条评论