NAG CPP Interfacenagcpp::opt::handle_set_nlnconstr (e04rk)

Settings help

CPP Name Style:

1Purpose

handle_set_nlnconstr is a part of the NAG optimization modelling suite and defines or overwrites nonlinear constraints in the model, their number as well as the sparsity structure of their first derivatives.

2Specification

#include "e04/nagcpp_e04rk.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
template <typename COMM, typename BL, typename BU, typename IROWGD, typename ICOLGD>

void function handle_set_nlnconstr(COMM &comm, const BL &bl, const BU &bu, const IROWGD &irowgd, const ICOLGD &icolgd, OptionalE04RK opt)
template <typename COMM, typename BL, typename BU, typename IROWGD, typename ICOLGD>

void function handle_set_nlnconstr(COMM &comm, const BL &bl, const BU &bu, const IROWGD &irowgd, const ICOLGD &icolgd)

3Description

After the handle has been initialized (e.g., handle_​init has been called), handle_set_nlnconstr may be used to define the nonlinear constraints ${l}_{g}\le g\left(x\right)\le {u}_{g}$ of the problem. If the nonlinear constraints have already been defined, they will be overwritten and their Hessians (or the Hessian of the Lagrangian) will be removed. If handle_set_nlnconstr is called with ${m}_{g}=0$, existing nonlinear constraints are removed and no new ones are added. This 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)
where $n$ is the number of the decision variables $x$, ${m}_{g}$ is the number of the nonlinear constraints (in (1)(b)) and $g\left(x\right)$, ${l}_{g}$ and ${u}_{g}$ are ${m}_{g}$-dimensional vectors.
Note that upper and lower bounds are specified for all the constraints. This form allows full generality in specifying various types of constraint. In particular, the $j$th constraint may be defined as an equality by setting ${l}_{j}={u}_{j}$. If certain bounds are not present, the associated elements ${l}_{j}$ or ${u}_{j}$ may be set to special values that are treated as $-\infty$ or $+\infty$. See the description of the optional parameter Infinite Bound Size which is common among all solvers in the suite. Its value is denoted as $\mathit{bigbnd}$ further in this text. Note that the bounds are interpreted based on its value at the time of calling this function and any later alterations to Infinite Bound Size will not affect these constraints.
Since each nonlinear constraint is most likely to involve a small subset of the decision variables, the partial derivatives of the constraint functions with respect to those variables are best expressed as a sparse Jacobian matrix of ${m}_{g}$ rows and $n$ columns. The row and column positions of all the nonzero derivatives must be registered with the handle through handle_set_nlnconstr. The values of the nonlinear constraint functions and their nonzero gradients at particular points in the decision variable space will be communicated to the NLP solver by user-supplied functions (e.g., confun and congrd for handle_​solve_​ipopt).
An individual set of bounds can be also modified by e04tdf (no CPP interface). Note that it is also possible to temporarily disable and enable individual constraints in the model by calling e04tcf (no CPP interface) and e04tbf (no CPP interface), respectively.
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{bl}\left({\mathbf{ncnln}}\right)$double array Input
On entry: bl and bu define lower and upper bounds of the nonlinear constraints, ${l}_{g}$ and ${u}_{g}$, respectively. To define the $j$th constraint as equality, set ${\mathbf{bl}}\left(j-1\right)={\mathbf{bu}}\left(j-1\right)=\beta$, where $|\beta |<\mathit{bigbnd}$. To specify a nonexistent lower bound (i.e., ${l}_{j}=-\infty$), set ${\mathbf{bl}}\left(j-1\right)\le -\mathit{bigbnd}$; to specify a nonexistent upper bound, set ${\mathbf{bu}}\left(j-1\right)\ge \mathit{bigbnd}$.
Constraints:
• ${\mathbf{bl}}\left(\mathit{j}-1\right)\le {\mathbf{bu}}\left(\mathit{j}-1\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{ncnln}}$;
• ${\mathbf{bl}}\left(\mathit{j}-1\right)<\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{ncnln}}$;
• ${\mathbf{bu}}\left(\mathit{j}-1\right)>-\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{ncnln}}$.
3: $\mathbf{bu}\left({\mathbf{ncnln}}\right)$double array Input
On entry: bl and bu define lower and upper bounds of the nonlinear constraints, ${l}_{g}$ and ${u}_{g}$, respectively. To define the $j$th constraint as equality, set ${\mathbf{bl}}\left(j-1\right)={\mathbf{bu}}\left(j-1\right)=\beta$, where $|\beta |<\mathit{bigbnd}$. To specify a nonexistent lower bound (i.e., ${l}_{j}=-\infty$), set ${\mathbf{bl}}\left(j-1\right)\le -\mathit{bigbnd}$; to specify a nonexistent upper bound, set ${\mathbf{bu}}\left(j-1\right)\ge \mathit{bigbnd}$.
Constraints:
• ${\mathbf{bl}}\left(\mathit{j}-1\right)\le {\mathbf{bu}}\left(\mathit{j}-1\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{ncnln}}$;
• ${\mathbf{bl}}\left(\mathit{j}-1\right)<\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{ncnln}}$;
• ${\mathbf{bu}}\left(\mathit{j}-1\right)>-\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{ncnln}}$.
4: $\mathbf{irowgd}\left({\mathbf{nnzgd}}\right)$types::f77_integer array Input
On entry: arrays irowgd and icolgd store the sparsity structure (pattern) of the Jacobian matrix as nnzgd nonzeros in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix has dimensions ${\mathbf{ncnln}}×n$. irowgd specifies one-based row indices and icolgd specifies one-based column indices. No particular order of elements is expected, but elements should not repeat and the same order should be used when the Jacobian is evaluated for the solver, e.g., the value of $\frac{\partial {g}_{i}}{\partial {x}_{j}}$ where $i={\mathbf{irowgd}}\left(l-1\right)$ and $j={\mathbf{icolgd}}\left(\mathit{l}-1\right)$ should be stored in ${\mathbf{gdx}}\left(\mathit{l}-1\right)$ in congrd in handle_​solve_​ipopt, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzgd}}$.
Constraints:
• $1\le {\mathbf{irowgd}}\left(\mathit{l}-1\right)\le {\mathbf{ncnln}}$, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzgd}}$;
• $1\le {\mathbf{icolgd}}\left(\mathit{l}-1\right)\le n$, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzgd}}$.
5: $\mathbf{icolgd}\left({\mathbf{nnzgd}}\right)$types::f77_integer array Input
On entry: arrays irowgd and icolgd store the sparsity structure (pattern) of the Jacobian matrix as nnzgd nonzeros in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). The matrix has dimensions ${\mathbf{ncnln}}×n$. irowgd specifies one-based row indices and icolgd specifies one-based column indices. No particular order of elements is expected, but elements should not repeat and the same order should be used when the Jacobian is evaluated for the solver, e.g., the value of $\frac{\partial {g}_{i}}{\partial {x}_{j}}$ where $i={\mathbf{irowgd}}\left(l-1\right)$ and $j={\mathbf{icolgd}}\left(\mathit{l}-1\right)$ should be stored in ${\mathbf{gdx}}\left(\mathit{l}-1\right)$ in congrd in handle_​solve_​ipopt, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzgd}}$.
Constraints:
• $1\le {\mathbf{irowgd}}\left(\mathit{l}-1\right)\le {\mathbf{ncnln}}$, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzgd}}$;
• $1\le {\mathbf{icolgd}}\left(\mathit{l}-1\right)\le n$, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzgd}}$.
6: $\mathbf{opt}$OptionalE04RK Input/Output
Optional parameter container, derived from Optional.

