NAG AD Library
e04uc_a1w_f (nlp1_solve_a1w)

Note: a1w denotes that first order adjoints are computed in working precision; this has the corresponding argument type nagad_a1w_w_rtype. Also available is the t1w (first order tangent linear) mode, the interface of which is implied by replacing a1w by t1w throughout this document. Additionally, the p0w (passive interface, as alternative to the FL interface) mode is available and can be inferred by replacing of active types by the corresponding passive types. The method of codifying AD implementations in the routine name and corresponding argument types is described in the NAG AD Library Introduction.
Settings help

AD Name Style:


AD Specification Language:

1 Purpose

e04uc_a1w_f is the adjoint version of the primal routine e04ucf.

2 Specification

Fortran Interface
Subroutine e04uc_a1w_f ( ad_handle, n, nclin, ncnln, lda, ldcj, ldr, a, bl, bu, confun, objfun, iter, istate, c, cjac, clamda, objf, objgrd, r, x, iwork, liwork, work, lwork, lwsav, iwsav, rwsav, iuser, ruser, ifail)
Integer, Intent (In) :: n, nclin, ncnln, lda, ldcj, ldr, liwork, lwork
Integer, Intent (Inout) :: istate(n+nclin+ncnln), iuser(*), iwsav(610), ifail
Integer, Intent (Out) :: iter, iwork(liwork)
Type (nagad_a1w_w_rtype), Intent (In) :: a(lda,*), bl(n+nclin+ncnln), bu(n+nclin+ncnln)
Type (nagad_a1w_w_rtype), Intent (Inout) :: cjac(ldcj,*), clamda(n+nclin+ncnln), r(ldr,n), x(n), ruser(*), rwsav(475)
Type (nagad_a1w_w_rtype), Intent (Out) :: c(max(1,ncnln)), objf, objgrd(n), work(lwork)
Logical, Intent (Inout) :: lwsav(120)
Type (c_ptr), Intent (Inout) :: ad_handle
External :: confun, objfun
C++ Header Interface
#include <nagad.h>
void e04uc_a1w_f_ ( void *&ad_handle, const Integer &n, const Integer &nclin, const Integer &ncnln, const Integer &lda, const Integer &ldcj, const Integer &ldr, const nagad_a1w_w_rtype a[], const nagad_a1w_w_rtype bl[], const nagad_a1w_w_rtype bu[],
void (NAG_CALL confun)(void *&ad_handle, Integer &mode, const Integer &ncnln, const Integer &n, const Integer &ldcj, const Integer needc[], const nagad_a1w_w_rtype x[], nagad_a1w_w_rtype c[], nagad_a1w_w_rtype cjac[], const Integer &nstate, Integer iuser[], nagad_a1w_w_rtype ruser[]),
void (NAG_CALL objfun)(void *&ad_handle, Integer &mode, const Integer &n, const nagad_a1w_w_rtype x[], nagad_a1w_w_rtype &objf, nagad_a1w_w_rtype objgrd[], const Integer &nstate, Integer iuser[], nagad_a1w_w_rtype ruser[]),
Integer &iter, Integer istate[], nagad_a1w_w_rtype c[], nagad_a1w_w_rtype cjac[], nagad_a1w_w_rtype clamda[], nagad_a1w_w_rtype &objf, nagad_a1w_w_rtype objgrd[], nagad_a1w_w_rtype r[], nagad_a1w_w_rtype x[], Integer iwork[], const Integer &liwork, nagad_a1w_w_rtype work[], const Integer &lwork, logical lwsav[], Integer iwsav[], nagad_a1w_w_rtype rwsav[], Integer iuser[], nagad_a1w_w_rtype ruser[], Integer &ifail)
The routine may be called by the names e04uc_a1w_f or nagf_opt_nlp1_solve_a1w. The corresponding t1w and p0w variants of this routine are also available.

3 Description

e04uc_a1w_f is the adjoint version of the primal routine e04ucf.
e04ucf is designed to minimize an arbitrary smooth function subject to constraints (which may include simple bounds on the variables, linear constraints and smooth nonlinear constraints) using a Sequential Quadratic Programming (SQP) method. As many first derivatives as possible should be supplied by you; any unspecified derivatives are approximated by finite differences. It is not intended for large sparse problems.
e04ucf may also be used for unconstrained, bound-constrained and linearly constrained optimization.
e04ucf uses forward communication for evaluating the objective function, the nonlinear constraint functions, and any of their derivatives. For further information see Section 3 in the documentation for e04ucf.

