NAG CPP Interface
nagcpp::opt::handle_set_nlnhess (e04rl)

Settings help

CPP Name Style:



1 Purpose

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.

2 Specification

#include "e04/nagcpp_e04rl.hpp"
#include "e04/nagcpp_class_CommE04RA.hpp"
template <typename COMM, typename IROWH, typename ICOLH>

void function handle_set_nlnhess(COMM &comm, const types::f77_integer idf, const IROWH &irowh, const ICOLH &icolh, OptionalE04RL opt)
template <typename COMM, typename IROWH, typename ICOLH>

void function handle_set_nlnhess(COMM &comm, const types::f77_integer idf, const IROWH &irowh, const ICOLH &icolh)

3 Description

After the handle has been initialized (e.g., handle_​init has been called), and a nonlinear objective function f(x) and/or the ith (1img) nonlinear constraint function gi(x) 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:
In general, each of the symmetric n×n 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., hess 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 Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

4 References

None.

5 Arguments

1: comm CommE04RA Input/Output
Communication structure. An object of either the derived class CommE04RA or its base class NoneCopyableComm can be supplied. It is recommended that the derived class is used. If the base class is supplied it must first be initialized via a call to opt::handle_init (e04ra).
2: idf types::f77_integer Input
On entry: specifies the functions for which a Hessian sparsity structure is provided in nnzh, irowh and icolh.
idf=−1
The sparsity structure of the Hessian of the Lagrangian is provided.
idf=0
The sparsity structure of the Hessian of the objective function is provided.
idf>0
The sparsity structure of the Hessian of the idfth constraint function is provided.
The value of idf 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, hess of handle_​solve_​ipopt.
Constraint: −1idfmg.
Note: mg, the number of nonlinear constraints registered with the handle.
3: irowh(nnzh) types::f77_integer array Input
On entry: arrays irowh and icolh store the nonzeros of the upper triangle of the matrix H in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). irowh specifies one-based row indices, icolh specifies one-based column indices and specifies the values of the nonzero elements in such a way that hij=H(l-1) where i=irowh(l-1) and j=icolh(l-1), for l=1,2,,nnzh. No particular order is expected, but elements should not repeat.
Constraint: 1irowh(l-1)icolh(l-1)n, for l=1,2,,nnzh.
4: icolh(nnzh) types::f77_integer array Input
On entry: arrays irowh and icolh store the nonzeros of the upper triangle of the matrix H in coordinate storage (CS) format (see Section 2.1.1 in the F11 Chapter Introduction). irowh specifies one-based row indices, icolh specifies one-based column indices and specifies the values of the nonzero elements in such a way that hij=H(l-1) where i=irowh(l-1) and j=icolh(l-1), for l=1,2,,nnzh. No particular order is expected, but elements should not repeat.
Constraint: 1irowh(l-1)icolh(l-1)n, for l=1,2,,nnzh.
5: opt OptionalE04RL Input/Output
Optional parameter container, derived from Optional.

5.1Additional Quantities

1: nnzh
The number of nonzero elements in the upper triangle of the matrix H

6 Exceptions and Warnings

Errors or warnings detected by the function:
All errors and warnings have an associated numeric error code field, errorid, stored either as a member of the thrown exception object (see errorid), or as a member of opt.ifail, depending on how errors and warnings are being handled (see Error Handling for more details).
Raises: ErrorException
errorid=1
comm::handle has not been initialized.
errorid=1
comm::handle does not belong to the NAG optimization modelling suite,
has not been initialized properly or is corrupted.
errorid=1
comm::handle has not been initialized properly or is corrupted.
errorid=2
The problem cannot be modified right now, the solver is running.
errorid=2
Neither nonlinear objective nor nonlinear constraints are present.
The structure of the Hessian cannot be defined.
errorid=2
No nonlinear objective has been defined, its Hessian cannot be set.
errorid=6
On entry, nnzh = value.
Constraint: nnzh>0.
errorid=7
On entry, idf = value.
Constraint: −1idfvalue.
errorid=8
On entry, i=value, irowh[i-1]=value and
n=value.
Constraint: 1irowh[i-1]n.
errorid=8
On entry, i=value, icolh[i-1]=value and
n=value.
Constraint: 1icolh[i-1]n.
errorid=8
On entry, i=value, irowh[i-1]=value and
icolh[i-1]=value.
Constraint: irowh[i-1]icolh[i-1] (elements within the upper triangle).
errorid=8
On entry, more than one element of structural matrix H has row index
value and column index value.
Constraint: each element of structural matrix H must have a unique row
and column index.
errorid=10601
On entry, argument value must be a vector of size value array.
Supplied argument has value dimensions.
errorid=10601
On entry, argument value must be a vector of size value array.
Supplied argument was a vector of size value.
errorid=10601
On entry, argument value must be a vector of size value array.
The size for the supplied array could not be ascertained.
errorid=10602
On entry, the raw data component of value is null.
errorid=10603
On entry, unable to ascertain a value for value.
errorid=10605
On entry, the communication class value has not been initialized correctly.
errorid=−99
An unexpected error has been triggered by this routine.
errorid=−399
Your licence key may have expired or may not have been installed correctly.
errorid=−999
Dynamic memory allocation failed.

7 Accuracy

Not applicable.

8 Parallelism and Performance

Please see the description for the underlying computational routine in this section of the FL Interface documentation.

9 Further Comments

10 Example

Examples of the use of this method may be found in the examples for: handle_​solve_​ipopt.