{ X = afinit (afNum,varNum,Xl,Xh,lchrom);
%initialization of AFSA
for i : afNum
 temp=[X(i,1),X(i,2)];
 Tempconsistence(i)=functionconsistence(temp,
simmodel);
end
foodconsistence=tempconsistence′;
% calculate food density
[a,b]=max(foodconsistence);
Xmax=[X(b,1),X(b,2)];
Ymax=a;
%initialize bulletin board
k=0;
visualweak=0;
while(k<iterativeTime)
for i=1:afNum
Xi=[X(i,1),X(i,2)];
%current status of fish i
nf1=0;
Xc=0; }
Algorithm 1