
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% private_110_ROUTINE -- Yes, called by STEPIT like all the others. A sheep!
%
%
%
%
% Written by Jason Lott, University of Alabama at Birmingham, 2001
% CONTACT: hoffa@uab.edu
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function a = private_110_ROUTINE(b)				%really just a script function.

global X
global XMAX
global XMIN
global DELTX
global DELMIN
global ERR
global FOBJ
global VEC
global DLX
global XS
global FSTORE
global DX
global SALVO
global XOSC
global FOSC
global ARG
global STCUT
global ACK
global FACUP
global RZERO
global XPLUS
global FSAVE
global FBEST
global XSAVE
global ABSDX
global FPREV
global DENOM
global DEL
global DXZ
global DXU
global DFZ
global DFU
global ABSVEC
global SUMV
global CINDER
global COXCOM
global COSIN
global STEPS
global J
global JFLAT
global JFLMIN
global JOCK
global JUMP
global JVARY
global JX
global K
global KERFEL
global KL
global KW
global MASK
global MATRX
global MINSOC
global MAXOSC
global MAXSTP
global NACK
global NACTIV
global NAH
global NCIRC
global NEQUAL
global NF
global NFLAT
global NFMAX
global NFSAV
global NGATE
global NGIANT
global NONZER
global NOREP
global NOSC
global NOUT
global NRETRY
global NSSW
global NSTEPS
global NT
global NTRACE
global NV
global NEXTRA
global NZIP
global NVMAX
global tag_380
global tag_390
global wtag
global tag
global continueflag
global T
global Y
global YSIG
global grandtag
global KFLAG
global DX
global DLX
global XS
global fortag
global KFLAGENCOUNTER

if ((NEQUAL == 1) | ((NOUT == 1) &(NEQUAL ==1)&((XSAVE==XMIN(JX))|(XSAVE==XMAX(JX)))))
                                 
   JFLAT(JX) = 1;
   X(JX) = XSAVE;
   NCIRC = NCIRC + 1;
   
   if NCIRC>=NACTIV
      
      %disp('ENTERING 570 from 110 1')
     % pause
      private_570_ROUTINE(1);
      
   else
     % disp('ENTERING 210 from 100 1')
     % pause
      private_210_ROUTINE(1);
      
   end
   
elseif NOUT>0
   
  % disp('ENTERING 140 from 110 1')
  % pause
   private_140_ROUTINE(1);
  
else
   
   DENOM = (FOBJ-FBEST) - (FBEST-FPREV);
   
   if DENOM<=RZERO
      
      %disp('ENTERING 140 from 110 2')
      %pause
      private_140_ROUTINE(1);
      
   else
      
      DLX(JX) = -DX(JX)*(FOBJ-FPREV)/(DENOM+DENOM);
      VEC(JX) = DLX(JX)/ABSDX;
      X(JX) = XSAVE+DLX(JX);
      
      if X(JX) == XSAVE
         
         DLX(JX) = RZERO;
         VEC(JX) = RZERO;
         %disp('ENTERING 140 from 110 3')
         %pause
         private_140_ROUTINE(1);
         
      else
         
         private_FUNK(1);
         NF = NF+1;
                                 
         if FOBJ>=FBEST
            
            DLX(JX) = RZERO;
            VEC(JX) = RZERO;
            %disp('ENTERING 140 from 110 4')
           % pause
            private_140_ROUTINE(1);
            
         else
            
            FBEST = FOBJ;
            JOCK = 1;
            NCIRC = NCIRC+1;
            
            if NCIRC>=NACTIV
               
               %disp('ENTERING 570 from 110 2')
               %pause
               private_570_ROUTINE(1);
               
            else
               
               %disp('ENTERING 210 from 110 2')
               %pause
               private_210_ROUTINE(1);
               
            end
            
         end
         
      end
      
   end
   
end
