NAG FL Interfacee04rlf (handle_​set_​nlnhess)

▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

1Purpose

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

2Specification

Fortran Interface
 Subroutine e04rlf ( idf, nnzh,
 Integer, Intent (In) :: idf, nnzh, irowh(nnzh), icolh(nnzh) Integer, Intent (Inout) :: ifail Type (c_ptr), Intent (In) :: handle
#include <nag.h>
 void e04rlf_ (void **handle, const Integer *idf, const Integer *nnzh, const Integer irowh[], const Integer icolh[], Integer *ifail)
The routine may be called by the names e04rlf or nagf_opt_handle_set_nlnhess.

3Description

After the handle has been initialized (e.g., e04raf has been called), and a nonlinear objective function $f\left(x\right)$ and/or the $i$th ($1\le i\le {m}_{g}$) nonlinear constraint function ${g}_{i}\left(x\right)$ has been registered with e04rgf and e04rkf, then e04rlf may be used to define the sparsity structure (pattern) of the Hessians of those functions or of their Lagrangian function. Define:
• ${\nabla }^{2}f\left(x\right)\equiv \left(\begin{array}{cccc}\frac{{\partial }^{2}f\left(x\right)}{{\partial }^{2}{x}_{1}}& \frac{{\partial }^{2}f\left(x\right)}{\partial {x}_{2}\partial {x}_{1}}& \dots & \frac{{\partial }^{2}f\left(x\right)}{\partial {x}_{n}\partial {x}_{1}}\\ \frac{{\partial }^{2}f\left(x\right)}{\partial {x}_{1}\partial {x}_{2}}& \frac{{\partial }^{2}f\left(x\right)}{{\partial }^{2}{x}_{2}}& \dots & \frac{{\partial }^{2}f\left(x\right)}{\partial {x}_{n}\partial {x}_{2}}\\ ⋮& ⋮& \ddots & ⋮\\ \frac{{\partial }^{2}f\left(x\right)}{\partial {x}_{1}\partial {x}_{n}}& \frac{{\partial }^{2}f\left(x\right)}{\partial {x}_{2}\partial {x}_{n}}& \dots & \frac{{\partial }^{2}f\left(x\right)}{{\partial }^{2}{x}_{n}}\end{array}\right)$, and ${\nabla }^{2}{g}_{i}\left(x\right)\equiv \left(\begin{array}{cccc}\frac{{\partial }^{2}{g}_{i}\left(x\right)}{{\partial }^{2}{x}_{1}}& \frac{{\partial }^{2}{g}_{i}\left(x\right)}{\partial {x}_{2}\partial {x}_{1}}& \dots & \frac{{\partial }^{2}{g}_{i}\left(x\right)}{\partial {x}_{n}\partial {x}_{1}}\\ \frac{{\partial }^{2}{g}_{i}\left(x\right)}{\partial {x}_{1}\partial {x}_{2}}& \frac{{\partial }^{2}{g}_{i}\left(x\right)}{{\partial }^{2}{x}_{2}}& \dots & \frac{{\partial }^{2}{g}_{i}\left(x\right)}{\partial {x}_{n}\partial {x}_{2}}\\ ⋮& ⋮& \ddots & ⋮\\ \frac{{\partial }^{2}{g}_{i}\left(x\right)}{\partial {x}_{1}\partial {x}_{n}}& \frac{{\partial }^{2}{g}_{i}\left(x\right)}{\partial {x}_{2}\partial {x}_{n}}& \dots & \frac{{\partial }^{2}{g}_{i}\left(x\right)}{{\partial }^{2}{x}_{n}}\end{array}\right)$ for $1\le i\le {m}_{g}$
• e04rlf can be used to define the following sparsity structures:
• the Hessian of the Lagrangian function $\sigma {\nabla }^{2}f\left(x\right)+\sum _{i=1}^{{m}_{g}}{\lambda }_{i}{\nabla }^{2}{g}_{i}\left(x\right)$,
• the Hessian of the objective function ${\nabla }^{2}f\left(x\right)$, or
• the Hessian of the $i$th constraint function ${\nabla }^{2}{g}_{i}\left(x\right)$ with $1\le i\le {m}_{g}$.
In general, each of the symmetric $n×n$ Hessian matrices will have its own sparsity structure. These structures can be given in separate e04rlf 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 e04stf). 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 e04rkf 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. e04rlf 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 e04rlf 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 e04rlf.
See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite.

