Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_opt_nlp1_sparse_solve (e04ug)

## Purpose

nag_opt_nlp1_sparse_solve (e04ug) solves sparse nonlinear programming problems.

## Syntax

[a, ns, xs, istate, clamda, miniz, minz, ninf, sinf, obj, user, lwsav, iwsav, rwsav, ifail] = e04ug(confun, objfun, n, m, ncnln, nonln, njnln, iobj, a, ha, ka, bl, bu, start, names, ns, xs, istate, clamda, lwsav, iwsav, rwsav, 'nnz', nnz, 'nname', nname, 'leniz', leniz, 'lenz', lenz, 'user', user)
[a, ns, xs, istate, clamda, miniz, minz, ninf, sinf, obj, user, lwsav, iwsav, rwsav, ifail] = nag_opt_nlp1_sparse_solve(confun, objfun, n, m, ncnln, nonln, njnln, iobj, a, ha, ka, bl, bu, start, names, ns, xs, istate, clamda, lwsav, iwsav, rwsav, 'nnz', nnz, 'nname', nname, 'leniz', leniz, 'lenz', lenz, 'user', user)
Before calling nag_opt_nlp1_sparse_solve (e04ug), or the option setting function (e04uj), nag_opt_init (e04wb) must be called.
Note: the interface to this routine has changed since earlier releases of the toolbox:
Mark 22: lenz and leniz have been made optional
.

## Description

nag_opt_nlp1_sparse_solve (e04ug) is designed to solve a class of nonlinear programming problems that are assumed to be stated in the following general form:
minimize f(x)  subject to  l{
 x F(x) Gx
}
u,
xRn
$minimizex∈Rnf(x) subject to l≤{ x F(x) Gx } ≤u,$
(1)
where x = (x1,x2,,xn)T$x={\left({x}_{1},{x}_{2},\dots ,{x}_{n}\right)}^{\mathrm{T}}$ is a set of variables, f(x)$f\left(x\right)$ is a smooth scalar objective function, l$l$ and u$u$ are constant lower and upper bounds, F(x)$F\left(x\right)$ is a vector of smooth nonlinear constraint functions {Fi(x)}$\left\{{F}_{i}\left(x\right)\right\}$ and G$G$ is a sparse matrix.
The constraints involving F$F$ and Gx$Gx$ are called the general constraints. Note that upper and lower bounds are specified for all variables and constraints. This form allows full generality in specifying various types of constraint. In particular, the j$j$th constraint can be defined as an equality by setting lj = uj${l}_{j}={u}_{j}$. If certain bounds are not present, the associated elements of l$l$ or u$u$ can be set to special values that will be treated as $-\infty$ or + $+\infty$. (See the description of the optional parameter Infinite Bound Size.)
nag_opt_nlp1_sparse_solve (e04ug) converts the upper and lower bounds on the m$m$ elements of F$F$ and Gx$Gx$ to equalities by introducing a set of slack variables s$s$, where s = (s1,s2,,sm)T$s={\left({s}_{1},{s}_{2},\dots ,{s}_{m}\right)}^{\mathrm{T}}$. For example, the linear constraint 52x1 + 3x2 + $5\le 2{x}_{1}+3{x}_{2}\le +\infty$ is replaced by 2x1 + 3x2s1 = 0$2{x}_{1}+3{x}_{2}-{s}_{1}=0$, together with the bounded slack 5s1 + $5\le {s}_{1}\le +\infty$. The problem defined by (1) can therefore be re-written in the following equivalent form:
minimize f(x)  subject to  {
 Gx
}
s = 0,  l{
 x s
}
u.
xRn,sRm
$minimizex∈Rn,s∈Rmf(x) subject to { Gx }-s=0, l≤{ x s } ≤u.$
(2)
Since the slack variables s$s$ are subject to the same upper and lower bounds as the elements of F$F$ and Gx$Gx$, the bounds on F$F$ and Gx$Gx$ can simply be thought of as bounds on the combined vector (x,s)$\left(x,s\right)$. The elements of x$x$ and s$s$ are partitioned into basic, nonbasic and superbasic variables defined as follows:
 – a basic variable (xj${x}_{j}$ say) is the j$j$th variable associated with the j$j$th column of the basis matrix B$B$; – a nonbasic variable is a variable that is temporarily fixed at its current value (usually its upper or lower bound); – a superbasic variable is a nonbasic variable which is not at one of its bounds that is free to move in any desired direction (namely one that will improve the value of the objective function or reduce the sum of infeasibilities).
For example, in the simplex method (see Gill et al. (1981)) the elements of x$x$ can be partitioned at each vertex into a set of m$m$ basic variables (all non-negative) and a set of (nm)$\left(n-m\right)$ nonbasic variables (all zero). This is equivalent to partitioning the columns of the constraint matrix as
 ( B N )
$\left(\begin{array}{cc}B& N\end{array}\right)$, where B$B$ contains the m$m$ columns that correspond to the basic variables and N$N$ contains the (nm)$\left(n-m\right)$ columns that correspond to the nonbasic variables. Note that B$B$ is square and nonsingular.
The optional parameter Maximize may be used to specify an alternative problem in which f(x)$f\left(x\right)$ is maximized. If the objective function is nonlinear and all the constraints are linear, F$F$ is absent and the problem is said to be linearly constrained. In general, the objective and constraint functions are structured in the sense that they are formed from sums of linear and nonlinear functions. This structure can be exploited by the function during the solution process as follows.
Consider the following nonlinear optimization problem with four variables (u,v,z,w$u,v,z,w$):
 minimize (u + v + z)2 + 3z + 5w u,v,z,w
$minimizeu,v,z,w (u+v+z) 2+3z+5w$
subject to the constraints
 u2 + v2 + z + w = 2 u4 + v4 + z + w = 4 2u + 4v + z + w ≥ 0
$u2+v2+z +w= 2 u4+v4 +z+w= 4 2u+ 4v +z+w≥ 0$
and to the bounds
 z ≥ 0. w ≥ 0.
$z≥0. w≥0.$
This problem has several characteristics that can be exploited by the function:
 – the objective function is nonlinear. It is the sum of a nonlinear function of the variables (u,v,z$u,v,z$) and a linear function of the variables (z,w$z,w$); – the first two constraints are nonlinear. The third is linear; – each nonlinear constraint function is the sum of a nonlinear function of the variables (u,v$u,v$) and a linear function of the variables (z,w$z,w$).
The nonlinear terms are defined by objfun and confun (see Section [Parameters]), which involve only the appropriate subset of variables.
For the objective, we define the function f(u,v,z) = (u + v + z)2$f\left(u,v,z\right)={\left(u+v+z\right)}^{2}$ to include only the nonlinear part of the objective. The three variables (u,v,z$u,v,z$) associated with this function are known as the nonlinear objective variables. The number of them is given by nonln (see Section [Parameters]) and they are the only variables needed in objfun. The linear part 3z + 5w$3z+5w$ of the objective is stored in row iobj (see Section [Parameters]) of the (constraint) Jacobian matrix A$A$ (see below).
Thus, if x${x}^{\prime }$ and y${y}^{\prime }$ denote the nonlinear and linear objective variables, respectively, the objective may be re-written in the form
 f(x′) + cTx′ + dTy′, $f(x′)+cTx′+dTy′,$
where f(x)$f\left({x}^{\prime }\right)$ is the nonlinear part of the objective and c$c$ and d$d$ are constant vectors that form a row of A$A$. In this example, x = (u,v,z)${x}^{\prime }=\left(u,v,z\right)$ and y = w${y}^{\prime }=w$.
Similarly for the constraints, we define a vector function F(u,v)$F\left(u,v\right)$ to include just the nonlinear terms. In this example, F1(u,v) = u2 + v2${F}_{1}\left(u,v\right)={u}^{2}+{v}^{2}$ and F2(u,v) = u4 + v4${F}_{2}\left(u,v\right)={u}^{4}+{v}^{4}$, where the two variables (u,v$u,v$) are known as the nonlinear Jacobian variables. The number of them is given by njnln (see Section [Parameters]) and they are the only variables needed in confun. Thus, if x${x}^{\prime \prime }$ and y${y}^{\prime \prime }$ denote the nonlinear and linear Jacobian variables, respectively, the constraint functions and the linear part of the objective have the form
 ( F(x ′ ′ ) + A2y ′ ′ ) A3x ′ ′ + A4y ′ ′
,
$F(x′′)+A2y′′ A3x′′+A4y′′ ,$
(3)
where x = (u,v)${x}^{\prime \prime }=\left(u,v\right)$ and y = (z,w)${y}^{\prime \prime }=\left(z,w\right)$ in this example. This ensures that the Jacobian is of the form
A =
 ( J(x ′ ′ ) A2 ) A3 A4
,
$A= J(x′′) A2 A3 A4 ,$
where J(x) = (F(x))/(x) $J\left({x}^{\prime \prime }\right)=\frac{\partial F\left({x}^{\prime \prime }\right)}{\partial x}$. Note that J(x)$J\left({x}^{\prime \prime }\right)$ always appears in the top left-hand corner of A$A$.
The inequalities l1F(x) + A2yu1${l}_{1}\le F\left({x}^{\prime \prime }\right)+{A}_{2}{y}^{\prime \prime }\le {u}_{1}$ and l2A3x + A4yu2${l}_{2}\le {A}_{3}{x}^{\prime \prime }+{A}_{4}{y}^{\prime \prime }\le {u}_{2}$ implied by the constraint functions in (3) are known as the nonlinear and linear constraints, respectively. The nonlinear constraint vector F(x)$F\left({x}^{\prime \prime }\right)$ in (3) and (optionally) its partial derivative matrix J(x)$J\left({x}^{\prime \prime }\right)$ are set in confun. The matrices A2${A}_{2}$, A3${A}_{3}$ and A4${A}_{4}$ contain any (constant) linear terms. Along with the sparsity pattern of J(x)$J\left({x}^{\prime \prime }\right)$ they are stored in the arrays a, ha and ka (see Section [Parameters]).
In general, the vectors x${x}^{\prime }$ and x${x}^{\prime \prime }$ have different dimensions, but they always overlap, in the sense that the shorter vector is always the beginning of the other. In the above example, the nonlinear Jacobian variables (u,v)$\left(u,v\right)$ are an ordered subset of the nonlinear objective variables (u,v,z)$\left(u,v,z\right)$. In other cases it could be the other way round (whichever is the most convenient), but the first way keeps J(x)$J\left({x}^{\prime \prime }\right)$ as small as possible.
Note that the nonlinear objective function f(x)$f\left({x}^{\prime }\right)$ may involve either a subset or superset of the variables appearing in the nonlinear constraint functions F(x)$F\left({x}^{\prime \prime }\right)$. Thus, ${\mathbf{nonln}}\le {\mathbf{njnln}}$ (or vice-versa). Sometimes the objective and constraints really involve disjoint sets of nonlinear variables. In such cases the variables should be ordered so that ${\mathbf{nonln}}>{\mathbf{njnln}}$ and x = (x,x)${x}^{\prime }=\left({x}^{\prime \prime },{x}^{\prime \prime \prime }\right)$, where the objective is nonlinear in just the last vector x${x}^{\prime \prime \prime }$. The first njnln elements of the gradient array objgrd should also be set to zero in objfun. This is illustrated in Section [Example].
If all elements of the constraint Jacobian are known (i.e., the optional parameter ${\mathbf{Derivative Level}}=2$ or 3$3$), any constant elements may be assigned their correct values in a, ha and ka. The corresponding elements of the constraint Jacobian array fjac need not be reset in confun. This includes values that are identically zero as constraint Jacobian elements are assumed to be zero unless specified otherwise. It must be emphasized that, if ${\mathbf{Derivative Level}}=0$ or 1$1$, unassigned elements of fjac are not treated as constant; they are estimated by finite differences, at nontrivial expense.
If there are no nonlinear constraints in (1) and f(x)$f\left(x\right)$ is linear or quadratic, then it may be more efficient to use nag_opt_qpconvex2_sparse_solve (e04nq) to solve the resulting linear or quadratic programming problem, or one of nag_opt_lp_solve (e04mf), nag_opt_lsq_lincon_solve (e04nc) or nag_opt_qp_dense_solve (e04nf) if G$G$ is a dense matrix. If the problem is dense and does have nonlinear constraints then one of nag_opt_nlp1_rcomm (e04uf), nag_opt_lsq_gencon_deriv (e04us) or nag_opt_nlp2_solve (e04wd) (as appropriate) should be used instead.
You must supply an initial estimate of the solution to (1), together with versions of objfun and confun that define f(x)$f\left({x}^{\prime }\right)$ and F(x)$F\left({x}^{\prime \prime }\right)$, respectively, and as many first partial derivatives as possible. Note that if there are any nonlinear constraints, then the first call to confun will precede the first call to objfun.
nag_opt_nlp1_sparse_solve (e04ug) is based on the SNOPT package described in Gill et al. (2002), which in turn utilizes functions from the MINOS package (see Murtagh and Saunders (1995)). It incorporates a sequential quadratic programming (SQP) method that obtains search directions from a sequence of quadratic programming (QP) subproblems. Each QP subproblem minimizes a quadratic model of a certain Lagrangian function subject to a linearization of the constraints. An augmented Lagrangian merit function is reduced along each search direction to ensure convergence from any starting point. Further details can be found in Section [Algorithmic Details].
Throughout this document the symbol ε$\epsilon$ is used to represent the machine precision (see nag_machine_precision (x02aj)).

## References

Conn A R (1973) Constrained optimization using a nondifferentiable penalty function SIAM J. Numer. Anal. 10 760–779
Eldersveld S K (1991) Large-scale sequential quadratic programming algorithms PhD Thesis Department of Operations Research, Stanford University, Stanford
Fletcher R (1984) An l1${l}_{1}$ penalty method for nonlinear constraints Numerical Optimization 1984 (eds P T Boggs, R H Byrd and R B Schnabel) 26–40 SIAM Philadelphia
Fourer R (1982) Solving staircase linear programs by the simplex method Math. Programming 23 274–313
Gill P E, Murray W and Saunders M A (2002) SNOPT: An SQP Algorithm for Large-scale Constrained Optimization 12 979–1006 SIAM J. Optim.
Gill P E, Murray W, Saunders M A and Wright M H (1986) Users' guide for NPSOL (Version 4.0): a Fortran package for nonlinear programming Report SOL 86-2 Department of Operations Research, Stanford University
Gill P E, Murray W, Saunders M A and Wright M H (1989) A practical anti-cycling procedure for linearly constrained optimization Math. Programming 45 437–474
Gill P E, Murray W, Saunders M A and Wright M H (1992) Some theoretical properties of an augmented Lagrangian merit function Advances in Optimization and Parallel Computing (ed P M Pardalos) 101–128 North Holland
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
Murtagh B A and Saunders M A (1995) MINOS 5.4 users' guide Report SOL 83-20R Department of Operations Research, Stanford University
Ortega J M and Rheinboldt W C (1970) Iterative Solution of Nonlinear Equations in Several Variables Academic Press
Powell M J D (1974) Introduction to constrained optimization Numerical Methods for Constrained Optimization (eds P E Gill and W Murray) 1–28 Academic Press

## Parameters

### Compulsory Input Parameters

1:     confun – function handle or string containing name of m-file
confun must calculate the vector F(x)$F\left(x\right)$ of nonlinear constraint functions and (optionally) its Jacobian ( = (F)/(x)) $\left(=\frac{\partial F}{\partial x}\right)$ for a specified n1${n}_{1}^{\prime \prime }$ (n$\text{}\le n$) element vector x$x$. If there are no nonlinear constraints (i.e., ncnln = 0${\mathbf{ncnln}}=0$), confun will never be called by nag_opt_nlp1_sparse_solve (e04ug) and confun may be the string 'e04ugm'. (nag_opt_nlp1_sparse_dummy_confun (e04ugm) is included in the NAG Toolbox.) If there are nonlinear constraints, the first call to confun will occur before the first call to objfun.
[mode, f, fjac, user] = confun(mode, ncnln, njnln, nnzjac, x, fjac, nstate, user)

Input Parameters

1:     mode – int64int32nag_int scalar
Indicates which values must be assigned during each call of confun. Only the following values need be assigned:
mode = 0${\mathbf{mode}}=0$
f.
mode = 1${\mathbf{mode}}=1$
All available elements of fjac.
mode = 2${\mathbf{mode}}=2$
f and all available elements of fjac.
2:     ncnln – int64int32nag_int scalar
nN${n}_{N}$, the number of nonlinear constraints. These must be the first ncnln constraints in the problem.
3:     njnln – int64int32nag_int scalar
n1${n}_{1}^{\prime \prime }$, the number of nonlinear variables. These must be the first njnln variables in the problem.
4:     nnzjac – int64int32nag_int scalar
The number of nonzero elements in the constraint Jacobian. Note that nnzjac will usually be less than ${\mathbf{ncnln}}×{\mathbf{njnln}}$.
5:     x(njnln) – double array
x$x$, the vector of nonlinear Jacobian variables at which the nonlinear constraint functions and/or the available elements of the constraint Jacobian are to be evaluated.
6:     fjac(nnzjac) – double array
The elements of fjac are set to special values which enable nag_opt_nlp1_sparse_solve (e04ug) to detect whether they are changed by confun.
7:     nstate – int64int32nag_int scalar
If nstate = 1${\mathbf{nstate}}=1$, then nag_opt_nlp1_sparse_solve (e04ug) is calling confun for the first time. This parameter setting allows you to save computation time if certain data must be read or calculated only once.
If nstate2${\mathbf{nstate}}\ge 2$, then nag_opt_nlp1_sparse_solve (e04ug) is calling confun for the last time. This parameter setting allows you to perform some additional computation on the final solution. In general, the last call to confun is made with nstate = 2 + ifail${\mathbf{nstate}}=2+{\mathbf{ifail}}$ (see Section [Error Indicators and Warnings]).
Otherwise, nstate = 0${\mathbf{nstate}}=0$.
8:     user – Any MATLAB object
confun is called from nag_opt_nlp1_sparse_solve (e04ug) with the object supplied to nag_opt_nlp1_sparse_solve (e04ug).

Output Parameters

1:     mode – int64int32nag_int scalar
You may set to a negative value as follows:
mode2${\mathbf{mode}}\le -2$
The solution to the current problem is terminated and in this case nag_opt_nlp1_sparse_solve (e04ug) will terminate with ifail set to mode.
mode = 1${\mathbf{mode}}=-1$
The nonlinear constraint functions cannot be calculated at the current x$x$. nag_opt_nlp1_sparse_solve (e04ug) will then terminate with ifail = 1${\mathbf{ifail}}=-1$ unless this occurs during the linesearch; in this case, the linesearch will shorten the step and try again.
2:     f(ncnln) – double array
If mode = 0${\mathbf{mode}}=0$ or 2$2$, f(i)${\mathbf{f}}\left(i\right)$ must contain the value of the i$i$th nonlinear constraint function at x$x$.
3:     fjac(nnzjac) – double array
If mode = 1${\mathbf{mode}}=1$ or 2$2$, fjac must return the available elements of the constraint Jacobian evaluated at x$x$. These elements must be stored in exactly the same positions as implied by the definitions of the arrays a, ha and ka. If optional parameter ${\mathbf{Derivative Level}}=2$ or 3$3$, the value of any constant Jacobian element not defined by confun will be obtained directly from a. Note that the function does not perform any internal checks for consistency (except indirectly via the optional parameter Verify Level), so great care is essential.
4:     user – Any MATLAB object
2:     objfun – function handle or string containing name of m-file
objfun must calculate the nonlinear part of the objective function f(x)$f\left(x\right)$ and (optionally) its gradient ( = (f)/(x)) $\left(=\frac{\partial f}{\partial x}\right)$ for a specified n1${n}_{1}^{\prime }$ (n$\text{}\le n$) element vector x$x$. If there are no nonlinear objective variables (i.e., nonln = 0${\mathbf{nonln}}=0$), objfun will never be called by nag_opt_nlp1_sparse_solve (e04ug) and objfun may be the string 'e04ugn'. (nag_opt_nlp1_sparse_dummy_objfun (e04ugn) is included in the NAG Toolbox.)
[mode, objf, objgrd, user] = objfun(mode, nonln, x, objgrd, nstate, user)

