3、 for j=1:N %聚群行为开始 XXX=[X(j,1),X(j,2)]; if(norm(XXX-XX)maxf(XX)) XXnext1=XX+rand*Step*(Xc-XX)/norm(Xc-XX); if(XXnext1(1)>b1) XXnext1(1)=b1; end if(XXnext1(1)
4、 XXnext1(1)=a1; end if(XXnext1(2)>b2) XXnext1(2)=b2; end if(XXnext1(2)b1) XXnext1(1)=b1; end if(XXnext1(1)<
5、a1) XXnext1(1)=a1; end if(XXnext1(2)>b2) XXnext1(2)=b2; end if(XXnext1(2)
6、isual & maxf(XXX)>maxY) maxX=XXX; maxY=maxf(XXX); end end if((maxY)>maxf(XX)) XXnext2=XX+rand*Step*(maxX-XX)/norm(maxX-XX); if(XXnext2(1)>b1) XXnext2(1)=b1; end if(XXnext2(1)
7、2)>b2) XXnext2(2)=b2; end if(XXnext2(2)b1) XXnext2(1)=b1; end if(XXnext2(1)
8、2(2)>b2) XXnext2(2)=b2; end if(XXnext2(2)maxf(XXnext2)) X(i,1)