None.

5Arguments

1: $\mathbf{handle}$Type (c_ptr) Input
On entry: the handle to the problem. It needs to be initialized (e.g., by e04raf) and must not be changed between calls to the NAG optimization modelling suite.
2: $\mathbf{idf}$Integer Input
On entry: specifies the functions for which a Hessian sparsity structure is provided in nnzh, irowh and icolh.
${\mathbf{idf}}=-1$
The sparsity structure of the Hessian of the Lagrangian is provided.
${\mathbf{idf}}=0$
The sparsity structure of the Hessian of the objective function is provided.
${\mathbf{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 subroutines 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 e04stf.
Constraint: $-1\le {\mathbf{idf}}\le {m}_{g}$.
Note: ${m}_{g}$, the number of nonlinear constraints registered with the handle.
3: $\mathbf{nnzh}$Integer Input
On entry: the number of nonzero elements in the upper triangle of the matrix $H$.
Constraint: ${\mathbf{nnzh}}>0$.
4: $\mathbf{irowh}\left({\mathbf{nnzh}}\right)$Integer array Input
5: $\mathbf{icolh}\left({\mathbf{nnzh}}\right)$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 ${h}_{ij}=\mathit{H}\left(l\right)$ where $i={\mathbf{irowh}}\left(l\right)$ and $j={\mathbf{icolh}}\left(\mathit{l}\right)$, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzh}}$. No particular order is expected, but elements should not repeat.
Constraint: $1\le {\mathbf{irowh}}\left(\mathit{l}\right)\le {\mathbf{icolh}}\left(\mathit{l}\right)\le n$, for $\mathit{l}=1,2,\dots ,{\mathbf{nnzh}}$.
6: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $-1$ is recommended. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

6Error Indicators and Warnings

If on entry ${\mathbf{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:
${\mathbf{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 properly initialized or it has been corrupted.
${\mathbf{ifail}}=2$
Neither nonlinear objective nor nonlinear constraints are present. The structure of the Hessian cannot be defined.
No nonlinear objective has been defined, its Hessian cannot be set.
The problem cannot be modified right now, the solver is running.
${\mathbf{ifail}}=6$
On entry, ${\mathbf{nnzh}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{nnzh}}>0$.
${\mathbf{ifail}}=7$
On entry, ${\mathbf{idf}}=⟨\mathit{\text{value}}⟩$.
Constraint: $-1\le {\mathbf{idf}}\le ⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=8$
On entry, $i=⟨\mathit{\text{value}}⟩$, ${\mathbf{icolh}}\left(\mathit{i}\right)=⟨\mathit{\text{value}}⟩$ and $n=⟨\mathit{\text{value}}⟩$.
Constraint: $1\le {\mathbf{icolh}}\left(\mathit{i}\right)\le n$.
On entry, $i=⟨\mathit{\text{value}}⟩$, ${\mathbf{irowh}}\left(\mathit{i}\right)=⟨\mathit{\text{value}}⟩$ and ${\mathbf{icolh}}\left(\mathit{i}\right)=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{irowh}}\left(\mathit{i}\right)\le {\mathbf{icolh}}\left(\mathit{i}\right)$ (elements within the upper triangle).
On entry, $i=⟨\mathit{\text{value}}⟩$, ${\mathbf{irowh}}\left(\mathit{i}\right)=⟨\mathit{\text{value}}⟩$ and $n=⟨\mathit{\text{value}}⟩$.
Constraint: $1\le {\mathbf{irowh}}\left(\mathit{i}\right)\le n$.
On entry, more than one element of structural matrix $H$ has row index $⟨\mathit{\text{value}}⟩$ and column index $⟨\mathit{\text{value}}⟩$.
Constraint: each element of structural matrix $H$ must have a unique row and column index.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.