Input Parameters

1:     mode – int64int32nag_int scalar
Indicates which values must be assigned during each call of objfun. Only the following values need be assigned:
mode = 0${\mathbf{mode}}=0$
objf.
mode = 1${\mathbf{mode}}=1$
All available elements of objgrd.
mode = 2${\mathbf{mode}}=2$
objf and all available elements of objgrd.
2:     nonln – int64int32nag_int scalar
n1${n}_{1}^{\prime }$, the number of nonlinear objective variables. These must be the first nonln variables in the problem.
3:     x(nonln) – double array
x$x$, the vector of nonlinear variables at which the nonlinear part of the objective function and/or all available elements of its gradient are to be evaluated.
4:     objgrd(nonln) – double array
The elements of objgrd are set to special values which enable nag_opt_nlp1_sparse_solve (e04ug) to detect whether they are changed by objfun.
5:     nstate – int64int32nag_int scalar
If nstate = 1${\mathbf{nstate}}=1$, nag_opt_nlp1_sparse_solve (e04ug) is calling objfun for the first time. This parameter setting allows you to save computation time if certain data must be read or calculated only once.
If nstate2${\mathbf{nstate}}\ge 2$, nag_opt_nlp1_sparse_solve (e04ug) is calling objfun for the last time. This parameter setting allows you to perform some additional computation on the final solution. In general, the last call to objfun is made with nstate = 2 + ifail${\mathbf{nstate}}=2+{\mathbf{ifail}}$ (see Section [Error Indicators and Warnings]).
Otherwise, nstate = 0${\mathbf{nstate}}=0$.
6:     user – Any MATLAB object
objfun is called from nag_opt_nlp1_sparse_solve (e04ug) with the object supplied to nag_opt_nlp1_sparse_solve (e04ug).

Output Parameters

1:     mode – int64int32nag_int scalar
You may set to a negative value as follows:
mode2${\mathbf{mode}}\le -2$
The solution to the current problem is terminated and in this case nag_opt_nlp1_sparse_solve (e04ug) will terminate with ifail set to mode.
mode = 1${\mathbf{mode}}=-1$
The nonlinear part of the objective function cannot be calculated at the current x$x$. nag_opt_nlp1_sparse_solve (e04ug) will then terminate with ifail = 1${\mathbf{ifail}}=-1$ unless this occurs during the linesearch; in this case, the linesearch will shorten the step and try again.
2:     objf – double scalar
If mode = 0${\mathbf{mode}}=0$ or 2$2$, objf must be set to the value of the objective function at x$x$.
3:     objgrd(nonln) – double array
If mode = 1${\mathbf{mode}}=1$ or 2$2$, objgrd must return the available elements of the gradient evaluated at x$x$.
4:     user – Any MATLAB object
3:     n – int64int32nag_int scalar
n$n$, the number of variables (excluding slacks). This is the number of columns in the full Jacobian matrix A$A$.
Constraint: n1${\mathbf{n}}\ge 1$.
4:     m – int64int32nag_int scalar
m$m$, the number of general constraints (or slacks). This is the number of rows in A$A$, including the free row (if any; see iobj). Note that A$A$ must contain at least one row. If your problem has no constraints, or only upper and lower bounds on the variables, then you must include a dummy ‘free’ row consisting of a single (zero) element subject to ‘infinite’ upper and lower bounds. Further details can be found under the descriptions for iobj, nnz, a, ha, ka, bl and bu.
Constraint: m1${\mathbf{m}}\ge 1$.
5:     ncnln – int64int32nag_int scalar
nN${n}_{N}$, the number of nonlinear constraints.
Constraint: 0ncnlnm$0\le {\mathbf{ncnln}}\le {\mathbf{m}}$.
6:     nonln – int64int32nag_int scalar
n1${n}_{1}^{\prime }$, the number of nonlinear objective variables. If the objective function is nonlinear, the leading n1${n}_{1}^{\prime }$ columns of A$A$ belong to the nonlinear objective variables. (See also the description for njnln.)
Constraint: 0nonlnn$0\le {\mathbf{nonln}}\le {\mathbf{n}}$.
7:     njnln – int64int32nag_int scalar
n1${n}_{1}^{\prime \prime }$, the number of nonlinear Jacobian variables. If there are any nonlinear constraints, the leading n1${n}_{1}^{\prime \prime }$ columns of A$A$ belong to the nonlinear Jacobian variables. If n1 > 0${n}_{1}^{\prime }>0$ and n1 > 0${n}_{1}^{\prime \prime }>0$, the nonlinear objective and Jacobian variables overlap. The total number of nonlinear variables is given by n = max (n1,n1)$\stackrel{-}{n}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({n}_{1}^{\prime },{n}_{1}^{\prime \prime }\right)$.
Constraints:
• if ncnln = 0${\mathbf{ncnln}}=0$, njnln = 0${\mathbf{njnln}}=0$;
• if ncnln > 0${\mathbf{ncnln}}>0$, 1njnlnn$1\le {\mathbf{njnln}}\le {\mathbf{n}}$.
8:     iobj – int64int32nag_int scalar
If ${\mathbf{iobj}}>{\mathbf{ncnln}}$, row iobj of A$A$ is a free row containing the nonzero elements of the linear part of the objective function.
iobj = 0${\mathbf{iobj}}=0$
There is no free row.
iobj = 1${\mathbf{iobj}}=-1$
There is a dummy ‘free’ row.
Constraints:
• if iobj > 0${\mathbf{iobj}}>0$, ${\mathbf{ncnln}}<{\mathbf{iobj}}\le {\mathbf{m}}$;
• otherwise iobj1${\mathbf{iobj}}\ge -1$.
9:     a(nnz) – double array
nnz, the dimension of the array, must satisfy the constraint 1nnzn × m$1\le {\mathbf{nnz}}\le {\mathbf{n}}×{\mathbf{m}}$.
The nonzero elements of the Jacobian matrix A$A$, ordered by increasing column index. Since the constraint Jacobian matrix J(x)$J\left({x}^{\prime \prime }\right)$ must always appear in the top left-hand corner of A$A$, those elements in a column associated with any nonlinear constraints must come before any elements belonging to the linear constraint matrix G$G$ and the free row (if any; see iobj).
In general, a is partitioned into a nonlinear part and a linear part corresponding to the nonlinear variables and linear variables in the problem. Elements in the nonlinear part may be set to any value (e.g., zero) because they are initialized at the first point that satisfies the linear constraints and the upper and lower bounds.
If ${\mathbf{Derivative Level}}=2$ or 3$3$, the nonlinear part may also be used to store any constant Jacobian elements. Note that if confun does not define the constant Jacobian element fjac(i)${\mathbf{fjac}}\left(i\right)$ then the missing value will be obtained directly from a(j)${\mathbf{a}}\left(j\right)$ for some ji$j\ge i$.
If ${\mathbf{Derivative Level}}=0$ or 1$1$, unassigned elements of fjac are not treated as constant; they are estimated by finite differences, at nontrivial expense.
The linear part must contain the nonzero elements of G$G$ and the free row (if any). If iobj = 1${\mathbf{iobj}}=-1$, set a(1) = 0${\mathbf{a}}\left(1\right)=0$. Elements with the same row and column indices are not allowed. (See also the descriptions for ha and ka.)
10:   ha(nnz) – int64int32nag_int array
nnz, the dimension of the array, must satisfy the constraint 1nnzn × m$1\le {\mathbf{nnz}}\le {\mathbf{n}}×{\mathbf{m}}$.
ha(i)${\mathbf{ha}}\left(\mathit{i}\right)$ must contain the row index of the nonzero element stored in a(i)${\mathbf{a}}\left(\mathit{i}\right)$, for i = 1,2,,nnz$\mathit{i}=1,2,\dots ,{\mathbf{nnz}}$. The row indices for a column may be supplied in any order subject to the condition that those elements in a column associated with any nonlinear constraints must appear before those elements associated with any linear constraints (including the free row, if any). Note that confun must define the Jacobian elements in the same order. If iobj = 1${\mathbf{iobj}}=-1$, set ha(1) = 1${\mathbf{ha}}\left(1\right)=1$.
Constraint: 1ha(i)m$1\le {\mathbf{ha}}\left(\mathit{i}\right)\le {\mathbf{m}}$, for i = 1,2,,nnz$\mathit{i}=1,2,\dots ,{\mathbf{nnz}}$.
11:   ka(n + 1${\mathbf{n}}+1$) – int64int32nag_int array
ka(j)${\mathbf{ka}}\left(\mathit{j}\right)$ must contain the index in a of the start of the j$\mathit{j}$th column, for j = 1,2,,n$\mathit{j}=1,2,\dots ,{\mathbf{n}}$. To specify the j$\mathit{j}$th column as empty, set ka(j) = ka(j + 1)${\mathbf{ka}}\left(\mathit{j}\right)={\mathbf{ka}}\left(\mathit{j}+1\right)$. Note that the first and last elements of ka must be such that ka(1) = 1${\mathbf{ka}}\left(1\right)=1$ and ka(n + 1) = nnz + 1${\mathbf{ka}}\left({\mathbf{n}}+1\right)={\mathbf{nnz}}+1$. If iobj = 1${\mathbf{iobj}}=-1$, set ka(j) = 2${\mathbf{ka}}\left(\mathit{j}\right)=2$, for j = 2,3,,n$\mathit{j}=2,3,\dots ,{\mathbf{n}}$.
Constraints:
• ka(1) = 1${\mathbf{ka}}\left(1\right)=1$;
• ka(j)1${\mathbf{ka}}\left(\mathit{j}\right)\ge 1$, for j = 2,3,,n$\mathit{j}=2,3,\dots ,{\mathbf{n}}$;
• ka(n + 1) = nnz + 1${\mathbf{ka}}\left({\mathbf{n}}+1\right)={\mathbf{nnz}}+1$;
• 0ka(j + 1)ka(j)m$0\le {\mathbf{ka}}\left(\mathit{j}+1\right)-{\mathbf{ka}}\left(\mathit{j}\right)\le {\mathbf{m}}$, for j = 1,2,,n$\mathit{j}=1,2,\dots ,{\mathbf{n}}$.
12:   bl(n + m${\mathbf{n}}+{\mathbf{m}}$) – double array
l$l$, the lower bounds for all the variables and general constraints, in the following order. The first n elements of bl must contain the bounds on the variables x$x$, the next ncnln elements the bounds for the nonlinear constraints F(x)$F\left(x\right)$ (if any) and the next (${\mathbf{m}}-{\mathbf{ncnln}}$) elements the bounds for the linear constraints Gx$Gx$ and the free row (if any). To specify a nonexistent lower bound (i.e., lj = ${l}_{j}=-\infty$), set bl(j)bigbnd${\mathbf{bl}}\left(j\right)\le -\mathit{bigbnd}$. To specify the j$j$th constraint as an equality, set bl(j) = bu(j) = β${\mathbf{bl}}\left(j\right)={\mathbf{bu}}\left(j\right)=\beta$, say, where |β| < bigbnd$|\beta |<\mathit{bigbnd}$. If iobj = 1${\mathbf{iobj}}=-1$, set bl(n + abs(iobj))bigbnd${\mathbf{bl}}\left({\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)\right)\le -\mathit{bigbnd}$.
Constraint: if ${\mathbf{ncnln}}<{\mathbf{iobj}}\le {\mathbf{m}}$ or iobj = 1${\mathbf{iobj}}=-1$, bl(n + abs(iobj))bigbnd${\mathbf{bl}}\left({\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)\right)\le -\mathit{bigbnd}$
13:   bu(n + m${\mathbf{n}}+{\mathbf{m}}$) – double array
u$u$, the upper bounds for all the variables and general constraints, in the following order. The first n elements of bu must contain the bounds on the variables x$x$, the next ncnln elements the bounds for the nonlinear constraints F(x)$F\left(x\right)$ (if any) and the next (${\mathbf{m}}-{\mathbf{ncnln}}$) elements the bounds for the linear constraints Gx$Gx$ and the free row (if any). To specify a nonexistent upper bound (i.e., uj = + ${u}_{j}=+\infty$), set bu(j)bigbnd${\mathbf{bu}}\left(j\right)\ge \mathit{bigbnd}$. To specify the j$j$th constraint as an equality, set bu(j) = bl(j) = β${\mathbf{bu}}\left(j\right)={\mathbf{bl}}\left(j\right)=\beta$, say, where |β| < bigbnd$|\beta |<\mathit{bigbnd}$. If iobj = 1${\mathbf{iobj}}=-1$, set bu(n + abs(iobj))bigbnd${\mathbf{bu}}\left({\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)\right)\ge \mathit{bigbnd}$.
Constraints:
• if ${\mathbf{ncnln}}<{\mathbf{iobj}}\le {\mathbf{m}}$ or iobj = 1${\mathbf{iobj}}=-1$, bu(n + abs(iobj))bigbnd${\mathbf{bu}}\left({\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)\right)\ge \mathit{bigbnd}$;
• bl(j)bu(j)${\mathbf{bl}}\left(\mathit{j}\right)\le {\mathbf{bu}}\left(\mathit{j}\right)$, for j = 1,2,,n + m$\mathit{j}=1,2,\dots ,{\mathbf{n}}+{\mathbf{m}}$;
• if bl(j) = bu(j) = β${\mathbf{bl}}\left(j\right)={\mathbf{bu}}\left(j\right)=\beta$, |β| < bigbnd$|\beta |<\mathit{bigbnd}$.
14:   start – string (length ≥ 1)
Indicates how a starting basis is to be obtained.
start = 'C'${\mathbf{start}}=\text{'C'}$
An internal Crash procedure will be used to choose an initial basis.
start = 'W'${\mathbf{start}}=\text{'W'}$
A basis is already defined in istate and ns (probably from a previous call).
Constraint: start = 'C'${\mathbf{start}}=\text{'C'}$ or 'W'$\text{'W'}$.
15:   names(nname) – cell array of strings
nname, the dimension of the array, must satisfy the constraint nname = 1${\mathbf{nname}}=1$ or n + m${\mathbf{n}}+{\mathbf{m}}$.
Specifies the column and row names to be used in the printed output.
If nname = 1${\mathbf{nname}}=1$, names is not referenced and the printed output will use default names for the columns and rows.
If nname = n + m${\mathbf{nname}}={\mathbf{n}}+{\mathbf{m}}$, the first n elements must contain the names for the columns, the next ncnln elements must contain the names for the nonlinear rows (if any) and the next (mncnln)$\left({\mathbf{m}}-{\mathbf{ncnln}}\right)$ elements must contain the names for the linear rows (if any) to be used in the printed output. Note that the name for the free row or dummy ‘free’ row must be stored in names(n + abs(iobj))${\mathbf{names}}\left({\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)\right)$.
16:   ns – int64int32nag_int scalar
nS${n}_{S}$, the number of superbasics. It need not be specified if start = 'C'${\mathbf{start}}=\text{'C'}$, but must retain its value from a previous call when start = 'W'${\mathbf{start}}=\text{'W'}$.
17:   xs(n + m${\mathbf{n}}+{\mathbf{m}}$) – double array
The initial values of the variables and slacks (x,s)$\left(x,s\right)$. (See the description for istate.)
18:   istate(n + m${\mathbf{n}}+{\mathbf{m}}$) – int64int32nag_int array
If start = 'C'${\mathbf{start}}=\text{'C'}$, the first n elements of istate and xs must specify the initial states and values, respectively, of the variables x$x$. (The slacks s$s$ need not be initialized.) An internal Crash procedure is then used to select an initial basis matrix B$B$. The initial basis matrix will be triangular (neglecting certain small elements in each column). It is chosen from various rows and columns of
 ( A − I )
$\left(\begin{array}{cc}A& -I\end{array}\right)$. Possible values for istate(j)${\mathbf{istate}}\left(j\right)$ are as follows:
 istate(j)${\mathbf{istate}}\left(j\right)$ State of xs(j)${\mathbf{xs}}\left(j\right)$ during Crash procedure 0$0$ or 1$1$ Eligible for the basis 2$2$ Ignored 3$3$ Eligible for the basis (given preference over 0$0$ or 1$1$) 4$4$ or 5$5$ Ignored
If nothing special is known about the problem, or there is no wish to provide special information, you may set istate(j) = 0${\mathbf{istate}}\left(\mathit{j}\right)=0$ and xs(j) = 0.0${\mathbf{xs}}\left(\mathit{j}\right)=0.0$, for j = 1,2,,n$\mathit{j}=1,2,\dots ,{\mathbf{n}}$. All variables will then be eligible for the initial basis. Less trivially, to say that the j$j$th variable will probably be equal to one of its bounds, set istate(j) = 4${\mathbf{istate}}\left(j\right)=4$ and xs(j) = bl(j)${\mathbf{xs}}\left(j\right)={\mathbf{bl}}\left(j\right)$ or istate(j) = 5${\mathbf{istate}}\left(j\right)=5$ and xs(j) = bu(j)${\mathbf{xs}}\left(j\right)={\mathbf{bu}}\left(j\right)$ as appropriate.
Following the Crash procedure, variables for which istate(j) = 2${\mathbf{istate}}\left(j\right)=2$ are made superbasic. Other variables not selected for the basis are then made nonbasic at the value xs(j)${\mathbf{xs}}\left(j\right)$ if bl(j)xs(j)bu(j)${\mathbf{bl}}\left(j\right)\le {\mathbf{xs}}\left(j\right)\le {\mathbf{bu}}\left(j\right)$, or at the value bl(j)${\mathbf{bl}}\left(j\right)$ or bu(j)${\mathbf{bu}}\left(j\right)$ closest to xs(j)${\mathbf{xs}}\left(j\right)$.
If start = 'W'${\mathbf{start}}=\text{'W'}$, istate and xs must specify the initial states and values, respectively, of the variables and slacks (x,s)$\left(x,s\right)$. If the function has been called previously with the same values of n and m, istate already contains satisfactory information.
Constraints:
• if start = 'C'${\mathbf{start}}=\text{'C'}$, 0istate(j)5$0\le {\mathbf{istate}}\left(\mathit{j}\right)\le 5$, for j = 1,2,,n$\mathit{j}=1,2,\dots ,{\mathbf{n}}$;
• if start = 'W'${\mathbf{start}}=\text{'W'}$, 0istate(j)3$0\le {\mathbf{istate}}\left(\mathit{j}\right)\le 3$, for j = 1,2,,n + m$\mathit{j}=1,2,\dots ,{\mathbf{n}}+{\mathbf{m}}$.
19:   clamda(n + m${\mathbf{n}}+{\mathbf{m}}$) – double array
If ncnln > 0${\mathbf{ncnln}}>0$, clamda(j)${\mathbf{clamda}}\left(\mathit{j}\right)$ must contain a Lagrange multiplier estimate for the j$\mathit{j}$th nonlinear constraint Fj(x)${F}_{\mathit{j}}\left(x\right)$, for j = n + 1,,n + ncnln$\mathit{j}={\mathbf{n}}+1,\dots ,{\mathbf{n}}+{\mathbf{ncnln}}$. If nothing special is known about the problem, or there is no wish to provide special information, you may set clamda(j) = 0.0${\mathbf{clamda}}\left(j\right)=0.0$. The remaining elements need not be set.
20:   lwsav(20$20$) – logical array
21:   iwsav(550$550$) – int64int32nag_int array
22:   rwsav(550$550$) – double array
The arrays lwsav, iwsav and rwsav must not be altered between calls to any of the functions nag_opt_nlp1_sparse_solve (e04ug), (e04uh) or (e04uj).

