function [YBEST,BESTCOST] = Transient_Search_Algorithm (Func_name,N,Lower,Upper,Maxiter)

fobj = TestFunctions (Func_name); 
D=length(Lower);
Y=zeros(N,D);
YNEW=zeros(N,D);
YBEST=zeros(1,D);
fitnessY=zeros(1,N);
k=2;

for i=1:N
  for j=1:D
    Y(i,j)=Lower(j)+(Upper(j)-Lower(j))*rand;
  end
  fitnessY(i)=fobj(Y(i,:));
end

[minval,mindex]=min(fitnessY);
YBEST=Y(mindex,:);
BESTCOST=fobj(YBEST);

iter=1;

while(iter <= Maxiter)
   z=2-2*(iter/Maxiter);
   
   for i=1:N
     
     r1=rand;
     if(r1<0.5)
         for j=1:D
           C1=k*z*rand+1;
           T=2*z*rand-z;
           YNEW(i,j)=YBEST(j)+(Y(i,j)-C1*YBEST(j))*exp(-T);
         end
     else
         for j=1:D
           C1=k*z*rand+1;
           T=2*z*rand-z;
           YNEW(i,j)=YBEST(j)+exp(-T)*(cos(2*pi*T)+sin(2*pi*T))*abs(Y(i,j)-C1*YBEST(j));
         end
     end
   end
   YNEW = boundary (YNEW, Lower,Upper,N,D);   
   Y = update (Y,YNEW,fobj);
     
   for i=1:N
       fitnessY(i)=fobj(Y(i,:));
   end    
     
   [minval,mindex]=min(fitnessY);
   YBEST=Y(mindex,:);
   BESTCOST=minval;
   iter=iter+1;
   
end   


endfunction
