e05usf is designed to find the global minimum of an arbitrary smooth sum of squares function subject to constraints (which may include simple bounds on the variables, linear constraints and smooth nonlinear constraints) by generating a number of different starting points and performing a local search from each using sequential quadratic programming.
The routine may be called by the names e05usf or nagf_glopt_nlp_multistart_sqp_lsq.
Before calling e05usf, the optional parameter arrays iopts and optsmust
be initialized for use with e05usf by calling e05zkf with optstr set to
‘Initialize = e05usf’.
Optional parameters may subsequently be specified by calling e05zkf before the call to e05usf.
3Description
The local minimization method is e04usa.
The problem is assumed to be stated in the following form:
(1)
where (the objective function) is a nonlinear function which can be represented as the sum of squares of subfunctions , the are constant, is an constant linear constraint matrix, and is an element vector of nonlinear constraint functions. (The matrix and the vector may be empty.) The objective function and the constraint functions are assumed to be smooth, i.e., at least twice-continuously differentiable. (This routine will usually solve (1) if any isolated discontinuities are away from the solution.)
e05usf solves a user-specified number of local optimization problems with different starting points. You may specify the starting points via the subroutine start. If a random number generator is used to generate the starting points then the argument repeat1 allows you to specify whether a repeatable set of points are generated or whether different starting points are generated on different calls. The resulting local minima are ordered and the best nb results returned in order of ascending values of the resulting objective function values at the minima. Thus the value returned in position will be the best result obtained. If a sufficiently high number of different points are chosen then this is likely to be the global minimum.
4References
Gill P E, Murray W and Wright M H (1981) Practical Optimization Academic Press
Hock W and Schittkowski K (1981) Test Examples for Nonlinear Programming Codes. Lecture Notes in Economics and Mathematical Systems187 Springer–Verlag
5Arguments
1: – IntegerInput
On entry: , the number of subfunctions associated with .
Constraint:
.
2: – IntegerInput
On entry: , the number of variables.
Constraint:
.
3: – IntegerInput
On entry: , the number of general linear constraints.
Constraint:
.
4: – IntegerInput
On entry: , the number of nonlinear constraints.
Constraint:
.
5: – Real (Kind=nag_wp) arrayInput
Note: the second dimension of the array a
must be at least
if , and at least otherwise.
On entry: the matrix of general linear constraints in (1). That is, the th row contains the coefficients of the th general linear constraint, for .
On entry: the first dimension of the array a as declared in the (sub)program from which e05usf is called.
Constraint:
.
7: – Real (Kind=nag_wp) arrayInput
8: – Real (Kind=nag_wp) arrayInput
On entry: bl must contain the lower bounds and bu the upper bounds for all the constraints in the following order. The first elements of each array must contain the bounds on the variables, the next elements the bounds for the general linear constraints (if any) and the next elements the bounds for the general nonlinear constraints (if any). To specify a nonexistent lower bound (i.e., ), set , and to specify a nonexistent upper bound (i.e., ), set ; the default value of is , but this may be changed by the optional parameter Infinite Bound Size. To specify the th constraint as an equality, set , say, where .
Constraints:
, for ;
if , .
9: – Real (Kind=nag_wp) arrayInput
On entry: the coefficients of the constant vector of the objective function.
10: – Subroutine, supplied by the NAG Library or the user.External Procedure
confun must calculate the vector of nonlinear constraint functions and (optionally) its Jacobian () for a specified -element vector . If there are no nonlinear constraints (i.e., ), confun will never be called by e05usf and confun may be the dummy routine e05udm. (e05udm is included in the NAG Library.) If there are nonlinear constraints, the first call to confun will occur before the first call to objfun.
On entry: indicates which values must be assigned during each call of confun. Only the following values need be assigned, for each value of such that :
On exit: may be set to a negative value if you wish to abandon the solution to the current local minimization problem. In this case e05usf will move to the next local minimization problem.
2: – IntegerInput
On entry: , the number of nonlinear constraints.
3: – IntegerInput
On entry: , the number of variables.
4: – IntegerInput
On entry: ldcjsl is the first dimension of the array cjsl.
5: – Integer arrayInput
On entry: the indices of the elements of c and/or cjsl that must be evaluated by confun. If , and/or the available elements of the th row of cjsl (see argument mode) must be evaluated at .
6: – Real (Kind=nag_wp) arrayInput
On entry: , the vector of variables at which the constraint functions and/or the available elements of the constraint Jacobian are to be evaluated.
7: – Real (Kind=nag_wp) arrayOutput
On exit: if and or , must contain the value of . The remaining elements of c, corresponding to the non-positive elements of needc, need not be set.
8: – Real (Kind=nag_wp) arrayInput/Output
cjsl may be regarded as a two-dimensional ‘slice’ of the three-dimensional array cjac of e05usf.
On entry: unless or , the elements of cjsl are set to special values which enable e05usf to detect whether they are changed by confun.
On exit: if and or , the th row of cjsl must contain the available elements of the vector given by
where is the partial derivative of the th constraint with respect to the th variable, evaluated at the point . See also the argument nstate. The remaining rows of cjsl, corresponding to non-positive elements of needc, need not be set.
If all elements of the constraint Jacobian are known (i.e., or ; note the default is ), any constant elements may be assigned to cjsl one time only at the start of each local optimization. An element of cjsl that is not subsequently assigned in confun will retain its initial value throughout the local optimization. Constant elements may be loaded into cjsl during the first call to confun for the local optimization (signalled by the value ). The ability to preload constants is useful when many Jacobian elements are identically zero, in which case cjsl may be initialized to zero and nonzero elements may be reset by confun.
Note that constant nonzero elements do affect the values of the constraints. Thus, if is set to a constant value, it need not be reset in subsequent calls to confun, but the value must nonetheless be added to . For example, if and then the term must be included in the definition of .
It must be emphasized that, if or , unassigned elements of cjsl are not treated as constant; they are estimated by finite differences, at nontrivial expense. If you do not supply a value for the optional parameter Difference Interval, an interval for each element of is computed automatically at the start of each local optimization. The automatic procedure can usually identify constant elements of cjsl, which are then computed once only by finite differences.
9: – IntegerInput
On entry: if then e05usf is calling confun for the first time on the current local optimization problem. This argument setting allows you to save computation time if certain data must be read or calculated only once.
10: – Integer arrayUser Workspace
11: – Real (Kind=nag_wp) arrayUser Workspace
confun is called with the arguments iuser and ruser as supplied to e05usf. You should use the arrays iuser and ruser to supply information to confun.
confun must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which e05usf is called. Arguments denoted as Input must not be changed by this procedure.
Note:confun should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by e05usf. If your code inadvertently does return any NaNs or infinities, e05usf is likely to produce unexpected results.
confun should be tested separately before being used in conjunction with e05usf. See also the description of the optional parameter
Verify.
11: – Subroutine, supplied by the user.External Procedure
objfun must calculate either the th element of the vector or all elements of and (optionally) its Jacobian () for a specified -element vector .
On exit: may be set to a negative value if you wish to abandon the solution to the current local minimization problem. In this case e05usf will move to the next local minimization problem.
2: – IntegerInput
On entry: , the number of subfunctions.
3: – IntegerInput
On entry: , the number of variables.
4: – IntegerInput
On entry: ldfjsl is the first dimension of the array fjsl.
5: – IntegerInput
On entry: if , only the th element of needs to be evaluated at ; the remaining elements need not be set. This can result in significant computational savings when .
6: – Real (Kind=nag_wp) arrayInput
On entry: , the vector of variables at which the objective function and/or all available elements of its gradient are to be evaluated.
7: – Real (Kind=nag_wp) arrayOutput
On exit: if and , must contain the value of at .
If or and ,
must contain the value of at , for .
8: – Real (Kind=nag_wp) arrayInput/Output
fjsl may be regarded as a two-dimensional ‘slice’ of the three-dimensional array fjac of e05usf.
On entry: is set to a special value.
On exit: if or and , the th row of fjsl must contain the available elements of the vector given by
evaluated at the point . See also the argument nstate.
9: – IntegerInput
On entry: if then e05usf is calling objfun for the first time on the current local optimization problem. This argument setting allows you to save computation time if certain data must be read or calculated only once.
10: – Integer arrayUser Workspace
11: – Real (Kind=nag_wp) arrayUser Workspace
objfun is called with the arguments iuser and ruser as supplied to e05usf. You should use the arrays iuser and ruser to supply information to objfun.
objfun must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which e05usf is called. Arguments denoted as Input must not be changed by this procedure.
Note:objfun should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by e05usf. If your code inadvertently does return any NaNs or infinities, e05usf is likely to produce unexpected results.
objfun should be tested separately before being used in conjunction with e05usf. See also the description of the optional parameter
Verify.
12: – IntegerInput
On entry: the number of different starting points to be generated and used. The more points used, the more likely that the best returned solution will be a global minimum.
Constraint:
.
13: – Real (Kind=nag_wp) arrayOutput
Note: the second dimension of the array x
must be at least
.
On exit: contains the final estimate of the th solution, for .
14: – IntegerInput
On entry: the first dimension of the array x as declared in the (sub)program from which e05usf is called.
Constraint:
.
15: – Subroutine, supplied by the NAG Library or the user.External Procedure
start must calculate the npts starting points to be used by the local optimizer. If you do not wish to write a routine specific to your problem then e05ucz may be used as the actual argument. e05ucz is supplied in the NAG Library and uses the NAG quasi-random number generators to distribute starting points uniformly across the domain. It is affected by the value of repeat1.
On entry: indicates the number of starting points.
2: – Real (Kind=nag_wp) arrayInput/Output
On entry: all elements of quas will have been set to zero, so only nonzero values need be set subsequently.
On exit: must contain the starting points for the npts local minimizations, i.e., must contain the th component of the th starting point.
3: – IntegerInput
On entry: the number of variables.
4: – LogicalInput
On entry: specifies whether a repeatable or non-repeatable sequence of points are to be generated.
5: – Real (Kind=nag_wp) arrayInput
On entry: the lower bounds on the variables. These may be used to ensure that the starting points generated in some sense ‘cover’ the region, but there is no requirement that a starting point be feasible.
6: – Real (Kind=nag_wp) arrayInput
On entry: the upper bounds on the variables. (See bl.)
7: – Integer arrayUser Workspace
8: – Real (Kind=nag_wp) arrayUser Workspace
start is called with the arguments iuser and ruser as supplied to e05usf. You should use the arrays iuser and ruser to supply information to start.
On exit: if you set mode to a negative value then e05usf will terminate immediately with .
start must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which e05usf is called. Arguments denoted as Input must not be changed by this procedure.
Note:start should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by e05usf. If your code inadvertently does return any NaNs or infinities, e05usf is likely to produce unexpected results.
16: – LogicalInput
On entry: is passed as an argument to start and may be used to initialize a random number generator to a repeatable, or non-repeatable, sequence. See Section 9 for more detail.
17: – IntegerInput
On entry: the number of solutions to be returned. The routine saves up to nb local minima ordered by increasing value of the final objective function. If the defining criterion for ‘best solution’ is only that the value of the objective function is as small as possible then nb should be set to . However, if you want to look at other solutions that may have desirable properties then setting will produce nb local minima, ordered by increasing value of their objective functions at the minima.
Constraint:
.
18: – Real (Kind=nag_wp) arrayOutput
On exit: contains the value of the objective function at the final iterate for the th solution.
19: – Real (Kind=nag_wp) arrayOutput
Note: the second dimension of the array f
must be at least
.
On exit: contains the value of the th function at the final iterate, for ,
for the th solution, for .
20: – Real (Kind=nag_wp) arrayOutput
Note: the last dimension of the array fjac
must be at least
.
On exit: for the th returned solution, the Jacobian matrix of the functions at the final iterate, i.e.,
contains the partial derivative of the th function with respect to the th variable, for , and . (See also the discussion of argument fjsl under objfun.)
21: – IntegerInput
On entry: the first dimension of the array fjac as declared in the (sub)program from which e05usf is called.
Constraint:
.
22: – IntegerInput
On entry: the second dimension of the array fjac as declared in the (sub)program from which e05usf is called.
Constraint:
.
23: – Integer arrayOutput
On exit: contains the number of major iterations performed to obtain the th solution. If less than nb solutions are returned then contains the number of starting points that have resulted in a converged solution. If this is close to npts then this might be indicative that fewer than nb local minima exist.
24: – Real (Kind=nag_wp) arrayOutput
Note: the second dimension of the array c
must be at least
.
On exit: if ,
contains the value of the th nonlinear constraint function at the final iterate, for the th solution, for .
On entry: the first dimension of the array c as declared in the (sub)program from which e05usf is called.
Constraint:
.
26: – Real (Kind=nag_wp) arrayOutput
Note: the last dimension of the array cjac
must be at least
.
On exit: if , cjac contains the Jacobian matrices of the nonlinear constraint functions at the final iterate for each of the returned solutions, i.e.,
contains the partial derivative of the th constraint function with respect to the th variable, for and , for the th solution. (See the discussion of argument cjsl under confun.)
On entry: the first dimension of the array cjac as declared in the (sub)program from which e05usf is called.
Constraint:
.
28: – IntegerInput
On entry: the second dimension of the array cjac as declared in the (sub)program from which e05usf is called.
Constraint:
if , .
29: – Real (Kind=nag_wp) arrayOutput
Note: the second dimension of the array clamda
must be at least
.
On exit: the values of the QP multipliers from the last QP subproblem solved for the th solution. should be non-negative if and non-positive if .
30: – IntegerInput
On entry: the first dimension of the array clamda as declared in the (sub)program from which e05usf is called.
Constraint:
.
31: – Integer arrayOutput
Note: the second dimension of the array istate
must be at least
.
On exit: contains the status of the constraints in the QP working set for the th solution. The significance of each possible value of is as follows:
Meaning
The constraint is satisfied to within the feasibility tolerance, but is not in the QP working set.
This inequality constraint is included in the QP working set at its lower bound.
This inequality constraint is included in the QP working set at its upper bound.
This constraint is included in the QP working set as an equality. This value of istate can occur only when .
32: – IntegerInput
On entry: the first dimension of the array istate as declared in the (sub)program from which e05usf is called.
Constraint:
.
33: – Integer arrayCommunication Array
34: – Real (Kind=nag_wp) arrayCommunication Array
The arrays iopts and optsmust not be altered between calls to any of the routines e05usfande05zkf.
35: – Integer arrayUser Workspace
36: – Real (Kind=nag_wp) arrayUser Workspace
iuser and ruser are not used by e05usf, but are passed directly to confun, objfun and start and may be used to pass information to these routines.
With SMP-enabled versions of e05usf the arrays iuser and ruser provided are classified as OpenMP shared memory. Use of iuser and ruser has to take account of this in order to preserve thread safety whenever information is written back to either of these arrays.
37: – Integer arrayOutput
On exit: if , does not contain an error value returned by e04usf/e04usa.
If on exit, then not all nb solutions have been found, and contains the number of solutions actually found.
38: – 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 since useful values can be provided in some output arguments even when on exit. 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:
Note: in some cases e05usf may return useful information.
An input value is incorrect. One or more of the following requirements are violated:
On entry, : .
Constraint: , for all .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, , , and .
Constraint: .
On entry, and .
Constraint: .
On entry, and .
Constraint: .
On entry, , , and .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, and .
Constraint: .
On entry, .
Constraint: .
On entry, .
Constraint: .
On entry, , and .
Constraint: if , .
On entry, and .
Constraint: .
e05usf has terminated without finding any solutions. The majority of calls to the local optimizer have failed to find a feasible point for the linear constraints and bounds, which means that either no feasible point exists for the given value of the optional parameter Linear Feasibility Tolerance (default value , where is the machine precision), or no feasible point could be found in the number of iterations specified by the optional parameter Minor Iteration Limit. You should check that there are no constraint redundancies. If the data for the constraints are accurate only to an absolute precision , you should ensure that the value of the optional parameter Linear Feasibility Tolerance is greater than . For example, if all elements of are of order unity and are accurate to only three decimal places, Linear Feasibility Tolerance should be at least .
No solution obtained. Linear constraints may be infeasible.
e05usf has failed to find any solutions. The majority of local optimizations could not find a feasible point for the nonlinear constraints. The problem may have no feasible solution. This behaviour will occur if there is no feasible point for the nonlinear constraints. (However, there is no general test that can determine whether a feasible point exists for a set of nonlinear constraints.)
No solution obtained. Nonlinear constraints may be infeasible.
e05usf has failed to find any solutions. The majority of local optimizations have failed because the limiting number of iterations have been reached.
No solution obtained. Many potential solutions reach iteration limit.
The user-supplied derivatives of the objective function and/or nonlinear constraints appear to be incorrect.
Large errors were found in the derivatives of the objective function and/or nonlinear constraints. This value of ifail will occur if the verification process indicated that at least one gradient or Jacobian element had no correct figures. You should refer to or enable the printed output to determine which elements are suspected to be in error.
As a first-step, you should check that the code for the objective and constraint values is correct – for example, by computing the function at a point where the correct value is known. However, care should be taken that the chosen point fully tests the evaluation of the function. It is remarkable how often the values or are used to test function evaluation procedures, and how often the special properties of these numbers make the test meaningless.
Gradient checking will be ineffective if the objective function uses information computed by the constraints, since they are not necessarily computed before each function evaluation.
Errors in programming the function may be quite subtle in that the function value is ‘almost’ correct. For example, the function may not be accurate to full precision because of the inaccurate calculation of a subsidiary quantity, or the limited accuracy of data upon which the function depends. A common error on machines where numerical calculations are usually performed in double precision is to include even one single precision constant in the calculation of the function; since some compilers do not convert such constants to double precision, half the correct figures may be lost by such a seemingly trivial error.
Only solutions obtained.
Not all nb solutions have been found. contains the number actually found.
User terminated computation from start procedure: .
If e05ucz has been used as an actual argument for start then the message displayed, when or on entry to e05usf, will have the following meaning:
failure to allocate space, a smaller value of NPTS should be tried.
an internal error has occurred. Please contact NAG for assistance.
Failed to initialize optional parameter arrays.
An unexpected error has been triggered by this routine. Please
contact NAG.
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.
7Accuracy
If on exit and the value of , then the vector returned in the array x for solution is an estimate of the solution to an accuracy of approximately
Optimality Tolerance.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
e05usf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library. In these implementations, this routine may make calls to the user-supplied functions from within an OpenMP parallel region. Thus OpenMP directives within the user functions can only be used if you are compiling the user-supplied function and linking the executable in accordance with the instructions in the Users' Note for your implementation. The user workspace arrays iuser and ruser are classified as OpenMP shared memory and use of iuser and ruser has to take account of this in order to preserve thread safety whenever information is written back to either of these arrays. If at all possible, it is recommended that these arrays are only used to supply read-only data to the user functions when a multithreaded implementation is being used.
e05usf 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.
9Further Comments
You should be wary of requesting much intermediate output from the local optimizer, since large volumes may be produced if npts is large.
The auxiliary routine e05ucz
makes use of the NAG quasi-random Sobol generator (g05ylfandg05ymf). If
e05ucz
is used as the actual argument for start and then a randomly chosen value for iskip is used, otherwise iskip is set to . If repeat1 is set to .FALSE. and the program is executed several times, each time producing the same best answer, then there is increased probability that this answer is a global minimum. However, if it is important that identical results be obtained on successive runs, then repeat1 should be set to .TRUE..
Several optional parameters in e05usf define choices in the problem specification or the algorithm logic. In order to reduce the number of formal arguments of e05usf these optional parameters have associated default values that are appropriate for most problems. Therefore, you need only specify those optional parameters whose values are to be different from their default values.
Optional parameters may be specified by calling e05zkf before a call to e05usf. Before calling e05usf, the optional parameter arrays iopts and optsmust
be initialized for use with e05usf by calling e05zkf with optstr set to ‘Initialize = e05usf’.
All optional parameters not specified are set to their default values. Optional parameters specified are unaltered by e05usf (unless they define invalid values) and so remain in effect for subsequent calls to e05usf.
See Section 12 in e04usf/e04usa for full details.
e05usf supports two options that are distinct from those of e04usf/e04usa:
Punch Unit
Default
This option allows you to send information arising from an appropriate setting of Out_Level to be sent to
the Fortran unit number defined by
Punch Unit. If you wish this file to be different to the standard output unit () where other output is displayed then this file should be attached by calling x04acf prior to calling e05usf.
Out_Level
Default
This option defines the amount of extra information to be sent to
the Fortran unit number defined by
Punch Unit. The possible choices for are the following:
Meaning
0
No extra output.
1
Updated solutions only. This is useful during long runs to observe progress.
2
Successful start points only. This is useful to save the starting points that gave rise to the final solution.
3
Both updated solutions and successful start points.