### Optional Input Parameters

1:     nnz – int64int32nag_int scalar
Default: The dimension of the arrays a, ha. (An error is raised if these dimensions are not equal.)
The number of nonzero elements in A$A$ (including the Jacobian for any nonlinear constraints). If iobj = 1${\mathbf{iobj}}=-1$, set nnz = 1${\mathbf{nnz}}=1$.
Constraint: 1nnzn × m$1\le {\mathbf{nnz}}\le {\mathbf{n}}×{\mathbf{m}}$.
2:     nname – int64int32nag_int scalar
Default: The dimension of the array names.
The number of column (i.e., variable) and row (i.e., constraint) names supplied in names.
nname = 1${\mathbf{nname}}=1$
There are no names. Default names will be used in the printed output.
nname = n + m${\mathbf{nname}}={\mathbf{n}}+{\mathbf{m}}$
All names must be supplied.
Constraint: nname = 1${\mathbf{nname}}=1$ or n + m${\mathbf{n}}+{\mathbf{m}}$.
3:     leniz – int64int32nag_int scalar
Default: max (500,n + m)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(500,{\mathbf{n}}+{\mathbf{m}}\right)$
The dimension of the array iz as declared in the (sub)program from which nag_opt_nlp1_sparse_solve (e04ug) is called.
Constraint: lenizmax (500,n + m)${\mathbf{leniz}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(500,{\mathbf{n}}+{\mathbf{m}}\right)$.
4:     lenz – int64int32nag_int scalar
The dimension of the array z as declared in the (sub)program from which nag_opt_nlp1_sparse_solve (e04ug) is called.
Constraint: lenz500${\mathbf{lenz}}\ge 500$.
The amounts of workspace provided (i.e., leniz and lenz) and required (i.e., miniz and minz) are (by default) output on the current advisory message unit (as defined by nag_file_set_unit_advisory (x04ab)). Since the minimum values of leniz and lenz required to start solving the problem are returned in miniz and minz respectively, you may prefer to obtain appropriate values from the output of a preliminary run with leniz set to max (500,n + m)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(500,{\mathbf{n}}+{\mathbf{m}}\right)$ and/or lenz set to 500$500$. (nag_opt_nlp1_sparse_solve (e04ug) will then terminate with ${\mathbf{ifail}}={\mathbf{15}}$ or 16${\mathbf{16}}$.)
5:     user – Any MATLAB object
user is not used by nag_opt_nlp1_sparse_solve (e04ug), but is passed to confun and objfun. Note that for large objects it may be more efficient to use a global variable which is accessible from the m-files than to use user.

iz z iuser ruser

### Output Parameters

1:     a(nnz) – double array
Elements in the nonlinear part corresponding to nonlinear Jacobian variables are overwritten.
2:     ns – int64int32nag_int scalar
The final number of superbasics.
3:     xs(n + m${\mathbf{n}}+{\mathbf{m}}$) – double array
The final values of the variables and slacks (x,s)$\left(x,s\right)$.
4:     istate(n + m${\mathbf{n}}+{\mathbf{m}}$) – int64int32nag_int array
The final states of the variables and slacks (x,s)$\left(x,s\right)$. The significance of each possible value of istate(j)${\mathbf{istate}}\left(j\right)$ is as follows:
 istate(j)${\mathbf{istate}}\left(j\right)$ State of variable j$j$ Normal value of xs(j)${\mathbf{xs}}\left(j\right)$ 0$0$ Nonbasic bl(j)${\mathbf{bl}}\left(j\right)$ 1$1$ Nonbasic bu(j)${\mathbf{bu}}\left(j\right)$ 2$2$ Superbasic Between bl(j)${\mathbf{bl}}\left(j\right)$ and bu(j)${\mathbf{bu}}\left(j\right)$ 3$3$ Basic Between bl(j)${\mathbf{bl}}\left(j\right)$ and bu(j)${\mathbf{bu}}\left(j\right)$
If ninf = 0${\mathbf{ninf}}=0$, basic and superbasic variables may be outside their bounds by as much as the value of the optional parameter Minor Feasibility Tolerance. Note that if scaling is specified, the optional parameter Minor Feasibility Tolerance applies to the variables of the scaled problem. In this case, the variables of the original problem may be as much as 0.1$0.1$ outside their bounds, but this is unlikely unless the problem is very badly scaled.
Very occasionally some nonbasic variables may be outside their bounds by as much as the optional parameter Minor Feasibility Tolerance and there may be some nonbasic variables for which xs(j)${\mathbf{xs}}\left(j\right)$ lies strictly between its bounds.
If ninf > 0${\mathbf{ninf}}>0$, some basic and superbasic variables may be outside their bounds by an arbitrary amount (bounded by sinf if scaling was not used).
5:     clamda(n + m${\mathbf{n}}+{\mathbf{m}}$) – double array
A set of Lagrange multipliers for the bounds on the variables (reduced costs) and the general constraints (shadow costs). More precisely, the first n elements contain the multipliers for the bounds on the variables, the next ncnln elements contain the multipliers for the nonlinear constraints F(x)$F\left(x\right)$ (if any) and the next (${\mathbf{m}}-{\mathbf{ncnln}}$) elements contain the multipliers for the linear constraints Gx$Gx$ and the free row (if any).
6:     miniz – int64int32nag_int scalar
The minimum value of leniz required to start solving the problem. If ${\mathbf{ifail}}={\mathbf{12}}$, nag_opt_nlp1_sparse_solve (e04ug) may be called again with leniz suitably larger than miniz. (The bigger the better, since it is not certain how much workspace the basis factors need.)
7:     minz – int64int32nag_int scalar
The minimum value of lenz required to start solving the problem. If ${\mathbf{ifail}}={\mathbf{13}}$, nag_opt_nlp1_sparse_solve (e04ug) may be called again with lenz suitably larger than minz. (The bigger the better, since it is not certain how much workspace the basis factors need.)
8:     ninf – int64int32nag_int scalar
The number of constraints that lie outside their bounds by more than the value of the optional parameter Minor Feasibility Tolerance.
If the linear constraints are infeasible, the sum of the infeasibilities of the linear constraints is minimized subject to the upper and lower bounds being satisfied. In this case, ninf contains the number of elements of Gx$Gx$ that lie outside their upper or lower bounds. Note that the nonlinear constraints are not evaluated.
Otherwise, the sum of the infeasibilities of the nonlinear constraints is minimized subject to the linear constraints and the upper and lower bounds being satisfied. In this case, ninf contains the number of elements of F(x)$F\left(x\right)$ that lie outside their upper or lower bounds.
9:     sinf – double scalar
The sum of the infeasibilities of constraints that lie outside their bounds by more than the value of the optional parameter Minor Feasibility Tolerance.
10:   obj – double scalar
The value of the objective function.
11:   user – Any MATLAB object
12:   lwsav(20$20$) – logical array
13:   iwsav(550$550$) – int64int32nag_int array
14:   rwsav(550$550$) – double array
15:   ifail – int64int32nag_int scalar
${\mathrm{ifail}}={\mathbf{0}}$ unless the function detects an error (see [Error Indicators and Warnings]).
nag_opt_nlp1_sparse_solve (e04ug) returns with ${\mathbf{ifail}}={\mathbf{0}}$ if the iterates have converged to a point x$x$ that satisfies the first-order Kuhn–Karesh–Tucker conditions (see Section [Major Iteration Printout]) to the accuracy requested by the optional parameters Major Feasibility Tolerance (default value = sqrt(ε)$\text{default value}=\sqrt{\epsilon }$) and Major Optimality Tolerance (default value = sqrt(ε)$\text{default value}=\sqrt{\epsilon }$).

## Error Indicators and Warnings

Note: nag_opt_nlp1_sparse_solve (e04ug) may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

W ifail < 0${\mathbf{ifail}}<0$
A negative value of ifail indicates an exit from nag_opt_nlp1_sparse_solve (e04ug) because you set mode < 0${\mathbf{mode}}<0$ in objfun or confun. The value of ifail will be the same as your setting of mode.
W ifail = 1${\mathbf{ifail}}=1$
The problem is infeasible. The general constraints cannot all be satisfied simultaneously to within the values of the optional parameters Major Feasibility Tolerance (default value = sqrt(ε)$\text{default value}=\sqrt{\epsilon }$) and Minor Feasibility Tolerance (default value = sqrt(ε)$\text{default value}=\sqrt{\epsilon }$).
W ifail = 2${\mathbf{ifail}}=2$
The problem is unbounded (or badly scaled). The objective function is not bounded below (or above in the case of maximization) in the feasible region because a nonbasic variable can apparently be increased or decreased by an arbitrary amount without causing a basic variable to violate a bound. Add an upper or lower bound to the variable (whose index is printed by default by nag_opt_nlp1_sparse_solve (e04ug)) and rerun nag_opt_nlp1_sparse_solve (e04ug).
W ifail = 3${\mathbf{ifail}}=3$
The problem may be unbounded. Check that the values of the optional parameters Unbounded Objective (default value = 1015$\text{default value}={10}^{15}$) and Unbounded Step Size (default value = max (bigbnd,1020)$\text{default value}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\mathit{bigbnd},{10}^{20}\right)$) are not too small. This exit also implies that the objective function is not bounded below (or above in the case of maximization) in the feasible region defined by expanding the bounds by the value of the optional parameter Violation Limit (default value = 10.0$\text{default value}=10.0$).
ifail = 4${\mathbf{ifail}}=4$
Too many iterations. The values of the optional parameters Major Iteration Limit (default value = 1000$\text{default value}=1000$) and/or Iteration Limit (default value = 10000$\text{default value}=10000$) are too small.
W ifail = 5${\mathbf{ifail}}=5$
Feasible solution found, but requested accuracy could not be achieved. Check that the value of the optional parameter Major Optimality Tolerance (default value = sqrt(ε)$\text{default value}=\sqrt{\epsilon }$) is not too small (say, < ε$\text{}<\epsilon$).
ifail = 6${\mathbf{ifail}}=6$
The value of the optional parameter Superbasics Limit (default value = min (500,n + 1)$\text{default value}=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(500,\stackrel{-}{n}+1\right)$) is too small.
ifail = 7${\mathbf{ifail}}=7$
An input parameter is invalid.
ifail = 8${\mathbf{ifail}}=8$
The user-supplied derivatives of the objective function computed by objfun appear to be incorrect. Check that objfun has been coded correctly and that all relevant elements of the objective gradient have been assigned their correct values.
ifail = 9${\mathbf{ifail}}=9$
The user-supplied derivatives of the nonlinear constraint functions computed by confun appear to be incorrect. Check that confun has been coded correctly and that all relevant elements of the nonlinear constraint Jacobian have been assigned their correct values.
W ifail = 10${\mathbf{ifail}}=10$
The current point cannot be improved upon. Check that objfun and confun have been coded correctly and that they are consistent with the value of the optional parameter Derivative Level (default value = 3$\text{default value}=3$).
ifail = 11${\mathbf{ifail}}=11$
Numerical error in trying to satisfy the linear constraints (or the linearized nonlinear constraints). The basis is very ill-conditioned.
ifail = 12${\mathbf{ifail}}=12$
Not enough integer workspace for the basis factors. Increase leniz and rerun nag_opt_nlp1_sparse_solve (e04ug).
ifail = 13${\mathbf{ifail}}=13$
Not enough real workspace for the basis factors. Increase lenz and rerun nag_opt_nlp1_sparse_solve (e04ug).
W ifail = 14${\mathbf{ifail}}=14$
The basis is singular after 15$15$ attempts to factorize it (and adding slacks where necessary). Either the problem is badly scaled or the value of the optional parameter LU Factor Tolerance (default value = 5.0$\text{default value}=5.0$ or 100.0$100.0$) is too large.
W ifail = 15${\mathbf{ifail}}=15$
Not enough integer workspace to start solving the problem. Increase leniz to at least miniz and rerun nag_opt_nlp1_sparse_solve (e04ug).
W ifail = 16${\mathbf{ifail}}=16$
Not enough real workspace to start solving the problem. Increase lenz to at least minz and rerun nag_opt_nlp1_sparse_solve (e04ug).
ifail = 17${\mathbf{ifail}}=17$

## Accuracy

If the value of the optional parameter Major Optimality Tolerance is set to 10d${10}^{-d}$ (default value = sqrt(ε)$\text{default value}=\sqrt{\epsilon }$) and ${\mathbf{ifail}}={\mathbf{0}}$ on exit, then the final value of f(x)$f\left(x\right)$ should have approximately d$d$ correct significant digits.

This section contains a description of the printed output.

### Major Iteration Printout

This section describes the intermediate printout and final printout produced by the major iterations of nag_opt_nlp1_sparse_solve (e04ug). The intermediate printout is a subset of the monitoring information produced by the function at every iteration (see Section [Description of Monitoring Information]). You can control the level of printed output (see the description of the optional parameter Major Print Level). Note that the intermediate printout and final printout are produced only if ${\mathbf{Major Print Level}}\ge 10$ (the default for nag_opt_nlp1_sparse_solve (e04ug), by default no output is produced by nag_opt_nlp1_sparse_solve (e04ug)).
The following line of summary output ( < 80$\text{}<80$ characters) is produced at every major iteration. In all cases, the values of the quantities printed are those in effect on completion of the given iteration.
 Maj is the major iteration count. Mnr is the number of minor iterations required by the feasibility and optimality phases of the QP subproblem. Generally, Mnr will be 1$1$ in the later iterations, since theoretical analysis predicts that the correct active set will be identified near the solution (see Section [Algorithmic Details]). Note that Mnr may be greater than the optional parameter Minor Iteration Limit if some iterations are required for the feasibility phase. Step is the step αk${\alpha }_{k}$ taken along the computed search direction. On reasonably well-behaved problems, the unit step (i.e., αk = 1${\alpha }_{k}=1$) will be taken as the solution is approached. Merit Function is the value of the augmented Lagrangian merit function (6) at the current iterate. This function will decrease at each iteration unless it was necessary to increase the penalty parameters (see Section [Major Iteration Printout]). As the solution is approached, Merit Function will converge to the value of the objective function at the solution. In elastic mode (see Section [Treatment of Constraint Infeasibilities]) then the merit function is a composite function involving the constraint violations weighted by the value of the optional parameter Elastic Weight.If there are no nonlinear constraints present then this entry contains Objective, the value of the objective function f(x)$f\left(x\right)$. In this case, f(x)$f\left(x\right)$ will decrease monotonically to its optimal value. Feasibl is the value of rowerr, the largest element of the scaled nonlinear constraint residual vector defined in the description of the optional parameter Major Feasibility Tolerance. The solution is regarded as ‘feasible’ if Feasibl is less than (or equal to) the optional parameter Major Feasibility Tolerance. Feasibl will be approximately zero in the neighbourhood of a solution.If there are no nonlinear constraints present, all iterates are feasible and this entry is not printed. Optimal is the value of maxgap, the largest element of the maximum complementarity gap vector defined in the description of the optional parameter Major Optimality Tolerance. The Lagrange multipliers are regarded as ‘optimal’ if Optimal is less than (or equal to) the optional parameter Major Optimality Tolerance. Optimal will be approximately zero in the neighbourhood of a solution. Cond Hz is an estimate of the condition number of the reduced Hessian of the Lagrangian (not printed if ncnln and nonln are both zero). It is the square of the ratio between the largest and smallest diagonal elements of the upper triangular matrix R$R$. This constitutes a lower bound on the condition number of the matrix RTR${R}^{\mathrm{T}}R$ that approximates the reduced Hessian. The larger this number, the more difficult the problem. PD is a two-letter indication of the status of the convergence tests involving the feasibility and optimality of the iterates defined in the descriptions of the optional parameters Major Feasibility Tolerance and Major Optimality Tolerance. Each letter is T if the test is satisfied and F otherwise. The tests indicate whether the values of Feasibl and Optimal are sufficiently small. For example, TF or TT is printed if there are no nonlinear constraints present (since all iterates are feasible). If either indicator is F when nag_opt_nlp1_sparse_solve (e04ug) terminates with ${\mathbf{ifail}}={\mathbf{0}}$, you should check the solution carefully. M is printed if an extra evaluation of user-supplied functions objfun and confun was needed in order to define an acceptable positive definite quasi-Newton update to the Hessian of the Lagrangian. This modification is only performed when there are nonlinear constraints present. m is printed if, in addition, it was also necessary to modify the update to include an augmented Lagrangian term. s is printed if a self-scaled BFGS (Broyden–Fletcher–Goldfarb–Shanno) update was performed. This update is always used when the Hessian approximation is diagonal and hence always follows a Hessian reset. S is printed if, in addition, it was also necessary to modify the self-scaled update in order to maintain positive-definiteness. n is printed if no positive definite BFGS update could be found, in which case the approximate Hessian is unchanged from the previous iteration. r is printed if the approximate Hessian was reset after 10$10$ consecutive major iterations in which no BFGS update could be made. The diagonal elements of the approximate Hessian are retained if at least one update has been performed since the last reset. Otherwise, the approximate Hessian is reset to the identity matrix. R is printed if the approximate Hessian has been reset by discarding all but its diagonal elements. This reset will be forced periodically by the values of the optional parameters Hessian Frequency and Hessian Updates. However, it may also be necessary to reset an ill-conditioned Hessian from time to time. l is printed if the change in the norm of the variables was greater than the value defined by the optional parameter Major Step Limit. If this output occurs frequently during later iterations, it may be worthwhile increasing the value of Major Step Limit. c is printed if central differences have been used to compute the unknown elements of the objective and constraint gradients. A switch to central differences is made if either the linesearch gives a small step, or x$x$ is close to being optimal. In some cases, it may be necessary to re-solve the QP subproblem with the central difference gradient and Jacobian. u is printed if the QP subproblem was unbounded. t is printed if the minor iterations were terminated after the number of iterations specified by the value of the optional parameter Minor Iteration Limit was reached. i is printed if the QP subproblem was infeasible when the function was not in elastic mode. This event triggers the start of nonlinear elastic mode, which remains in effect for all subsequent iterations. Once in elastic mode, the QP subproblems are associated with the elastic problem (8) (see Section [Treatment of Constraint Infeasibilities]). It is also printed if the minimizer of the elastic subproblem does not satisfy the linearized constraints when the function is already in elastic mode. (In this case, a feasible point for the usual QP subproblem may or may not exist.) w is printed if a weak solution of the QP subproblem was found.
The final printout includes a listing of the status of every variable and constraint.
The following describes the printout for each variable. A full stop (.) is printed for any numerical value that is zero.
Variable gives the name of the variable. If nname = 1${\mathbf{nname}}=1$, a default name is assigned to the j$\mathit{j}$th variable, for j = 1,2,,n$\mathit{j}=1,2,\dots ,n$. If nname = n + m${\mathbf{nname}}={\mathbf{n}}+{\mathbf{m}}$, the name supplied in names(j)${\mathbf{names}}\left(\mathit{j}\right)$ is assigned to the j$\mathit{j}$th variable.
State gives the state of the variable (LL if nonbasic on its lower bound, UL if nonbasic on its upper bound, EQ if nonbasic and fixed, FR if nonbasic and strictly between its bounds, BS if basic and SBS if superbasic).
A key is sometimes printed before State. Note that unless the optional parameter ${\mathbf{Scale Option}}=0$ is specified, the tests for assigning a key are applied to the variables of the scaled problem.
 A Alternative optimum possible. The variable is nonbasic, but its reduced gradient is essentially zero. This means that if the variable were allowed to start moving away from its current value, there would be no change in the value of the objective function. The values of the basic and superbasic variables might change, giving a genuine alternative solution. The values of the Lagrange multipliers might also change. D Degenerate. The variable is basic, but it is equal to (or very close to) one of its bounds. I Infeasible. The variable is basic and is currently violating one of its bounds by more than the value of the optional parameter Minor Feasibility Tolerance. N Not precisely optimal. The variable is nonbasic. Its reduced gradient is larger than the value of the optional parameter Major Feasibility Tolerance.
