Program h02bufe
! H02BUF Example Program Text
! Mark 27.3 Release. NAG Copyright 2021.
! .. Use Statements ..
Use nag_library, Only: e04mff, e04mhf, h02buf, h02bvf, nag_wp, x04acf, &
x04baf
! .. Implicit None Statement ..
Implicit None
! .. Parameters ..
Real (Kind=nag_wp), Parameter :: xbl_default = 0.0E0_nag_wp
Real (Kind=nag_wp), Parameter :: xbu_default = 1.0E+20_nag_wp
Integer, Parameter :: maxm = 50, maxn = 50, nindat = 7, &
nout = 6
Integer, Parameter :: lda = maxm
Integer, Parameter :: liwork = 2*maxn + 3
Integer, Parameter :: lwork = 2*(maxm+1)**2 + 7*maxn + 5* &
maxm
Character (*), Parameter :: fname = 'h02bufe.opt'
Character (8), Parameter :: kblank = ' '
Character (3), Parameter :: optim = 'MIN'
! .. Local Scalars ..
Real (Kind=nag_wp) :: objval
Integer :: ifail, infile, iter, m, mode, n
Logical :: mpslst
Character (8) :: nmbnd, nmobj, nmprob, nmrhs, nmrng
Character (80) :: rec
! .. Local Arrays ..
Real (Kind=nag_wp) :: a(maxm,maxn), ax(maxm), &
bl(maxn+maxm), bu(maxn+maxm), &
clamda(maxn+maxm), cvec(maxn), &
work(lwork), x(maxn)
Integer :: intvar(maxn), istate(maxn+maxm), &
iwork(liwork)
Character (8) :: crname(maxn+maxm)
! .. Executable Statements ..
Write (rec,99999) 'H02BUF Example Program Results'
Call x04baf(nout,rec)
! Open the data file for reading
mode = 0
ifail = 0
Call x04acf(nindat,fname,mode,ifail)
! Initialize parameters
infile = nindat
nmprob = kblank
nmobj = kblank
nmrhs = kblank
nmrng = kblank
nmbnd = kblank
mpslst = .False.
! Convert the MPSX data file for use by E04MFF
ifail = 0
Call h02buf(infile,maxn,maxm,optim,xbl_default,xbu_default,nmobj,nmrhs, &
nmrng,nmbnd,mpslst,n,m,a,bl,bu,cvec,x,intvar,crname,nmprob,istate, &
ifail)
! Solve the problem
Call e04mhf('Print Level = 5')
ifail = -1
Call e04mff(n,m,a,lda,bl,bu,cvec,istate,x,iter,objval,ax,clamda,iwork, &
liwork,work,lwork,ifail)
Select Case (ifail)
Case (0,1,3)
! Print solution (using MPSX names)
ifail = 0
Call h02bvf(n,m,a,lda,bl,bu,x,clamda,istate,crname,ifail)
End Select
99999 Format (1X,A)
End Program h02bufe