NAG AD Library
e05jb (bnd_mcs_solve)

Settings help

AD Name Style:


AD Specification Language:

1 Purpose

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

2 Specification

Fortran Interface
Subroutine e05jb_AD_f ( ad_handle, n, objfun, ibound, iinit, bl, bu, sdlist, list, numpts, initpt, monit, x, obj, comm, lcomm, iuser, ruser, ifail)
Integer, Intent (In) :: n, ibound, iinit, sdlist, lcomm
Integer, Intent (Inout) :: numpts(n), initpt(n), iuser(*), ifail
ADTYPE, Intent (Inout) :: bl(n), bu(n), list(n,sdlist), comm(lcomm), ruser(*)
ADTYPE, Intent (Out) :: x(n), obj
Type (c_ptr), Intent (Inout) :: ad_handle
External :: objfun, 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 MONIT_T>
void e05jb ( handle_t &ad_handle, const Integer &n, OBJFUN_T &&objfun, const Integer &ibound, const Integer &iinit, ADTYPE bl[], ADTYPE bu[], const Integer &sdlist, ADTYPE list[], Integer numpts[], Integer initpt[], MONIT_T &&monit, ADTYPE x[], ADTYPE &obj, ADTYPE comm[], const Integer &lcomm, 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

e05jb is the AD Library version of the primal routine e05jbf.
e05jbf is designed to find the global minimum or maximum of an arbitrary function, subject to simple bound-constraints using a multi-level coordinate search method. Derivatives are not required, but convergence is only guaranteed if the objective function is continuous in a neighbourhood of a global optimum. It is not intended for large problems.
The initialization routine e05jaf must have been called before calling e05jbf. For further information see Section 3 in the documentation for e05jbf.

4 References

Huyer W and Neumaier A (1999) Global optimization by multi-level coordinate search Journal of Global Optimization 14 331–355

5 Arguments

In addition to the arguments present in the interface of the primal routine, e05jb 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: n – Integer 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.
The specification of objfun is:
Fortran Interface
Subroutine objfun ( ad_handle, n, x, f, nstate, iuser, ruser, inform)
Integer, Intent (In) :: n, nstate
Integer, Intent (Inout) :: iuser(*)
Integer, Intent (Out) :: inform
ADTYPE, Intent (In) :: x(n)
ADTYPE, Intent (Inout) :: ruser(*)
ADTYPE, Intent (Out) :: f
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Interface
auto objfun = [&]( const handle_t &ad_handle, const Integer &n, const ADTYPE x[], ADTYPE &f, const Integer &nstate, Integer &inform)
1: ad_handlenag::ad::handle_t Input/Output
On entry: a handle to the AD handle object.
2: n – Integer Input
3: xADTYPE array Input
4: fADTYPE Output
5: nstate – Integer Input
*: iuser – Integer array User Workspace
*: ruserADTYPE array User Workspace
6: inform – Integer Output
4: ibound – Integer Input
5: iinit – Integer Input
6: bl(n) – ADTYPE array Input/Output
Please consult Overwriting of Inputs in the NAG AD Library Introduction.
7: bu(n) – ADTYPE array Input/Output
Please consult Overwriting of Inputs in the NAG AD Library Introduction.
8: sdlist – Integer Input
9: list(n, sdlist) – ADTYPE array Input/Output
Please consult Overwriting of Inputs in the NAG AD Library Introduction.
10: numpts(n) – Integer array Input/Output
11: initpt(n) – Integer array Input/Output
12: 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 e05jb_AD_k may be used as the actual argument for this parameter.
The specification of monit is:
Fortran Interface
Integer, Intent (In) :: n, ncall, icount(6), ninit, numpts(n), initpt(n), nbaskt, nstate
Integer, Intent (Inout) :: iuser(*)
Integer, Intent (Out) :: inform
ADTYPE, Intent (In) :: xbest(n), list(n,ninit), xbaskt(n,nbaskt), boxl(n), boxu(n)
ADTYPE, Intent (Inout) :: ruser(*)
Type (c_ptr), Intent (Inout) :: ad_handle
C++ Interface
auto monit = [&]( const handle_t &ad_handle, const Integer &n, const Integer &ncall, const ADTYPE xbest[], const Integer icount[], const Integer &ninit, const ADTYPE list[], const Integer numpts[], const Integer initpt[], const Integer &nbaskt, const ADTYPE xbaskt[], const ADTYPE boxl[], const ADTYPE boxu[], const Integer &nstate, Integer &inform)
1: ad_handlenag::ad::handle_t Input/Output
On entry: a handle to the AD handle object.
2: n – Integer Input
3: ncall – Integer Input
4: xbestADTYPE array Input
5: icount – Integer array Input
6: ninit – Integer Input
7: listADTYPE array Input
8: numpts – Integer array Input
9: initpt – Integer array Input
10: nbaskt – Integer Input
11: xbasktADTYPE array Input
12: boxlADTYPE array Input
13: boxuADTYPE array Input
14: nstate – Integer Input
*: iuser – Integer array User Workspace
*: ruserADTYPE array User Workspace
15: inform – Integer Output
13: x(n) – ADTYPE array Output
14: objADTYPE Output
15: comm(lcomm) – ADTYPE array Communication Array
Please consult Overwriting of Inputs in the NAG AD Library Introduction.
16: lcomm – Integer Input
*: iuser(*) – Integer array User Workspace
*: ruser(*) – ADTYPE array User Workspace
Please consult Overwriting of Inputs in the NAG AD Library Introduction.
17: ifail – Integer Input/Output

6 Error Indicators and Warnings

e05jb preserves all error codes from e05jbf 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

e05jb 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.