function [Ceq1,Ceq1_fit] = Equilibrium_Optimizer (Func_name,N,Lower,Upper,Maxiter)
 
fobj = TestFunctions (Func_name); 
D=length(Lower);
C=zeros(N,D);
C_old=zeros(N,D);
C_avedat=zeros(4,D);
C_pool=zeros(5,D);
Ceq=zeros(1,D);
Ceq1=zeros(1,D);
Ceq2=zeros(1,D);
Ceq3=zeros(1,D);
Ceq4=zeros(1,D);
Cave=zeros(1,D);
lamda=zeros(1,D);
F=zeros(1,D);
r=zeros(1,D);
GCP=zeros(1,D);
G0=zeros(1,D);
G=zeros(1,D);
fitness=zeros(1,N); 
fit_old=zeros(1,N);
BEST=zeros(1,D);
 
a1=2.0;
a2=1.0;
GP=0.5;
Ceq1_fit=1E+200;
Ceq2_fit=1E+200;
Ceq3_fit=1E+200;
Ceq4_fit=1E+200;

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

iter=1;

while(iter <= Maxiter)
    
      C=boundary(C, Lower,Upper,N,D); 
      
      for i=1:N
          fitness(i)=fobj(C(i,:));
          if(fitness(i)<Ceq1_fit)
             Ceq1_fit=fitness(i);
             Ceq1=C(i,:);
          elseif((fitness(i)>Ceq1_fit) && (fitness(i)<Ceq2_fit))
             Ceq2_fit=fitness(i);
             Ceq2=C(i,:);
          elseif ((fitness(i)>Ceq1_fit) && (fitness(i)>Ceq2_fit) && (fitness(i)<Ceq3_fit))
             Ceq3_fit=fitness(i);
             Ceq3=C(i,:);
          elseif ((fitness(i)>Ceq1_fit) && (fitness(i)>Ceq2_fit) && (fitness(i)>Ceq3_fit) && (fitness(i)<Ceq4_fit) )
             Ceq4_fit=fitness(i);
             Ceq4=C(i,:);   
          end
      end
      
      if (iter==1)
        for i=1:N
          fit_old(i)=fitness(i);
          C_old(i,:)=C(i,:);
        end
      end
    
      for i=1:N
        if (fit_old(i)<fitness(i))
          fitness(i)=fit_old(i);
          C(i,:)=C_old(i,:);
        end
      end
      
      for i=1:N
        fit_old(i)=fitness(i);
        C_old(i,:)=C(i,:);
      end
      
      C_avedat(1,:)=Ceq1;
      C_avedat(2,:)=Ceq2;
      C_avedat(3,:)=Ceq3;
      C_avedat(4,:)=Ceq4;
    
      Cave=mean(C_avedat);  
      
      Cpool(1,:)=Ceq1;
      Cpool(2,:)=Ceq2;
      Cpool(3,:)=Ceq3;
      Cpool(4,:)=Ceq4;
      Cpool(5,:)=Cave;
      
      t=((1.0-(iter/Maxiter))^(a2*iter/Maxiter));
      
      for i=1:N
        m=ceil(5*rand);
        r=rand(1,D);
        lamda=rand(1,D);
        Ceq=Cpool(m,:);
        F=a1.*sign(r-0.5).*(exp(-lamda.*t)-1.0);
        if (rand>GP)
          GCP=0.5.*rand(1,D);
        else
          GCP=0.0.*rand(1,D);
        end
        G0=GCP.*(Ceq-lamda.*C(i,:));
        G=G0.*F;
        C(i,:)=Ceq+(C(i,:)-Ceq).*F+(G./lamda).*(1.0-F);
      end
     
      iter=iter+1;
end

 
endfunction