Value is the value of the variable at the final iteration.
Lower Bound is the lower bound specified for the variable. None indicates that bl(j)bigbnd${\mathbf{bl}}\left(j\right)\le -\mathit{bigbnd}$.
Upper Bound is the upper bound specified for the variable. None indicates that bu(j)bigbnd${\mathbf{bu}}\left(j\right)\ge \mathit{bigbnd}$.
Lagr Mult is the Lagrange multiplier for the associated bound. This will be zero if State is FR. If x$x$ is optimal, the multiplier should be non-negative if State is LL, non-positive if State is UL and zero if State is BS or SBS.
Residual is the difference between the variable Value and the nearer of its (finite) bounds bl(j)${\mathbf{bl}}\left(j\right)$ and bu(j)${\mathbf{bu}}\left(j\right)$. A blank entry indicates that the associated variable is not bounded (i.e., bl(j)bigbnd${\mathbf{bl}}\left(j\right)\le -\mathit{bigbnd}$ and bu(j)bigbnd${\mathbf{bu}}\left(j\right)\ge \mathit{bigbnd}$).
The meaning of the printout for general constraints is the same as that given above for variables, with ‘variable’ replaced by ‘constraint’, n$n$ replaced by m$m$, names(j)${\mathbf{names}}\left(j\right)$ replaced by names(n + j)${\mathbf{names}}\left(n+j\right)$, bl(j)${\mathbf{bl}}\left(j\right)$ and bu(j)${\mathbf{bu}}\left(j\right)$ are replaced by bl(n + j)${\mathbf{bl}}\left(n+j\right)$ and bu(n + j)${\mathbf{bu}}\left(n+j\right)$ respectively. The heading is changed as follows:
 Constrnt gives the name of the general constraint.
Numerical values are output with a fixed number of digits; they are not guaranteed to be accurate to this precision.

### Minor Iteration Printout

This section describes the printout produced by the minor iterations of nag_opt_nlp1_sparse_solve (e04ug), which involve solving a QP subproblem at every major iteration. (Further details can be found in Section [Major Iteration Printout].) The printout is a subset of the monitoring information produced by the function at every iteration (see Section [Description of Monitoring Information]). You can control the level of printed output (see the description of the optional parameter Minor Print Level). Note that the printout is produced only if ${\mathbf{Minor Print Level}}\ge 1$ (default value = 0$\text{default value}=0$, which produces no output).
The following line of summary output ( < 80$\text{}<80$ characters) is produced at every minor iteration. In all cases, the values of the quantities printed are those in effect on completion of the given iteration of the QP subproblem.
 Itn is the iteration count. Step is the step taken along the computed search direction. Ninf is the number of infeasibilities. This will not increase unless the iterations are in elastic mode. Ninf will be zero during the optimality phase. Sinf is the value of the sum of infeasibilities if Ninf is nonzero. This will be zero during the optimality phase. Objective is the value of the current QP objective function when Ninf is zero and the iterations are not in elastic mode. The switch to elastic mode is indicated by a change in the heading to Composite Obj. Composite Obj is the value of the composite objective function (9) when the iterations are in elastic mode. This function will decrease monotonically at each iteration. Norm rg is the Euclidean norm of the reduced gradient of the QP objective function. During the optimality phase, this norm will be approximately zero after a unit step.
Numerical values are output with a fixed number of digits; they are not guaranteed to be accurate to this precision.

## Example

function nag_opt_nlp1_sparse_solve_example
n = int64(4);
m = int64(6);
ncnln = int64(3);
nonln = int64(4);
njnln = int64(2);
iobj = int64(6);
a = [1e25;1e25;1e25;1;-1;1e25;1e25;1e25;-1;1;3;-1;-1;2];
ha = [int64(1);2;3;5;4;1;2;3;5;4;6;1;2;6];
ka = [int64(1);6;11;13;15];
bl = [-0.55;-0.55;0;0;-894.8;-894.8;-1294.8;-0.55;-0.55;-1e25];
bu = [0.55;0.55;1200;1200;-894.8;-894.8;-1294.8;1e25;1e25;1e25];
start = 'C';
names = {'Varble 1'; 'Varble 2'; 'Varble 3'; 'Varble 4'; 'NlnCon 1';  ...
'NlnCon 2'; 'NlnCon 3'; 'LinCon 1'; 'LinCon 2'; 'Free Row'};
ns = int64(0);
xs = [0;0;0;0;0;0;0;0;0;0];
istate = zeros(10, 1, 'int64');
clamda = [0;0;0;0;0;0;0;0;0;0];
leniz = int64(1000);
lenz = int64(1000);
[cwsav,lwsav,iwsav,rwsav,ifail] = nag_opt_init('nag_opt_nlp1_sparse_solve');
disp('First call to nag_opt_nlp1_sparse_solve')
[aOut, nsOut, xsOut, istateOut, clamdaOut, miniz, minz, ninf, sinf, obj, ...
user, lwsavOut, iwsavOut, rwsavOut, ifail] = ...
nag_opt_nlp1_sparse_solve(@confun, @objfun, n, m, ncnln, nonln, njnln, ...
iobj, a, ha, ka, bl, bu, start, names, ns, xs, istate, ...
clamda, lwsav, iwsav, rwsav);
if (ifail == 15 || ifail == 16)
% Default amount of workspace is insufficient, use values bigger than those
% returned in in minz and miniz
disp('Second call to nag_opt_nlp1_sparse_solve')
[aOut, nsOut, xsOut, istateOut, clamdaOut, miniz, minz, ninf, sinf, obj, ...
user, lwsavOut, iwsavOut, rwsavOut, ifail] = ...
nag_opt_nlp1_sparse_solve(@confun, @objfun, n, m, ncnln, nonln, njnln, ...
iobj, a, ha, ka, bl, bu, start, names, ns, xs, istate, ...
clamda, lwsav, iwsav, rwsav, 'lenz', int64(10*double(minz)),  ...
'leniz', int64(10*double(miniz)));
obj
ifail
end

function [mode, f, fjac, user] = ...
confun(mode, ncnln, njnln, nnzjac, x, fjac, nstate, user)
f = zeros(ncnln, 1);

if (mode == 0 || mode == 2)
f(1) = 1000*sin(-x(1)-0.25) + 1000*sin(-x(2)-0.25);
f(2) = 1000*sin(x(1)-0.25) + 1000*sin(x(1)-x(2)-0.25);
f(3) = 1000*sin(x(2)-x(1)-0.25) + 1000*sin(x(2)-0.25);
end

if (mode == 1 || mode == 2)
%   nonlinear jacobian elements for column 1.
fjac(1) = -1000*cos(-x(1)-0.25);
fjac(2) = 1000*cos(x(1)-0.25) + 1000*cos(x(1)-x(2)-0.25);
fjac(3) = -1000*cos(x(2)-x(1)-0.25);
%   nonlinear jacobian elements for column 2.
fjac(4) = -1000*cos(-x(2)-0.25);
fjac(5) = -1000*cos(x(1)-x(2)-0.25);
fjac(6) = 1000*cos(x(2)-x(1)-0.25) + 1000*cos(x(2) -0.25);
end

function [mode, objf, objgrd, user] =  ...
objfun(mode, nonln, x, objgrd, nstate, user)

if (mode == 0 || mode == 2)
objf = 1.0e-6*x(3)^3 + 2.0e-6*x(4)^3/3;
end

if (mode == 1 || mode == 2)
objgrd(1) = 0;
objgrd(2) = 0;
objgrd(3) = 3.0e-6*x(3)^2;
objgrd(4) = 2.0e-6*x(4)^2;
end

First call to nag_opt_nlp1_sparse_solve
Warning: nag_opt_nlp1_sparse_solve (e04ug) returned a warning indicator (15)
Second call to nag_opt_nlp1_sparse_solve

obj =

5.1265e+03

ifail =

0

function e04ug_example
n = int64(4);
m = int64(6);
ncnln = int64(3);
nonln = int64(4);
njnln = int64(2);
iobj = int64(6);
a = [1e25;
1e25;
1e25;
1;
-1;
1e25;
1e25;
1e25;
-1;
1;
3;
-1;
-1;
2];
ha = [int64(1);2;3;5;4;1;2;3;5;4;6;1;2;6];
ka = [int64(1);6;11;13;15];
bl = [-0.55;-0.55;0;0;-894.8;-894.8;-1294.8;-0.55;-0.55;-1e25];
bu = [0.55;0.55;1200;1200;-894.8;-894.8;-1294.8;1e25;1e25;1e25];
start = 'C';
names = {'Varble 1'; 'Varble 2'; 'Varble 3'; 'Varble 4'; 'NlnCon 1'; ...
'NlnCon 2'; 'NlnCon 3'; 'LinCon 1'; 'LinCon 2'; 'Free Row'};
ns = int64(0);
xs = [0;0;0;0;0;0;0;0;0;0];
istate = zeros(10, 1, 'int64');
clamda = [0;0;0;0;0;0;0;0;0;0];
leniz = int64(1000);
lenz = int64(1000);
[cwsav,lwsav,iwsav,rwsav,ifail] = e04wb('e04ug');
disp('First call to e04ug')
[aOut, nsOut, xsOut, istateOut, clamdaOut, miniz, minz, ninf, sinf, obj, ...
user, lwsavOut, iwsavOut, rwsavOut, ifail] = ...
e04ug(@confun, @objfun, n, m, ncnln, nonln, njnln, ...
iobj, a, ha, ka, bl, bu, start, names, ns, xs, istate, ...
clamda, lwsav, iwsav, rwsav);
if (ifail == 15 || ifail == 16)
% Default amount of workspace is insufficient, use values bigger than those
% returned in in minz and miniz
disp('Second call to e04ug')
[aOut, nsOut, xsOut, istateOut, clamdaOut, miniz, minz, ninf, sinf, obj, ...
user, lwsavOut, iwsavOut, rwsavOut, ifail] = ...
e04ug(@confun, @objfun, n, m, ncnln, nonln, njnln, ...
iobj, a, ha, ka, bl, bu, start, names, ns, xs, istate, clamda, ...
lwsav, iwsav, rwsav, 'lenz', int64(10*double(minz)), 'leniz', int64(10*double(miniz)));
obj
ifail
end

function [mode, f, fjac, user] = ...
confun(mode, ncnln, njnln, nnzjac, x, fjac, nstate, user)
f = zeros(ncnln, 1);

if (mode == 0 || mode == 2)
f(1) = 1000*sin(-x(1)-0.25) + 1000*sin(-x(2)-0.25);
f(2) = 1000*sin(x(1)-0.25) + 1000*sin(x(1)-x(2)-0.25);
f(3) = 1000*sin(x(2)-x(1)-0.25) + 1000*sin(x(2)-0.25);
end

if (mode == 1 || mode == 2)
%   nonlinear jacobian elements for column 1.
fjac(1) = -1000*cos(-x(1)-0.25);
fjac(2) = 1000*cos(x(1)-0.25) + 1000*cos(x(1)-x(2)-0.25);
fjac(3) = -1000*cos(x(2)-x(1)-0.25);
%   nonlinear jacobian elements for column 2.
fjac(4) = -1000*cos(-x(2)-0.25);
fjac(5) = -1000*cos(x(1)-x(2)-0.25);
fjac(6) = 1000*cos(x(2)-x(1)-0.25) + 1000*cos(x(2) -0.25);
end

function [mode, objf, objgrd, user] = objfun(mode, nonln, x, objgrd, nstate, user)

if (mode == 0 || mode == 2)
objf = 1.0e-6*x(3)^3 + 2.0e-6*x(4)^3/3;
end

if (mode == 1 || mode == 2)
objgrd(1) = 0;
objgrd(2) = 0;
objgrd(3) = 3.0e-6*x(3)^2;
objgrd(4) = 2.0e-6*x(4)^2;
end

First call to e04ug
Warning: nag_opt_nlp1_sparse_solve (e04ug) returned a warning indicator (15)
Second call to e04ug

obj =

5.1265e+03

ifail =

0

the remainder of this document is intended for more advanced users. Section [Algorithmic Details] contains a detailed description of the algorithm which may be needed in order to understand Sections [Optional Parameters] and [Description of Monitoring Information]. Section [Optional Parameters] describes the optional parameters which may be set by calls to nag_opt_nlp1_sparse_option_string (e04uj). Section [Description of Monitoring Information] describes the quantities which can be requested to monitor the course of the computation.

## Algorithmic Details

This section contains a detailed description of the method used by nag_opt_nlp1_sparse_solve (e04ug).

### Overview

Here we briefly summarise the main features of the method and introduce some terminology. Where possible, explicit reference is made to the names of variables that are parameters of the function or appear in the printed output. Further details can be found in Gill et al. (2002).
At a solution of (1), some of the constraints will be active, i.e., satisfied exactly. Let
r(x) =
 x F(x) Gx
$r(x)= x F(x) Gx$
and G$\mathcal{G}$ denote the set of indices of r(x)$r\left(x\right)$ corresponding to active constraints at an arbitrary point x$x$. Let rj(x)${r}_{j}^{\prime }\left(x\right)$ denote the usual derivative of rj(x)${r}_{j}\left(x\right)$, which is the row vector of first partial derivatives of rj(x)${r}_{j}\left(x\right)$ (see Ortega and Rheinboldt (1970)). The vector rj(x)${r}_{j}^{\prime }\left(x\right)$ comprises the j$j$th row of r(x)${r}^{\prime }\left(x\right)$ so that
r(x) =
 I J(x) G
,
$r′(x)= I J(x) G ,$
where J(x)$J\left(x\right)$ is the Jacobian of F(x)$F\left(x\right)$.
A point x$x$ is a first-order Kuhn–Karesh–Tucker (KKT) point for (1) (see Powell (1974)) if the following conditions hold:
(a) x$x$ is feasible;
(b) there exists a vector λ$\lambda$ (the Lagrange multiplier vector for the bound and general constraints) such that
 g(x) = r′(x)Tλ = (I J(x)T GT)λ, $g(x)=r′(x)Tλ=(I J(x)T GT)λ,$ (4)
where g$g$ is the gradient of f$f$ evaluated at x$x$;
(c) the Lagrange multiplier λj${\lambda }_{j}$ associated with the j$j$th constraint satisfies λj = 0${\lambda }_{j}=0$ if lj < rj(x) < uj${l}_{j}<{r}_{j}\left(x\right)<{u}_{j}$; λj0${\lambda }_{j}\ge 0$ if lj = rj(x)${l}_{j}={r}_{j}\left(x\right)$; λj0${\lambda }_{j}\le 0$ if rj(x) = uj${r}_{j}\left(x\right)={u}_{j}$; and λj${\lambda }_{j}$ can have any value if lj = uj${l}_{j}={u}_{j}$.
An equivalent statement of the condition (4) is
 ZTg(x) = 0, $ZTg(x)=0,$
where Z$Z$ is a matrix defined as follows. Consider the set N$N$ of vectors orthogonal to the gradients of the active constraints, i.e.,
 N = {z  ∣  rj ′ (x)z = 0  for all  j ∈ G} . $N = { z ∣ rj′ (x) z=0 for all j∈G } .$
The columns of Z$Z$ may then be taken as any basis for the vector space N$N$. The vector ZTg${Z}^{\mathrm{T}}g$ is termed the reduced gradient of f$f$ at x$x$. Certain additional conditions must be satisfied in order for a first-order KKT point to be a solution of (1) (see Powell (1974)).
The basic structure of nag_opt_nlp1_sparse_solve (e04ug) involves major and minor iterations. The major iterations generate a sequence of iterates {xk}$\left\{{x}_{k}\right\}$ that satisfy the linear constraints and converge to a point x*${x}^{*}$ that satisfies the first-order KKT optimality conditions. At each iterate a QP subproblem is used to generate a search direction towards the next iterate (xk + 1${x}_{k+1}$). The constraints of the subproblem are formed from the linear constraints GxsL = 0$Gx-{s}_{L}=0$ and the nonlinear constraint linearization
 F(xk) + F′(xk)(x − xk) − sN = 0, $F(xk)+F′(xk)(x-xk)-sN=0,$
where F(xk)${F}^{\prime }\left({x}_{k}\right)$ denotes the Jacobian matrix, whose rows are the first partial derivatives of F(x)$F\left(x\right)$ evaluated at the point xk${x}_{k}$. The QP constraints therefore comprise the m$m$ linear constraints
 F′(xk)x − sN − sL = − F(xk) + F′(xk)xk, ' (xk)Gx − sN − sL = 0,F(xk) + F′(xk)xk
$F′(xk)x-sN-sL=-F(xk)+F′(xk)xk, '(xk)Gx-sN-sL=0,F(xk)+F′(xk)xk$
where x$x$ and s = (sN,sL)T$s={\left({s}_{N},{s}_{L}\right)}^{\mathrm{T}}$ are bounded above and below by u$u$ and l$l$ as before. If the m$m$ by n$n$ matrix A$A$ and m$m$ element vector b$b$ are defined as
A =
 ( F′(xk) ) G
and  b =
 ( − F(xk) + F′(xk)xk ) 0
,
$A= F′(xk) G and b= -F(xk)+F′(xk)xk 0 ,$
then the QP subproblem can be written as
$minimizex,sq(x) subject to Ax-s=b, l≤{ x s } ≤u,$
 minimizex,s q(x)  subject to  Ax − s = b,  l ≤ { x s } ≤ u,
(5)
where q(x)$q\left(x\right)$ is a quadratic approximation to a modified Lagrangian function (see Gill et al. (2002)).
The linear constraint matrix A$A$ is stored in the arrays a, ha and ka (see Section [Parameters]). This allows you to specify the sparsity pattern of nonzero elements in F(x)${F}^{\prime }\left(x\right)$ and G$G$ and to identify any nonzero elements that remain constant throughout the minimization.
Solving the QP subproblem is itself an iterative procedure, with the minor iterations of an SQP method being the iterations of the QP method. At each minor iteration, the constraints Axs = b$Ax-s=b$ are (conceptually) partitioned into the form
 BxB + SxS + NxN = b, $BxB+SxS+NxN=b,$