4 References

Dennis J E Jr and Moré J J (1977) Quasi-Newton methods, motivation and theory SIAM Rev. 19 46–89
Dennis J E Jr and Schnabel R B (1981) A new derivation of symmetric positive-definite secant updates nonlinear programming (eds O L Mangasarian, R R Meyer and S M Robinson) 4 167–199 Academic Press
Dennis J E Jr and Schnabel R B (1983) Numerical Methods for Unconstrained Optimization and Nonlinear Equations Prentice–Hall
Fletcher R (1987) Practical Methods of Optimization (2nd Edition) Wiley
Gill P E, Hammarling S, Murray W, Saunders M A and Wright M H (1986) Users' guide for LSSOL (Version 1.0) Report SOL 86-1 Department of Operations Research, Stanford University
Gill P E, Murray W, Saunders M A and Wright M H (1984a) Procedures for optimization problems with a mixture of bounds and general linear constraints ACM Trans. Math. Software 10 282–298
Gill P E, Murray W, Saunders M A and Wright M H (1984b) Users' guide for SOL/QPSOL version 3.2 Report SOL 84–5 Department of Operations Research, Stanford University
Gill P E, Murray W, Saunders M A and Wright M H (1986a) Some theoretical properties of an augmented Lagrangian merit function Report SOL 86–6R Department of Operations Research, Stanford University
Gill P E, Murray W, Saunders M A and Wright M H (1986b) Users' guide for NPSOL (Version 4.0): a Fortran package for nonlinear programming Report SOL 86-2 Department of Operations Research, Stanford University
Gill P E, Murray W and Wright M H (1981) Practical Optimization Academic Press
Hock W and Schittkowski K (1981) Test Examples for Nonlinear Programming Codes. Lecture Notes in Economics and Mathematical Systems 187 Springer–Verlag
Powell M J D (1974) Introduction to constrained optimization Numerical Methods for Constrained Optimization (eds P E Gill and W Murray) 1–28 Academic Press
Powell M J D (1983) Variable metric methods in constrained optimization Mathematical Programming: the State of the Art (eds A Bachem, M Grötschel and B Korte) 288–311 Springer–Verlag

5 Arguments

