NAG Library Routine Document
E05USF
1 Purpose
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.
2 Specification
SUBROUTINE E05USF ( 
M, N, NCLIN, NCNLN, A, LDA, BL, BU, Y, CONFUN, OBJFUN, NPTS, X, LDX, START, REPEAT1, NB, OBJF, F, FJAC, LDFJAC, SDFJAC, ITER, C, LDC, CJAC, LDCJAC, SDCJAC, CLAMDA, LDCLDA, ISTATE, LISTAT, IOPTS, OPTS, IUSER, RUSER, INFO, IFAIL) 
INTEGER 
M, N, NCLIN, NCNLN, LDA, NPTS, LDX, NB, LDFJAC, SDFJAC, ITER(NB), LDC, LDCJAC, SDCJAC, LDCLDA, ISTATE(LISTAT,*), LISTAT, IOPTS(740), IUSER(*), INFO(NB), IFAIL 
REAL (KIND=nag_wp) 
A(LDA,*), BL(N+NCLIN+NCNLN), BU(N+NCLIN+NCNLN), Y(M), X(LDX,*), OBJF(NB), F(M,*), FJAC(LDFJAC,SDFJAC,*), C(LDC,*), CJAC(LDCJAC,SDCJAC,*), CLAMDA(LDCLDA,*), OPTS(485), RUSER(*) 
LOGICAL 
REPEAT1 
EXTERNAL 
CONFUN, OBJFUN, START 

Before calling E05USF, the optional parameter arrays
IOPTS and
OPTS
must
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.
3 Description
The local minimization method is
E04USA. The problem is assumed to be stated in the following form:
where
$F\left(x\right)$ (the
objective function) is a nonlinear function which can be represented as the sum of squares of
$m$ subfunctions
$\left({y}_{1}{f}_{1}\left(x\right)\right),\left({y}_{2}{f}_{2}\left(x\right)\right),\dots ,\left({y}_{m}{f}_{m}\left(x\right)\right)$, the
${y}_{i}$ are constant,
${A}_{L}$ is an
${n}_{L}$ by
$n$ constant linear constraint matrix, and
$c\left(x\right)$ is an
${n}_{N}$ element vector of nonlinear constraint functions. (The matrix
${A}_{L}$ and the vector
$c\left(x\right)$ may be empty.) The objective function and the constraint functions are assumed to be smooth, i.e., at least twicecontinuously differentiable. (The method of
E04USA will usually solve
(1) if any isolated discontinuities are away from the solution.)
E05USF solves a userspecified 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 parameter
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
$1$ 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.
4 References
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 Systems 187 Springer–Verlag
5 Parameters
 1: M – INTEGERInput
On entry: $m$, the number of subfunctions associated with $F\left(x\right)$.
Constraint:
${\mathbf{M}}>0$.
 2: N – INTEGERInput
On entry: $n$, the number of variables.
Constraint:
${\mathbf{N}}>0$.
 3: NCLIN – INTEGERInput
On entry: ${n}_{L}$, the number of general linear constraints.
Constraint:
${\mathbf{NCLIN}}\ge 0$.
 4: NCNLN – INTEGERInput
On entry: ${n}_{N}$, the number of nonlinear constraints.
Constraint:
${\mathbf{NCNLN}}\ge 0$.
 5: A(LDA,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array
A
must be at least
${\mathbf{N}}$ if
${\mathbf{NCLIN}}>0$, and at least
$1$ otherwise.
On entry: the matrix
${A}_{L}$ of general linear constraints in
(1). That is, the
$\mathit{i}$th row contains the coefficients of the
$\mathit{i}$th general linear constraint, for
$\mathit{i}=1,2,\dots ,{\mathbf{NCLIN}}$.
If
${\mathbf{NCLIN}}=0$, the array
A is not referenced.
 6: LDA – INTEGERInput
On entry: the first dimension of the array
A as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{LDA}}\ge {\mathbf{NCLIN}}$.
 7: BL(${\mathbf{N}}+{\mathbf{NCLIN}}+{\mathbf{NCNLN}}$) – REAL (KIND=nag_wp) arrayInput
 8: BU(${\mathbf{N}}+{\mathbf{NCLIN}}+{\mathbf{NCNLN}}$) – 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
