NAG AD Library
e04kf (handle_solve_bounds_foas)

Settings help

AD Name Style:


AD Specification Language:

1 Purpose

e04kf is the AD Library version of the primal routine e04kff. Based (in the C++ interface) on overload resolution, e04kf can be used for primal, tangent and adjoint evaluation. It supports tangents and adjoints of first order.

2 Specification

Fortran Interface
Subroutine e04kf_AD_f ( handle, objfun, objgrd, monit, nvar, x, rinfo, stats, iuser, ruser, cpuser, ifail)
Integer, Intent (In) :: nvar
Integer, Intent (Inout) :: iuser(*), ifail
ADTYPE, Intent (Inout) :: x(nvar), ruser(*)
ADTYPE, Intent (Out) :: rinfo(100), stats(100)
Type (c_ptr), Intent (Inout) :: ad_handle
Type (c_ptr), Intent (In) :: handle, cpuser
External :: objfun, objgrd, monit
Corresponding to the overloaded C++ function, the Fortran interface provides five routines with names reflecting the type used for active real arguments. The actual subroutine and type names are formed by replacing AD and ADTYPE in the above as follows:
when ADTYPE is Real(kind=nag_wp) then AD is p0w
when ADTYPE is Type(nagad_a1w_w_rtype) then AD is a1w
when ADTYPE is Type(nagad_t1w_w_rtype) then AD is t1w
C++ Interface
#include <dco.hpp>
#include <nagad.h>
namespace nag {
namespace ad {
template <typename OBJFUN_T, typename OBJGRD_T, typename MONIT_T>
void e04kf ( handle_t &ad_handle, void *handle, OBJFUN_T &&objfun, OBJGRD_T &&objgrd, MONIT_T &&monit, const Integer &nvar, ADTYPE x[], ADTYPE rinfo[], ADTYPE stats[], Integer &ifail)
}
}
The function is overloaded on ADTYPE which represents the type of active arguments. ADTYPE may be any of the following types:
double,
dco::ga1s<double>::type,
dco::gt1s<double>::type
Note: this function can be used with AD tools other than dco/c++. For details, please contact NAG.

3 Description

e04kf is the AD Library version of the primal routine e04kff.
e04kff is a solver from the NAG optimization modelling suite for bound-constrained large-scale Nonlinear Programming (NLP) problems. It is a first-order active-set method (FOAS) that has low memory requirements and thus is suitable for very large-scale problems. For further information see Section 3 in the documentation for e04kff.

4 References

Dai Y-H and Kou C-X (2013) A Nonlinear Conjugate Gradient Algorithm with an Optimal Property and an Improved Wolfe Line Search SIAM J. Optim. 23(1) 296–320
Gill P E and Leonard M W (2003) Limited-Memory Reduced-Hessian Methods for Large-Scale Unconstrained Optimization SIAM J. Optim. 14(2) 380–401
Hager W W and Zhang H (2005) A New Conjugate Gradient Method with Guaranteed Descent and an Efficient Line Search SIAM J. Optim. 16(1) 170–192
Hager W W and Zhang H (2006a) Algorithm 851: CG DESCENT, a Conjugate Gradient Method with Guaranteed Descent ACM Trans. Math. Software 32(1) 113–137
Hager W W and Zhang H (2006b) A New Active Set Algorithm for Box Constrained Optimization SIAM J. Optim. 17(2) 525–557
Hager W W and Zhang H (2013) The Limited Memory Conjugate Gradient Method SIAM J. Optim. 23(4) 2150–2168
Nocedal J and Wright S J (2006) Numerical Optimization (2nd Edition) Springer Series in Operations Research, Springer, New York

5 Arguments

