NAG Library Routine Document

1Purpose

e04rgf 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

Fortran Interface
 Subroutine e04rgf (
 Integer, Intent (In) :: nnzfd, idxfd(nnzfd) Integer, Intent (Inout) :: ifail Type (c_ptr), Intent (In) :: handle
#include nagmk26.h
 void e04rgf_ (void **handle, const Integer *nnzfd, const Integer idxfd[], Integer *ifail)

3Description

After the initialization routine e04raf has been called (and unless the objective function has already been defined), e04rgf 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 fx (a) subject to lg≤gx≤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). See e04raf for more details.

None.

5Arguments

1:     $\mathbf{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:     $\mathbf{nnzfd}$ – IntegerInput
On entry: the number of nonzero elements in the sparse gradient vector of the objective function.
Constraint: ${\mathbf{nnzfd}}\ge 0$.
3:     $\mathbf{idxfd}\left({\mathbf{nnzfd}}\right)$ – Integer arrayInput
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 e04raf.
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}\right)\le n$, for $\mathit{i}=1,2,\dots ,{\mathbf{nnzfd}}$;
• ${\mathbf{idxfd}}\left(\mathit{i}\right)<{\mathbf{idxfd}}\left(\mathit{i}+1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{nnzfd}}-1$.
4:     $\mathbf{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).

6Error 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 Hessians of nonlinear functions have already been defined, a nonlinear objective cannot be added.
The problem cannot be modified in this phase any more, the solver has already been called.
${\mathbf{ifail}}=3$
The objective function has already been defined.
${\mathbf{ifail}}=6$
On entry, ${\mathbf{nnzfd}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{nnzfd}}\ge 0$.
${\mathbf{ifail}}=7$
On entry, $i=〈\mathit{\text{value}}〉$, ${\mathbf{idxfd}}\left(i\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{idxfd}}\left(i+1\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{idxfd}}\left(\mathit{i}\right)<{\mathbf{idxfd}}\left(i+1\right)$ (ascending order).
On entry, $i=〈\mathit{\text{value}}〉$, ${\mathbf{idxfd}}\left(i\right)=〈\mathit{\text{value}}〉$ and $n=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{idxfd}}\left(i\right)\le n$.
${\mathbf{ifail}}=-99$
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.

8Parallelism and Performance

e04rgf is not threaded in any implementation.