$n$ elements of each array must contain the bounds on the variables, the next
${n}_{L}$ elements the bounds for the general linear constraints (if any) and the next
${n}_{N}$ elements the bounds for the general nonlinear constraints (if any). To specify a nonexistent lower bound (i.e.,
${l}_{j}=\infty $), set
${\mathbf{BL}}\left(j\right)\le \mathit{bigbnd}$, and to specify a nonexistent upper bound (i.e.,
${u}_{j}=+\infty $), set
${\mathbf{BU}}\left(j\right)\ge \mathit{bigbnd}$; the default value of
$\mathit{bigbnd}$ is
${10}^{20}$, but this may be changed by the optional parameter
Infinite Bound Size. To specify the
$j$th constraint as an equality, set
${\mathbf{BL}}\left(j\right)={\mathbf{BU}}\left(j\right)=\beta $, say, where
$\left\beta \right<\mathit{bigbnd}$.
Constraints:
 ${\mathbf{BL}}\left(\mathit{j}\right)\le {\mathbf{BU}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}+{\mathbf{NCLIN}}+{\mathbf{NCNLN}}$;
 if ${\mathbf{BL}}\left(j\right)={\mathbf{BU}}\left(j\right)=\beta $, $\left\beta \right<\mathit{bigbnd}$.
 9: Y(M) – REAL (KIND=nag_wp) arrayInput
On entry: the coefficients of the constant vector $y$ of the objective function.
 10: CONFUN – SUBROUTINE, supplied by the NAG Library or the user.External Procedure
CONFUN must calculate the vector
$c\left(x\right)$ of nonlinear constraint functions and (optionally) its Jacobian (
$\text{}=\frac{\partial c}{\partial x}$) for a specified
$n$element vector
$x$. If there are no nonlinear constraints (i.e.,
${\mathbf{NCNLN}}=0$),
CONFUN will never be called by E05USF and
CONFUN may be the dummy routine E04UDM. (E04UDM is included in the NAG Library.) If there are nonlinear constraints, the first call to
CONFUN will occur before the first call to
OBJFUN.
The specification of
CONFUN is:
SUBROUTINE CONFUN ( 
MODE, NCNLN, N, LDCJSL, NEEDC, X, C, CJSL, NSTATE, IUSER, RUSER) 
INTEGER 
MODE, NCNLN, N, LDCJSL, NEEDC(NCNLN), NSTATE, IUSER(*) 
REAL (KIND=nag_wp) 
X(N), C(NCNLN), CJSL(LDCJSL,*), RUSER(*) 

 1: MODE – INTEGERInput/Output
On entry: indicates which values must be assigned during each call of
CONFUN. Only the following values need be assigned, for each value of
$i$ such that
${\mathbf{NEEDC}}\left(i\right)>0$:
 ${\mathbf{MODE}}=0$
 ${\mathbf{C}}\left(i\right)$, the $i$th nonlinear constraint.
 ${\mathbf{MODE}}=1$
 All available elements in the $i$th row of CJSL.
 ${\mathbf{MODE}}=2$
 ${\mathbf{C}}\left(i\right)$ and all available elements in the $i$th row of CJSL.
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: NCNLN – INTEGERInput
On entry: ${n}_{N}$, the number of nonlinear constraints.
 3: N – INTEGERInput
On entry: $n$, the number of variables.
 4: LDCJSL – INTEGERInput
On entry:
LDCJSL is the first dimension of the array
CJSL.
 5: NEEDC(NCNLN) – INTEGER arrayInput
On entry: the indices of the elements of
C and/or
CJSL that must be evaluated by
CONFUN. If
${\mathbf{NEEDC}}\left(i\right)>0$,
${\mathbf{C}}\left(i\right)$ and/or the available elements of the
$i$th row of
CJSL (see parameter
MODE) must be evaluated at
$x$.
 6: X(N) – REAL (KIND=nag_wp) arrayInput