In addition to the arguments present in the interface of the primal routine, e04kf includes some arguments specific to AD.
A brief summary of the AD specific arguments is given below. For the remainder, links are provided to the corresponding argument from the primal routine. A tooltip popup for all arguments can be found by hovering over the argument name in Section 2 and in this section.
1: ad_handlenag::ad::handle_t Input/Output
On entry: a configuration object that holds information on the differentiation strategy. Details on setting the AD strategy are described in AD handle object in the NAG AD Library Introduction.
2: handle – Type(c_ptr) Input
3: objfun – Callable Input
objfun needs to be callable with the specification listed below. This can be a C++ lambda, a functor or a (static member) function pointer. If using a lambda, parameters can be captured safely by reference. No copies of the callable are made internally.
If a null pointer is used as the argument, then a NAG supplied routine will be used as the argument for this parameter (C++ only).
For the Fortran interface, the NAG supplied routine e04kf_AD_v may be used as the actual argument for this parameter.
The specification of objfun is:
Fortran Interface
Subroutine objfun ( nvar, x, fx, inform, iuser, ruser, cpuser)
Integer, Intent (In) :: nvar
Integer, Intent (Inout) :: inform, iuser(*)
ADTYPE, Intent (In) :: x(nvar)
ADTYPE, Intent (Inout) :: ruser(*)
ADTYPE, Intent (Out) :: fx
Type (c_ptr), Intent (Inout) :: ad_handle
Type (c_ptr), Intent (In) :: cpuser
C++ Interface
auto objfun = [&]( const handle_t &ad_handle, const Integer &nvar, const ADTYPE x[], ADTYPE &fx, Integer &inform)
1: ad_handlenag::ad::handle_t Input/Output
On entry: a handle to the AD handle object.
2: nvar – Integer Input
3: xADTYPE array Input
4: fxADTYPE Output
5: inform – Integer Input/Output
*: iuser – Integer array User Workspace
*: ruserADTYPE array User Workspace
*: cpuser – Type(c_ptr) User Workspace
4: objgrd – Callable Input
objgrd needs to be callable with the specification listed below. This can be a C++ lambda, a functor or a (static member) function pointer. If using a lambda, parameters can be captured safely by reference. No copies of the callable are made internally.
If a null pointer is used as the argument, then a NAG supplied routine will be used as the argument for this parameter (C++ only).
For the Fortran interface, the NAG supplied routine e04kf_AD_w may be used as the actual argument for this parameter.
The specification of objgrd is:
Fortran Interface
Subroutine objgrd ( nvar, x, nnzfd, fdx, inform, iuser, ruser, cpuser)
Integer, Intent (In) :: nvar, nnzfd
Integer, Intent (Inout) :: inform, iuser(*)
ADTYPE, Intent (In) :: x(nvar)
ADTYPE, Intent (Inout) :: fdx(nnzfd), ruser(*)
Type (c_ptr), Intent (Inout) :: ad_handle
Type (c_ptr), Intent (In) :: cpuser
C++ Interface
auto objgrd = [&]( const handle_t &ad_handle, const Integer &nvar, const ADTYPE x[], const Integer &nnzfd, ADTYPE fdx[], Integer &inform)
1: ad_handlenag::ad::handle_t Input/Output
On entry: a handle to the AD handle object.
2: nvar – Integer Input
3: xADTYPE array Input
4: nnzfd – Integer Input
5: fdxADTYPE array Input/Output
6: inform – Integer Input/Output
*: iuser – Integer array User Workspace
*: ruserADTYPE array User Workspace
*: cpuser – Type(c_ptr) User Workspace
5: monit – Callable Input
monit needs to be callable with the specification listed below. This can be a C++ lambda, a functor or a (static member) function pointer. If using a lambda, parameters can be captured safely by reference. No copies of the callable are made internally.
If a null pointer is used as the argument, then a NAG supplied routine will be used as the argument for this parameter (C++ only).
For the Fortran interface, the NAG supplied routine e04kf_AD_u may be used as the actual argument for this parameter.
The specification of monit is:
Fortran Interface
Subroutine monit ( nvar, x, inform, rinfo, stats, iuser, ruser, cpuser)
Integer, Intent (In) :: nvar
Integer, Intent (Inout) :: inform, iuser(*)
ADTYPE, Intent (In) :: x(nvar), rinfo(100), stats(100)
ADTYPE, Intent (Inout) :: ruser(*)
Type (c_ptr), Intent (Inout) :: ad_handle
Type (c_ptr), Intent (In) :: cpuser
C++ Interface
auto monit = [&]( const handle_t &ad_handle, const Integer &nvar, const ADTYPE x[], Integer &inform, const ADTYPE rinfo[], const ADTYPE stats[])
1: ad_handlenag::ad::handle_t Input/Output
On entry: a handle to the AD handle object.
2: nvar – Integer Input
3: xADTYPE array Input
4: inform – Integer Input/Output
5: rinfoADTYPE array Input
6: statsADTYPE array Input
*: iuser – Integer array User Workspace
*: ruserADTYPE array User Workspace
*: cpuser – Type(c_ptr) User Workspace
6: nvar – Integer Input
7: x(nvar) – ADTYPE array Input/Output
Please consult Overwriting of Inputs in the NAG AD Library Introduction.
8: rinfo(100) – ADTYPE array Output
9: stats(100) – ADTYPE array Output
*: iuser(*) – Integer array User Workspace
*: ruser(*) – ADTYPE array User Workspace
Please consult Overwriting of Inputs in the NAG AD Library Introduction.
*: cpuser – Type(c_ptr) User Workspace
10: ifail – Integer Input/Output

6 Error Indicators and Warnings

e04kf preserves all error codes from e04kff and in addition can return:
ifail=-89
An unexpected AD error has been triggered by this routine. Please contact NAG.
See Error Handling in the NAG AD Library Introduction for further information.
ifail=-199
The routine was called using a strategy that has not yet been implemented.
See AD Strategies in the NAG AD Library Introduction for further information.
ifail=-444
A C++ exception was thrown.
The error message will show the details of the C++ exception text.
ifail=-899
Dynamic memory allocation failed for AD.
See Error Handling in the NAG AD Library Introduction for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

e04kf is not threaded in any implementation.

9 Further Comments

None.

10 Example

A NAG AD Library example is not yet available, please refer to the NAG AD Library Introduction for information on calling routines from the AD Library.