*DECK MAIN
C**** File  MI00MAIN FORTRAN.
C
C     MAIN     FUNOBJ   FUNCON   MATMOD
C
C   *****************************************************************
C   *                                                               *
C   *                           M I N O S                           *
C   *                                                               *
C   *        A Modular In-core Nonlinear Optimization System        *
C   *                                                               *
C   *                  Version 5.1    June 11, 1987                 *
C   *                                                               *
C   *                                                               *
C   *        Bruce A. Murtagh, University of New South Wales        *
C   *        Michael A. Saunders,        Stanford University        *
C   *                                                               *
C   *---------------------------------------------------------------*
C   *                                                               *
C   * MINOS  is distributed by OTL, Stanford University.  Enquiries *
C   * should be directed to the following address:                  *
C   *                                                               *
C   *        Office of Technology Licensing                         *
C   *        Software Distribution Center                           *
C   *        350 Cambridge Avenue, Suite 250                        *
C   *        Palo Alto, California 94306, U.S.A.                    *
C   *                                                               *
C   * Telephone: (415) 723-0651         Telex: 348402 STANFRD STNU  *
C   *                                                               *
C   *---------------------------------------------------------------*
C   *                                                               *
C   *             Copyright  1987  Stanford University.             *
C   *                                                               *
C   * This material may be reproduced by or for the U.S. Government *
C   * pursuant to the copyright license under DAR CLAUSE 7-104.9(A) *
C   * (1979 MAR).                                                   *
C   *                                                               *
C   * This material is based upon work partially supported by the   *
C   * National Science Foundation under grants MCS-7926009 and      *
C   * ECS-8012974; the Department of Energy contract AM03-76SF00326,*
C   * PA NO. DE-AT03-76ER72018; and the Army Research Office        *
C   * contract DAAG29-81-K-0156.                                    *
C   *                                                               *
C   *****************************************************************
C
C     This is the default main program for MINOS.
C     It provides all of the necessary workspace.
C
      PARAMETER(NWCORE=30000)
      DOUBLE PRECISION   Z(NWCORE)
      COMMON       /ZCOMM / Z
C     DATA          NWCORE/41000/
C
      CALL MINOS1( Z,NWCORE )
      STOP
C
C     End of MAIN
      END
*DECK FUNOBJ
      SUBROUTINE FUNOBJ( MODE, N, X, F, G, NSTATE, NPROB, Z, NWCORE )
      IMPLICIT           REAL*8(A-H,O-Z)
      DOUBLE PRECISION   X(N), G(N), Z(NWCORE)
C
C     ------------------------------------------------------------------
C     This is the default version of  FUNOBJ  for MINOS.
C     It belongs to the nonlinear test problem    MANNE,
C     which will specify          PROBLEM NUMBER   1111
C     in order to identify itself.
C
C     For test purposes, we look at    DERIVATIVE LEVEL
C     and sometimes pretend that we dont know the first
C     three elements of the gradient.
C     ------------------------------------------------------------------
C
      COMMON    /M1FILE/ IREAD,IPRINT,ISUMM
      COMMON    /M8DIFF/ DIFINT(2),GDUMMY,LDERIV,LVLDIF,KNOWNG(2)
      COMMON    /MANNE / B,AT(100),BT(100)
      LOGICAL            GKNOWN
      DATA               ZERO /0.0D+0/
C
      IF (NPROB .NE. 1111) GO TO 900
      GKNOWN = LDERIV .EQ. 1  .OR.  LDERIV .EQ. 3
      NT     = N/2
      F      = ZERO
C
      DO 50 J = 1, NT
         XCON = X(NT+J)
         F    = F + BT(J)*DLOG(XCON)
         G(J) = ZERO
         IF (GKNOWN  .OR.  J .GT. 3) G(NT+J) = BT(J)/XCON
   50 CONTINUE
      RETURN
C
C
C     It looks like some other  FUNOBJ  is needed.
C
  900 WRITE(IPRINT, 9000)
      IF (ISUMM .GT. 0) WRITE(ISUMM, 9000)
      MODE   = -1
      RETURN
C
 9000 FORMAT(/ ' XXX Subroutine FUNOBJ has not been loaded.')
C     End of FUNOBJ for MANNE
      END
*DECK FUNCON
      SUBROUTINE FUNCON( MODE, M, N, NJAC, X, F, G,
     *                   NSTATE, NPROB, Z, NWCORE )
      IMPLICIT           REAL*8(A-H,O-Z)
      DOUBLE PRECISION   X(N), F(M), G(NJAC), Z(NWCORE)
