clusterselniche.sci

来自「站长您好!GATS是一种遗传算法工具箱」· SCI 代码 · 共 29 行

SCI
29
字号
function endPop=ClusterSelNiche(oldPop,newPop,bounds,NicheOpt,options)
e = size(oldPop,2)-1; //number of Variables
n = size(oldPop,1);   //number of Pop;
CF=NicheOpt(1);  //parameter for select
endPop=oldPop;
[a,randidx]=gsort(rand(n,CF)*n,'g','i');
initIndex=zeros(n,1);
for i=1:n 
    Pop1=newPop(i,:);
    initDistance = 1; //maxmiam distance between two population
    for j=1:CF 
        Pop2=oldPop(randidx(i,j),:);
        dis= normDistance(Pop1,Pop2,bounds,options);
        if (dis < initDistance)
            initDistance = dis;
            initIndex(i) = j;
        end
    end
    endPop(randidx(i,initIndex(i)),:)=Pop1;
end







    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?