where the basis matrix B$B$ is square and nonsingular. The elements of xB${x}_{B}$, xS${x}_{S}$ and xN${x}_{N}$ are called the basic, superbasic and nonbasic variables respectively; they are a permutation of the elements of x$x$ and s$s$. At a QP solution, the basic and superbasic variables will lie somewhere between their bounds, while the nonbasic variables will be equal to one of their upper or lower bounds. At each minor iteration, xS${x}_{S}$ is regarded as a set of independent variables that are free to move in any desired direction, namely one that will improve the value of the QP objective function q(x)$q\left(x\right)$ or sum of infeasibilities (as appropriate). The basic variables are then adjusted in order to ensure that (x,s$x,s$) continues to satisfy Axs = b$Ax-s=b$. The number of superbasic variables (nS${n}_{S}$ say) therefore indicates the number of degrees of freedom remaining after the constraints have been satisfied. In broad terms, nS${n}_{S}$ is a measure of how nonlinear the problem is. In particular, nS${n}_{S}$ will always be zero if there are no nonlinear constraints in (1) and f(x)$f\left(x\right)$ is linear.
If it appears that no improvement can be made with the current definition of B$B$, S$S$ and N$N$, a nonbasic variable is selected to be added to S$S$ and the process is repeated with the value of nS${n}_{S}$ increased by one. At all stages, if a basic or superbasic variable encounters one of its bounds, the variable is made nonbasic and the value of nS${n}_{S}$ decreased by one.
Associated with each of the m$m$ equality constraints Axs = b$Ax-s=b$ is a dual variable πi${\pi }_{i}$. Similarly, each variable in (x,s)$\left(x,s\right)$ has an associated reduced gradient dj${d}_{j}$ (also known as a reduced cost). The reduced gradients for the variables x$x$ are the quantities gATπ$g-{A}^{\mathrm{T}}\pi$, where g$g$ is the gradient of the QP objective function q(x)$q\left(x\right)$; the reduced gradients for the slack variables s$s$ are the dual variables π$\pi$. The QP subproblem (5) is optimal if dj0${d}_{j}\ge 0$ for all nonbasic variables at their lower bounds, dj0${d}_{j}\le 0$ for all nonbasic variables at their upper bounds and dj = 0${d}_{j}=0$ for other variables (including superbasics). In practice, an approximate QP solution is found by slightly relaxing these conditions on dj${d}_{j}$ (see the description of the optional parameter Minor Optimality Tolerance).
After a QP subproblem has been solved, new estimates of the solution to (1) are computed using a linesearch on the augmented Lagrangian merit function
 M (x,s,π) = f(x) − πT (F(x) − sN) + (1/2) (F(x) − sN)T D (F(x) − sN) , $M (x,s,π) = f(x) - πT ( F(x) - sN ) + 12 ( F (x) - sN )T D ( F(x) - sN ) ,$ (6)
where D$D$ is a diagonal matrix of penalty parameters. If (xk,sk,πk${x}_{k},{s}_{k},{\pi }_{k}$) denotes the current estimate of the solution and (,,π̂$\stackrel{^}{x},\stackrel{^}{s},\stackrel{^}{\pi }$) denotes the optimal QP solution, the linesearch determines a step αk${\alpha }_{k}$ (where 0 < αk1$0<{\alpha }_{k}\le 1$) such that the new point
 xk + 1 sk + 1 πk + 1
=
 xk sk πk
+ αk
 x̂k − xk ŝk − sk π̂k − πk
$xk+1 sk+1 πk+1 = xk sk πk +αk x^k-xk s^k-sk π^k-πk$
produces a sufficient decrease in the merit function (6). When necessary, the penalties in D$D$ are increased by the minimum-norm perturbation that ensures descent for M$\mathcal{M}$ (see Gill et al. (1992)). As in nag_opt_nlp2_solve (e04wd), sN${s}_{N}$ is adjusted to minimize the merit function as a function of s$s$ before the solution of the QP subproblem. Further details can be found in Eldersveld (1991) and Gill et al. (1986).

### Treatment of Constraint Infeasibilities

nag_opt_nlp1_sparse_solve (e04ug) makes explicit allowance for infeasible constraints. Infeasible linear constraints are detected first by solving a problem of the form
$minimizex,v,weT(v+w) subject to l≤{ x Gx-v+w } ≤u, v≥0, w≥0,$
 minimizex,v,w eT(v + w)  subject to  l ≤ { x Gx − v + w } ≤ u,  v ≥ 0,  w ≥ 0,
(7)
where e = (1,1,,1)T$e={\left(1,1,\dots ,1\right)}^{\mathrm{T}}$. This is equivalent to minimizing the sum of the general linear constraint violations subject to the simple bounds. (In the linear programming literature, the approach is often called elastic programming.)
If the linear constraints are infeasible (i.e., v0$v\ne 0$ or w0$w\ne 0$), the function terminates without computing the nonlinear functions.
If the linear constraints are feasible, all subsequent iterates will satisfy the linear constraints. (Such a strategy allows linear constraints to be used to define a region in which f(x)$f\left(x\right)$ and F(x)$F\left(x\right)$ can be safely evaluated.) The function then proceeds to solve (1) as given, using search directions obtained from a sequence of QP subproblems (5). Each QP subproblem minimizes a quadratic model of a certain Lagrangian function subject to linearized constraints. An augmented Lagrangian merit function (6) is reduced along each search direction to ensure convergence from any starting point.
The function enters ‘elastic’ mode if the QP subproblem proves to be infeasible or unbounded (or if the dual variables π$\pi$ for the nonlinear constraints become ‘large’) by solving a problem of the form
$minimizex,v,wf-(x,v,w) subject to l≤{ x F(x)-v+w Gx } ≤u, v≥0, w≥0,$
 minimizex,v,w f(x,v,w)  subject to  l ≤ { x F(x) − v + w Gx } ≤ u,  v ≥ 0,  w ≥ 0,
(8)
where
 f(x,v,w) = f(x) + γeT(v + w) $f-(x,v,w)=f(x)+γeT(v+w)$ (9)
is called a composite objective and γ$\gamma$ is a non-negative parameter (the elastic weight). If γ$\gamma$ is sufficiently large, this is equivalent to minimizing the sum of the nonlinear constraint violations subject to the linear constraints and bounds. A similar l1${l}_{1}$ formulation of (1) is fundamental to the Sl1${\mathrm{Sl}}_{1}$QP algorithm of Fletcher (1984). See also Conn (1973).

## Optional Parameters

Several optional parameters in nag_opt_nlp1_sparse_solve (e04ug) define choices in the problem specification or the algorithm logic. In order to reduce the number of formal parameters of nag_opt_nlp1_sparse_solve (e04ug) 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.
The remainder of this section can be skipped if you wish to use the default values for all optional parameters.
The following is a list of the optional parameters available. A full description of each optional parameter is provided in Section [Description of the optional parameters].
Optional parameters may be specified by calling nag_opt_nlp1_sparse_option_string (e04uj) before a call to nag_opt_nlp1_sparse_solve (e04ug).
nag_opt_nlp1_sparse_option_string (e04uj) can be called to supply options directly, one call being necessary for each optional parameter. For example,
[lwsav, iwsav, rwsav, inform] = e04uj('Print Level = 5', lwsav, iwsav, rwsav);
nag_opt_nlp1_sparse_option_string (e04uj) should be consulted for a full description of this method of supplying optional parameters.
All optional parameters not specified by you are set to their default values. Optional parameters specified by you are unaltered by nag_opt_nlp1_sparse_solve (e04ug) (unless they define invalid values) and so remain in effect for subsequent calls to nag_opt_nlp1_sparse_solve (e04ug) from the calling program (unless altered by you).

### Description of the Optional Parameters

For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
• the keywords, where the minimum abbreviation of each keyword is underlined (if no characters of an optional qualifier are underlined, the qualifier may be omitted);
• a parameter value, where the letters a$a$, i​ and ​r$i\text{​ and ​}r$ denote options that take character, integer and real values respectively;
• the default value is used whenever the condition |i|100000000$|i|\ge 100000000$ is satisfied and where the symbol ε$\epsilon$ is a generic notation for machine precision (see nag_machine_precision (x02aj)).
Keywords and character values are case and white space insensitive.
Central Difference Interval  r$r$
Default = root(3,Function Precision)$\text{}=\sqrt[3]{{\mathbf{Function Precision}}}$
Note that this option does not apply when ${\mathbf{Derivative Level}}=3$.
The value of r$r$ is used near an optimal solution in order to obtain more accurate (but more expensive) estimates of gradients. This requires twice as many function evaluations as compared to using forward differences (see optional parameter Forward Difference Interval). The interval used for the j$j$th variable is hj = r(1 + |xj|)${h}_{j}=r\left(1+|{x}_{j}|\right)$. The resulting gradient estimates should be accurate to O(r2)$\mathit{O}\left({r}^{2}\right)$, unless the functions are badly scaled. The switch to central differences is indicated by c at the end of each line of intermediate printout produced by the major iterations (see Section [Major Iteration Printout]). See Gill et al. (1981) for a discussion of the accuracy in finite difference approximations.
If r0$r\le 0$, the default value is used.
Check Frequency  i$i$
Default = 60$\text{}=60$
Every i$i$th minor iteration after the most recent basis factorization, a numerical test is made to see if the current solution (x,s)$\left(x,s\right)$ satisfies the general linear constraints (including any linearized nonlinear constraints). The constraints are of the form Axs = b$Ax-s=b$, where s$s$ is the set of slack variables. If the largest element of the residual vector r = bAx + s$r=b-Ax+s$ is judged to be too large, the current basis is refactorized and the basic variables recomputed to satisfy the general constraints more accurately.
If i < 0$i<0$, the default value is used. If i = 0$i=0$, the value i = 99999999$i=99999999$ is used and effectively no checks are made.
Crash Option  i$i$
Default = 0​ or ​3$\text{}=0\text{​ or ​}3$
The default value of i$i$ is 0$0$ if there are any nonlinear constraints and 3$3$ otherwise. Note that this option does not apply when start = 'W'${\mathbf{start}}=\text{'W'}$ (see Section [Parameters]).
If start = 'C'${\mathbf{start}}=\text{'C'}$, an internal Crash procedure is used to select an initial basis from various rows and columns of the constraint matrix
 ( A − I )
$\left(\begin{array}{cc}A& -I\end{array}\right)$. The value of i$i$ determines which rows and columns of A$A$ are initially eligible for the basis and how many times the Crash procedure is called. Columns of I$-I$ are used to pad the basis where necessary. The possible choices for i$i$ are the following.
 i$i$ Meaning 0 The initial basis contains only slack variables: B = I$B=I$. 1 The Crash procedure is called once (looking for a triangular basis in all rows and columns of A$A$). 2 The Crash procedure is called twice (if there are any nonlinear constraints). The first call looks for a triangular basis in linear rows and the iteration proceeds with simplex iterations until the linear constraints are satisfied. The Jacobian is then evaluated for the first major iteration and the Crash procedure is called again to find a triangular basis in the nonlinear rows (whilst retaining the current basis for linear rows). 3 The Crash procedure is called up to three times (if there are any nonlinear constraints). The first two calls treat linear equality constraints and linear inequality constraints separately. The Jacobian is then evaluated for the first major iteration and the Crash procedure is called again to find a triangular basis in the nonlinear rows (whilst retaining the current basis for linear rows).
If i < 0$i<0$ or i > 3$i>3$, the default value is used.
If i1$i\ge 1$, certain slacks on inequality rows are selected for the basis first. (If i2$i\ge 2$, numerical values are used to exclude slacks that are close to a bound.) The Crash procedure then makes several passes through the columns of A$A$, searching for a basis matrix that is essentially triangular. A column is assigned to ‘pivot’ on a particular row if the column contains a suitably large element in a row that has not yet been assigned. (The pivot elements ultimately form the diagonals of the triangular basis.) For remaining unassigned rows, slack variables are inserted to complete the basis.
Crash Tolerance  r$r$
Default = 0.1$\text{}=0.1$
The value r$r$ (0r < 1$0\le r<1$) allows the Crash procedure to ignore certain ‘small’ nonzero elements in the columns of A$A$ while searching for a triangular basis. If amax${a}_{\mathrm{max}}$ is the largest element in the j$j$th column, other nonzeros aij${a}_{ij}$ in the column are ignored if |aij|amax × r$|{a}_{ij}|\le {a}_{\mathrm{max}}×r$.
When r > 0$r>0$, the basis obtained by the Crash procedure may not be strictly triangular, but it is likely to be nonsingular and almost triangular. The intention is to obtain a starting basis containing more columns of A$A$ and fewer (arbitrary) slacks. A feasible solution may be reached earlier on some problems.
If r < 0$r<0$ or r1$r\ge 1$, the default value is used.
Defaults
This special keyword may be used to reset all optional parameters to their default values.
Derivative Level  i$i$
Default = 3$\text{}=3$
This parameter indicates which nonlinear function gradients are provided in user-supplied functions objfun and confun. The possible choices for i$i$ are the following.
 i$i$ Meaning 3 All elements of the objective gradient and the constraint Jacobian are provided. 2 All elements of the constraint Jacobian are provided, but some (or all) elements of the objective gradient are not specified. 1 All elements of the objective gradient are provided, but some (or all) elements of the constraint Jacobian are not specified. 0 Some (or all) elements of both the objective gradient and the constraint Jacobian are not specified.
The default value i = 3$i=3$ should be used whenever possible. It is the most reliable and will usually be the most efficient.
If i = 0​ or ​2$i=0\text{​ or ​}2$, nag_opt_nlp1_sparse_solve (e04ug) will estimate the unspecified elements of the objective gradient, using finite differences. This may simplify the coding of objfun. However, the computation of finite difference approximations usually increases the total run-time substantially (since a call to objfun is required for each unspecified element) and there is less assurance that an acceptable solution will be found.
If i = 0​ or ​1$i=0\text{​ or ​}1$, nag_opt_nlp1_sparse_solve (e04ug) will approximate unspecified elements of the constraint Jacobian. For each column of the Jacobian, one call to confun is needed to estimate all unspecified elements in that column (if any). For example, if the sparsity pattern of the Jacobian has the form
 * * * * * ? ? * * * ? * * * * *
$* * * * * ? ? * * * ? * * * * *$
where ‘*$*$’ indicates an element provided and ‘?’ indicates an unspecified element, nag_opt_nlp1_sparse_solve (e04ug) will call confun twice: once to estimate the missing element in column 2$2$ and again to estimate the two missing elements in column 3$3$. (Since columns 1$1$ and 4$4$ are known, they require no calls to confun.)
At times, central differences are used rather than forward differences, in which case twice as many calls to objfun and confun are needed. (The switch to central differences is not under your control.)
If i < 0$i<0$ or i > 3$i>3$, the default value is used.
Derivative Linesearch
Default
Nonderivative Linesearch
At each major iteration, a linesearch is used to improve the value of the Lagrangian merit function (6). The default linesearch uses safeguarded cubic interpolation and requires both function and gradient values in order to compute estimates of the step αk${\alpha }_{k}$. If some analytic derivatives are not provided or optional parameter Nonderivative Linesearch is specified, a linesearch based upon safeguarded quadratic interpolation (which does not require the evaluation or approximation of any gradients) is used instead.
A nonderivative linesearch can be slightly less robust on difficult problems and it is recommended that the default be used if the functions and their derivatives can be computed at approximately the same cost. If the gradients are very expensive to compute relative to the functions however, a nonderivative linesearch may result in a significant decrease in the total run-time.
If optional parameter Nonderivative Linesearch is selected, nag_opt_nlp1_sparse_solve (e04ug) signals the evaluation of the linesearch by calling objfun and confun with mode = 0${\mathbf{mode}}=0$. Once the linesearch is complete, the nonlinear functions are re-evaluated with mode = 2${\mathbf{mode}}=2$. If the potential savings offered by a nonderivative linesearch are to be fully realised, it is essential that objfun and confun be coded so that no derivatives are computed when mode = 0${\mathbf{mode}}=0$.
Elastic Weight  r$r$
Default = 1.0$\text{}=1.0$ or 100.0$100.0$
The default value of r$r$ is 100.0$100.0$ if there are any nonlinear constraints and 1.0$1.0$ otherwise.
This option defines the initial weight γ$\gamma$ associated with problem (8).
At any given major iteration k$k$, elastic mode is entered if the QP subproblem is infeasible or the QP dual variables (Lagrange multipliers) are larger in magnitude than r × (1 + g(xk)2)$r×\left(1+{‖g\left({x}_{k}\right)‖}_{2}\right)$, where g$g$ is the objective gradient. In either case, the QP subproblem is resolved in elastic mode with γ = r × (1 + g(xk)2)$\gamma =r×\left(1+{‖g\left({x}_{k}\right)‖}_{2}\right)$.
Thereafter, γ$\gamma$ is increased (subject to a maximum allowable value) at any point that is optimal for problem (8), but not feasible for problem (1). After the p$p$th increase, γ = r × 10p × (1 + g(xk1)2)$\gamma =r×{10}^{p}×\left(1+{‖g\left({x}_{{k}_{1}}\right)‖}_{2}\right)$, where xk1${x}_{{k}_{1}}$ is the iterate at which γ$\gamma$ was first needed.
If r < 0$r<0$, the default value is used.
Expand Frequency  i$i$
Default = 10000$\text{}=10000$
This option is part of the EXPAND anti-cycling procedure due to Gill et al. (1989), which is designed to make progress even on highly degenerate problems.
For linear models, the strategy is to force a positive step at every iteration, at the expense of violating the constraints by a small amount. Suppose that the value of optional parameter Minor Feasibility Tolerance is δ$\delta$. Over a period of i$i$ iterations, the feasibility tolerance actually used by nag_opt_nlp1_sparse_solve (e04ug) (i.e., the working feasibility tolerance) increases from 0.5δ$0.5\delta$ to δ$\delta$ (in steps of 0.5δ / i$0.5\delta /i$).
For nonlinear models, the same procedure is used for iterations in which there is only one superbasic variable. (Cycling can only occur when the current solution is at a vertex of the feasible region.) Thus, zero steps are allowed if there is more than one superbasic variable, but otherwise positive steps are enforced.
Increasing the value of i$i$ helps reduce the number of slightly infeasible nonbasic basic variables (most of which are eliminated during the resetting procedure). However, it also diminishes the freedom to choose a large pivot element (see optional parameter Pivot Tolerance).
If i < 0$i<0$, the default value is used. If i = 0$i=0$, the value i = 99999999$i=99999999$ is used and effectively no anti-cycling procedure is invoked.
Factorization Frequency  i$i$
Default = 50​ or ​100$\text{}=50\text{​ or ​}100$
The default value of i$i$ is 50$50$ if there are any nonlinear constraints and 100$100$ otherwise.
If i > 0$i>0$, at most i$i$ basis changes will occur between factorizations of the basis matrix.
For linear problems, the basis factors are usually updated at every iteration. The default value i = 100$i=100$ is reasonable for typical problems, particularly those that are extremely sparse and well-scaled.
When the objective function is nonlinear, fewer basis updates will occur as the solution is approached. The number of iterations between basis factorizations will therefore increase. During these iterations a test is made regularly according to the value of optional parameter Check Frequency to ensure that the general constraints are satisfied. If necessary, the basis will be refactorized before the limit of i$i$ updates is reached.
If i0$i\le 0$, the default value is used.
Infeasible Exit
Default
Feasible Exit
Note that this option is ignored if the value of optional parameter Major Iteration Limit is exceeded, or the linear constraints are infeasible.
If termination is about to occur at a point that does not satisfy the nonlinear constraints and optional parameter Feasible Exit is selected, this option requests that additional iterations be performed in order to find a feasible point (if any) for the nonlinear constraints. This involves solving a feasible point problem in which the objective function is omitted.
Otherwise, this option requests no additional iterations be performed.
Minimize
Default
Maximize
Feasible Point
If optional parameter Feasible Point is selected, this option attempts to find a feasible point (if any) for the nonlinear constraints by omitting the objective function. It can also be used to check whether the nonlinear constraints are feasible.
Otherwise, this option specifies the required direction of the optimization. It applies to both linear and nonlinear terms (if any) in the objective function. Note that if two problems are the same except that one minimizes f(x)$f\left(x\right)$ and the other maximizes f(x)$-f\left(x\right)$, their solutions will be the same but the signs of the dual variables πi${\pi }_{i}$ and the reduced gradients dj${d}_{j}$ will be reversed.
Forward Difference Interval  r$r$
Default = sqrt(Function Precision)$\text{}=\sqrt{{\mathbf{Function Precision}}}$
This option defines an interval used to estimate derivatives by forward differences in the following circumstances:
 (a) For verifying the objective and/or constraint gradients (see the description of the optional parameter Verify Level). (b) For estimating unspecified elements of the objective gradient and/or the constraint Jacobian.