1: $\mathbf{ncnln}$
${m}_{g}$, the number of nonlinear constraints (number of rows of the Jacobian matrix).
2: $\mathbf{nnzgd}$
nnzgd gives the number of nonzeros in the Jacobian matrix.

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{nnzgd}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{nnzgd}}>0$.
$\mathbf{errorid}=6$
On entry, ${\mathbf{ncnln}}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{ncnln}}\ge 0$.
$\mathbf{errorid}=8$
On entry, $i=⟨\mathit{value}⟩$, ${\mathbf{irowgd}}\left[i-1\right]=⟨\mathit{value}⟩$ and
${\mathbf{ncnln}}=⟨\mathit{value}⟩$.
Constraint: $1\le {\mathbf{irowgd}}\left[i-1\right]\le {\mathbf{ncnln}}$.
$\mathbf{errorid}=8$
On entry, $i=⟨\mathit{value}⟩$, ${\mathbf{icolgd}}\left[i-1\right]=⟨\mathit{value}⟩$ and
$n=⟨\mathit{value}⟩$.
Constraint: $1\le {\mathbf{icolgd}}\left[i-1\right]\le n$.
$\mathbf{errorid}=8$
On entry, more than one element of structural Jacobian matrix has row index
$⟨\mathit{\text{value}}⟩$ and column index $⟨\mathit{\text{value}}⟩$.
Constraint: each element of structural Jacobian matrix must have a unique
row and column index.
$\mathbf{errorid}=10$
On entry, $j=⟨\mathit{value}⟩$, ${\mathbf{bl}}\left[j-1\right]=⟨\mathit{value}⟩$ and
${\mathbf{bu}}\left[j-1\right]=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{bl}}\left[j-1\right]\le {\mathbf{bu}}\left[j-1\right]$.
$\mathbf{errorid}=10$
On entry, $j=⟨\mathit{value}⟩$, ${\mathbf{bl}}\left[j-1\right]=⟨\mathit{value}⟩$,
$\mathit{bigbnd}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{bl}}\left[j-1\right]<\mathit{bigbnd}$.
$\mathbf{errorid}=10$
On entry, $j=⟨\mathit{value}⟩$, ${\mathbf{bu}}\left[j-1\right]=⟨\mathit{value}⟩$,
$\mathit{bigbnd}=⟨\mathit{value}⟩$.
Constraint: ${\mathbf{bu}}\left[j-1\right]>-\mathit{bigbnd}$.
$\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.