NAG FL Interface
e04rgf (handle_​set_​nlnobj)

1 Purpose

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.

2 Specification

Fortran Interface
Subroutine e04rgf ( handle, nnzfd, idxfd, ifail)
Integer, Intent (In) :: nnzfd, idxfd(nnzfd)
Integer, Intent (Inout) :: ifail
Type (c_ptr), Intent (In) :: handle
C Header Interface
#include <nag.h>
void  e04rgf_ (void **handle, const Integer *nnzfd, const Integer idxfd[], Integer *ifail)
The routine may be called by the names e04rgf or nagf_opt_handle_set_nlnobj.

3 Description

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 xn fx   (a) subject to lggxug,   (b) lBBxuB.   (c) lxxux   (d) (1)
The values of the nonlinear objective function fx and the nonzero values of its gradient f xi (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 e04stf). See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

4 References

None.

5 Arguments

1: handle Type (c_ptr) Input
On entry: the handle to the problem. It needs to be initialized by e04raf and must not be changed before the call to e04rgf.
2: nnzfd Integer Input
On entry: the number of nonzero elements in the sparse gradient vector of the objective function.
Constraint: nnzfd0.
3: idxfdnnzfd 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 e04raf.
If nnzfd=0, the objective is assumed to be zero and the array idxfd will not be referenced.
Constraints:
  • 1idxfdin, for i=1,2,,nnzfd;
  • idxfdi<idxfdi+1, for i=1,2,,nnzfd-1.
4: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value -1 is recommended since useful values can be provided in some output arguments even when ifail0 on exit. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry 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:
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.
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.
ifail=3
The objective function has already been defined.
ifail=6
On entry, nnzfd=value.
Constraint: nnzfd0.
ifail=7
On entry, i=value, idxfdi=value and idxfdi+1=value.
Constraint: idxfdi<idxfdi+1 (ascending order).
On entry, i=value, idxfdi=value and n=value.
Constraint: 1idxfdin.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

Not applicable.

8 Parallelism and Performance

e04rgf is not threaded in any implementation.

9 Further Comments

None.

10 Example

See Section 10 in e04stf.