naginterfaces.library.opt.handle_​set_​nlnhess

naginterfaces.library.opt.handle_set_nlnhess(handle, idf, irowh=None, icolh=None)[source]

handle_set_nlnhess is a part of the NAG optimization modelling suite and defines or redefines either the structure of the Hessians of the nonlinear objective and constraints or the structure of the Hessian of the Lagrangian.

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

https://support.nag.com/numeric/nl/nagdoc_30/flhtml/e04/e04rlf.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.

idfint

Specifies the functions for which a Hessian sparsity structure is provided in , and .

The sparsity structure of the Hessian of the Lagrangian is provided.

The sparsity structure of the Hessian of the objective function is provided.

The sparsity structure of the Hessian of the th constraint function is provided.

The value of will also determine how an NLP solver will call the user-supplied functions that evaluate these nonzeros at particular points of the decision variable space, i.e., whether the solver will expect the nonzero values of the objective and constraint Hessians in separate calls or merged in the Lagrangian Hessian, in one call.

See, for example, of handle_solve_ipopt().

irowhNone or int, array-like, shape , optional

Arrays and store the nonzeros of the upper triangle of the matrix in coordinate storage (CS) format (see the F11 Introduction). specifies one-based row indices, specifies one-based column indices and specifies the values of the nonzero elements in such a way that where and , for . No particular order is expected, but elements should not repeat.

icolhNone or int, array-like, shape , optional

Arrays and store the nonzeros of the upper triangle of the matrix in coordinate storage (CS) format (see the F11 Introduction). specifies one-based row indices, specifies one-based column indices and specifies the values of the nonzero elements in such a way that where and , for . No particular order is expected, but elements should not repeat.

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 )

Neither nonlinear objective nor nonlinear constraints are present. The structure of the Hessian cannot be defined.

(errno )

No nonlinear objective has been defined, its Hessian cannot be set.

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: .

(errno )

On entry, , and .

Constraint: (elements within the upper triangle).

(errno )

On entry, more than one element of structural matrix has row index and column index .

Constraint: each element of structural matrix must have a unique row and column index.

Notes

After the has been initialized (e.g., handle_init() has been called), and a nonlinear objective function and/or the th () nonlinear constraint function has been registered with handle_set_nlnconstr() and handle_set_nlnobj(), then handle_set_nlnhess may be used to define the sparsity structure (pattern) of the Hessians of those functions or of their Lagrangian function. Define:

, and for

handle_set_nlnhess can be used to define the following sparsity structures:

the Hessian of the Lagrangian function ,

the Hessian of the objective function , or

the Hessian of the th constraint function with .

In general, each of the symmetric Hessian matrices will have its own sparsity structure. These structures can be given in separate handle_set_nlnhess calls, or merged together in the Lagrangian and given in one call. The nonzero values of the Hessians at particular points will be communicated to the NLP solver by user-supplied functions (e.g., for handle_solve_ipopt()). The values will need to be provided in the order matching the sparsity pattern.

Note that the Hessians are automatically deleted whenever the underlying functions change. For example, if handle_set_nlnconstr() is called to redefine the nonlinear constraints, all individual constraints Hessians or Hessian of the Lagrangian would be deleted. If a nonlinear objective function was changed to linear, the Hessian of the objective function or of the Lagrangian would be deleted. handle_set_nlnhess can work either with individual Hessians or with the Hessian of the Lagrangian but not both. Therefore, if the Hessian of the Lagrangian was defined and handle_set_nlnhess was called to define an individual Hessian of the constraint, the Hessian of the Lagrangian would be removed, and vice versa. Hessians can be redefined by multiple calls of handle_set_nlnhess.

See the E04 Introduction for more details about the NAG optimization modelling suite.