      program            MIMAIN
      implicit           double precision (a-h,o-z)
C---------------------------------------------------------------------C
C x(1) - x11                                                          C
C x(2) - x21                                                          C
C x(3) - x31                                                          C
C x(4) - y12                                                          C
C x(5) - x12                                                          C
C x(6) - x22                                                          C
C x(7) - x32                                                          C
C---------------------------------------------------------------------C
      parameter           (nwcore = 100000)
      double precision   z(nwcore)
      open(unit=4,file='midtermq2.spc')
      open(unit=9,file='midtermq2.out')
      open(unit=10,file='midtermq2.sol')
      open(unit=11,file='midtermq2.sum')
      call minos1( z, nwcore )
      end
      subroutine funobj( mode, n, x, f, g, nstate, nprob, z, nwcore )
      implicit           double precision (a-h,o-z)
      double precision   x(n), g(n), z(nwcore)
      common    /m1file/ iread,iprint,isumm
*     end of funobj
      end

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

      subroutine funcon( mode, m, n, njac, x, f, g,
     $                   nstate, nprob, z, nwcore )
      implicit           double precision (a-h,o-z)
      double precision   x(n), f(m), g(m,n), z(nwcore)
      common    /m1file/ iread,iprint,isumm
      do 10 i=1,m
        do 5 j=1,n
          g(i,j) = 0.0
    5   continue
   10 continue
      f(1) = dexp(0.05+0.30*dlog(x(1))+0.25*dlog(x(2))+0.15*dlog(x(3)) 
     1       -0.010*dlog(x(1))*dlog(x(1))+0.001*dlog(x(1))*dlog(x(2))
     2       -0.002*dlog(x(1))*dlog(x(3))-0.025*dlog(x(2))*dlog(x(2))
     3       +0.005*dlog(x(2))*dlog(x(3))-0.009*dlog(x(3))*dlog(x(3)))
     4       - x(4)
      g(1,1) = (0.30 - 0.020*dlog(x(1)) + 0.001*dlog(x(2))
     1          - 0.002*dlog(x(3)))*(f(1)+x(4))/x(1)
      g(1,2) = (0.25 + 0.001*dlog(x(1)) - 0.050*dlog(x(2))
     1          + 0.005*dlog(x(3)))*(f(1)+x(4))/x(2)
      g(1,3) = (0.15 - 0.002*dlog(x(1)) + 0.005*dlog(x(2))
     1          - 0.018*dlog(x(3)))*(f(1)+x(4))/x(3)
      g(1,4) = -1.00
      f(2) = dexp(0.03+0.40*dlog(x(4))+0.20*dlog(x(5))+0.10*dlog(x(6)) 
     1   + 0.05*dlog(x(7)) - 0.001*dlog(x(4))*dlog(x(4))
     2   + 0.0005*dlog(x(4))*dlog(x(5)) - 0.0002*dlog(x(4))*dlog(x(6))
     3   + 0.0009*dlog(x(4))*dlog(x(7)) - 0.0009*dlog(x(5))*dlog(x(5))
     4   + 0.0006*dlog(x(5))*dlog(x(6)) + 0.0010*dlog(x(5))*dlog(x(7))
     5   - 0.0012*dlog(x(6))*dlog(x(6)) + 0.0003*dlog(x(6))*dlog(x(7))
     6   - 0.0001*dlog(x(7))*dlog(x(7)) )
      g(2,4) = (0.40 - 0.002*dlog(x(4)) + 0.0005*dlog(x(5))
     1   - 0.0002*dlog(x(6)) + 0.0009*dlog(x(7)))*f(2)/x(4)
      g(2,5) = (0.20 + 0.0005*dlog(x(4)) - 0.0018*dlog(x(5))
     1   + 0.0006*dlog(x(6)) + 0.0010*dlog(x(7)))*f(2)/x(5)
      g(2,6) = (0.10 - 0.0002*dlog(x(4)) + 0.0006*dlog(x(5))
     1   - 0.0024*dlog(x(6)) + 0.0003*dlog(x(7)))*f(2)/x(6)
      g(2,7) = (0.05 + 0.0009*dlog(x(4)) + 0.0010*dlog(x(5))
     1   + 0.0003*dlog(x(6)) - 0.0002*dlog(x(7)))*f(2)/x(7)
      if (nstate.eq.1) then
        write(iprint,9000) f(1),f(2),g(1,1),g(1,2),g(1,3),g(1,4),
     1    g(2,4),g(2,5),g(2,6),g(2,7)
      endif
 9000 format(x,10(f10.4))
*     end of funcon
      end

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

      subroutine matmod( ncycle, nprob, finish,
     $                   m, n, nb, ne, nka, ns, nscl, nname,
     $                   a, ha, ka, bl, bu,
     $                   ascale, hs, name1, name2,
     $                   x, pi, rc, z, nwcore )

      implicit           double precision (a-h,o-z)
      integer*4          ha(ne), hs(nb)
      integer            ka(nka), name1(nname), name2(nname)
      double precision   a(ne), ascale(nscl), bl(nb), bu(nb)
      double precision   x(nb), pi(m), rc(nb), z(nwcore)
      logical            finish

*     ------------------------------------------------------------------
*     This is the default version of  matmod  for MINOS.
*     It belongs to the nonlinear test problem t4manne,
*     which will specify
*        Problem number   1114
*     in order to identify itself.
*
*     If Cycle limit > 1,  matmod  is called before the first cycle
*     (ncycle = 0) and at the end of each cycle except the last.
*
*     25 Nov 1991: nname and rc added as parameters.
*                  nname = nb for regular MINOS, 1 for minoss.
*     26 Jun 1992: If ncycle ge 1, rc contains reduced costs for the
*                  columns and rows, using the appropriate objective
*                  and pi.  (If infeasible, it is the Phase 1 obj.
*                  If feasible and maximizing, the sign is changed.)
*     ------------------------------------------------------------------

      common    /m1file/ iread,iprint,isumm

      if (nprob .eq. 1114) then
         bu(n)  = 0.1
         if (iprint .gt. 0) write(iprint, 1000) bu(n)
         if (isumm  .gt. 0) write(isumm , 1000) bu(n)
      else
         if (iprint .gt. 0) write(iprint, 9000)
         if (isumm  .gt. 0) write(isumm , 9000)
         finish = .true.
      end if

 1000 format(/ ' matmod  changes last upper bound to', f5.2)
 9000 format(/ ' XXX Subroutine matmod has not been loaded.')

*     end of matmod
      end

*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