On entry: $x$, the vector of variables at which the constraint functions and/or the available elements of the constraint Jacobian are to be evaluated.
 7: C(NCNLN) – REAL (KIND=nag_wp) arrayOutput
On exit: if
${\mathbf{NEEDC}}\left(i\right)>0$ and
${\mathbf{MODE}}=0$ or
$2$,
${\mathbf{C}}\left(i\right)$ must contain the value of
${c}_{i}\left(x\right)$. The remaining elements of
C, corresponding to the nonpositive elements of
NEEDC, need not be set.
 8: CJSL(LDCJSL,$*$) – REAL (KIND=nag_wp) arrayInput/Output
CJSL may be regarded as a twodimensional ‘slice’ of the threedimensional array
CJAC of E05USF.
On entry: unless
${\mathbf{Derivative\; Level}}=2$ or
$3$, the elements of
CJSL are set to special values which enable E05USF to detect whether they are changed by
CONFUN.
On exit: if
${\mathbf{NEEDC}}\left(i\right)>0$ and
${\mathbf{MODE}}=1$ or
$2$, the
$i$th row of
CJSL must contain the available elements of the vector
$\nabla {c}_{i}$ given by
where
$\frac{\partial {c}_{i}}{\partial {x}_{j}}$ is the partial derivative of the
$i$th constraint with respect to the
$j$th variable, evaluated at the point
$x$. See also the parameter
NSTATE. The remaining rows of
CJSL, corresponding to nonpositive elements of
NEEDC, need not be set.
If all elements of the constraint Jacobian are known (i.e.,
${\mathbf{Derivative\; Level}}=2$ or
$3$; note the default is
${\mathbf{Derivative\; Level}}=3$), 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
${\mathbf{NSTATE}}=1$). 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
${\mathbf{CJSL}}\left(i,j\right)$ is set to a constant value, it need not be reset in subsequent calls to
CONFUN, but the value
${\mathbf{CJSL}}\left(i,j\right)\times {\mathbf{X}}\left(j\right)$ must nonetheless be added to
${\mathbf{C}}\left(i\right)$. For example, if
${\mathbf{CJSL}}\left(1,1\right)=2$ and
${\mathbf{CJSL}}\left(1,2\right)=5$ then the term
$2\times {\mathbf{X}}\left(1\right)5\times {\mathbf{X}}\left(2\right)$ must be included in the definition of
${\mathbf{C}}\left(1\right)$.
It must be emphasized that, if
${\mathbf{Derivative\; Level}}=0$ or
$1$, 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
$x$ 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: NSTATE – INTEGERInput
On entry: if
${\mathbf{NSTATE}}=1$ then E05USF is calling
CONFUN for the first time on the current local optimization problem. This parameter setting allows you to save computation time if certain data must be read or calculated only once.
 10: IUSER($*$) – INTEGER arrayUser Workspace
 11: RUSER($*$) – REAL (KIND=nag_wp) arrayUser Workspace

CONFUN is called with the parameters
IUSER and
RUSER as supplied to E05USF. You are free to use the arrays
IUSER and
RUSER to supply information to
CONFUN as an alternative to using COMMON global variables.
CONFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E05USF is called. Parameters denoted as
Input must
not be changed by this procedure.
CONFUN should be tested separately before being used in conjunction with E05USF. See also the description of the optional parameter
Verify.
 11: OBJFUN – SUBROUTINE, supplied by the user.External Procedure
