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

Settings help

CPP Name Style:

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 handle has been initialized (e.g., handle_​init has been called), 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. If the objective function has already been defined, it will be overwritten and its Hessian (or the Hessian of the Lagrangian) will be removed. If handle_set_nlnobj is called with no nonzeroes in the sparsity pattern, any existing objective function is removed, no new one is added and the problem will be solved as a feasible point problem.
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$ is the current number of decision variables in the model.
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 right now, the solver is running.
$\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.