A derivative with respect to xj${x}_{j}$ is estimated by perturbing that element of x$x$ to the value xj + r(1 + |xj|)${x}_{j}+r\left(1+|{x}_{j}|\right)$ and then evaluating f(x)$f\left(x\right)$ and/or F(x)$F\left(x\right)$ (as appropriate) at the perturbed point. The resulting gradient estimates should be accurate to O(r)$\mathit{O}\left(r\right)$, unless the functions are badly scaled. Judicious alteration of r$r$ may sometimes lead to greater accuracy. See Gill et al. (1981) for a discussion of the accuracy in finite difference approximations.
If r0$r\le 0$, the default value is used.
Function Precision  r$r$
Default = ε0.8$\text{}={\epsilon }^{0.8}$
This parameter defines the relative function precision εr${\epsilon }_{r}$, which is intended to be a measure of the relative accuracy with which the nonlinear functions can be computed. For example, if f(x)$f\left(x\right)$ (or Fi(x)${F}_{i}\left(x\right)$) is computed as 1000.56789$1000.56789$ for some relevant x$x$ and the first 6$6$ significant digits are known to be correct then the appropriate value for εr${\epsilon }_{r}$ would be 106${10}^{-6}$.
Ideally the functions f(x)$f\left(x\right)$ or Fi(x)${F}_{i}\left(x\right)$ should have magnitude of order 1$1$. If all functions are substantially less than 1$1$ in magnitude, εr${\epsilon }_{r}$ should be the absolute precision. For example, if f(x)$f\left(x\right)$ (or Fi(x)${F}_{i}\left(x\right)$) is computed as 1.23456789 × 104$1.23456789×{10}^{-4}$ for some relevant x$x$ and the first 6$6$ significant digits are known to be correct then the appropriate value for εr${\epsilon }_{r}$ would be 1010${10}^{-10}$.
The choice of εr${\epsilon }_{r}$ can be quite complicated for badly scaled problems; see Chapter 8 of Gill et al. (1981) for a discussion of scaling techniques. The default value is appropriate for most simple functions that are computed with full accuracy.
In some cases the function values will be the result of extensive computation, possibly involving an iterative procedure that can provide few digits of precision at reasonable cost. Specifying an appropriate value of r$r$ may therefore lead to savings, by allowing the linesearch procedure to terminate when the difference between function values along the search direction becomes as small as the absolute error in the values.
If r < ε$r<\epsilon$ or r1$r\ge 1$, the default value is used.
Hessian Frequency  i$i$
Default = 99999999$\text{}=99999999$
This option forces the approximate Hessian formed from i$i$ BFGS updates to be reset to the identity matrix upon completion of a major iteration. It is intended to be used in conjunction with optional parameter Hessian Full Memory.
If i0$i\le 0$, the default value is used and effectively no resets occur.
Hessian Full Memory
Default when n < 75$\stackrel{-}{n}<75$
Hessian Limited Memory
Default when n75$\stackrel{-}{n}\ge 75$
These options specify the method for storing and updating the quasi-Newton approximation to the Hessian of the Lagrangian function.
If Hessian Full Memory is specified, the approximate Hessian is treated as a dense matrix and BFGS quasi-Newton updates are applied explicitly. This is most efficient when the total number of nonlinear variables is not too large (say, n < 75$\stackrel{-}{n}<75$). In this case, the storage requirement is fixed and you can expect 1$1$-step Q-superlinear convergence to the solution.
Hessian Limited Memory should only be specified when n$\stackrel{-}{n}$ is very large. In this case a limited memory procedure is used to update a diagonal Hessian approximation Hr${H}_{r}$ a limited number of times. (Updates are accumulated as a list of vector pairs. They are discarded at regular intervals after Hr${H}_{r}$ has been reset to their diagonal.)
Note that if ${\mathbf{Hessian Frequency}}=20$ is used in conjunction with Hessian Full Memory, the effect will be similar to using Hessian Limited Memory in conjunction with ${\mathbf{Hessian Updates}}=20$, except that the latter will retain the current diagonal during resets.
Hessian Updates  i$i$
Default = 20​ or ​99999999$\text{}=20\text{​ or ​}99999999$
The default value of i$i$ is 20$20$ when Hessian Limited Memory is in effect and 99999999$99999999$ when Hessian Full Memory is in effect, in which case no updates are performed.
If Hessian Limited Memory is in effect, this option defines the maximum number of pairs of Hessian update vectors that are to be used to define the quasi-Newton approximate Hessian. Once the limit of i$i$ updates is reached, all but the diagonal elements of the accumulated updates are discarded and the process starts again. Broadly speaking, the more updates that are stored, the better the quality of the approximate Hessian. On the other hand, the more vectors that are stored, the greater the cost of each QP iteration.
The default value of i$i$ is likely to give a robust algorithm without significant expense, but faster convergence may be obtained with far fewer updates (e.g., i = 5$i=5$).
If i < 0$i<0$, the default value is used.
Infinite Bound Size  r$r$
Default = 1020$\text{}={10}^{20}$
If r > 0$r>0$, r$r$ defines the ‘infinite’ bound bigbnd$\mathit{bigbnd}$ in the definition of the problem constraints. Any upper bound greater than or equal to bigbnd$\mathit{bigbnd}$ will be regarded as + $+\infty$ (and similarly any lower bound less than or equal to bigbnd$-\mathit{bigbnd}$ will be regarded as $-\infty$).
If r0$r\le 0$, the default value is used.
Iteration Limit  i$i$
Default = 10000$\text{}=10000$
The value of i$i$ specifies the maximum number of minor iterations allowed (i.e., iterations of the simplex method or the QP algorithm), summed over all major iterations. (See also the description of the optional parameters Major Iteration Limit and Minor Iteration Limit.)
If i < 0$i<0$, the default value is used.
Linesearch Tolerance  r$r$
Default = 0.9$\text{}=0.9$
This option controls the accuracy with which a step length will be located along the direction of search at each iteration. At the start of each linesearch a target directional derivative for the Lagrangian merit function is identified. The value of r$r$ therefore determines the accuracy to which this target value is approximated.
The default value r = 0.9$r=0.9$ requests an inaccurate search and is appropriate for most problems, particularly those with any nonlinear constraints.
If the nonlinear functions are cheap to evaluate, a more accurate search may be appropriate; try r = 0.1,0.01 ​ or ​ 0.001$r=0.1,0.01\text{​ or ​}0.001$. The number of major iterations required to solve the problem might decrease.
If the nonlinear functions are expensive to evaluate, a less accurate search may be appropriate. If ${\mathbf{Derivative Level}}=3$, try r = 0.99$r=0.99$. (The number of major iterations required to solve the problem might increase, but the total number of function evaluations may decrease enough to compensate.)
If ${\mathbf{Derivative Level}}<3$, a moderately accurate search may be appropriate; try r = 0.5$r=0.5$. Each search will (typically) require only 15$1-5$ function values, but many function calls will then be needed to estimate the missing gradients for the next iteration.
If r < 0$r<0$ or r1$r\ge 1$, the default value is used.
List
Default for e04ug = List$\text{e04ug}={\mathbf{List}}$
Nolist
Default for e04ug = Nolist$\text{e04ug}={\mathbf{Nolist}}$
Normally each optional parameter specification is printed as it is supplied. Optional parameter Nolist may be used to suppress the printing and optional parameter List may be used to restore printing.
LU Density Tolerance  r1${r}_{1}$
Default = 0.6$\text{}=0.6$
LU Singularity Tolerance  r2${r}_{2}$
Default = ε0.67$\text{}={\epsilon }^{0.67}$
If r1 > 0${r}_{1}>0$, r1${r}_{1}$ defines the density tolerance used during the LU$LU$ factorization of the basis matrix. Columns of L$L$ and rows of U$U$ are formed one at a time and the remaining rows and columns of the basis are altered appropriately. At any stage, if the density of the remaining matrix exceeds r1${r}_{1}$, the Markowitz strategy for choosing pivots is terminated. The remaining matrix is then factorized using a dense LU$LU$ procedure. Increasing the value of r1${r}_{1}$ towards unity may give slightly sparser LU$LU$ factors, with a slight increase in factorization time. If r10${r}_{1}\le 0$, the default value is used.
If r2 > 0${r}_{2}>0$, r2${r}_{2}$ defines the singularity tolerance used to guard against ill-conditioned basis matrices. Whenever the basis is refactorized, the diagonal elements of U$U$ are tested as follows. If |ujj|r2$|{u}_{jj}|\le {r}_{2}$ or |ujj| < r2 × maxi |uij|$|{u}_{jj}|<{r}_{2}×\underset{i}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}|{u}_{ij}|$, the j$j$th column of the basis is replaced by the corresponding slack variable. This is most likely to occur when start = 'W'${\mathbf{start}}=\text{'W'}$ (see Section [Parameters]), or at the start of a major iteration. If r20${r}_{2}\le 0$, the default value is used.
In some cases, the Jacobian matrix may converge to values that make the basis exactly singular (e.g., a whole row of the Jacobian matrix could be zero at an optimal solution). Before exact singularity occurs, the basis could become very ill-conditioned and the optimization could progress very slowly (if at all). Setting r2 = 0.00001${r}_{2}=0.00001$ (say) may therefore help cause a judicious change of basis in such situations.
LU Factor Tolerance  r1${r}_{1}$
Default = 5.0$\text{}=5.0$ or 100.0$100.0$
LU Update Tolerance  r2${r}_{2}$
Default = 5.0$\text{}=5.0$ or 10.0$10.0$
The default value of r1${r}_{1}$ is 5.0$5.0$ if there are any nonlinear constraints and 100.0$100.0$ otherwise. The default value of r2${r}_{2}$ is 5.0$5.0$ if there are any nonlinear constraints and 10.0$10.0$ otherwise.
If r11${r}_{1}\ge 1$ and r21${r}_{2}\ge 1$, the values of r1${r}_{1}$ and r2${r}_{2}$ affect the stability and sparsity of the basis factorization B = LU$B=LU$, during refactorization and updating, respectively. The lower triangular matrix L$L$ is a product of matrices of the form
 ( 1 0 ) μ 1
,
$1 0 μ 1 ,$
where the multipliers μ$\mu$ satisfy |μ|ri$|\mu |\le {r}_{i}$. Smaller values of ri${r}_{i}$ favour stability, while larger values favour sparsity. The default values of r1${r}_{1}$ and r2${r}_{2}$ usually strike a good compromise. For large and relatively dense problems, setting r1 = 10.0 ​ or ​ 5.0${r}_{1}=10.0\text{​ or ​}5.0$ (say) may give a marked improvement in sparsity without impairing stability to a serious degree. Note that for problems involving band matrices, it may be necessary to reduce r1${r}_{1}$ and/or r2${r}_{2}$ in order to achieve stability.
If r1 < 1${r}_{1}<1$ or r2 < 1${r}_{2}<1$, the appropriate default value is used.
Major Feasibility Tolerance  r$r$
Default = sqrt(ε)$\text{}=\sqrt{\epsilon }$
This option specifies how accurately the nonlinear constraints should be satisfied. The default value is appropriate when the linear and nonlinear constraints contain data to approximately that accuracy. A larger value may be appropriate if some of the problem functions are known to be of low accuracy.
Let rowerr be defined as the maximum nonlinear constraint violation normalized by the size of the solution. It is required to satisfy
 rowerr = max (violi)/(‖(x,s)‖) ≤ r, i
$rowerr=maxivioli‖(x,s)‖ ≤r,$
where violi${\mathit{viol}}_{i}$ is the violation of the i$i$th nonlinear constraint.
If rε$r\le \epsilon$, the default value is used.
Major Iteration Limit  i$i$
Default = 1000$\text{}=1000$
The value of i$i$ specifies the maximum number of major iterations allowed before termination. It is intended to guard against an excessive number of linearizations of the nonlinear constraints. Setting i = 0$i=0$ and ${\mathbf{Major Print Level}}>0$ means that the objective and constraint gradients will be checked if ${\mathbf{Verify Level}}>0$ and the workspace needed to start solving the problem will be computed and printed, but no iterations will be performed.
If i < 0$i<0$, the default value is used.
Major Optimality Tolerance  r$r$
Default = sqrt(ε)$\text{}=\sqrt{\epsilon }$
Optimality Tolerance  r$r$
This option specifies the final accuracy of the dual variables. If nag_opt_nlp1_sparse_solve (e04ug) terminates with ${\mathbf{ifail}}={\mathbf{0}}$, a primal and dual solution (x,s,π$x,s,\pi$) will have been computed such that
 maxgap = max (gapj)/(‖π‖) ≤ r, j
$maxgap=maxjgapj‖π‖≤r,$
where gapj${\mathit{gap}}_{j}$ is an estimate of the complementarity gap for the j$j$th variable and π$‖\pi ‖$ is a measure of the size of the QP dual variables (or Lagrange multipliers) given by
 m ‖π‖ = max (σ/(sqrt(m)),1),   where  σ = ∑ |πi|. i = 1
$‖π‖=max(σm,1), where σ=∑i=1m|πi|.$
It is included to make the tests independent of a scale factor on the objective function. Specifically, gapj${\mathit{gap}}_{j}$ is computed from the final QP solution using the reduced gradients dj = gjπTaj${d}_{j}={g}_{j}-{\pi }^{\mathrm{T}}{a}_{j}$, where gj${g}_{j}$ is the j$j$th element of the objective gradient and aj${a}_{j}$ is the associated column of the constraint matrix
 ( A − I )