OBJFUN must calculate either the
$i$th element of the vector
$f\left(x\right)={\left({f}_{1}\left(x\right),{f}_{2}\left(x\right),\dots ,{f}_{m}\left(x\right)\right)}^{\mathrm{T}}$ or all
$m$ elements of
$f\left(x\right)$ and (optionally) its Jacobian (
$\text{}=\frac{\partial f}{\partial x}$) for a specified
$n$element vector
$x$.
The specification of
OBJFUN is:
SUBROUTINE OBJFUN ( 
MODE, M, N, LDFJSL, NEEDFI, X, F, FJSL, NSTATE, IUSER, RUSER) 
INTEGER 
MODE, M, N, LDFJSL, NEEDFI, NSTATE, IUSER(*) 
REAL (KIND=nag_wp) 
X(N), F(M), FJSL(LDFJSL,*), RUSER(*) 

 1: MODE – INTEGERInput/Output
On entry: indicates which values must be assigned during each call of
OBJFUN. Only the following values need be assigned:
 ${\mathbf{MODE}}=0$ and ${\mathbf{NEEDFI}}=i$, where $i>0$
 ${\mathbf{F}}\left(i\right)$.
 ${\mathbf{MODE}}=0$ and ${\mathbf{NEEDFI}}<0$
 F.
 ${\mathbf{MODE}}=1$ and ${\mathbf{NEEDFI}}<0$
 All available elements of FJSL.
 ${\mathbf{MODE}}=2$ and ${\mathbf{NEEDFI}}<0$
 F and all available elements of FJSL.
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: M – INTEGERInput
On entry: $m$, the number of subfunctions.
 3: N – INTEGERInput
On entry: $n$, the number of variables.
 4: LDFJSL – INTEGERInput
On entry:
LDFJSL is the first dimension of the array
FJSL.
 5: NEEDFI – INTEGERInput
On entry: if ${\mathbf{NEEDFI}}=i>0$, only the $i$th element of $f\left(x\right)$ needs to be evaluated at $x$; the remaining elements need not be set. This can result in significant computational savings when $m\gg n$.
 6: X(N) – REAL (KIND=nag_wp) arrayInput
On entry: $x$, the vector of variables at which the objective function and/or all available elements of its gradient are to be evaluated.
 7: F(M) – REAL (KIND=nag_wp) arrayOutput
On exit: if
${\mathbf{MODE}}=0$ and
${\mathbf{NEEDFI}}=i>0$,
${\mathbf{F}}\left(i\right)$ must contain the value of
${f}_{i}$ at
$x$.
If ${\mathbf{MODE}}=0$ or $2$ and ${\mathbf{NEEDFI}}<0$,
${\mathbf{F}}\left(\mathit{i}\right)$ must contain the value of ${f}_{\mathit{i}}$ at $x$, for $\mathit{i}=1,2,\dots ,m$.
 8: FJSL(LDFJSL,$*$) – REAL (KIND=nag_wp) arrayInput/Output
FJSL may be regarded as a twodimensional ‘slice’ of the threedimensional array
FJAC of E05USF.
On entry: is set to a special value.
On exit: if
${\mathbf{MODE}}=1$ or
$2$ and
${\mathbf{NEEDFI}}<0$, the
$i$th row of
FJSL must contain the available elements of the vector
$\nabla {f}_{i}$ given by
evaluated at the point
$x$. See also the parameter
NSTATE.
 9: NSTATE – INTEGERInput
On entry: if
${\mathbf{NSTATE}}=1$ then E05USF is calling
OBJFUN for the first time on the current local optimization problem. This parameter setting allows you to save computation time if certain data must be read or calculated only once.
 10: IUSER($*$) – INTEGER arrayUser Workspace
 11: RUSER($*$) – REAL (KIND=nag_wp) arrayUser Workspace

OBJFUN is called with the parameters
IUSER and
RUSER as supplied to E05USF. You are free to use the arrays
IUSER and
RUSER to supply information to
OBJFUN as an alternative to using COMMON global variables.
OBJFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E05USF is called. Parameters denoted as
Input must
not be changed by this procedure.
OBJFUN should be tested separately before being used in conjunction with E05USF. See also the description of the optional parameter
Verify.
 12: NPTS – 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:
$1\le {\mathbf{NB}}\le {\mathbf{NPTS}}$.
 13: X(LDX,$*$) – REAL (KIND=nag_wp) arrayOutput

