NAG CPP Interfacenagcpp::opt::handle_set_nlnobj (e04rg)

1Purpose

handle_set_nlnobj is a part of the NAG optimization modelling suite and declares the objective function of the problem as a nonlinear function with a particular gradient sparsity structure.

2Specification

```#include "e04/nagcpp_e04rg.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
```
```template <typename COMM, typename IDXFD>

void function handle_set_nlnobj(COMM &comm, const IDXFD &idxfd, OptionalE04RG opt)```
```template <typename COMM, typename IDXFD>

void function handle_set_nlnobj(COMM &comm, const IDXFD &idxfd)```

3Description

After the initialization function handle_​init has been called (and unless the objective function has already been defined), handle_set_nlnobj may be used to declare the objective function of the problem as a nonlinear function and define the sparsity pattern (list of nonzero elements) of its gradient. This objective function will typically be used for nonlinear programming problems (NLP) of the kind:
 $minimize x∈ℝn f(x) (a) subject to lg≤g(x)≤ug, (b) lB≤Bx≤uB. (c) lx≤x≤ux (d)$ (1)
The values of the nonlinear objective function $f\left(x\right)$ and the nonzero values of its gradient $\frac{\partial f}{\partial {x}_{i}}$ (matching the sparsity pattern) evaluated at particular points in the decision variable space will be communicated to the NLP solver by user-supplied functions (e.g., objfun and objgrd for handle_​solve_​ipopt). See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

None.

5Arguments

1: $\mathbf{comm}$CommE04RA Input/Output
Communication structure. An object of either the derived class CommE04RA or its base class NoneCopyableComm can be supplied. It is recommended that the derived class is used. If the base class is supplied it must first be initialized via a call to opt::handle_init (e04ra).
2: $\mathbf{idxfd}\left({\mathbf{nnzfd}}\right)$types::f77_integer array Input
On entry: the one-based indices of the nonzero elements of the sparse gradient vector. The indices must be stored in ascending order. Note that $n$, the number of decision variables in the problem, was set in nvar during the initialization of the handle by handle_​init.
If ${\mathbf{nnzfd}}=0$, the objective is assumed to be zero and the array idxfd will not be referenced.
Constraints:
• $1\le {\mathbf{idxfd}}\left(\mathit{i}-1\right)\le n$, for $\mathit{i}=1,2,\dots ,{\mathbf{nnzfd}}$;
• ${\mathbf{idxfd}}\left(\mathit{i}-1\right)<{\mathbf{idxfd}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{nnzfd}}-1$.
3: $\mathbf{opt}$OptionalE04RG Input/Output
Optional parameter container, derived from Optional.

1: $\mathbf{nnzfd}$
The number of nonzero elements in the sparse gradient vector of the objective function.

6Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
$\mathbf{errorid}=1$
comm::handle has not been initialized.
$\mathbf{errorid}=1$
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
$\mathbf{errorid}=1$
comm::handle has not been initialized properly or is corrupted.
$\mathbf{errorid}=2$
The problem cannot be modified in this phase any more, the solver
$\mathbf{errorid}=2$
The Hessians of nonlinear functions have already been defined,
a nonlinear objective cannot be added.
$\mathbf{errorid}=3$
The objective function has already been defined.
$\mathbf{errorid}=6$
On entry, ${\mathbf{nnzfd}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{nnzfd}}\ge 0$.
$\mathbf{errorid}=7$
On entry, $i=⟨\mathit{value}⟩$, ${\mathbf{idxfd}}\left[i-1\right]=⟨\mathit{value}⟩$ and
${\mathbf{idxfd}}\left[i+0\right]=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{idxfd}}\left[i-1\right]<{\mathbf{idxfd}}\left[i+0\right]$ (ascending order).
$\mathbf{errorid}=7$
On entry, $i=⟨\mathit{value}⟩$, ${\mathbf{idxfd}}\left[i-1\right]=⟨\mathit{value}⟩$ and
$n=⟨\mathit{value}⟩$.
Constraint: $1\le {\mathbf{idxfd}}\left[i-1\right]\le n$.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
Supplied argument has $⟨\mathit{\text{value}}⟩$ dimensions.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
Supplied argument was a vector of size $⟨\mathit{\text{value}}⟩$.
$\mathbf{errorid}=10601$
On entry, argument $⟨\mathit{\text{value}}⟩$ must be a vector of size $⟨\mathit{\text{value}}⟩$ array.
The size for the supplied array could not be ascertained.
$\mathbf{errorid}=10602$
On entry, the raw data component of $⟨\mathit{\text{value}}⟩$ is null.
$\mathbf{errorid}=10603$
On entry, unable to ascertain a value for $⟨\mathit{\text{value}}⟩$.
$\mathbf{errorid}=10605$
On entry, the communication class $⟨\mathit{\text{value}}⟩$ has not been initialized correctly.
$\mathbf{errorid}=-99$
An unexpected error has been triggered by this routine.
$\mathbf{errorid}=-399$
Your licence key may have expired or may not have been installed correctly.
$\mathbf{errorid}=-999$
Dynamic memory allocation failed.

Not applicable.

8Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.