中文说明:format longVisual=2.5;Step=0.3;delta=0.618;N=50;Try_number=100;a1=-10;%控制左区间1b1=10;%控制右区间1a2=-10;%控制左区间2b2=10;%控制右区间2d=[];U=[];h=1e-1;Friend_number=50;k=1;m=51;X1=rand(N,1)*(b1-a1)+a1;X2=rand(N,1)*(b2-a2)+a2;X=[X1 X2];%人工鱼状态for i=1:Nwwww=[X(i,1),X(i,2)];d(i)=maxf(wwww); %将d的值依次列出来end[w,i]=max(d); %w为d的最大值,i为最大值对应的下标即第几条鱼maxX=[X(i,1),X(i,2)];%初始公告板记录 ,将最大值对应的X赋给maxXmaxY=w;%初始公告板记录
English Description:
format longVisual=2.5;Step=0.3;delta=0.618;N=50;Try_number=100;A1=-10;% controls the left zone 1B1=10;% control the right interval 1A2=-10;% controls the left zone 2B2=10;% control the right interval 2d=[];U=[];h=1e-1;Friend_number=50;k=1;m=51;X1=rand(N,1)*(b1-a1)+a1;X2=rand(N,1)*(b2-a2)+a2;X=[X1 X2];% artificial fishfor i=1:Nwwww=[X(i,1),X(i,2)];d(i)=maxf(wwww); Value listed for the% dend[w,i]=max(d); %W value on the d, I is the maximum value corresponds to the index that first fishMaxX=[X (i,1), x (i,2)];% the initial Bulletin Board records, x corresponds to the maximum value assigned to the maxXMaxY=w;% initial Bulletin Board records