c     SEQUENTIAL LP SOLVER
C     IT IS USED IN SECTION 2.6 OF THE TEXT
      USE IMSL
      DIMENSION X(50),G(50),DELG(50,50),B(50),DELF(50)
     & ,IRTYPE(50),XLB(50),XUB(50),XSOL(50),DSOL(50)
     & ,A(50,50)
      X(1)=1.
      X(2)=1.
      N=2
      M=3
      LDA=50
      NIT=100
      CFAC=.1
      DO 4 ITER=1,NIT
      CALL ROUTINES (X,F,G,DELG,N,ITER,DELF)
      DO 1 I=1,M
      B(I)=-G(I)
      IRTYPE(I)=2
    1 CONTINUE
      DO 2 I=1,N
      XLB(I)=-CFAC*X(I)
    2 XUB(I)= CFAC*X(I)
      CALL DLPRS(M,N,DELG,LDA,B,B,DELF,IRTYPE,XLB,XUB,OBJ,
     & XSOL,DSOL)
      DO 3 I=1,N
    3 X(I)=X(I)+XSOL(I)
    4 CONTINUE
      STOP
      END
C
      SUBROUTINE ROUTINES (X,F,G,DELG,N,ITER,DELF)
      DIMENSION X(50),G(50),DELG(50,50),DELF(50)
      F=-(X(1)**3)-2.*(X(2)**2)+10.*X(1)-6-2.*(X(2)**3)
      DELF(1)=-3.*(X(1)**2)+10.
      DELF(2)=-4.*X(2)-6.*(X(2)**2)
      G(1)=10.-X(1)*X(2)
      G(2)=X(1)
      G(3)=10.-X(2)
      DELG(1,1)=-X(2)
      DELG(1,2)=-X(1)
      DELG(2,1)=1.
      DELG(2,2)=0.
      DELG(3,1)=0.
      DELG(3,2)=-1.
      WRITE(60,*)ITER,F,(X(I),I=1,N)
      write(61,*)iter,f
      RETURN
      END
