function [Globalminimizer,Globalminimum] =Teaching_Learning_based_Optimization1 (fobj,N,Lower,Upper,Maxiter)
D=length(Lower);
Globalminimizer=zeros(1,D);
MEAN=zeros(1,D);
XNEW=zeros(N,D);
yX=zeros(1,N);
yXTEACHER=zeros(1,N);
X=zeros(N,D);
XTEACHER=zeros(1,D);
Globalminimum=1.0E200;

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


iter=1;

while(iter <= Maxiter)

   for i=1:N
     yXTEACHER(i)=fobj(X(i,:));
   end  
     
     [minval,mindex]=min(yXTEACHER);
     XTEACHER=X(mindex,:);
     MEAN=mean(X);
   for i=1:N
     for j=1:D
       TF=round(1+rand);
       XNEW(i,j)=X(i,j)+rand*(XTEACHER(j)-(TF*MEAN(j)));
     end
   end  
   
   X = update (X,XNEW,fobj);
   
   for i=1:N
     k1=ceil(rand*N);
     while(i==k1)
        k1=ceil(rand*N);
     end
     
     if (fobj(X(k1,:)) < fobj(X(i,:)))
         XNEW(i,:)=X(i,:)+rand*(X(k1,:)-X(i,:));
     else
         XNEW(i,:)=X(i,:)+rand*(X(i,:)-X(k1,:));
     end
   end
  
   X = update (X,XNEW,fobj);
 
   for i=1:N
     yXTEACHER(i)=fobj(X(i,:));
   end  
     
     [ybest,mindex2]=min(yXTEACHER);
   
   if(ybest < Globalminimum)
      Globalminimum=ybest;
      Globalminimizer=X(mindex2,:);
   end  

   iter=iter+1;

end


endfunction
