naginterfaces.library.opt.handle_​set_​nlnobj

naginterfaces.library.opt.handle_set_nlnobj(handle, idxfd=None)[source]

handle_set_nlnobj 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.

For full information please refer to the NAG Library document for e04rg

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/e04/e04rgf.html

Parameters
handleHandle

The handle to the problem. It needs to be initialized (e.g., by handle_init()) and must not be changed between calls to the NAG optimization modelling suite.

idxfdNone or int, array-like, shape , optional

The one-based indices of the nonzero elements of the sparse gradient vector. The indices must be stored in ascending order. Note that is the current number of decision variables in the model.

If , the objective is assumed to be zero and the array will not be referenced.

Raises
NagValueError
(errno )

has not been initialized.

(errno )

does not belong to the NAG optimization modelling suite, has not been initialized properly or is corrupted.

(errno )

has not been initialized properly or is corrupted.

(errno )

The problem cannot be modified right now, the solver is running.

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: (ascending order).

(errno )

On entry, , and .

Constraint: .

Notes

After the has been initialized (e.g., handle_init() has been called), handle_set_nlnobj 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. If the objective function has already been defined, it will be overwritten and its Hessian (or the Hessian of the Lagrangian) will be removed. If handle_set_nlnobj is called with no nonzeroes in the sparsity pattern, any existing objective function is removed, no new one is added and the problem will be solved as a feasible point problem.

This objective function will typically be used for nonlinear programming problems (NLP) of the kind:

The values of the nonlinear objective function and the nonzero values of its gradient (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., and for handle_solve_ipopt()). See the E04 Introduction for more details about the NAG optimization modelling suite.