Note: the second dimension of the array
X
must be at least
${\mathbf{NB}}$.
On exit: ${\mathbf{X}}\left(\mathit{j},i\right)$ contains the final estimate of the $i$th solution, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}$.
 14: LDX – INTEGERInput
On entry: the first dimension of the array
X as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{LDX}}\ge {\mathbf{N}}$.
 15: START – 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 quasirandom number generators to distribute starting points uniformly across the domain. It is affected by the value of
REPEAT1.
The specification of
START is:
INTEGER 
NPTS, N, IUSER(*), MODE 
REAL (KIND=nag_wp) 
QUAS(N,NPTS), BL(N), BU(N), RUSER(*) 
LOGICAL 
REPEAT1 

 1: NPTS – INTEGERInput
On entry: indicates the number of starting points.
 2: QUAS(N,NPTS) – 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.,
${\mathbf{QUAS}}\left(j,i\right)$ must contain the
$j$th component of the
$i$th starting point.
 3: N – INTEGERInput
On entry: the number of variables.
 4: REPEAT1 – LOGICALInput
On entry: specifies whether a repeatable or nonrepeatable sequence of points are to be generated.
 5: BL(N) – 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: BU(N) – REAL (KIND=nag_wp) arrayInput
On entry: the upper bounds on the variables. (See
BL.)
 7: IUSER($*$) – INTEGER arrayUser Workspace
 8: RUSER($*$) – REAL (KIND=nag_wp) arrayUser Workspace

START is called with the parameters
IUSER and
RUSER as supplied to E05USF. You are free to use the arrays
IUSER and
RUSER to supply information to
START as an alternative to using COMMON global variables.
 9: MODE – INTEGERInput/Output
On entry:
MODE will contain
$0$.
On exit: if you set
MODE to a negative value then E05USF will terminate immediately with
${\mathbf{IFAIL}}={\mathbf{9}}$.
START must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E05USF is called. Parameters denoted as
Input must
not be changed by this procedure.
 16: REPEAT1 – LOGICALInput

On entry: is passed as an argument to
START and may be used to initialize a random number generator to a repeatable, or nonrepeatable, sequence. See
Section 8 for more detail.
 17: NB – 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
$1$. However, if you want to look at other solutions that may have desirable properties then setting
${\mathbf{NB}}>1$ will produce
NB local minima, ordered by increasing value of their objective functions at the minima.
Constraint:
$1\le {\mathbf{NB}}\le {\mathbf{NPTS}}$.
 18: OBJF(NB) – REAL (KIND=nag_wp) arrayOutput
On exit: ${\mathbf{OBJF}}\left(i\right)$ contains the value of the objective function at the final iterate for the $i$th solution.
 19: F(M,$*$) – REAL (KIND=nag_wp) arrayOutput

Note: the second dimension of the array
F
must be at least
${\mathbf{NB}}$.
On exit: ${\mathbf{F}}\left(\mathit{j},i\right)$ contains the value of the $\mathit{j}$th function ${f}_{j}$ at the final iterate, for $\mathit{j}=1,2,\dots ,{\mathbf{M}}$,
for the $\mathit{i}$th solution, for $\mathit{i}=1,2,\dots ,{\mathbf{NB}}$.
 20: FJAC(LDFJAC,SDFJAC,$*$) – REAL (KIND=nag_wp) arrayOutput

Note: the last dimension of the array
FJAC
must be at least
${\mathbf{NB}}$.
On exit: for the
$i$th returned solution, the Jacobian matrix of the functions
${f}_{1},{f}_{2},\dots ,{f}_{m}$ at the final iterate, i.e.,
${\mathbf{FJAC}}\left(\mathit{k},\mathit{j},\mathit{i}\right)$ contains the partial derivative of the
$\mathit{k}$th function with respect to the
$\mathit{j}$th variable, for
$\mathit{k}=1,2,\dots ,{\mathbf{M}}$,
$\mathit{j}=1,2,\dots ,{\mathbf{N}}$ and
$\mathit{i}=1,2,\dots ,{\mathbf{NB}}$. (See also the discussion of parameter
FJSL under
OBJFUN.)
 21: LDFJAC – INTEGERInput