C
C     ------------------------------------------------------------------
C     This is the default version of  FUNCON  for MINOS.
C     It belongs to the nonlinear test problem    MANNE,
C     which will specify          PROBLEM NUMBER   1111
C     in order to identify itself.
C
C     For test purposes, we look at    DERIVATIVE LEVEL
C     and sometimes pretend that we dont know the first
C     three elements of the gradient.
C     ------------------------------------------------------------------
C
      COMMON    /M1FILE/ IREAD,IPRINT,ISUMM
      COMMON    /M8DIFF/ DIFINT(2),GDUMMY,LDERIV,LVLDIF,KNOWNG(2)
      COMMON    /MANNE / B,AT(100),BT(100)
      LOGICAL            GKNOWN
C
      IF (NPROB .NE. 1111) GO TO 900
      GKNOWN = LDERIV .GE. 2
      NT     = N
      IF (NSTATE .NE. 1) GO TO 100
C
C     ------------
C     First entry.
C     ------------
      ONE    = 1.0
      GROW   = 0.03
      BETA   = 0.95
      XK0    = 3.0
      XC0    = 0.95
      XI0    = 0.05
      B      = 0.25
      WRITE(IPRINT, 1000) B
C
      A      = (XC0 + XI0) / XK0**B
      GFAC   = (ONE + GROW)**(ONE - B)
      AT(1)  = A*GFAC
      BT(1)  = BETA
      DO 10 J  = 2, NT
         AT(J) = AT(J-1)*GFAC
         BT(J) = BT(J-1)*BETA
   10 CONTINUE
      BT(NT) = BT(NT)/(ONE - BETA)
C
C     -------------
C     Normal entry.
C     -------------
  100 DO 150 J = 1, NT
         XKAP  = X(J)
         FJ    = AT(J) * XKAP**B
         F(J)  = FJ
         IF (GKNOWN  .OR.  J .GT. 3) G(J) = B*FJ / XKAP
  150 CONTINUE
      IF (NSTATE .LT. 2) RETURN
C
C     ------------
C     Final entry.
C     ------------
      WRITE(IPRINT, 2000) (F(J), J = 1, NT)
      RETURN
C
C
C     It looks like some other  FUNCON  is needed.
C
  900 WRITE(IPRINT, 9000)
      IF (ISUMM .GT. 0) WRITE(ISUMM, 9000)
      MODE   = -1
      RETURN