In addition to the arguments present in the interface of the primal routine, e04uc_a1w_f 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 – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object, as created by x10aa_a1w_f.
2: n – Integer Input
3: nclin – Integer Input
4: ncnln – Integer Input
5: lda – Integer Input
6: ldcj – Integer Input
7: ldr – Integer Input
8: a(lda, *) – Type (nagad_a1w_w_rtype) array Input
9: bl(n+nclin+ncnln) – Type (nagad_a1w_w_rtype) array Input
10: bu(n+nclin+ncnln) – Type (nagad_a1w_w_rtype) array Input
11: confun – Subroutine External Procedure
The specification of confun is:
Fortran Interface
Subroutine confun ( ad_handle, mode, ncnln, n, ldcj, needc, x, c, cjac, nstate, iuser, ruser)
Integer, Intent (In) :: ncnln, n, ldcj, needc(ncnln), nstate
Integer, Intent (Inout) :: mode, iuser(*)
Type (nagad_a1w_w_rtype), Intent (In) :: x(n)
Type (nagad_a1w_w_rtype), Intent (Inout) :: cjac(ldcj,n), ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out) :: c(ncnln)
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Header Interface
#include <nagad.h>
void confun ( void *&ad_handle, Integer &mode, const Integer &ncnln, const Integer &n, const Integer &ldcj, const Integer needc[], const nagad_a1w_w_rtype x[], nagad_a1w_w_rtype c[], nagad_a1w_w_rtype cjac[], const Integer &nstate, Integer iuser[], nagad_a1w_w_rtype ruser[])
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object.
2: mode – Integer Input/Output
3: ncnln – Integer Input
4: n – Integer Input
5: ldcj – Integer Input
6: needc – Integer array Input
7: xType (nagad_a1w_w_rtype) array Input
8: cType (nagad_a1w_w_rtype) array Output
9: cjacType (nagad_a1w_w_rtype) array Input/Output
10: nstate – Integer Input
11: iuser – Integer array User Workspace
12: ruserType (nagad_a1w_w_rtype) array User Workspace
12: objfun – Subroutine External Procedure
The specification of objfun is:
Fortran Interface
Subroutine objfun ( ad_handle, mode, n, x, objf, objgrd, nstate, iuser, ruser)
Integer, Intent (In) :: n, nstate
Integer, Intent (Inout) :: mode, iuser(*)
Type (nagad_a1w_w_rtype), Intent (In) :: x(n)
Type (nagad_a1w_w_rtype), Intent (Inout) :: objgrd(n), ruser(*)
Type (nagad_a1w_w_rtype), Intent (Out) :: objf
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Header Interface
#include <nagad.h>
void objfun ( void *&ad_handle, Integer &mode, const Integer &n, const nagad_a1w_w_rtype x[], nagad_a1w_w_rtype &objf, nagad_a1w_w_rtype objgrd[], const Integer &nstate, Integer iuser[], nagad_a1w_w_rtype ruser[])
1: ad_handle – Type (c_ptr) Input/Output
On entry: a handle to the AD configuration data object.
2: mode – Integer Input/Output
3: n – Integer Input
4: xType (nagad_a1w_w_rtype) array Input
5: objfType (nagad_a1w_w_rtype) Output
6: objgrdType (nagad_a1w_w_rtype) array Input/Output
7: nstate – Integer Input
8: iuser – Integer array User Workspace
9: ruserType (nagad_a1w_w_rtype) array User Workspace
13: iter – Integer Output
14: istate(n+nclin+ncnln) – Integer array Input/Output
15: c(max(1,ncnln)) – Type (nagad_a1w_w_rtype) array Output
16: cjac(ldcj, *) – Type (nagad_a1w_w_rtype) array Input/Output
17: clamda(n+nclin+ncnln) – Type (nagad_a1w_w_rtype) array Input/Output
18: objfType (nagad_a1w_w_rtype) Output
19: objgrd(n) – Type (nagad_a1w_w_rtype) array Output
20: r(ldr, n) – Type (nagad_a1w_w_rtype) array Input/Output
21: x(n) – Type (nagad_a1w_w_rtype) array Input/Output
22: iwork(liwork) – Integer array Workspace
23: liwork – Integer Input
24: work(lwork) – Type (nagad_a1w_w_rtype) array Workspace
25: lwork – Integer Input
26: lwsav(120) – logical array Communication Array
The arrays lwsav, iwsav and rwsav must not be altered between calls to any of the routines routine, routine or routine.
27: iwsav(610) – Integer array Communication Array
The arrays lwsav, iwsav and rwsav must not be altered between calls to any of the routines routine, routine or routine.
28: rwsav(475) – Type (nagad_a1w_w_rtype) array Communication Array
The arrays lwsav, iwsav and rwsav must not be altered between calls to any of the routines routine, routine or routine.
29: iuser(*) – Integer array User Workspace
30: ruser(*) – Type (nagad_a1w_w_rtype) array User Workspace
31: ifail – Integer Input/Output

6 Error Indicators and Warnings

e04uc_a1w_f preserves all error codes from e04ucf 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=-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

e04uc_a1w_f is not threaded in any implementation.

9 Further Comments

None.

10 Example

The following examples are variants of the example for e04ucf, modified to demonstrate calling the NAG AD Library.

10.1 Adjoint mode (a1w)

LanguageSource FileDataResults
Fortrane04uc_a1w_fe.f90e04uc_a1w_fe.de04uc_a1w_fe.r
C++e04uc_a1w_hcppe.cppe04uc_a1w_hcppe.de04uc_a1w_hcppe.r

10.2 Tangent mode (t1w)

LanguageSource FileDataResults
Fortrane04uc_t1w_fe.f90e04uc_t1w_fe.de04uc_t1w_fe.r
C++e04uc_t1w_hcppe.cppe04uc_t1w_hcppe.de04uc_t1w_hcppe.r

10.3 Passive mode (p0w)

LanguageSource FileDataResults
Fortrane04uc_p0w_fe.f90e04uc_p0w_fe.de04uc_p0w_fe.r
C++e04uc_p0w_hcppe.cppe04uc_p0w_hcppe.de04uc_p0w_hcppe.r