On entry: the first dimension of the array
FJAC as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{LDFJAC}}\ge {\mathbf{M}}$.
 22: SDFJAC – INTEGERInput
On entry: the second dimension of the array
FJAC as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{SDFJAC}}\ge {\mathbf{N}}$.
 23: ITER(NB) – INTEGER arrayOutput
On exit:
${\mathbf{ITER}}\left(i\right)$ contains the number of major iterations performed to obtain the
$i$th solution. If less than
NB solutions are returned then
${\mathbf{ITER}}\left({\mathbf{NB}}\right)$ 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: C(LDC,$*$) – REAL (KIND=nag_wp) arrayOutput
Note: the second dimension of the array
C
must be at least
${\mathbf{NB}}$.
On exit: if
${\mathbf{NCNLN}}>0$,
${\mathbf{C}}\left(\mathit{j},\mathit{i}\right)$ contains the value of the
$\mathit{j}$th nonlinear constraint function
${c}_{\mathit{j}}$ at the final iterate, for the
$\mathit{i}$th solution, for
$\mathit{j}=1,2,\dots ,{\mathbf{NCNLN}}$.
If
${\mathbf{NCNLN}}=0$, the array
C is not referenced.
 25: LDC – INTEGERInput
On entry: the first dimension of the array
C as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{LDC}}\ge {\mathbf{NCNLN}}$.
 26: CJAC(LDCJAC,SDCJAC,$*$) – REAL (KIND=nag_wp) arrayOutput

Note: the last dimension of the array
CJAC
must be at least
${\mathbf{NB}}$.
On exit: if
${\mathbf{NCNLN}}>0$,
CJAC contains the Jacobian matrices of the nonlinear constraint functions at the final iterate for each of the returned solutions, i.e.,
${\mathbf{CJAC}}\left(\mathit{k},\mathit{j},i\right)$ contains the partial derivative of the
$\mathit{k}$th constraint function with respect to the
$\mathit{j}$th variable, for
$\mathit{k}=1,2,\dots ,{\mathbf{NCNLN}}$ and
$\mathit{j}=1,2,\dots ,{\mathbf{N}}$, for the
$i$th solution. (See the discussion of parameter
CJSL under
CONFUN.)
If
${\mathbf{NCNLN}}=0$, the array
CJAC is not referenced.
 27: LDCJAC – INTEGERInput
On entry: the first dimension of the array
CJAC as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{LDCJAC}}\ge {\mathbf{NCNLN}}$.
 28: SDCJAC – INTEGERInput
On entry: the second dimension of the array
CJAC as declared in the (sub)program from which E05USF is called.
Constraint:
if ${\mathbf{NCNLN}}>0$, ${\mathbf{SDCJAC}}\ge {\mathbf{N}}$.
 29: CLAMDA(LDCLDA,$*$) – REAL (KIND=nag_wp) arrayOutput

Note: the second dimension of the array
CLAMDA
must be at least
${\mathbf{NB}}$.
On exit: the values of the QP multipliers from the last QP subproblem solved for the $i$th solution. ${\mathbf{CLAMDA}}\left(j,i\right)$ should be nonnegative if ${\mathbf{ISTATE}}\left(j,i\right)=1$ and nonpositive if ${\mathbf{ISTATE}}\left(j,i\right)=2$.
 30: LDCLDA – INTEGERInput
On entry: the first dimension of the array
CLAMDA as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{LDCLDA}}\ge {\mathbf{N}}+{\mathbf{NCLIN}}+{\mathbf{NCNLN}}$.
 31: ISTATE(LISTAT,$*$) – INTEGER arrayOutput

