function [BEST,FITBEST] =Seagull_Optimization_Algorithm1 (fobj,Lower,Upper,Maxiter)
D=length(Lower);
N=length(Lower);
Dst=zeros(N,D);
Pst=zeros(N,D);
Pstnew=zeros(N,D);
fitPst=zeros(1,N);
BEST=zeros(1,D);
for i=1:N
  for j=1:D
    Pst(i,j)=Lower(j)+(Upper(j)-Lower(j))*rand;
  endfor
  fitPst(i)=fobj(Pst(i,:));
endfor

[minval,mindex]=min(fitPst);
BEST=Pst(mindex,:);

iter=1;

while(iter <= Maxiter)
     
     SA=2-(iter*(2/Maxiter));
     for i=1:N
       Dst(i,:)=SA.*Pst(i,:)+2.0.*SA.*SA.*rand.*(BEST-Pst(i,:));
     endfor
     
     for i=1:N
       k=2.0*rand*pi;
       k1=2.0*rand*pi;
       k2=2.0*rand*pi;
       k3=2.0*rand*pi;
       Radius=rand*exp(k*rand);
       xdot=Radius.*sin(k1);
       ydot=Radius.*cos(k1);
       zdot=Radius.*k3;
       Pstnew(i,:)=BEST+(xdot.*ydot.*zdot.*Dst(i,:));
     end
       
     Pstnew = boundary (Pstnew, Lower,Upper,N,D); 
     Pst = update (Pst,Pstnew,fobj);
     Pst = sortX (Pst,fobj,N,D);
     BEST=Pst(1,:);
     FITBEST=fobj(BEST);
     iter=iter+1; 
end

      





endfunction
