E04RKF (PDF version)
E04 Chapter Contents
E04 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentE04RKF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

E04RKF is a part of the NAG optimization modelling suite and defines the number of nonlinear constraints of the problem as well as the sparsity structure of their first derivatives.

## 2  Specification

 SUBROUTINE E04RKF ( HANDLE, NCNLN, BL, BU, NNZGD, IROWGD, ICOLGD, IFAIL)
 INTEGER NCNLN, NNZGD, IROWGD(NNZGD), ICOLGD(NNZGD), IFAIL REAL (KIND=nag_wp) BL(NCNLN), BU(NCNLN) TYPE (C_PTR) HANDLE

## 3  Description

After the initialization routine E04RAF has been called, E04RKF may be used to define the nonlinear constraints ${l}_{g}\le g\left(x\right)\le {u}_{g}$ of the problem unless the nonlinear constraints have already been defined. This will typically be used for nonlinear programming problems (NLP) of the kind:
 $minimize x∈ℝn fx (a) subject to lg≤gx≤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. Linear constraints ((1)(c)), which require no separate gradient information, can be introduced by E04RJF and Box constraints ((1)(d)) can be introduced by E04RHF.
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 of the solver E04STF. 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 routine 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 E04RKF.
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 E04STF).
See E04RAF for more details.

None.

## 5  Arguments

1:     $\mathrm{HANDLE}$ – TYPE (C_PTR)Input
On entry: the handle to the problem. It needs to be initialized by E04RAF and must not be changed.
2:     $\mathrm{NCNLN}$ – INTEGERInput
On entry: ${m}_{g}$, the number of nonlinear constraints (number of rows of the Jacobian matrix).
If ${\mathbf{NCNLN}}=0$, no nonlinear constraints will be defined and BL, BU, NNZGD, IROWGD and ICOLGD will not be referenced.
Constraint: ${\mathbf{NCNLN}}\ge 0$.
3:     $\mathrm{BL}\left({\mathbf{NCNLN}}\right)$ – REAL (KIND=nag_wp) arrayInput
4:     $\mathrm{BU}\left({\mathbf{NCNLN}}\right)$ – REAL (KIND=nag_wp) arrayInput
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\right)={\mathbf{BU}}\left(j\right)=\beta$, where $\left|\beta \right|<\mathit{bigbnd}$. To specify a nonexistent lower bound (i.e., ${l}_{j}=-\infty$), set ${\mathbf{BL}}\left(j\right)\le -\mathit{bigbnd}$; to specify a nonexistent upper bound, set ${\mathbf{BU}}\left(j\right)\ge \mathit{bigbnd}$.
Constraints:
• ${\mathbf{BL}}\left(\mathit{j}\right)\le {\mathbf{BU}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{NCNLN}}$;
• ${\mathbf{BL}}\left(\mathit{j}\right)<\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{NCNLN}}$;
• ${\mathbf{BU}}\left(\mathit{j}\right)>-\mathit{bigbnd}$, for $\mathit{j}=1,2,\dots ,{\mathbf{NCNLN}}$.
5:     $\mathrm{NNZGD}$ – INTEGERInput
On entry: NNZGD gives the number of nonzeros in the Jacobian matrix.
Constraint: if ${\mathbf{NCNLN}}>0$, ${\mathbf{NNZGD}}>0$.
6:     $\mathrm{IROWGD}\left({\mathbf{NNZGD}}\right)$ – INTEGER arrayInput
7:     $\mathrm{ICOLGD}\left({\mathbf{NNZGD}}\right)$ – INTEGER arrayInput
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\right)$ and $j={\mathbf{ICOLGD}}\left(\mathit{l}\right)$ should be stored in ${\mathbf{GDX}}\left(\mathit{l}\right)$, for $\mathit{l}=1,2,\dots ,{\mathbf{NNZGD}}$.
Constraints:
• $1\le {\mathbf{IROWGD}}\left(\mathit{l}\right)\le {\mathbf{NCNLN}}$, for $\mathit{l}=1,2,\dots ,{\mathbf{NNZGD}}$;
• $1\le {\mathbf{ICOLGD}}\left(\mathit{l}\right)\le n$, for $\mathit{l}=1,2,\dots ,{\mathbf{NNZGD}}$.
8:     $\mathrm{IFAIL}$ – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, the recommended value is $-1$. When the value $-\mathbf{1}\text{​ or ​}1$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
The supplied HANDLE does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been initialized by E04RAF or it has been corrupted.
${\mathbf{IFAIL}}=2$
The Hessian of the nonlinear objective has already been defined, nonlinear constraints cannot be added.
The problem cannot be modified in this phase any more, the solver has already been called.
${\mathbf{IFAIL}}=3$
A set of nonlinear constraints has already been defined.
${\mathbf{IFAIL}}=6$
On entry, ${\mathbf{NCNLN}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{NCNLN}}\ge 0$.
On entry, ${\mathbf{NNZGD}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{NNZGD}}>0$.
${\mathbf{IFAIL}}=8$
On entry, $i=〈\mathit{\text{value}}〉$, ${\mathbf{ICOLGD}}\left(\mathit{i}\right)=〈\mathit{\text{value}}〉$ and $n=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{ICOLGD}}\left(\mathit{i}\right)\le n$.
On entry, $i=〈\mathit{\text{value}}〉$, ${\mathbf{IROWGD}}\left(\mathit{i}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{NCNLN}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{IROWGD}}\left(\mathit{i}\right)\le {\mathbf{NCNLN}}$.
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{IFAIL}}=10$
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{BL}}\left(j\right)=〈\mathit{\text{value}}〉$, $\mathit{bigbnd}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{BL}}\left(j\right)<\mathit{bigbnd}$.
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{BL}}\left(j\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{BU}}\left(j\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{BL}}\left(j\right)\le {\mathbf{BU}}\left(j\right)$.
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{BU}}\left(j\right)=〈\mathit{\text{value}}〉$, $\mathit{bigbnd}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{BU}}\left(j\right)>-\mathit{bigbnd}$.
${\mathbf{IFAIL}}=-99$
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{IFAIL}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{IFAIL}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

## 8  Parallelism and Performance

E04RKF is not threaded in any implementation.

## 9  Further Comments

### 9.1  Additional Licensor

Parts of the code for E04STF are distributed according to terms imposed by another licensor. Please refer to Library Licensors for further details.

## 10  Example

See Section 10 in E04STF.

E04RKF (PDF version)
E04 Chapter Contents
E04 Chapter Introduction
NAG Library Manual