Note: the second dimension of the array
ISTATE
must be at least
${\mathbf{NB}}$.
On exit:
${\mathbf{ISTATE}}\left(j,i\right)$ contains the status of the constraints in the QP working set for the
$i$th solution. The significance of each possible value of
${\mathbf{ISTATE}}\left(j,i\right)$ is as follows:
${\mathbf{ISTATE}}\left(j,i\right)$ 
Meaning 
$\phantom{}0$ 
The constraint is satisfied to within the feasibility tolerance, but is not in the QP working set. 
$\phantom{}1$ 
This inequality constraint is included in the QP working set at its lower bound. 
$\phantom{}2$ 
This inequality constraint is included in the QP working set at its upper bound. 
$\phantom{}3$ 
This constraint is included in the QP working set as an equality. This value of ISTATE can occur only when ${\mathbf{BL}}\left(j\right)={\mathbf{BU}}\left(j\right)$. 
 32: LISTAT – INTEGERInput
On entry: the first dimension of the array
ISTATE as declared in the (sub)program from which E05USF is called.
Constraint:
${\mathbf{LISTAT}}\ge {\mathbf{N}}+{\mathbf{NCLIN}}+{\mathbf{NCNLN}}$.
 33: IOPTS($740$) – INTEGER arrayCommunication Array
 34: OPTS($485$) – REAL (KIND=nag_wp) arrayCommunication Array
The arrays
IOPTS and
OPTS must not be altered between calls to any of the routines E05USF and
E05ZKF.
 35: IUSER($*$) – INTEGER arrayUser Workspace
 36: RUSER($*$) – 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 as an alternative to using COMMON global variables.
With SMPenabled 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: INFO(NB) – INTEGER arrayOutput

On exit: if
${\mathbf{IFAIL}}>0$,
${\mathbf{INFO}}\left(i\right)$ contains an error value returned by
E04USF/E04USA; in which case please refer to that routine document for a detailed explanation.
If
${\mathbf{IFAIL}}={\mathbf{8}}$ on exit, then not all
NB solutions have been found, and
${\mathbf{INFO}}\left({\mathbf{NB}}\right)$ contains the number of solutions actually found.
 38: IFAIL – INTEGERInput/Output

On entry:
IFAIL must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is
$1$.
When the value $\mathbf{1}\text{ or}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).
6 Error Indicators and Warnings
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${{\mathbf{1}}}$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: E05USF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
 ${\mathbf{IFAIL}}=1$
An input value is incorrect. One or more of the following requirements are violated:

On entry, ${\mathbf{BL}}\left(i\right)>{\mathbf{BU}}\left(i\right)$: $i=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{BL}}\left(i\right)\le {\mathbf{BU}}\left(i\right)$, for all $i$.

On entry, ${\mathbf{LDA}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{NCLIN}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{LDA}}\ge {\mathbf{NCLIN}}$.

On entry, ${\mathbf{LDC}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{NCNLN}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{LDC}}\ge {\mathbf{NCNLN}}$.

On entry, ${\mathbf{LDCJAC}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{NCNLN}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{LDCJAC}}\ge {\mathbf{NCNLN}}$.

On entry, ${\mathbf{LDCLDA}}=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{N}}=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{NCLIN}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{NCNLN}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{LDCLDA}}\ge {\mathbf{N}}+{\mathbf{NCLIN}}+{\mathbf{NCNLN}}$.

On entry, ${\mathbf{LDFJAC}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{M}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{LDFJAC}}\ge {\mathbf{M}}$.

On entry, ${\mathbf{LDX}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{N}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{LDX}}\ge {\mathbf{N}}$.

On entry, ${\mathbf{LISTAT}}=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{N}}=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{NCLIN}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{NCNLN}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{LISTAT}}\ge {\mathbf{N}}+{\mathbf{NCLIN}}+{\mathbf{NCNLN}}$.

On entry, ${\mathbf{M}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{M}}>0$.

On entry, ${\mathbf{N}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{N}}>0$.

