replace.m

来自「模糊聚类算法」· M 代码 · 共 21 行

M
21
字号
function r1=replace(holdm,v1,hist,c,population,f)
%%子优代父,基于浓度的群体更新
tempP=rand(1);%生成0-1间的随机数
C=0.5;%抗体浓度
a=0.3;%参数1
b=0.5;%参数2

    father=f;
    for i=1:population
        [V(i,:),f(i)]=fcm(hist,c,v1(i,:));
    end
    child=f;
    Ps=a*C*abs(1-f./max(f))+b*f./max(f);%基于浓度更新的公式
    hold=v1;
    for i=1:population
       if child(i)>father(i) & tempP<Ps
          hold(i)=v1(i);
       else hold(i)=holdm(i);
      end
   end
   r1=hold;

⌨️ 快捷键说明

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