CONOPT
Loading...
Searching...
No Matches

The modeler can tell CONOPT that second order information is available as the Hessian of the Lagrangian, assumed to be a sparse matrix, by registering a 2DLagrStr callback routine using COIDEF_2DLagrStr() before the solve. The number of nonzero elements and the sparsety pattern of the Hessian of the Lagrangian are defined in two setup calls to 2DLagrStr. It is possible during the first setup call to “un-register” the 2DLagrStr by returning the function value -1. This might be required if it turns out that the Hessian is too expensive to evaluate or cannot be computed after all. There is also a maximum size allowed by CONOPT that may prevent further use of the Hessian. The numerical values of the Hessian must be returned by the subsequent call of 2DLagrVal, which is described in 2DLagrVal. The two setup calls will be called during model setup just after ReadMatrix and the numerical calls will be scattered throughout the optimization, usually with no more than one call per iteration.

2DLagrStr - Structure of the Second Derivatives of the Lagrangian

This optional callback routine can be registered using COIDEF_2DLagrStr(). The purpose is to compute and return the sparsety pattern of the Hessian of the Lagrangian. The elements of the Hessian must be sorted column-wise, i.e. the column numbers in COLNO must be non-decreasing. Within each column the elements must be sorted row-wise, i.e. the elements of ROWNO must be increasing for sequences for which COLNO is constant.

int COI_CALLCONV 2DLagrStr( int* ROWNO, int* COLNO, int* NODRV,
int* N, int* M, int* NHESS, void* USRMEM );

where:


2DLagrVal - Values of Second Derivatives of the Lagrangian

Note
This callback must be registered if the 2DLagrStr callback is registered.

This optional callback routines can be registered using COIDEF_2DLagrVal(). It has three modes with the following purposes:

1. Compute and return the number of nonzero elements on the diagonal and in the lower triangular part of the Hessian of the Lagrangian in NHESS. When CONOPT calls 2DLagrVal it will provide a maximum on the number of elements it will accept, also in NHESS, and the modeler can choose to abort and return 2DLagrVal = -1 if this maximum is exceeded. Otherwise, if the number of nonzero elements is too large, CONOPT will not call 2DLagrVal again.

2. Compute and return the sparsety pattern of the Hessian of the Lagrangian. The elements of the Hessian must be sorted column-wise, i.e. the column numbers in COLNO must be non-decreasing. Within each column the elements must be sorted row-wise, i.e. the elements of ROWNO must be increasing for sequences for which COLNO is constant., and

3. Compute the numerical values of the Hessian of the Lagrangian as defined in the introduction to this section. The order of the elements is the same as the order used for the sparsety pattern in the 2nd call.

int COI_CALLCONV 2DLagrVal( double* X, double* U, int* ROWNO,
int* COLNO, double* VALUE, int* NODRV, int* N,
int* M, int* NHESS, int* MODE, void* USRMEM );

where:

2DLagrVal will only be called in points in which the constraint values have been computed successfully before with FDEval. Checks for function evaluation errors can therefore usually be limited. Note that 2DLagrVal in some cases can be called in a point that is different from the last point in which FDEval was called.

The maximum number of Hessian nonzero elements accepted by CONOPT is computed as the option value RVHESS multiplied by the number of nonlinear Jacobian elements. The default value of RVHESS is 10. If the Hessian has more than 10 times as many elements as the Jacobian it is expected that it is too expensive to compute and that directional 2nd derivatives in some form are more efficient to use. The modeler may allow CONOPT to use a denser Hessian by increasing RVHESS.

There is a rudimentary debugger of the values returned by 2DLagrVal. It can be turned on by setting Debug2D in COIDEF_Debug2D() or with the option LKDEB2. Information on the debugger including messages and error return codes can be found in Error Return Codes.