The routine may be called by the names e04vjf or nagf_opt_nlp2_sparse_jacobian.
When using e04vhf, if you set the optional parameter and usrfun provides none of the derivatives, you may need to call e04vjf to determine the input arrays iafun, javar, a, igfun and jgvar. These arrays define the pattern of nonzeros in the Jacobian matrix.
A typical sequence of calls could be
e04vjf determines the sparsity pattern for the Jacobian and identifies the constant elements automatically. To do so, e04vjf approximates the problem functions, , at three random perturbations of the given initial point . If an element of the approximate Jacobian is the same at all three points, then it is taken to be constant. If it is zero, it is taken to be identically zero. Since the random points are not chosen close together, the heuristic will correctly classify the Jacobian elements in the vast majority of cases. In general, e04vjf finds that the Jacobian can be permuted to the form:
where , and are constant. Note that might contain elements that are also constant, but e04vjf must classify them as nonlinear. This is because e04vhf ‘removes’ linear variables from the calculation of by setting them to zero before calling usrfun. A knowledgeable user would be able to move such elements from in usrfun and enter them as part of iafun, javar and a for e04vhf.
Hock W and Schittkowski K (1981) Test Examples for Nonlinear Programming Codes. Lecture Notes in Economics and Mathematical Systems187 Springer–Verlag
Note: all optional parameters are described in detail in Section 12.1 in e04vhf.
1: – IntegerInput
On entry: , the number of problem functions in , including the objective function (if any) and the linear and nonlinear constraints. Simple upper and lower bounds on can be defined using the arguments xlow and xupp and should not be included in .
2: – IntegerInput
On entry: , the number of variables.
3: – Subroutine, supplied by the user.External Procedure
usrfun must define the problem functions . This subroutine is passed to e04vjf as the external argument usrfun.
usrfun must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which e04vjf is called. Arguments denoted as Input must not be changed by this procedure.
Note:usrfun should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by e04vjf. If your code inadvertently does return any NaNs or infinities, e04vjf is likely to produce unexpected results.
4: – Integer arrayOutput
5: – Integer arrayOutput
6: – Real (Kind=nag_wp) arrayOutput
On exit: define the coordinates and values of the nonzero elements of the linear part of the function .
In particular, nea triples define the row and column indices and of the element .
7: – IntegerInput
On entry: the dimension of the arrays iafun, javar and a that hold as declared in the (sub)program from which e04vjf is called. lena should be an overestimate of the number of elements in the linear part of the Jacobian.
8: – IntegerOutput
On exit: is the number of nonzero entries in such that .
9: – Integer arrayOutput
10: – Integer arrayOutput
On exit: define the coordinates of the nonzero elements of , the nonlinear part of the derivatives of the function .
11: – IntegerInput
On entry: the dimension of the arrays igfun and jgvar that define the varying Jacobian elements as declared in the (sub)program from which e04vjf is called. leng should be an overestimate of the number of elements in the nonlinear part of the Jacobian.
12: – IntegerOutput
On exit: the number of nonzero entries in .
13: – Real (Kind=nag_wp) arrayInput
On entry: an initial estimate of the variables . The contents of will be used by e04vjf in the call of usrfun, and so each element of x should be within the bounds given by xlow and xupp.
14: – Real (Kind=nag_wp) arrayInput
15: – Real (Kind=nag_wp) arrayInput
On entry: contain the lower and upper bounds and on the variables .
To specify a nonexistent lower bound , set , where is the optional parameter Infinite Bound Size. To specify a nonexistent upper bound .
To fix the th variable (say, , where ), set .
16: – Character(8) arrayCommunication Array
17: – IntegerInput
On entry: the dimension of the array cw as declared in the (sub)program from which e04vjf is called.
18: – Integer arrayCommunication Array
19: – IntegerInput
On entry: the dimension of the array iw as declared in the (sub)program from which e04vjf is called.
20: – Real (Kind=nag_wp) arrayCommunication Array
21: – IntegerInput
On entry: the dimension of the array rw as declared in the (sub)program from which e04vjf is called.
22: – Character(8) arrayUser Workspace
23: – Integer arrayUser Workspace
24: – Real (Kind=nag_wp) arrayUser Workspace
cuser, iuser and ruser are not used by e04vjf, but are passed directly to usrfun and may be used to pass information to this routine.
25: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, .
On entry, .
On entry, .
The initialization routine e04vgf has not been called.
On entry, .
On entry, .
User-supplied routine usrfun indicates that functions are undefined near given point x.
You have indicated that the problem functions are undefined by setting on exit from usrfun. This exit occurs if e04vjf is unable to find a point at which the functions are defined.
You have indicated the wish to terminate the call to e04vjf by setting status to a value on exit from usrfun.
Either lena or leng is too small. Increase both of them and corresponding array sizes. and .
Cannot estimate Jacobian structure at given point x.
Internal error: memory allocation failed when attempting to allocate workspace sizes , and . Please contact NAG.
Internal memory allocation was insufficient. Please contact NAG.
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
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.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
8Parallelism and Performance
e04vjf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
This example shows how to call e04vjf to determine the sparsity pattern of the Jacobian before calling e04vhf to solve a sparse nonlinear programming problem without providing the Jacobian information in usrfun.