C
 1000 FORMAT(// ' This is problem  MANNE.   B =', F8.3)
 2000 FORMAT(// ' Final nonlinear function values' / (5F12.5))
 9000 FORMAT( / ' XXX Subroutine FUNCON has not been loaded.')
C     End of FUNCON for MANNE
      END
*DECK MATMOD
      SUBROUTINE MATMOD( NCYCLE, NPROB, FINISH,
     *                   M, N, NB, NE, NKA, NS, NSCL,
     *                   A, HA, KA, BL, BU,
     *                   ASCALE, HS, ID1, ID2,
     *                   X, PI, Z, NWCORE )
C
      IMPLICIT           REAL*8(A-H,O-Z)
      INTEGER*2          HA(NE), HS(NB)
      INTEGER            KA(NKA), ID1(NB), ID2(NB)
      DOUBLE PRECISION   A(NE), ASCALE(NSCL), BL(NB), BU(NB)
      DOUBLE PRECISION   X(NB), PI(M), Z(NWCORE)
      LOGICAL            FINISH
C
C     ------------------------------------------------------------------
C     This is the default version of  MATMOD  for MINOS.
C     It belongs to the nonlinear test problem    MANNE,
C     which will specify          PROBLEM NUMBER   1111
C     in order to identity itself.
C
C     MATMOD  is called at the end of each CYCLE except the last.
C     ------------------------------------------------------------------
C
      COMMON    /M1FILE/ IREAD,IPRINT,ISUMM
      COMMON    /M5LOBJ/ SINF,WTOBJ,MINIMZ,NINF,IOBJ,JOBJ,KOBJ
      COMMON    /CYCLCM/ CNVTOL,JNEW,MATERR,MAXCY,NEPHNT,NPHANT,NPRINT
C
      IF (NPROB .NE. 1111) GO TO 900
      BU(N)  = 0.1
      WRITE(IPRINT, 1000) BU(N)
      IF (ISUMM .GT. 0) WRITE(ISUMM, 1000) BU(N)
      RETURN
C
C
C     It looks like some other  MATMOD  is needed.
C
  900 WRITE(IPRINT, 9000)
      IF (ISUMM .GT. 0) WRITE(ISUMM, 9000)
      FINISH = .TRUE.
      RETURN
C
 1000 FORMAT(/ ' MATMOD  changes last upper bound to', F5.2)
 9000 FORMAT(/ ' XXX Subroutine MATMOD has not been loaded.')
C
C     End of MATMOD
      END
C**** File  MI10MACH FORTRAN.
C
C     MIFILE   MINOS1   MINOS2   MINOS3
C     M1CHAR   M1HASH   M1INIT   M1READ
C
C
C  Contents of this and other MINOS source files
C  =============================================
C
C
C  0. File MI00MAIN   Main program and user subroutines:
C     -------------
C
C     MAIN     FUNOBJ   FUNCON   MATMOD
C
C
C  1. File MI10MACH   Machine-dependent routines:
C     -------------
C
C     MIFILE   MINOS1   MINOS2   MINOS3
C     M1CHAR   M1HASH   M1INIT   M1READ
C
C
C  2. File MI15BLAS   Basic Linear Algebra Subprograms (a subset):
C     -------------
C
C     DASUM    DAXPY    DCOPY    DDOT     DNRM2    DSCAL    IDAMAX
C
C     These correspond to members of the BLAS package (Basic Linear
C     Algebra Subprograms, Lawson et al. (1979), ACM TOMS 5, 3).
C     If possible, they should be replaced by authentic BLAS routines
C     tuned to the machine being used.
C     Beware that the versions here work correctly only when
C     INCX and INCY are 1 (which is the only way MINOS uses them).
C
C
C     The following utilities are also used:
C
C     DDDIV    DDSCL    DNORM    DZERO    HCOPY    ICOPY
C
C     These could be tuned to the machine being used.
C     DZERO  is used the most.
C
C
C  3. File MI20AMAT   Core allocation and manipulation of the
C     -------------   constraint matrix  ( A  I ):
C
C     M2CORE   M2AMAT   M2APRD   M2APR1   M2APR5
C     M2CRSH   M2SCAL   M2SCLA   M2UNPK   M2UNP2   MATCOL
C
C
C  4. File MI25BFAC   Basis routines for handling the factorization
C     -------------   of the basis matrix  B:
C
C     M2BFAC   M2BMAP   M2BELM   M2BSOL   M2SING
C     LU1FAC   LU1MAR   LU1OR1   LU1OR2   LU1OR3   LU1OR4
C     LU1PQ1   LU1PQ2   LU1REC
C     LU6CHK   LU6SOL   LU7ADD   LU7ELM   LU7FOR   LU7ZAP   LU8RPC
C
C
C  5. File MI30SPEC   SPECS file routines:
C     -------------
C
C     M3SPC0   M3SPC1   M3SPC2
C
C
C  6. FilE MI35INPT   MPS file routines:
C     -------------
C
C     M3INPT   M3MPSA   M3MPSB   M3MPSC   M3READ
C
C
C  7. File MI40BFIL   Basis file and solution output routines:
C     -------------
C
C     M4GETB   M4NAME   M4INST   M4LOAD   M4OLDB   M4CHEK
C     M4SAVB   M4DUMP   M4NEWB   M4PNCH   M4SOLN   M4SOLP
C     M4STAT   REPORT
C
C
C  8. File MI50LP     Routines for the primal simplex method:
C     -------------
C
C     M5BSX    M5CHZR   M5FRMC   M5LOG    M5LPIT   M5PRIC
C     M5SETP   M5SETX   M5SOLV
C
C
C  9. File MI60SRCH   Routines for the linesearch and subproblem obj:
C     -------------
C
C     M6DMMY   M6FOBJ   M6FCON   M6FUN    M6FUN1   M6GRD    M6GRD1
C     M6DOBJ   M6DCON   M6SRCH   GETPTC   GETPTQ
C
C
C 10. File MI65RMOD   For maintaining  R,  the quasi-Newton
C     -------------   approximation to the reduced Hessian:
C
C     M6BFGS   M6BSWP   M6RADD   M6RCND   M6RDEL
C     M6RMOD   M6RSET   M6RSOL   M6SWAP
C
C
C 11. File MI70NOBJ   To handle a nonlinear objective function
C     -------------   via the reduced-gradient algorithm:
C
C     M7BSG    M7CHKD   M7CHKG   M7CHZQ
C     M7RG     M7RGIT   M7SDIR   M7SSCV
C
C
C 12. File MI80NCON   to handle nonlinear constraints
C     -------------   via the projected augmented Lagrangian algorithm:
C
C     M8AJAC   M8AUGL   M8AUG1   M8CHKJ   M8PRTJ   M8SCLJ
C     M8SETJ   M8VIOL
C
C  ******************************************************************
C