On entry, ${\mathbf{NB}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{NPTS}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: $1\le {\mathbf{NB}}\le {\mathbf{NPTS}}$.

On entry, ${\mathbf{NCLIN}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{NCLIN}}\ge 0$.

On entry, ${\mathbf{NCNLN}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{NCNLN}}\ge 0$.

On entry, ${\mathbf{NCNLN}}>0$, ${\mathbf{SDCJAC}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{N}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: if ${\mathbf{NCNLN}}>0$, ${\mathbf{SDCJAC}}\ge {\mathbf{N}}$.

On entry, ${\mathbf{SDFJAC}}=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{N}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{SDFJAC}}\ge {\mathbf{N}}$.
 ${\mathbf{IFAIL}}=2$
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
$\sqrt{\mathit{macheps}}$, where
$\mathit{macheps}$ 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
$\sigma $, you should ensure that the value of the optional parameter
Linear Feasibility Tolerance is greater than
$\sigma $. For example, if all elements of
${A}_{L}$ are of order unity and are accurate to only three decimal places,
Linear Feasibility Tolerance should be at least
${10}^{3}$.
No solution obtained. Linear constraints may be infeasible.
 ${\mathbf{IFAIL}}=3$
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.
 ${\mathbf{IFAIL}}=4$
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.
 ${\mathbf{IFAIL}}=7$

Usersupplied derivatives probably wrong.
The usersupplied 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 firststep, 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 $x=0$ or $x=1$ 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.
 ${\mathbf{IFAIL}}=8$

Only
$\u27e8\mathit{\text{value}}\u27e9$ solutions obtained.
Not all
NB solutions have been found.
${\mathbf{INFO}}\left({\mathbf{NB}}\right)$ contains the number actually found.
 ${\mathbf{IFAIL}}=9$

User terminated computation from
START procedure:
${\mathbf{MODE}}=\u27e8\mathit{\text{value}}\u27e9$.
If E05UCZ has been used as an actual argument for
START then the message displayed, when
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${{\mathbf{1}}}$ on entry to E05USF, will have the following meaning:
$998$ 
failure to allocate space, a smaller value of NPTS should be tried. 
$997$ 
an internal error has occurred. Please contact NAG for assistance. 
 ${\mathbf{IFAIL}}=10$

Failed to initialize optional parameter arrays.
 ${\mathbf{IFAIL}}=999$

Dynamic memory allocation failed.
7 Accuracy
If
${\mathbf{IFAIL}}={\mathbf{0}}$ on exit and the value of
${\mathbf{INFO}}\left(i\right)=0$, then the vector returned in the array
X for solution
$i$ is an estimate of the solution to an accuracy of approximately
Optimality Tolerance.
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 quasirandom Sobol generator (
G05YLF and
G05YMF). If
E05UCZ
is used as the actual argument for
START (see the description of
START) and
${\mathbf{REPEAT1}}=\mathrm{.FALSE.}$ then a randomly chosen value for
ISKIP is used, otherwise
ISKIP is set to
$100$. 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..
8.1 Description of the Printed Output
See
Section 8.1 in E04USF/E04USA.
9 Example
This example is based on Problem 57 in
Hock and Schittkowski (1981) and involves the minimization of the sum of squares function
where
and
subject to the bounds
to the general linear constraint
and to the nonlinear constraint
The optimal solution (to five figures) is
and
$F\left({x}^{*}\right)=0.01423$. The nonlinear constraint is active at the solution.
The document for
E04UQF/E04UQA includes an example program to solve the same problem using some of the optional parameters described in
Section 11.
9.1 Program Text
Program Text (e05usfe.f90)
9.2 Program Data
Program Data (e05usfe.d)
9.3 Program Results
Program Results (e05usfe.r)
10 Algorithmic Details
See
Section 10 in E04USF/E04USA.
11 Optional Parameters
Several optional parameters in E05USF define choices in the problem specification or the algorithm logic. In order to reduce the number of formal parameters 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
OPTS
must
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 11 in E04USF/E04USA for full details.
The
Warm Start option of
E04USF/E04USA is not a valid option for use with E05USF.
12 Description of Monitoring Information
See
Section 12 in E04USF/E04USA.