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 ( ad_handle, 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++ Header Interface
#include <dco.hpp>
#include <nagad.h>
namespace nag {
namespace ad {
void e04kf ( void *&ad_handle, void *handle,
void (NAG_CALL objfun)(void *&ad_handle, const Integer &nvar, const ADTYPE x[], ADTYPE &fx, Integer &inform, Integer iuser[], ADTYPE ruser[], void *cpuser),
void (NAG_CALL objgrd)(void *&ad_handle, const Integer &nvar, const ADTYPE x[], const Integer &nnzfd, ADTYPE fdx[], Integer &inform, Integer iuser[], ADTYPE ruser[], void *cpuser),
void (NAG_CALL monit)(void *&ad_handle, const Integer &nvar, const ADTYPE x[], Integer &inform, const ADTYPE rinfo[], const ADTYPE stats[], Integer iuser[], ADTYPE ruser[], void *cpuser),
const Integer &nvar, ADTYPE x[], ADTYPE rinfo[], ADTYPE stats[], const Integer &liuser, Integer iuser[], const Integer &lruser, ADTYPE ruser[], void *cpuser, 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_handle – Pointer to AD Data Input/Output
On entry: a handle to the AD configuration data object, as created by x10aa.
2: handle – Type(c_ptr) Input
3: objfun – Subroutine External Procedure
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 ( ad_handle, 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++ Header Interface
void objfun ( void *&ad_handle, const Integer &nvar, const ADTYPE x[], ADTYPE &fx, Integer &inform, Integer iuser[], ADTYPE ruser[], void *cpuser)
1: ad_handle – Pointer to AD Data Input/Output
On entry: a handle to the AD configuration data object.
2: nvar – Integer Input
3: xADTYPE array Input
4: fxADTYPE Output
5: inform – Integer Input/Output
6: iuser – Integer array User Workspace
7: ruserADTYPE array User Workspace
8: cpuser – Type(c_ptr) User Workspace
4: objgrd – Subroutine External Procedure
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 ( ad_handle, 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++ Header Interface
void objgrd ( void *&ad_handle, const Integer &nvar, const ADTYPE x[], const Integer &nnzfd, ADTYPE fdx[], Integer &inform, Integer iuser[], ADTYPE ruser[], void *cpuser)
1: ad_handle – Pointer to AD Data Input/Output
On entry: a handle to the AD configuration data object.
2: nvar – Integer Input
3: xADTYPE array Input
4: nnzfd – Integer Input
5: fdxADTYPE array Input/Output
6: inform – Integer Input/Output
7: iuser – Integer array User Workspace
8: ruserADTYPE array User Workspace
9: cpuser – Type(c_ptr) User Workspace
5: monit – Subroutine External Procedure
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 ( ad_handle, 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++ Header Interface
void monit ( void *&ad_handle, const Integer &nvar, const ADTYPE x[], Integer &inform, const ADTYPE rinfo[], const ADTYPE stats[], Integer iuser[], ADTYPE ruser[], void *cpuser)
1: ad_handle – Pointer to AD Data Input/Output
On entry: a handle to the AD configuration data object.
2: nvar – Integer Input
3: xADTYPE array Input
4: inform – Integer Input/Output
5: rinfoADTYPE array Input
6: statsADTYPE array Input
7: iuser – Integer array User Workspace
8: ruserADTYPE array User Workspace
9: cpuser – Type(c_ptr) User Workspace
6: nvar – Integer Input
7: x(nvar) – ADTYPE array Input/Output
8: rinfo(100) – ADTYPE array Output
9: stats(100) – ADTYPE array Output
10: liuser Input
User workspace dimension (C++ only), see x10af to specify the dimension from Fortran.
11: iuser(*) – Integer array User Workspace
12: lruser Input
User workspace dimension (C++ only), see x10ae to specify the dimension from Fortran.
13: ruser(*) – ADTYPE array User Workspace
14: cpuser – Type(c_ptr) User Workspace
15: 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 Section 4.8.2 in the NAG AD Library Introduction for further information.
ifail=-199
The routine was called using a mode that has not yet been implemented.
ifail=-443
On entry: ad_handle is nullptr.
This check is only made if the overloaded C++ interface is used with arguments not of type double.
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 Section 4.8.1 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.