function [BEST, BESTVAL] = Arithmetic_Optimization_Algorithm1 (fobj,N,Lower,Upper,Maxiter,MOP_Max,MOP_Min,alpha,mu)
D=length(Lower);  
X=zeros(N,D);
XNEW=zeros(N,D);
fitness=zeros(1,N); 
fitnessnew=zeros(1,N);
BEST=zeros(1,D);
 

%%MOP_Max=1.0;
%%MOP_Min=0.2;
%%alpha=5.0;
%%mu=0.499;

eps=1e-15; 


 

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

[minval,mindex]=min(fitness);
for j=1:D
   BEST(j)=X(mindex,j);
end

iter=1;

while(iter<Maxiter)
   
   MOP=1.0-((iter.^(1./alpha))/(Maxiter.^(1./alpha)));
   MOA=MOP_Min+iter.*((MOP_Max-MOP_Min)./Maxiter);
   
   for i=1:N
        
         if (rand<MOA)
            if(rand > 0.5)
              XNEW(i,:)=BEST./(MOP+eps).*((Upper-Lower).*mu+Lower);
            else
              XNEW(i,:)=BEST.*(MOP).*((Upper-Lower).*mu+Lower);
            end
         else
            if(rand>0.5)
               XNEW(i,:)=BEST-(MOP).*((Upper-Lower).*mu+Lower);
            else
               XNEW(i,:)=BEST+(MOP)*((Upper-Lower).*mu+Lower);
            end
         end  
    end   
  
    XNEW=boundary(XNEW, Lower,Upper,N,D);   
    
    X = update (X,XNEW,fobj);
    
    for i=1:N
      fitness(i)=fobj(X(i,:));
    end
      
   [minval,mindex]=min(fitness);
   for j=1:D
       BEST(j)=X(mindex,j);
   end
    BESTVAL=fobj(BEST);
   iter=iter+1;
end
    

endfunction
