NAG C Library Function Document

nag_opt_handle_set_nlnobj (e04rgc)

1
Purpose

nag_opt_handle_set_nlnobj (e04rgc) 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

#include <nag.h>
#include <nage04.h>
void  nag_opt_handle_set_nlnobj (void *handle, Integer nnzfd, const Integer idxfd[], NagError *fail)

3
Description

After the initialization function nag_opt_handle_init (e04rac) has been called (and unless the objective function has already been defined), nag_opt_handle_set_nlnobj (e04rgc) 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 nag_opt_handle_init (e04rac) for more details.

4
References

None.

5
Arguments

1:     handle void *Input
On entry: the handle to the problem. It needs to be initialized by nag_opt_handle_init (e04rac) 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:     idxfd[nnzfd] const IntegerInput
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 nag_opt_handle_init (e04rac).
If nnzfd=0, the objective is assumed to be zero and the array idxfd will not be referenced and may be NULL.
Constraints:
  • 1idxfd[i-1]n, for i=1,2,,nnzfd;
  • idxfd[i-1]<idxfd[i], for i=1,2,,nnzfd-1.
4:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_ALREADY_DEFINED
The objective function has already been defined.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_HANDLE
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 nag_opt_handle_init (e04rac) or it has been corrupted.
NE_INT
On entry, nnzfd=value.
Constraint: nnzfd0.
NE_INTARR
On entry, i=value, idxfd[i-1]=value and n=value.
Constraint: 1idxfd[i-1]n.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_NOT_INCREASING
On entry, i=value, idxfd[i-1]=value and idxfd[i]=value.
Constraint: idxfd[i-1]<idxfd[i] (ascending order).
NE_PHASE
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.

7
Accuracy

Not applicable.

8
Parallelism and Performance

nag_opt_handle_set_nlnobj (e04rgc) is not threaded in any implementation.

9
Further Comments

None.

10
Example

See Section 10 in nag_opt_handle_solve_ipopt (e04stc).