$\left(\begin{array}{cc}A& -I\end{array}\right)$:
gapj =
 { − djmin (xj − lj,1) if ​dj ≥ 0; − djmin (uj − xj,1) if ​dj < 0.
$gapj = { -djmin(xj-lj,1) if ​dj≥0; -djmin(uj-xj,1) if ​dj<0.$
If r0$r\le 0$, the default value is used.
Major Print Level  i$i$
Print Level
The value of i$i$ controls the amount of printout produced by the major iterations of nag_opt_nlp1_sparse_solve (e04ug), as indicated below. A detailed description of the printed output is given in Section [Major Iteration Printout] (summary output at each major iteration and the final solution) and Section [Description of Monitoring Information] (monitoring information at each major iteration). (See also the description of Minor Print Level.)
The following printout is sent to the current advisory message unit (as defined by nag_file_set_unit_advisory (x04ab)):
 i$i$ Output ≥ 00$\phantom{\ge 0}0$ No output. ≥ 01$\phantom{\ge 0}1$ The final solution only. ≥ 05$\phantom{\ge 0}5$ One line of summary output ( < 80$\text{}<80$ characters; see Section [Major Iteration Printout]) for each major iteration (no printout of the final solution). ≥ 10$\text{}\ge 10$ The final solution and one line of summary output for each major iteration.
The following printout is sent to the logical unit number defined by the optional parameter Monitoring File:
 i$i$ Output ≥ 00$\phantom{\ge 0}0$ No output. ≥ 01$\phantom{\ge 0}1$ The final solution only. ≥ 05$\phantom{\ge 0}5$ One long line of output ( < 120$\text{}<120$ characters; see Section [Description of Monitoring Information]) for each major iteration (no printout of the final solution). ≥ 10$\text{}\ge 10$ The final solution and one long line of output for each major iteration. ≥ 20$\text{}\ge 20$ The final solution, one long line of output for each major iteration, matrix statistics (initial status of rows and columns, number of elements, density, biggest and smallest elements, etc.), details of the scale factors resulting from the scaling procedure (if ${\mathbf{Scale Option}}=1$ or 2$2$), basis factorization statistics and details of the initial basis resulting from the Crash procedure (if start = 'C'${\mathbf{start}}=\text{'C'}$; see Section [Parameters]).
If ${\mathbf{Major Print Level}}\ge 5$ and the unit number defined by the optional parameter Monitoring File is the same as that defined by nag_file_set_unit_advisory (x04ab) then the summary output for each major iteration is suppressed.
Major Step Limit  r$r$
Default = 2.0$\text{}=2.0$
If r > 0,r$r>0,r$ limits the change in x$x$ during a linesearch. It applies to all nonlinear problems once a ‘feasible solution’ or ‘feasible subproblem’ has been found.
A linesearch determines a step α$\alpha$ in the interval 0 < αβ$0<\alpha \le \beta$, where β = 1$\beta =1$ if there are any nonlinear constraints, or the step to the nearest upper or lower bound on x$x$ if all the constraints are linear. Normally, the first step attempted is α1 = min (1,β)${\alpha }_{1}=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(1,\beta \right)$.
In some cases, such as f(x) = aebx$f\left(x\right)=a{e}^{bx}$ or f(x) = axb$f\left(x\right)=a{x}^{b}$, even a moderate change in the elements of x$x$ can lead to floating point overflow. The parameter r$r$ is therefore used to define a step limit β$\stackrel{-}{\beta }$ given by
 β = (r(1 + ‖x‖2))/(‖p‖2), $β-=r(1+‖x‖2) ‖p‖2 ,$
where p$p$ is the search direction and the first evaluation of f(x)$f\left(x\right)$ is made at the (potentially) smaller step length α1 = min (1,β,β)${\alpha }_{1}=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(1,\stackrel{-}{\beta },\beta \right)$.
Wherever possible, upper and lower bounds on x$x$ should be used to prevent evaluation of nonlinear functions at meaningless points. The default value r = 2.0$r=2.0$ should not affect progress on well-behaved functions, but values such as r = 0.1 ​ or ​ 0.01$r=0.1\text{​ or ​}0.01$ may be helpful when rapidly varying functions are present. If a small value of r$r$ is selected, a ‘good’ starting point may be required. An important application is to the class of nonlinear least squares problems.
If r0$r\le 0$, the default value is used.
Minor Feasibility Tolerance  r$r$
Default = sqrt(ε)$\text{}=\sqrt{\epsilon }$
Feasibility Tolerance  r$r$
This option attempts to ensure that all variables eventually satisfy their upper and lower bounds to within the tolerance r$r$. Since this includes slack variables, general linear constraints should also be satisfied to within r$r$. Note that feasibility with respect to nonlinear constraints is judged by the value of optional parameter Major Feasibility Tolerance and not by r$r$.
If the bounds and linear constraints cannot be satisfied to within r$r$, the problem is declared infeasible. Let Sinf be the corresponding sum of infeasibilities. If Sinf is quite small, it may be appropriate to raise r$r$ by a factor of 10$10$ or 100$100$. Otherwise, some error in the data should be suspected.
If ${\mathbf{Scale Option}}\ge 1$, feasibility is defined in terms of the scaled problem (since it is more likely to be meaningful).
Nonlinear functions will only be evaluated at points that satisfy the bounds and linear constraints. If there are regions where a function is undefined, every effort should be made to eliminate these regions from the problem. For example, if f(x1,x2) = sqrt(x1) + log(x2)$f\left({x}_{1},{x}_{2}\right)=\sqrt{{x}_{1}}+\mathrm{log}\left({x}_{2}\right)$, it is essential to place lower bounds on both x1${x}_{1}$ and x2${x}_{2}$. If the value r = 106$r={10}^{-6}$ is used, the bounds x1105${x}_{1}\ge {10}^{-5}$ and x2104${x}_{2}\ge {10}^{-4}$ might be appropriate. (The log singularity is more serious; in general, you should attempt to keep x$x$ as far away from singularities as possible.)
In reality, r$r$ is used as a feasibility tolerance for satisfying the bounds on x$x$ and s$s$ in each QP subproblem. If the sum of infeasibilities cannot be reduced to zero, the QP subproblem is declared infeasible and the function is then in elastic mode thereafter (with only the linearized nonlinear constraints defined to be elastic). (See also the description of Elastic Weight.)
If rε$r\le \epsilon$, the default value is used.
Minor Iteration Limit  i$i$
Default = 500$\text{}=500$
The value of i$i$ specifies the maximum number of iterations allowed between successive linearizations of the nonlinear constraints. A value in the range 10i50$10\le i\le 50$ prevents excessive effort being expended on early major iterations, but allows later QP subproblems to be solved to completion. Note that an extra m$m$ minor iterations are allowed if the first QP subproblem to be solved starts with the all-slack basis B = I$B=I$. (See the description of the optional parameter Crash Option.)
In general, it is unsafe to specify values as small as i = 1​ or ​2$i=1\text{​ or ​}2$ (because even when an optimal solution has been reached, a few minor iterations may be needed for the corresponding QP subproblem to be recognized as optimal).
If i0$i\le 0$, the default value is used.
Minor Optimality Tolerance  r$r$
Default = sqrt(ε)$\text{}=\sqrt{\epsilon }$
This option is used to judge optimality for each QP subproblem. Let the QP reduced gradients be dj = gjπTaj${d}_{j}={g}_{j}-{\pi }^{\mathrm{T}}{a}_{j}$, where gj${g}_{j}$ is the j$j$th element of the QP gradient, aj${a}_{j}$ is the associated column of the QP constraint matrix and π$\pi$ is the set of QP dual variables.
By construction, the reduced gradients for basic variables are always zero. The QP subproblem will be declared optimal if the reduced gradients for nonbasic variables at their upper or lower bounds satisfy
 (dj)/(‖π‖) ≥ − r  or  (dj)/(‖π‖) ≤ r $dj‖π‖≥-r or dj‖π‖≤r$
respectively, and if (|dj|)/(π)r$\frac{|{d}_{j}|}{‖\pi ‖}\le r$ for superbasic variables.
Note that π$‖\pi ‖$ is a measure of the size of the dual variables. It is included to make the tests independent of a scale factor on the objective function. (The value of π$‖\pi ‖$ actually used is defined in the description for optional parameter Major Optimality Tolerance.)
If the objective is scaled down to be very small, the optimality test reduces to comparing dj${d}_{j}$ against r$r$.
If r0$r\le 0$, the default value is used.
Minor Print Level  i$i$
Default = 0$\text{}=0$
The value of i$i$ controls the amount of printout produced by the minor iterations of nag_opt_nlp1_sparse_solve (e04ug) (i.e., the iterations of the quadratic programming algorithm), as indicated below. A detailed description of the printed output is given in Section [Minor Iteration Printout] (summary output at each minor iteration) and Section [Description of Monitoring Information] (monitoring information at each minor iteration). (See also the description of the optional parameter Major Print Level.)
The following printout is sent to the current advisory message unit (as defined by nag_file_set_unit_advisory (x04ab)):
 i$i$ Output ≥ 0$\phantom{\ge }0$ No output. ≥ 1$\text{}\ge 1$ One line of summary output ( < 80$\text{}<80$ characters; see Section [Minor Iteration Printout]) for each minor iteration.
The following printout is sent to the logical unit number defined by the optional parameter Monitoring File:
 i$i$ Output ≥ 0$\phantom{\ge }0$ No output. ≥ 1$\text{}\ge 1$ One long line of output ( < 120$\text{}<120$ characters; see Section [Description of Monitoring Information]) for each minor iteration.
If ${\mathbf{Minor Print Level}}\ge 1$ and the unit number defined by the optional parameter Monitoring File is the same as that defined by nag_file_set_unit_advisory (x04ab) then the summary output for each minor iteration is suppressed.
Monitoring File  i$i$
Default = 1$\text{}=-1$
If i0$i\ge 0$ and ${\mathbf{Major Print Level}}\ge 5$ or i0$i\ge 0$ and ${\mathbf{Minor Print Level}}\ge 1$ then monitoring information is produced by nag_opt_nlp1_sparse_solve (e04ug) at every iteration is sent to a file with logical unit number i$i$. If i < 0$i<0$ and/or ${\mathbf{Major Print Level}}<5$ and ${\mathbf{Minor Print Level}}<1$ then no monitoring information is produced.
Partial Price  i$i$
Default = 1​ or ​10$\text{}=1\text{​ or ​}10$
The default value of i$i$ is 1$1$ if there are any nonlinear constraints and 10$10$ otherwise.
This option is recommended for large problems that have significantly more variables than constraints (i.e., nm$n\gg m$). It reduces the work required for each ‘pricing’ operation (i.e., when a nonbasic variable is selected to become superbasic). The possible choices for i$i$ are the following.
i$i$ Meaning
1$\phantom{\ge }1$ All columns of the constraint matrix
 ( A − I )
$\left(\begin{array}{cc}A& -I\end{array}\right)$ are searched.
2$\text{}\ge 2$ Both A$A$ and I$I$ are partitioned to give i$i$ roughly equal segments Aj,Ij${A}_{\mathit{j}},{I}_{\mathit{j}}$, for j = 1,2,,p$\mathit{j}=1,2,\dots ,p$ (modulo p$p$). If the previous pricing search was successful on Aj,Ij${A}_{j},{I}_{j}$, the next search begins on the segments Aj + 1,Ij + 1${A}_{j+1},{I}_{j+1}$. If a reduced gradient is found that is larger than some dynamic tolerance, the variable with the largest such reduced gradient (of appropriate sign) is selected to enter the basis. If nothing is found, the search continues on the next segments Aj + 2,Ij + 2${A}_{j+2},{I}_{j+2}$ and so on.
If i0$i\le 0$, the default value is used.
Pivot Tolerance  r$r$
Default = ε0.67$\text{}={\epsilon }^{0.67}$
If r > 0$r>0$, r$r$ is used during the solution of QP subproblems to prevent columns entering the basis if they would cause the basis to become almost singular.
When x$x$ changes to x + αp$x+\alpha p$ for some specified search direction p$p$, a ‘ratio test’ is used to determine which element of x$x$ reaches an upper or lower bound first. The corresponding element of p$p$ is called the pivot element. Elements of p$p$ are ignored (and therefore cannot be pivot elements) if they are smaller than r$r$.
It is common in practice for two (or more) variables to reach a bound at essentially the same time. In such cases, the Minor Feasibility Tolerance provides some freedom to maximize the pivot element and thereby improve numerical stability. Excessively small values of Minor Feasibility Tolerance should therefore not be specified. To a lesser extent, the Expand Frequency also provides some freedom to maximize the pivot element. Excessively large values of Expand Frequency should therefore not be specified.
If r0$r\le 0$, the default value is used.
Scale Option  i$i$
Default = 1​ or ​2$\text{}=1\text{​ or ​}2$
The default value of i$i$ is 1$1$ if there are any nonlinear constraints and 2$2$ otherwise.
This option enables you to scale the variables and constraints using an iterative procedure due to Fourer (1982), which attempts to compute row scales ri${r}_{i}$ and column scales cj${c}_{j}$ such that the scaled matrix coefficients aij = aij × (cj / ri)${\stackrel{-}{a}}_{ij}={a}_{ij}×\left({c}_{j}/{r}_{i}\right)$ are as close as possible to unity. (The lower and upper bounds on the variables and slacks for the scaled problem are redefined as lj = lj / cj${\stackrel{-}{l}}_{j}={l}_{j}/{c}_{j}$ and uj = uj / cj${\stackrel{-}{u}}_{j}={u}_{j}/{c}_{j}$ respectively, where cjrjn${c}_{j}\equiv {r}_{j-n}$ if j > n$j>n$.) The possible choices for i$i$ are the following.
i$i$ Meaning
0 No scaling is performed. This is recommended if it is known that the elements of x$x$ and the constraint matrix A$A$ (along with its Jacobian) never become large (say, > 1000$\text{}>1000$).
1 All linear constraints and variables are scaled. This may improve the overall efficiency of the function on some problems.
2 All constraints and variables are scaled. Also, an additional scaling is performed that takes into account columns of
 ( A − I )
$\left(\begin{array}{cc}A& -I\end{array}\right)$ that are fixed or have positive lower bounds or negative upper bounds.
If there are any nonlinear constraints present, the scale factors depend on the Jacobian at the first point that satisfies the linear constraints and the upper and lower bounds. The setting i = 2$i=2$ should therefore be used only if a ‘good’ starting point is available and the problem is not highly nonlinear.
If i < 0$i<0$ or i > 2$i>2$, the default value is used.
Scale Tolerance  r$r$
Default = 0.9$\text{}=0.9$
Note that this option does not apply when ${\mathbf{Scale Option}}=0$.
The value r$r$ (0 < r < 1$0) is used to control the number of scaling passes to be made through the constraint matrix A$A$. At least 3$3$ (and at most 10$10$) passes will be made. More precisely, let ap${a}_{p}$ denote the largest column ratio (i.e., ('biggest'​ element)/('smallest'​ element) $\frac{\text{'biggest'}\text{​ element}}{\text{'smallest'}\text{​ element}}$ in some sense) after the p$p$th scaling pass through A$A$. The scaling procedure is terminated if apap1 × r${a}_{p}\ge {a}_{p-1}×r$ for some p3$p\ge 3$. Thus, increasing the value of r$r$ from 0.9$0.9$ to 0.99$0.99$ (say) will probably increase the number of passes through A$A$.
If r0$r\le 0$ or r1$r\ge 1$, the default value is used.
Start Objective Check At Column  i1${i}_{1}$
Default = 1$\text{}=1$
Stop Objective Check At Column  i2${i}_{2}$
Default = n1$\text{}={n}_{1}^{\prime }$
Start Constraint Check At Column  i3${i}_{3}$
Default = 1$\text{}=1$
Stop Constraint Check At Column  i4${i}_{4}$
Default = n1$\text{}={n}_{1}^{\prime \prime }$
These keywords take effect only if ${\mathbf{Verify Level}}>0$. They may be used to control the verification of gradient elements computed by objfun and/or Jacobian elements computed by confun. For example, if the first 30$30$ elements of the objective gradient appeared to be correct in an earlier run, so that only element 31$31$ remains questionable then it is reasonable to specify ${\mathbf{Start Objective Check At Column}}=31$. Similarly for columns of the Jacobian. If the first 30$30$ variables occur nonlinearly in the constraints but the remaining variables are nonlinear only in the objective, then objfun must set the first 30$30$ elements of the array objgrd to zero, but these hardly need to be verified. Again it is reasonable to specify ${\mathbf{Start Objective Check At Column}}=31$.
If i20${i}_{2}\le 0$ or i2 > n1${i}_{2}>{n}_{1}^{\prime }$, the default value is used.
If i10${i}_{1}\le 0$ or i1 > min (n1,i2)${i}_{1}>\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({n}_{1}^{\prime },{i}_{2}\right)$, the default value is used.
If i40${i}_{4}\le 0$ or i4 > n1${i}_{4}>{n}_{1}^{\prime \prime }$, the default value is used.
If i30${i}_{3}\le 0$ or i3 > min (n1,i4)${i}_{3}>\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({n}_{1}^{\prime \prime },{i}_{4}\right)$, the default value is used.
Superbasics Limit  i$i$
Default = min (500,n + 1)$\text{}=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(500,\stackrel{-}{n}+1\right)$
Note that this option does not apply to linear problems.
It places a limit on the storage allocated for superbasic variables. Ideally, the value of i$i$ should be set slightly larger than the ‘number of degrees of freedom’ expected at the solution.
For nonlinear problems, the number of degrees of freedom is often called the ‘number of independent variables’. Normally, the value of i$i$ need not be greater than n + 1$\stackrel{-}{n}+1$, but for many problems it may be considerably smaller. (This will save storage if n$\stackrel{-}{n}$ is very large.)
If i0$i\le 0$, the default value is used.
Unbounded Objective  r1${r}_{1}$
Default = 1015$\text{}={10}^{15}$
Unbounded Step Size  r2${r}_{2}$
Default = max (bigbnd,1020)$\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\mathit{bigbnd},{10}^{20}\right)$
These options are intended to detect unboundedness in nonlinear problems. During the linesearch, the objective function f$f$ is evaluated at points of the form x + αp$x+\alpha p$, where x$x$ and p$p$ are fixed and α$\alpha$ varies. If |f|$|f|$ exceeds r1${r}_{1}$ or α$\alpha$ exceeds r2${r}_{2}$, the iterations are terminated and the function returns with ${\mathbf{ifail}}={\mathbf{3}}$.
If singularities are present, unboundedness in f(x)$f\left(x\right)$ may manifest itself by a floating point overflow during the evaluation of f(x + αp)$f\left(x+\alpha p\right)$, before the test against r1${r}_{1}$ can be made.
Unboundedness in x$x$ is best avoided by placing finite upper and lower bounds on the variables.
If r10${r}_{1}\le 0$ or r20${r}_{2}\le 0$, the appropriate default value is used.
Verify Level  i$i$
Default = 0$\text{}=0$
This option refers to finite difference checks on the gradient elements computed by objfun and confun. Gradients are verified at the first point that satisfies the linear constraints and the upper and lower bounds. Unspecified gradient elements are not checked and hence they result in no overhead. The possible choices for i$i$ are the following.
 i$i$ Meaning − 1$-1$ No checks are performed. − 0$\phantom{-}0$ Only a ‘cheap’ test will be performed, requiring three calls to objfun and two calls to confun. Note that no checks are carried out if every column of the constraint gradients (Jacobian) contains a missing element. − 1$\phantom{-}1$ Individual objective gradient elements will be checked using a reliable (but more expensive) test. If ${\mathbf{Major Print Level}}>0$, a key of the form OK or BAD? indicates whether or not each element appears to be correct. − 2$\phantom{-}2$ Individual columns of the constraint gradients (Jacobian) will be checked using a reliable (but more expensive) test. If ${\mathbf{Major Print Level}}>0$, a key of the form OK or BAD? indicates whether or not each element appears to be correct. − 3$\phantom{-}3$ Check both constraint and objective gradients (in that order) as described above for i = 2$i=2$ and i = 1$i=1$ respectively.
The value i = 3$i=3$ should be used whenever a new function function is being developed. The Start Objective Check At Column and Stop Objective Check At Column keywords may be used to limit the number of nonlinear variables to be checked.
If i < 1$i<-1$ or i > 3$i>3$, the default value is used.
Violation Limit  r$r$
Default = 10.0$\text{}=10.0$
This option defines an absolute limit on the magnitude of the maximum constraint violation after the linesearch. Upon completion of the linesearch, the new iterate xk + 1${x}_{k+1}$ satisfies the condition
 vi(xk + 1) ≤ r × max (1,vi(x0)), $vi(xk+1)≤r×max(1,vi(x0)),$
where x0${x}_{0}$ is the point at which the nonlinear constraints are first evaluated and vi(x)${v}_{i}\left(x\right)$ is the i$i$th nonlinear constraint violation vi(x) = max (0,liFi(x),Fi(x)ui)${v}_{i}\left(x\right)=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(0,{l}_{i}-{F}_{i}\left(x\right),{F}_{i}\left(x\right)-{u}_{i}\right)$.
The effect of the violation limit is to restrict the iterates to lie in an expanded feasible region whose size depends on the magnitude of r$r$. This makes it possible to keep the iterates within a region where the objective function is expected to be well-defined and bounded below (or above in the case of maximization). If the objective function is bounded below (or above in the case of maximization) for all values of the variables, then r$r$ may be any large positive value.
If r0$r\le 0$, the default value is used.

## Description of Monitoring Information

This section describes the intermediate printout and final printout which constitutes the monitoring information produced by nag_opt_nlp1_sparse_solve (e04ug). (See also the description of the optional parameters Monitoring File, Major Print Level and Minor Print Level.) You can control the level of printed output.
When ${\mathbf{Major Print Level}}\ge 20$ and ${\mathbf{Monitoring File}}\ge 0$, the following line of intermediate printout ( < 120$\text{}<120$ characters) is produced at every major iteration on the unit number specified by optional parameter Monitoring File. Unless stated otherwise, the values of the quantities printed are those in effect on completion of the given iteration.
Major is the major iteration count.
Minor is the number of minor iterations required by the feasibility and optimality phases of the QP subproblem. Generally, Minor will be 1$1$ in the later iterations, since theoretical analysis predicts that the correct active set will be identified near the solution (see Section [Algorithmic Details]).
Step is the step αk${\alpha }_{k}$ taken along the computed search direction. On reasonably well-behaved problems, the unit step (i.e., αk = 1${\alpha }_{k}=1$) will be taken as the solution is approached.
nObj is the number of times objfun has been called to evaluate the nonlinear part of the objective function. Evaluations needed for the estimation of the gradients by finite differences are not included. nObj is printed as a guide to the amount of work required for the linesearch.
nCon is the number of times confun has been called to evaluate the nonlinear constraint functions (not printed if ncnln is zero).
Merit is the value of the augmented Lagrangian merit function (6) at the current iterate. This function will decrease at each iteration unless it was necessary to increase the penalty parameters (see Section [Major Iteration Printout]). As the solution is approached, Merit will converge to the value of the objective function at the solution.
In elastic mode (see Section [Treatment of Constraint Infeasibilities]), the merit function is a composite function involving the constraint violations weighted by the value of the optional parameter Elastic Weight.
If there are no nonlinear constraints present, this entry contains Objective, the value of the objective function f(x)$f\left(x\right)$. In this case, f(x)$f\left(x\right)$ will decrease monotonically to its optimal value.
Feasibl is the value of rowerr, the largest element of the scaled nonlinear constraint residual vector defined in the description of the optional parameter Major Feasibility Tolerance. The solution is regarded as ‘feasible’ if Feasibl is less than (or equal to) the optional parameter Major Feasibility Tolerance. Feasibl will be approximately zero in the neighbourhood of a solution.
If there are no nonlinear constraints present, all iterates are feasible and this entry is not printed.
Optimal is the value of maxgap, the largest element of the maximum complementarity gap vector defined in the description of the optional parameter Major Optimality Tolerance. The Lagrange multipliers are regarded as ‘optimal’ if Optimal is less than (or equal to) the optional parameter Major Optimality Tolerance. Optimal will be approximately zero in the neighbourhood of a solution.
nS is the current number of superbasic variables.
Penalty is the Euclidean norm of the vector of penalty parameters used in the augmented Lagrangian merit function (not printed if ncnln is zero).
LU is the number of nonzeros representing the basis factors L$L$ and U$U$ on completion of the QP subproblem.
If there are nonlinear constraints present, the basis factorization B = LU$B=LU$ is computed at the start of the first minor iteration. At this stage, LU = lenL + lenU$\mathtt{LU}=\mathtt{lenL}+\mathtt{lenU}$, where lenL is the number of subdiagonal elements in the columns of a lower triangular matrix and lenU is the number of diagonal and superdiagonal elements in the rows of an upper triangular matrix. As columns of B$B$ are replaced during the minor iterations, the value of LU may fluctuate up or down (but in general will tend to increase). As the solution is approached and the number of minor iterations required to solve each QP subproblem decreases towards zero, LU will reflect the number of nonzeros in the LU$LU$ factors at the start of each QP subproblem.
If there are no nonlinear constraints present, refactorization is subject only to the value of the optional parameter Factorization Frequency and hence LU will tend to increase between factorizations.
Swp is the number of columns of the basis matrix B$B$ that were swapped with columns of S$S$ in order to improve the condition number of B$B$ (not printed if ncnln is zero). The swaps are determined by an LU$LU$ factorization of the rectangular matrix BS = (BS)
 T
${B}_{S}={\left(\begin{array}{cc}B& S\end{array}\right)}^{\mathrm{T}}$, with stability being favoured more than sparsity.
Cond Hz is an estimate of the condition number of the reduced Hessian of the Lagrangian (not printed if ncnln and nonln are both zero). It is the square of the ratio between the largest and smallest diagonal elements of the upper triangular matrix R$R$. This constitutes a lower bound on the condition number of the matrix RTR${R}^{\mathrm{T}}R$ that approximates the reduced Hessian. The larger this number, the more difficult the problem.
PD is a two-letter indication of the status of the convergence tests involving the feasibility and optimality of the iterates defined in the descriptions of the optional parameters Major Feasibility Tolerance and Major Optimality Tolerance. Each letter is T if the test is satisfied and F otherwise. The tests indicate whether the values of Feasibl and Optimal are sufficiently small. For example, TF or TT is printed if there are no nonlinear constraints present (since all iterates are feasible). If either indicator is F when nag_opt_nlp1_sparse_solve (e04ug) terminates with ${\mathbf{ifail}}={\mathbf{0}}$, you should check the solution carefully.
M is printed if an extra evaluation of user-supplied functions objfun and confun was needed in order to define an acceptable positive definite quasi-Newton update to the Hessian of the Lagrangian. This modification is only performed when there are nonlinear constraints present.
m is printed if, in addition, it was also necessary to modify the update to include an augmented Lagrangian term.
s is printed if a self-scaled BFGS (Broyden–Fletcher–Goldfarb–Shanno) update was performed. This update is always used when the Hessian approximation is diagonal and hence always follows a Hessian reset.
S is printed if, in addition, it was also necessary to modify the self-scaled update in order to maintain positive-definiteness.
n is printed if no positive definite BFGS update could be found, in which case the approximate Hessian is unchanged from the previous iteration.
r is printed if the approximate Hessian was reset after 10$10$ consecutive major iterations in which no BFGS update could be made. The diagonal elements of the approximate Hessian are retained if at least one update has been performed since the last reset. Otherwise, the approximate Hessian is reset to the identity matrix.
R is printed if the approximate Hessian has been reset by discarding all but its diagonal elements. This reset will be forced periodically by the values of the optional parameters Hessian Frequency and Hessian Updates. However, it may also be necessary to reset an ill-conditioned Hessian from time to time.
l is printed if the change in the norm of the variables was greater than the value defined by the optional parameter Major Step Limit. If this output occurs frequently during later iterations, it may be worthwhile increasing the value of Major Step Limit.
c is printed if central differences have been used to compute the unknown elements of the objective and constraint gradients. A switch to central differences is made if either the linesearch gives a small step, or x$x$ is close to being optimal. In some cases, it may be necessary to re-solve the QP subproblem with the central difference gradient and Jacobian.
u is printed if the QP subproblem was unbounded.
t is printed if the minor iterations were terminated after the number of iterations specified by the value of the optional parameter Minor Iteration Limit was reached.
i is printed if the QP subproblem was infeasible when the function was not in elastic mode. This event triggers the start of nonlinear elastic mode, which remains in effect for all subsequent iterations. Once in elastic mode, the QP subproblems are associated with the elastic problem (8) (see Section [Treatment of Constraint Infeasibilities]). It is also printed if the minimizer of the elastic subproblem does not satisfy the linearized constraints when the function is already in elastic mode. (In this case, a feasible point for the usual QP subproblem may or may not exist.)
w is printed if a weak solution of the QP subproblem was found.
When ${\mathbf{Minor Print Level}}\ge 1$ and ${\mathbf{Monitoring File}}\ge 0$, the following line of intermediate printout ( < 120$\text{}<120$ characters) is produced at every minor iteration on the unit number specified by optional parameter Monitoring File. Unless stated otherwise, the values of the quantities printed are those in effect on completion of the given iteration.
In the description below, a ‘pricing’ operation is defined to be the process by which a nonbasic variable is selected to become superbasic (in addition to those already in the superbasic set). If the problem is purely linear, the variable selected will usually become basic immediately (unless it happens to reach its opposite bound and return to the nonbasic set).
Itn is the iteration count.
pp is the partial price indicator. The variable selected by the last pricing operation came from the ppth partition of A$A$ and I$-I$. Note that pp is reset to zero whenever the basis is refactorized.
dj is the value of the reduced gradient (or reduced cost) for the variable selected by the pricing operation at the start of the current iteration.
+SBS is the variable selected by the pricing operation to be added to the superbasic set.
-SBS is the variable chosen to leave the superbasic set. It has become basic if the entry under -B is nonzero; otherwise it has become nonbasic.
-BS is the variable removed from the basis (if any) to become nonbasic.
-B is the variable removed from the basis (if any) to swap with a slack variable made superbasic by the latest pricing operation. The swap is done to ensure that there are no superbasic slacks.
Step is the value of the step length α$\alpha$ taken along the current search direction p$p$. The variables x$x$ have just been changed to x + αp$x+\alpha p$. If a variable is made superbasic during the current iteration (i.e., +SBS is positive), Step will be the step to the nearest bound. During the optimality phase, the step can be greater than unity only if the reduced Hessian is not positive definite.
Pivot is the r$r$th element of a vector y$y$ satisfying By = aq$By={a}_{q}$ whenever aq${a}_{q}$ (the q$q$th column of the constraint matrix
 ( A − I )
$\left(\begin{array}{cc}A& -I\end{array}\right)$) replaces the r$r$th column of the basis matrix B$B$. Wherever possible, Step is chosen so as to avoid extremely small values of Pivot (since they may cause the basis to be nearly singular). In extreme cases, it may be necessary to increase the value of the optional parameter Pivot Tolerance to exclude very small elements of y$y$ from consideration during the computation of Step.
Ninf is the number of infeasibilities. This will not increase unless the iterations are in elastic mode. Ninf will be zero during the optimality phase.
Sinf/Objective is the value of the current objective function. If x$x$ is infeasible, Sinf gives the value of the sum of infeasibilities at the start of the current iteration. It will usually decrease at each nonzero value of Step, but may occasionally increase if the value of Ninf decreases by a factor of 2$2$ or more. However, in elastic mode this entry gives the value of the composite objective function (9), which will decrease monotonically at each iteration. If x$x$ is feasible, Objective is the value of the current QP objective function.
L is the number of nonzeros in the basis factor L$L$. Immediately after a basis factorization B = LU$B=LU$, this entry contains lenL. Further nonzeros are added to L when various columns of B$B$ are later replaced. (Thus, L increases monotonically.)
U is the number of nonzeros in the basis factor U$U$. Immediately after a basis factorization B = LU$B=LU$, this entry contains lenU. As columns of B$B$ are replaced, the matrix U$U$ is maintained explicitly (in sparse form). The value of U may fluctuate up or down; in general, it will tend to increase.
Ncp is the number of compressions required to recover workspace in the data structure for U$U$. This includes the number of compressions needed during the previous basis factorization. Normally, Ncp should increase very slowly. If it does not, increase leniz and lenz by at least L + U$\mathtt{L}+\mathtt{U}$ and rerun nag_opt_nlp1_sparse_solve (e04ug) (possibly using start = 'W'${\mathbf{start}}=\text{'W'}$; see Section [Parameters]).
The following items are printed only if the problem is nonlinear or the superbasic set is non-empty (i.e., if the current solution is nonbasic).
 Norm rg is the Euclidean norm of the reduced gradient of the QP objective function. During the optimality phase, this norm will be approximately zero after a unit step. nS is the current number of superbasic variables. Cond Hz is an estimate of the condition number of the reduced Hessian of the Lagrangian (not printed if ncnln and nonln are both zero). It is the square of the ratio between the largest and smallest diagonal elements of the upper triangular matrix R$R$. This constitutes a lower bound on the condition number of the matrix RTR${R}^{\mathrm{T}}R$ that approximates the reduced Hessian. The larger this number, the more difficult the problem.
When ${\mathbf{Major Print Level}}\ge 20$ and ${\mathbf{Monitoring File}}\ge 0$, the following lines of intermediate printout ( < 120$\text{}<120$ characters) are produced on the unit number specified by optional parameter Monitoring File whenever the matrix B$B$ or BS = (BS)T${B}_{S}={\left(B\text{ }S\right)}^{\mathrm{T}}$ is factorized before solving the next QP subproblem. Gaussian elimination is used to compute a sparse LU$LU$ factorization of B$B$ or BS${B}_{S}$, where PLPT$PL{P}^{\mathrm{T}}$ is a lower triangular matrix and PUQ$PUQ$ is an upper triangular matrix for some permutation matrices P$P$ and Q$Q$. The factorization is stabilized in the manner described under the optional parameter LU Factor Tolerance (default value = 5.0$\text{default value}=5.0$ or 100.0$100.0$).
Note that BS${B}_{S}$ may be factorized at the beginning of just some of the major iterations. It is immediately followed by a factorization of B$B$ itself.
 Factorize is the factorization count. Iteration is the iteration count. Nonlinear is the number of nonlinear variables in the current basis B$B$ (not printed if BS${B}_{S}$ is factorized). Linear is the number of linear variables in B$B$ (not printed if BS${B}_{S}$ is factorized). Slacks is the number of slack variables in B$B$ (not printed if BS${B}_{S}$ is factorized). Elems is the number of nonzeros in B$B$ (not printed if BS${B}_{S}$ is factorized). Density is the percentage nonzero density of B$B$ (not printed if BS${B}_{S}$ is factorized). More precisely, Density = 100 × Elems / (Nonlinear + Linear + Slacks)2$\mathtt{Density}=100×\mathtt{Elems}/{\left(\mathtt{Nonlinear}+\mathtt{Linear}+\mathtt{Slacks}\right)}^{2}$. Compressns is the number of times the data structure holding the partially factorized matrix needed to be compressed, in order to recover unused workspace. Ideally, it should be zero. If it is more than 3$3$ or 4$4$, increase leniz and lenz and rerun nag_opt_nlp1_sparse_solve (e04ug) (possibly using start = 'W'${\mathbf{start}}=\text{'W'}$; see Section [Parameters]). Merit is the average Markowitz merit count for the elements chosen to be the diagonals of PUQ$PUQ$. Each merit count is defined to be (c − 1)(r − 1)$\left(c-1\right)\left(r-1\right)$, where c$c$ and r$r$ are the number of nonzeros in the column and row containing the element at the time it is selected to be the next diagonal. Merit is the average of m such quantities. It gives an indication of how much work was required to preserve sparsity during the factorization. lenL is the number of nonzeros in L$L$. lenU is the number of nonzeros in U$U$. Increase is the percentage increase in the number of nonzeros in L$L$ and U$U$ relative to the number of nonzeros in B$B$. More precisely, Increase = 100 × (lenL + lenU − Elems) / Elems$\mathtt{Increase}=100×\left(\mathtt{lenL}+\mathtt{lenU}-\mathtt{Elems}\right)/\mathtt{Elems}$. m is the number of rows in the problem. Note that m = Ut + Lt + bp$\mathtt{m}=\mathtt{Ut}+\mathtt{Lt}+\mathtt{bp}$. Ut is the number of triangular rows of B$B$ at the top of U$U$. d1 is the number of columns remaining when the density of the basis matrix being factorized reached 0.3$0.3$. Lmax is the maximum subdiagonal element in the columns of L$L$. This will not exceed the value of the optional parameter LU Factor Tolerance. Bmax is the maximum nonzero element in B$B$ (not printed if BS${B}_{S}$ is factorized). BSmax is the maximum nonzero element in BS${B}_{S}$ (not printed if B$B$ is factorized). Umax is the maximum nonzero element in U$U$, excluding elements of B$B$ that remain in U$U$ unchanged. (For example, if a slack variable is in the basis, the corresponding row of B$B$ will become a row of U$U$ without modification. Elements in such rows will not contribute to Umax. If the basis is strictly triangular then none of the elements of B$B$ will contribute and Umax will be zero.)Ideally, Umax should not be significantly larger than Bmax. If it is several orders of magnitude larger, it may be advisable to reset the optional parameter LU Factor Tolerance to some value nearer unity.Umax is not printed if BS${B}_{S}$ is factorized. Umin is the magnitude of the smallest diagonal element of PUQ$PUQ$. Growth is the value of the ratio Umax/Bmax, which should not be too large.Providing Lmax is not large (say, < 10.0$\text{}<10.0$), the ratio max (Bmax,Umax) / Umin$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\mathtt{Bmax},\mathtt{Umax}\right)/\mathtt{Umin}$ is an estimate of the condition number of B$B$. If this number is extremely large, the basis is nearly singular and some numerical difficulties might occur. (However, an effort is made to avoid near-singularity by using slacks to replace columns of B$B$ that would have made Umin extremely small and the modified basis is refactorized.) Lt is the number of triangular columns of B$B$ at the left of L$L$. bp is the size of the ‘bump’ or block to be factorized nontrivially after the triangular rows and columns of B$B$ have been removed. d2 is the number of columns remaining when the density of the basis matrix being factorized has reached 0.6$0.6$.
