    Program h02bbfe

!     H02BBF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: h02bbf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Real (Kind=nag_wp)               :: bigbnd, objmip, tolfes, toliv
      Integer                          :: i, ifail, intfst, itmax, j, lda,     &
                                          liwork, lrwork, m, maxdpt, maxnod,   &
                                          msglvl, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: a(:,:), bl(:), bu(:), cvec(:),       &
                                          rwork(:), x(:)
      Integer, Allocatable             :: intvar(:), iwork(:)
!     .. Intrinsic Procedures ..
      Intrinsic                        :: min
!     .. Executable Statements ..
      Write (nout,*) 'H02BBF Example Program Results'
      Flush (nout)

!     Skip heading in data file
      Read (nin,*)

      Read (nin,*) n, m
      lda = m
      Allocate (a(lda,n),bl(m+n),bu(m+n),cvec(n),x(n),intvar(n))

      Read (nin,*) itmax, msglvl
      Read (nin,*) maxnod
      Read (nin,*) intfst, maxdpt
      Read (nin,*) tolfes, toliv
      Read (nin,*)(cvec(i),i=1,n)
      Read (nin,*)((a(i,j),j=1,n),i=1,m)
      Read (nin,*) bigbnd
      Read (nin,*)(bl(i),i=1,n+m)
      Read (nin,*)(bu(i),i=1,n+m)
      Read (nin,*)(intvar(i),i=1,n)
      Read (nin,*)(x(i),i=1,n)

      liwork = (25+n+m)*maxdpt + 5*n + m + 4
      lrwork = maxdpt*(n+1) + 2*min(n,m+1)**2 + 14*n + 12*m
      Allocate (iwork(liwork),rwork(lrwork))

!     Solve the IP problem

      ifail = 0
      Call h02bbf(itmax,msglvl,n,m,a,lda,bl,bu,intvar,cvec,maxnod,intfst, &
        maxdpt,toliv,tolfes,bigbnd,x,objmip,iwork,liwork,rwork,lrwork,ifail)

    End Program h02bbfe
