NAG Library Routine Document

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 <nagmk26.h>
void  e04rgf_ (void **handle, const Integer *nnzfd, const Integer idxfd[], Integer *ifail)

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). See e04raf for more details.

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.
2:     nnzfd – IntegerInput
On entry: the number of nonzero elements in the sparse gradient vector of the objective function.
Constraint: nnzfd0.
3:     idxfdnnzfd – 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 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 – IntegerInput/Output
On entry: ifail must be set to 0, -1 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 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 -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 3.9 in How to Use the NAG Library and its Documentation for further information.
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.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation 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.