When ${\mathbf{Major Print Level}}\ge 20$, ${\mathbf{Monitoring File}}\ge 0$ and ${\mathbf{Crash Option}}>0$ (default value = 0​ or ​3$\text{default value}=0\text{​ or ​}3$), the following lines of intermediate printout ( < 80$\text{}<80$ characters) are produced on the unit number specified by optional parameter Monitoring File whenever start = 'C'${\mathbf{start}}=\text{'C'}$ (see Section [Parameters]). They refer to the number of columns selected by the Crash procedure during each of several passes through A$A$ while searching for a triangular basis matrix.
 Slacks is the number of slacks selected initially. Free cols is the number of free columns in the basis, including those whose bounds are rather far apart. Preferred is the number of ‘preferred’ columns in the basis (i.e., istate(j) = 3${\mathbf{istate}}\left(j\right)=3$ for some j ≤ n$j\le n$). It will be a subset of the columns for which istate(j) = 3${\mathbf{istate}}\left(j\right)=3$ was specified. Unit is the number of unit columns in the basis. Double is the number of columns in the basis containing two nonzeros. Triangle is the number of triangular columns in the basis with three (or more) nonzeros. Pad is the number of slacks used to pad the basis (to make it a nonsingular triangle).
When ${\mathbf{Major Print Level}}=1$ or 10$\text{}\ge 10$ and ${\mathbf{Monitoring File}}\ge 0$, the following lines of final printout ( < 120$\text{}<120$ characters) are produced on the unit number specified by optional parameter Monitoring File.
Let xj${x}_{\mathit{j}}$ denote the j$\mathit{j}$th ‘column variable’, for j = 1,2,,n$\mathit{j}=1,2,\dots ,n$. We assume that a typical variable xj${x}_{j}$ has bounds αxjβ$\alpha \le {x}_{j}\le \beta$.
The following describes the printout for each column (or variable). A full stop (.) is printed for any numerical value that is zero.
Number is the column number j$j$. (This is used internally to refer to xj${x}_{j}$ in the intermediate output.)
Column gives the name of xj${x}_{j}$.
State gives the state of xj${x}_{j}$ relative to the bounds α$\alpha$ and β$\beta$.
The various possible states are as follows:
 LL xj${x}_{j}$ is nonbasic at its lower limit, α$\alpha$. UL xj${x}_{j}$ is nonbasic at its upper limit, β$\beta$. EQ xj${x}_{j}$ is nonbasic and fixed at the value α = β$\alpha =\beta$. FR xj${x}_{j}$ is nonbasic at some value strictly between its bounds: α < xj < β$\alpha <{x}_{j}<\beta$. BS xj${x}_{j}$ is basic. Usually α < xj < β$\alpha <{x}_{j}<\beta$.
A key is sometimes printed before State. Note that unless the optional parameter ${\mathbf{Scale Option}}=0$ is specified, the tests for assigning a key are applied to the variables of the scaled problem.
 A Alternative optimum possible. The variable is nonbasic, but its reduced gradient is essentially zero. This means that if the variable were allowed to start moving away from its current value, there would be no change in the value of the objective function. The values of the basic and superbasic variables might change, giving a genuine alternative solution. The values of the Lagrange multipliers might also change. D Degenerate. The variable is basic, but it is equal to (or very close to) one of its bounds. I Infeasible. The variable is basic and is currently violating one of its bounds by more than the value of the optional parameter Minor Feasibility Tolerance. N Not precisely optimal. The variable is nonbasic. Its reduced gradient is larger than the value of the optional parameter Major Feasibility Tolerance.
Activity is the value of xj${x}_{j}$ at the final iterate.
Obj Gradient is the value of gj${g}_{j}$ at the final iterate. (If any xj${x}_{j}$ is infeasible, gj${g}_{j}$ is the gradient of the sum of infeasibilities.)
Lower Bound is the lower bound specified for the variable. None indicates that bl(j)bigbnd${\mathbf{bl}}\left(j\right)\le -\mathit{bigbnd}$.
Upper Bound is the upper bound specified for the variable. None indicates that bu(j)bigbnd${\mathbf{bu}}\left(j\right)\ge \mathit{bigbnd}$.
Reduced Gradnt is the value of dj${d}_{j}$ at the final iterate.
m + j is the value of m + j$m+j$.
General linear constraints take the form lAxu$l\le Ax\le u$. The i$i$th constraint is therefore of the form αaiTxβ$\alpha \le {a}_{i}^{\mathrm{T}}x\le \beta$ and the value of aiTx${a}_{i}^{\mathrm{T}}x$ is called the row activity. Internally, the linear constraints take the form Axs = 0$Ax-s=0$, where the slack variables s$s$ should satisfy the bounds lsu$l\le s\le u$. For the i$i$th ‘row’, it is the slack variable si${s}_{i}$ that is directly available and it is sometimes convenient to refer to its state. Slacks may be basic or nonbasic (but not superbasic).
Nonlinear constraints αFi(x) + aiTxβ$\alpha \le {F}_{i}\left(x\right)+{a}_{i}^{\mathrm{T}}x\le \beta$ are treated similarly, except that the row activity and degree of infeasibility are computed directly from Fi(x) + aiTx${F}_{i}\left(x\right)+{a}_{i}^{\mathrm{T}}x$ rather than from si${s}_{i}$.
The following describes the printout for each row (or constraint). A full stop (.) is printed for any numerical value that is zero.
Number is the value of n + i$n+i$. (This is used internally to refer to si${s}_{i}$ in the intermediate output.)
Row gives the name of the i$i$th row.
State gives the state of the i$i$th row relative to the bounds α$\alpha$ and β$\beta$.
The various possible states are as follows:
 LL The row is at its lower limit, α$\alpha$. UL The row is at its upper limit, β$\beta$. EQ The limits are the same (α = β)$\left(\alpha =\beta \right)$. BS The constraint is not binding. si${s}_{i}$ is basic.
A key is sometimes printed before State. Note that unless the optional parameter ${\mathbf{Scale Option}}=0$ is specified, the tests for assigning a key are applied to the variables of the scaled problem.
 A Alternative optimum possible. The variable is nonbasic, but its reduced gradient is essentially zero. This means that if the variable were allowed to start moving away from its current value, there would be no change in the value of the objective function. The values of the basic and superbasic variables might change, giving a genuine alternative solution. The values of the Lagrange multipliers might also change. D Degenerate. The variable is basic, but it is equal to (or very close to) one of its bounds. I Infeasible. The variable is basic and is currently violating one of its bounds by more than the value of the optional parameter Minor Feasibility Tolerance. N Not precisely optimal. The variable is nonbasic. Its reduced gradient is larger than the value of the optional parameter Major Feasibility Tolerance.
Activity is the value of aiTx${a}_{i}^{\mathrm{T}}x$ (or Fi(x) + aiTx${F}_{i}\left(x\right)+{a}_{i}^{\mathrm{T}}x$ for nonlinear rows) at the final iterate.
Slack Activity is the value by which the row differs from its nearest bound. (For the free row (if any), it is set to Activity.)
Lower Bound is α$\alpha$, the lower bound specified for the i$i$th row. None indicates that bl(n + i)bigbnd${\mathbf{bl}}\left(n+i\right)\le -\mathit{bigbnd}$.
Upper Bound is β$\beta$, the upper bound specified for the i$i$th row. None indicates that bu(n + i)bigbnd${\mathbf{bu}}\left(n+i\right)\ge \mathit{bigbnd}$.
Dual Activity is the value of the dual variable πi${\pi }_{i}$.
i gives the index i$i$ of the i$i$th row.
Numerical values are output with a fixed number of digits; they are not guaranteed to be accurate to this precision.