NAG Library Routine Document
E04NKF/E04NKA
Note: this routine uses optional parameters to define choices in the problem specification and in the details of the algorithm. If you wish to use default
settings for all of the optional parameters, you need only read Sections 1 to 9 of this document. If, however, you wish to reset some or all of the settings please refer to Section 10 for a detailed description of the algorithm, to Section 11 for a detailed description of the specification of the optional parameters and to Section 12 for a detailed description of the monitoring information produced by the routine.
1 Purpose
E04NKF/E04NKA solves sparse linear programming or quadratic programming problems.
E04NKA is a version of E04NKF that has additional parameters in order to make it safe for use in multithreaded applications (see
Section 5). The initialization routine
E04WBF must have been called before calling E04NKA.
2 Specification
2.1 Specification for E04NKF
SUBROUTINE E04NKF ( 
N, M, NNZ, IOBJ, NCOLH, QPHX, A, HA, KA, BL, BU, START, NAMES, NNAME, CRNAME, NS, XS, ISTATE, MINIZ, MINZ, NINF, SINF, OBJ, CLAMDA, IZ, LENIZ, Z, LENZ, IFAIL) 
INTEGER 
N, M, NNZ, IOBJ, NCOLH, HA(NNZ), KA(N+1), NNAME, NS, ISTATE(N+M), MINIZ, MINZ, NINF, IZ(LENIZ), LENIZ, LENZ, IFAIL 
REAL (KIND=nag_wp) 
A(NNZ), BL(N+M), BU(N+M), XS(N+M), SINF, OBJ, CLAMDA(N+M), Z(LENZ) 
CHARACTER(1) 
START 
CHARACTER(8) 
NAMES(5), CRNAME(NNAME) 
EXTERNAL 
QPHX 

2.2 Specification for E04NKA
SUBROUTINE E04NKA ( 
N, M, NNZ, IOBJ, NCOLH, QPHX, A, HA, KA, BL, BU, START, NAMES, NNAME, CRNAME, NS, XS, ISTATE, MINIZ, MINZ, NINF, SINF, OBJ, CLAMDA, IZ, LENIZ, Z, LENZ, IUSER, RUSER, LWSAV, IWSAV, RWSAV, IFAIL) 
INTEGER 
N, M, NNZ, IOBJ, NCOLH, HA(NNZ), KA(N+1), NNAME, NS, ISTATE(N+M), MINIZ, MINZ, NINF, IZ(LENIZ), LENIZ, LENZ, IUSER(*), IWSAV(380), IFAIL 
REAL (KIND=nag_wp) 
A(NNZ), BL(N+M), BU(N+M), XS(N+M), SINF, OBJ, CLAMDA(N+M), Z(LENZ), RUSER(*), RWSAV(285) 
LOGICAL 
LWSAV(20) 
CHARACTER(1) 
START 
CHARACTER(8) 
NAMES(5), CRNAME(NNAME) 
EXTERNAL 
QPHX 

Before calling E04NKA, or
either of the option setting routines
E04NLA or
E04NMA,
E04WBF must be called.
The specification for
E04WBF is:
INTEGER 
LCWSAV, LLWSAV, IWSAV(LIWSAV), LIWSAV, LRWSAV, IFAIL 
REAL (KIND=nag_wp) 
RWSAV(LRWSAV) 
LOGICAL 
LWSAV(LLWSAV) 
CHARACTER(*) 
RNAME 
CHARACTER(80) 
CWSAV(LCWSAV) 

E04WBF should be called with
${\mathbf{RNAME}}=\text{'E04NKA'}$.
LCWSAV,
LLWSAV,
LIWSAV and
LRWSAV, the declared lengths of
CWSAV,
LWSAV,
IWSAV and
RWSAV respectively, must satisfy:
 ${\mathbf{LCWSAV}}\ge 1$
 ${\mathbf{LLWSAV}}\ge 20$
 ${\mathbf{LIWSAV}}\ge 380$
 ${\mathbf{LRWSAV}}\ge 285$
The contents of the
arrays
CWSAV,
LWSAV,
IWSAV and
RWSAVmust not be altered between calling routines
E04NKA,
E04NLA,
E04NMA and
E04WBF.
3 Description
E04NKF/E04NKA is designed to solve a class of quadratic programming problems that are assumed to be stated in the following general form:
where
$x$ is a set of variables,
$A$ is an
$m$ by
$n$ matrix and the objective function
$f\left(x\right)$ may be specified in a variety of ways depending upon the particular problem to be solved. The optional parameter
Maximize may be used to specify an alternative problem in which
$f\left(x\right)$ is maximized. The possible forms for
$f\left(x\right)$ are listed in
Table 1, in which the prefixes FP, LP and QP stand for ‘feasible point’, ‘linear programming’ and ‘quadratic programming’ respectively,
$c$ is an
$n$element vector and
$H$ is the
$n$ by
$n$ secondderivative matrix
${\nabla}^{2}f\left(x\right)$ (the
Hessian matrix).
Problem type 
Objective function $f\left(x\right)$ 
Hessian matrix $H$ 
FP 
Not applicable 
Not applicable 
LP 
${c}^{\mathrm{T}}x$ 
Not applicable 
QP 
${c}^{\mathrm{T}}x+\frac{1}{2}{x}^{\mathrm{T}}Hx$ 
Symmetric positive semidefinite 
Table 1
For LP and QP problems, the unique global minimum value of
$f\left(x\right)$ is found. For FP problems,
$f\left(x\right)$ is omitted and the routine attempts to find a feasible point for the set of constraints. For QP problems, you must also provide a subroutine that computes
$Hx$ for any given vector
$x$. (
$H$ need not be stored explicitly.) If
$H$ is the zero matrix, the routine will still solve the resulting LP problem; however, this can be accomplished more efficiently by setting
${\mathbf{NCOLH}}=0$ (see
Section 5).
The defining feature of a
convex QP problem is that the matrix
$H$ must be
positive semidefinite, i.e., it must satisfy
${x}^{\mathrm{T}}Hx\ge 0$ for all
$x$. Otherwise,
$f\left(x\right)$ is said to be
nonconvex and it may be more appropriate to call
E04UGF/E04UGA instead.
E04NKF/E04NKA is intended to solve largescale linear and quadratic programming problems in which the constraint matrix
$A$ is
sparse (i.e., when the number of zero elements is sufficiently large that it is worthwhile using algorithms which avoid computations and storage involving zero elements). The routine also takes advantage of sparsity in
$c$. (Sparsity in
$H$ can be exploited in the subroutine that computes
$Hx$.) For problems in which
$A$ can be treated as a
dense matrix, it is usually more efficient to use
E04MFF/E04MFA,
E04NCF/E04NCA or
E04NFF/E04NFA.
The upper and lower bounds on the
$m$ elements of
$Ax$ are said to define the
general constraints of the problem. Internally, E04NKF/E04NKA converts the general constraints to equalities by introducing a set of
slack variables $s$, where
$s={\left({s}_{1},{s}_{2},\dots ,{s}_{m}\right)}^{\mathrm{T}}$. For example, the linear constraint
$5\le 2{x}_{1}+3{x}_{2}\le +\infty $ is replaced by
$2{x}_{1}+3{x}_{2}{s}_{1}=0$, together with the bounded slack
$5\le {s}_{1}\le +\infty $. The problem defined by
(1) can therefore be rewritten in the following equivalent form:
Since the slack variables
$s$ are subject to the same upper and lower bounds as the elements of
$Ax$, the bounds on
$Ax$ and
$x$ can simply be thought of as bounds on the combined vector
$\left(x,s\right)$. (In order to indicate their special role in QP problems, the original variables
$x$ are sometimes known as ‘column variables’, and the slack variables
$s$ are known as ‘row variables’.)
Each LP or QP problem is solved using an activeset method. This is an iterative procedure with two phases: a feasibility phase, in which the sum of infeasibilities is minimized to find a feasible point; and an optimality phase, in which $f\left(x\right)$ is minimized by constructing a sequence of iterations that lies within the feasible region.
A constraint is said to be active or binding at $x$ if the associated element of either $x$ or $Ax$ is equal to one of its upper or lower bounds. Since an active constraint in $Ax$ has its associated slack variable at a bound, the status of both simple and general upper and lower bounds can be conveniently described in terms of the status of the variables $\left(x,s\right)$. A variable is said to be nonbasic if it is temporarily fixed at its upper or lower bound. It follows that regarding a general constraint as being active is equivalent to thinking of its associated slack as being nonbasic.
At each iteration of an activeset method, the constraints
$Axs=0$ are (conceptually) partitioned into the form
where
${x}_{N}$ consists of the nonbasic elements of
$\left(x,s\right)$ and the
basis matrix $B$ is square and nonsingular. The elements of
${x}_{B}$ and
${x}_{S}$ are called the
basic and
superbasic variables respectively; with
${x}_{N}$ they are a permutation of the elements of
$x$ and
$s$. At a QP solution, the basic and superbasic variables will lie somewhere between their upper or lower bounds, while the nonbasic variables will be equal to one of their bounds. At each iteration,
${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 objective function (or sum of infeasibilities). The basic variables are then adjusted in order to ensure that
$\left(x,s\right)$ continues to satisfy
$Axs=0$. The number of superbasic variables (
${n}_{S}$ say) therefore indicates the number of degrees of freedom remaining after the constraints have been satisfied. In broad terms,
${n}_{S}$ is a measure of
how nonlinear the problem is. In particular,
${n}_{S}$ will always be zero for FP and LP problems.
If it appears that no improvement can be made with the current definition of $B$, $S$ and $N$, a nonbasic variable is selected to be added to $S$, and the process is repeated with the value of ${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 ${n}_{S}$ is decreased by one.
Associated with each of the
$m$ equality constraints
$Axs=0$ is a
dual variable ${\pi}_{i}$. Similarly, each variable in
$\left(x,s\right)$ has an associated
reduced gradient ${d}_{j}$ (also known as a
reduced cost). The reduced gradients for the variables
$x$ are the quantities
$g{A}^{\mathrm{T}}\pi $, where
$g$ is the gradient of the QP objective function; and the reduced gradients for the slack variables
$s$ are the dual variables
$\pi $. The QP subproblem is optimal if
${d}_{j}\ge 0$ for all nonbasic variables at their lower bounds,
${d}_{j}\le 0$ for all nonbasic variables at their upper bounds and
${d}_{j}=0$ for all superbasic variables. In practice, an
approximate QP solution is found by slightly relaxing these conditions on
${d}_{j}$ (see the description of the optional parameter
Optimality Tolerance).
The process of computing and comparing reduced gradients is known as
pricing (a term first introduced in the context of the simplex method for linear programming). To ‘price’ a nonbasic variable
${x}_{j}$ means that the reduced gradient
${d}_{j}$ associated with the relevant active upper or lower bound on
${x}_{j}$ is computed via the formula
${d}_{j}={g}_{j}{a}^{\mathrm{T}}\pi $, where
${a}_{j}$ is the
$j$th column of
$\left(\begin{array}{cc}A& I\end{array}\right)$. (The variable selected by such a process and the corresponding value of
${d}_{j}$ (i.e., its reduced gradient) are the quantities
+S and
dj in the monitoring file output; see
Section 12.) If
$A$ has significantly more columns than rows (i.e.,
$n\gg m$), pricing can be computationally expensive. In this case, a strategy known as
partial pricing can be used to compute and compare only a subset of the
${d}_{j}$'s.
E04NKF/E04NKA is based on SQOPT, which is part of the SNOPT package described in
Gill et al. (2002), which in turn utilizes routines from the MINOS package (see
Murtagh and Saunders (1995)). It uses stable numerical methods throughout and includes a reliable basis package (for maintaining sparse
$LU$ factors of the basis matrix
$B$), a practical antidegeneracy procedure, efficient handling of linear constraints and bounds on the variables (by an activeset strategy), as well as automatic scaling of the constraints. Further details can be found in
Section 10.
4 References
Fourer R (1982) Solving staircase linear programs by the simplex method Math. Programming 23 274–313
Gill P E and Murray W (1978) Numerically stable methods for quadratic programming Math. Programming 14 349–372
Gill P E, Murray W and Saunders M A (2002) SNOPT: An SQP Algorithm for Largescale Constrained Optimization 12 979–1006 SIAM J. Optim.
Gill P E, Murray W, Saunders M A and Wright M H (1987) Maintaining LU factors of a general sparse matrix Linear Algebra and its Applics. 88/89 239–270
Gill P E, Murray W, Saunders M A and Wright M H (1989) A practical anticycling procedure for linearly constrained optimization Math. Programming 45 437–474
Gill P E, Murray W, Saunders M A and Wright M H (1991) Inertiacontrolling methods for general quadratic programming SIAM Rev. 33 1–36
Hall J A J and McKinnon K I M (1996) The simplest examples where the simplex method cycles and conditions where EXPAND fails to prevent cycling Report MS 96–100 Department of Mathematics and Statistics, University of Edinburgh
Murtagh B A and Saunders M A (1995) MINOS 5.4 users' guide Report SOL 8320R Department of Operations Research, Stanford University
5 Parameters
 1: N – INTEGERInput
On entry: $n$, the number of variables (excluding slacks). This is the number of columns in the linear constraint matrix $A$.
Constraint:
${\mathbf{N}}\ge 1$.
 2: M – INTEGERInput
On entry:
$m$, the number of general linear constraints (or slacks). This is the number of rows in
$A$, including the free row (if any; see
IOBJ).
Constraint:
${\mathbf{M}}\ge 1$.
 3: NNZ – INTEGERInput
On entry: the number of nonzero elements in $A$.
Constraint:
$1\le {\mathbf{NNZ}}\le {\mathbf{N}}\times {\mathbf{M}}$.
 4: IOBJ – INTEGERInput
On entry: if
${\mathbf{IOBJ}}>0$, row
IOBJ of
$A$ is a free row containing the nonzero elements of the vector
$c$ appearing in the linear objective term
${c}^{\mathrm{T}}x$.
If
${\mathbf{IOBJ}}=0$, there is no free row, i.e., the problem is either an FP problem (in which case
IOBJ must be set to zero), or a QP problem with
$c=0$.
Constraint:
$0\le {\mathbf{IOBJ}}\le {\mathbf{M}}$.
 5: NCOLH – INTEGERInput
On entry:
${n}_{H}$, the number of leading nonzero columns of the Hessian matrix
$H$. For FP and LP problems,
NCOLH must be set to zero.
Constraint:
$0\le {\mathbf{NCOLH}}\le {\mathbf{N}}$.
 6: QPHX – SUBROUTINE, supplied by the NAG Library or the user.External Procedure
For QP problems, you must supply a version of
QPHX to compute the matrix product
$Hx$. If
$H$ has zero rows and columns, it is most efficient to order the variables
$x={\left(\begin{array}{cc}y& z\end{array}\right)}^{\mathrm{T}}$ so that
where the nonlinear variables
$y$ appear first as shown. For FP and LP problems,
QPHX will never be called by E04NKF/E04NKA and hence
QPHX may be the dummy routine E04NKU/E54NKU.
The specification of
QPHX
for E04NKF is:
INTEGER 
NSTATE, NCOLH 
REAL (KIND=nag_wp) 
X(NCOLH), HX(NCOLH) 

The specification of
QPHX
for E04NKA is:
INTEGER 
NSTATE, NCOLH, IUSER(*) 
REAL (KIND=nag_wp) 
X(NCOLH), HX(NCOLH), RUSER(*) 

 1: NSTATE – INTEGERInput
On entry: if
${\mathbf{NSTATE}}=1$, E04NKF/E04NKA is calling
QPHX for the first time. This parameter setting allows you to save computation time if certain data must be read or calculated only once.
If
${\mathbf{NSTATE}}\ge 2$, E04NKF/E04NKA is calling
QPHX for the last time. This parameter setting allows you to perform some additional computation on the final solution. In general, the last call to
QPHX is made with
${\mathbf{NSTATE}}=2+{\mathbf{IFAIL}}$ (see
Section 6).
Otherwise, ${\mathbf{NSTATE}}=0$.
 2: NCOLH – INTEGERInput
On entry: this is the same parameter
NCOLH as supplied to E04NKF/E04NKA.
 3: X(NCOLH) – REAL (KIND=nag_wp) arrayInput
On entry: the first
NCOLH elements of the vector
$x$.
 4: HX(NCOLH) – REAL (KIND=nag_wp) arrayOutput
On exit: the product $Hx$.
 Note: the following are additional parameters for specific use with E04NKA. Users of E04NKF therefore need not read the remainder of this description.
 5: IUSER($*$) – INTEGER arrayUser Workspace
 6: RUSER($*$) – REAL (KIND=nag_wp) arrayUser Workspace

QPHX is called with the parameters
IUSER and
RUSER as supplied to E04NKF/E04NKA. You are free to use the arrays
IUSER and
RUSER to supply information to
QPHX as an alternative to using COMMON global variables.
QPHX must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E04NKF/E04NKA is called. Parameters denoted as
Input must
not be changed by this procedure.
 7: A(NNZ) – REAL (KIND=nag_wp) arrayInput
On entry: the nonzero elements of $A$, ordered by increasing column index. Note that elements with the same row and column indices are not allowed.
 8: HA(NNZ) – INTEGER arrayInput
On entry: ${\mathbf{HA}}\left(\mathit{i}\right)$ must contain the row index of the nonzero element stored in ${\mathbf{A}}\left(\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZ}}$. Note that the row indices for a column may be supplied in any order.
Constraint:
$1\le {\mathbf{HA}}\left(\mathit{i}\right)\le {\mathbf{M}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZ}}$.
 9: KA(${\mathbf{N}}+1$) – INTEGER arrayInput
On entry:
${\mathbf{KA}}\left(\mathit{j}\right)$ must contain the index in
A of the start of the
$\mathit{j}$th column, for
$\mathit{j}=1,2,\dots ,{\mathbf{N}}$.
${\mathbf{KA}}\left({\mathbf{N}}+1\right)$ must be set to
${\mathbf{NNZ}}+1$. To specify the
$j$th column as empty, set
${\mathbf{KA}}\left(j\right)={\mathbf{KA}}\left(j+1\right)$. As a consequence
${\mathbf{KA}}\left(1\right)$ is always
$1$.
Constraints:
 ${\mathbf{KA}}\left(1\right)=1$;
 ${\mathbf{KA}}\left(\mathit{j}\right)\ge 1$, for $\mathit{j}=2,3,\dots ,{\mathbf{N}}$;
 ${\mathbf{KA}}\left({\mathbf{N}}+1\right)={\mathbf{NNZ}}+1$;
 $0\le {\mathbf{KA}}\left(\mathit{j}+1\right){\mathbf{KA}}\left(\mathit{j}\right)\le {\mathbf{M}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}$.
 10: BL(${\mathbf{N}}+{\mathbf{M}}$) – REAL (KIND=nag_wp) arrayInput
On entry:
$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$, and the next
M elements the bounds for the general linear constraints
$Ax$ (or slacks
$s$) and the free row (if any). To specify a nonexistent lower bound (i.e.,
${l}_{j}=\infty $), set
${\mathbf{BL}}\left(j\right)\le \mathit{bigbnd}$, where
$\mathit{bigbnd}$ is the value of the optional parameter
Infinite Bound Size. To specify the
$j$th constraint as an
equality, set
${\mathbf{BL}}\left(j\right)={\mathbf{BU}}\left(j\right)=\beta $, say, where
$\left\beta \right<\mathit{bigbnd}$. Note that the lower bound corresponding to the free row must be set to
$\infty $ and stored in
${\mathbf{BL}}\left({\mathbf{N}}+{\mathbf{IOBJ}}\right)$.
Constraint:
if
${\mathbf{IOBJ}}>0$,
${\mathbf{BL}}\left({\mathbf{N}}+{\mathbf{IOBJ}}\right)\le \mathit{bigbnd}$(See also the description for
BU.)
 11: BU(${\mathbf{N}}+{\mathbf{M}}$) – REAL (KIND=nag_wp) arrayInput
On entry:
$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$, and the next
M elements the bounds for the general linear constraints
$Ax$ (or slacks
$s$) and the free row (if any). To specify a nonexistent upper bound (i.e.,
${u}_{j}=+\infty $), set
${\mathbf{BU}}\left(j\right)\ge \mathit{bigbnd}$. Note that the upper bound corresponding to the free row must be set to
$+\infty $ and stored in
${\mathbf{BU}}\left({\mathbf{N}}+{\mathbf{IOBJ}}\right)$.
Constraints:
 if ${\mathbf{IOBJ}}>0$, ${\mathbf{BU}}\left({\mathbf{N}}+{\mathbf{IOBJ}}\right)\ge \mathit{bigbnd}$;
 ${\mathbf{BL}}\left(\mathit{j}\right)\le {\mathbf{BU}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}+{\mathbf{M}}$;
 if ${\mathbf{BL}}\left(j\right)={\mathbf{BU}}\left(j\right)=\beta $, $\left\beta \right<\mathit{bigbnd}$.
 12: START – CHARACTER(1)Input
On entry: indicates how a starting basis is to be obtained.
 ${\mathbf{START}}=\text{'C'}$
 An internal Crash procedure will be used to choose an initial basis matrix $B$.
 ${\mathbf{START}}=\text{'W'}$
 A basis is already defined in ISTATE (probably from a previous call).
Constraint:
${\mathbf{START}}=\text{'C'}$ or $\text{'W'}$.
 13: NAMES($5$) – CHARACTER(8) arrayInput
On entry: a set of names associated with the socalled MPSX form of the problem, as follows:
 ${\mathbf{NAMES}}\left(1\right)$
 Must contain the name for the problem (or be blank).
 ${\mathbf{NAMES}}\left(2\right)$
 Must contain the name for the free row (or be blank).
 ${\mathbf{NAMES}}\left(3\right)$
 Must contain the name for the constraint righthand side (or be blank).
 ${\mathbf{NAMES}}\left(4\right)$
 Must contain the name for the ranges (or be blank).
 ${\mathbf{NAMES}}\left(5\right)$
 Must contain the name for the bounds (or be blank).
(These names are used in the monitoring file output; see
Section 12.)
 14: NNAME – INTEGERInput
On entry: the number of column (i.e., variable) and row names supplied in
CRNAME.
 ${\mathbf{NNAME}}=1$
 There are no names. Default names will be used in the printed output.
 ${\mathbf{NNAME}}={\mathbf{N}}+{\mathbf{M}}$
 All names must be supplied.
Constraint:
${\mathbf{NNAME}}=1$ or ${\mathbf{N}}+{\mathbf{M}}$.
 15: CRNAME(NNAME) – CHARACTER(8) arrayInput
On entry: the optional column and row names, respectively.
If
${\mathbf{NNAME}}=1$,
CRNAME is not referenced and the printed output will use default names for the columns and rows.
If
${\mathbf{NNAME}}={\mathbf{N}}+{\mathbf{M}}$, the first
N elements must contain the names for the columns and the next
M elements must contain the names for the rows. Note that the name for the free row (if any) must be stored in
${\mathbf{CRNAME}}\left({\mathbf{N}}+{\mathbf{IOBJ}}\right)$.
 16: NS – INTEGERInput/Output
On entry:
${n}_{S}$, the number of superbasics. For QP problems,
NS need not be specified if
${\mathbf{START}}=\text{'C'}$, but must retain its value from a previous call when
${\mathbf{START}}=\text{'W'}$. For FP and LP problems,
NS need not be initialized.
On exit: the final number of superbasics. This will be zero for FP and LP problems.
 17: XS(${\mathbf{N}}+{\mathbf{M}}$) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the initial values of the variables and slacks
$\left(x,s\right)$. (See the description for
ISTATE.)
On exit: the final values of the variables and slacks $\left(x,s\right)$.
 18: ISTATE(${\mathbf{N}}+{\mathbf{M}}$) – INTEGER arrayInput/Output
On entry: if
${\mathbf{START}}=\text{'C'}$, the first
N elements of
ISTATE and
XS must specify the initial states and values, respectively, of the variables
$x$. (The slacks
$s$ need not be initialized.) An internal Crash procedure is then used to select an initial basis matrix
$B$. The initial basis matrix will be triangular (neglecting certain small elements in each column). It is chosen from various rows and columns of
$\left(\begin{array}{cc}A& I\end{array}\right)$. Possible values for
${\mathbf{ISTATE}}\left(j\right)$ are as follows:
${\mathbf{ISTATE}}\left(j\right)$  State of ${\mathbf{XS}}\left(j\right)$ during Crash procedure 
$0$ or $1$  Eligible for the basis 
$2$  Ignored 
$3$  Eligible for the basis (given preference over $0$ or $1$) 
$4$ or $5$  Ignored 
If nothing special is known about the problem, or there is no wish to provide special information, you may set
${\mathbf{ISTATE}}\left(\mathit{j}\right)=0$ and ${\mathbf{XS}}\left(\mathit{j}\right)=0.0$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}$. All variables will then be eligible for the initial basis. Less trivially, to say that the $\mathit{j}$th variable will probably be equal to one of its bounds, set ${\mathbf{ISTATE}}\left(j\right)=4$ and ${\mathbf{XS}}\left(j\right)={\mathbf{BL}}\left(j\right)$ or ${\mathbf{ISTATE}}\left(j\right)=5$ and ${\mathbf{XS}}\left(j\right)={\mathbf{BU}}\left(j\right)$ as appropriate.
Following the Crash procedure, variables for which ${\mathbf{ISTATE}}\left(j\right)=2$ are made superbasic. Other variables not selected for the basis are then made nonbasic at the value ${\mathbf{XS}}\left(j\right)$ if ${\mathbf{BL}}\left(j\right)\le {\mathbf{XS}}\left(j\right)\le {\mathbf{BU}}\left(j\right)$, or at the value ${\mathbf{BL}}\left(j\right)$ or ${\mathbf{BU}}\left(j\right)$ closest to ${\mathbf{XS}}\left(j\right)$.
If
${\mathbf{START}}=\text{'W'}$,
ISTATE and
XS must specify the initial states and values, respectively, of the variables and slacks
$\left(x,s\right)$. If E04NKF/E04NKA has been called previously with the same values of
N and
M,
ISTATE already contains satisfactory information.
Constraints:
 if ${\mathbf{START}}=\text{'C'}$, $0\le {\mathbf{ISTATE}}\left(\mathit{j}\right)\le 5$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}$;
 if ${\mathbf{START}}=\text{'W'}$, $0\le {\mathbf{ISTATE}}\left(\mathit{j}\right)\le 3$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}+{\mathbf{M}}$.
On exit: the final states of the variables and slacks
$\left(x,s\right)$. The significance of each possible value of
${\mathbf{ISTATE}}\left(j\right)$ is as follows:
${\mathbf{ISTATE}}\left(j\right)$  State of variable $j$  Normal value of ${\mathbf{XS}}\left(j\right)$ 
$0$  Nonbasic  ${\mathbf{BL}}\left(j\right)$ 
$1$  Nonbasic  ${\mathbf{BU}}\left(j\right)$ 
$2$  Superbasic  Between ${\mathbf{BL}}\left(j\right)$ and ${\mathbf{BU}}\left(j\right)$ 
$3$  Basic  Between ${\mathbf{BL}}\left(j\right)$ and ${\mathbf{BU}}\left(j\right)$ 
If
${\mathbf{NINF}}=0$, basic and superbasic variables may be outside their bounds by as much as the value of the optional parameter
Feasibility Tolerance. Note that unless the
${\mathbf{Scale\; Option}}=0$ is specified, the optional parameter
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$ 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
Feasibility Tolerance, and there may be some nonbasic variables for which
${\mathbf{XS}}\left(j\right)$ lies strictly between its bounds.
If
${\mathbf{NINF}}>0$, some basic and superbasic variables may be outside their bounds by an arbitrary amount (bounded by
SINF if
${\mathbf{Scale\; Option}}=0$).
 19: MINIZ – INTEGEROutput
On exit: the minimum value of
LENIZ required to start solving the problem. If
${\mathbf{IFAIL}}={\mathbf{12}}$, E04NKF/E04NKA 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.)
 20: MINZ – INTEGEROutput
On exit: the minimum value of
LENZ required to start solving the problem. If
${\mathbf{IFAIL}}={\mathbf{13}}$, E04NKF/E04NKA 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.)
 21: NINF – INTEGEROutput
On exit: the number of infeasibilities. This will be zero if ${\mathbf{IFAIL}}={\mathbf{0}}$ or ${\mathbf{1}}$.
 22: SINF – REAL (KIND=nag_wp)Output
On exit: the sum of infeasibilities. This will be zero if
${\mathbf{NINF}}=0$. (Note that E04NKF/E04NKA does
not attempt to compute the minimum value of
SINF if
${\mathbf{IFAIL}}={\mathbf{3}}$.)
 23: OBJ – REAL (KIND=nag_wp)Output
On exit: the value of the objective function.
If
${\mathbf{NINF}}=0$,
OBJ includes the quadratic objective term
$\frac{1}{2}{x}^{\mathrm{T}}Hx$ (if any).
If
${\mathbf{NINF}}>0$,
OBJ is just the linear objective term
${c}^{\mathrm{T}}x$ (if any).
For FP problems,
OBJ is set to zero.
 24: CLAMDA(${\mathbf{N}}+{\mathbf{M}}$) – REAL (KIND=nag_wp) arrayOutput
On exit: a set of Lagrange multipliers for the bounds on the variables and the general constraints. More precisely, the first
N elements contain the multipliers (
reduced costs) for the bounds on the variables, and the next
M elements contain the multipliers (
shadow prices) for the general linear constraints.
 25: IZ(LENIZ) – INTEGER arrayWorkspace
 26: LENIZ – INTEGERInput
On entry: the dimension of the array
IZ as declared in the (sub)program from which E04NKF/E04NKA is called.
Constraint:
${\mathbf{LENIZ}}\ge 1$.
 27: Z(LENZ) – REAL (KIND=nag_wp) arrayWorkspace
 28: LENZ – INTEGERInput
On entry: the dimension of the array
Z as declared in the (sub)program from which E04NKF/E04NKA is called.
Constraint:
${\mathbf{LENZ}}\ge 1$.
The amounts of workspace provided (i.e.,
LENIZ and
LENZ) and required (i.e.,
MINIZ and
MINZ) are (by default for E04NKF) output on the current advisory message unit
NADV (as defined by
X04ABF). 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 and
LENZ set to
$1$. (E04NKF/E04NKA will then terminate with
${\mathbf{IFAIL}}={\mathbf{12}}$.)
 29: IFAIL – INTEGERInput/Output

Note: for E04NKA, IFAIL does not occur in this position in the parameter list. See the additional parameters described below.
On entry:
IFAIL must be set to
$0$,
$1\text{ or}1$. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
$1\text{ or}1$ is recommended. If the output of error messages is undesirable, then the value
$1$ is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
${\mathbf{IFAIL}}\ne {\mathbf{0}}$ on exit, the recommended value is
$1$.
When the value $\mathbf{1}\text{ or}1$ is used it is essential to test the value of IFAIL on exit.
On exit:
${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see
Section 6).
E04NKF/E04NKA returns with
${\mathbf{IFAIL}}={\mathbf{0}}$ if the reduced gradient (
Norm rg; see
Section 8.1) is negligible, the Lagrange multipliers (
Lagr Mult; see
Section 8.1) are optimal and
$x$ satisfies the constraints to the accuracy requested by the value of the optional parameter
Feasibility Tolerance (
$\text{default value}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({10}^{6},\sqrt{\epsilon}\right)$, where
$\epsilon $ is the
machine precision).
 Note: the following are additional parameters for specific use with E04NKA. Users of E04NKF therefore need not read the remainder of this description.
 29: IUSER($*$) – INTEGER arrayUser Workspace
 30: RUSER($*$) – REAL (KIND=nag_wp) arrayUser Workspace

IUSER and
RUSER are not used by E04NKF/E04NKA, but are passed directly to
QPHX and may be used to pass information to this routine as an alternative to using COMMON global variables.
 31: LWSAV($20$) – LOGICAL arrayCommunication Array
 32: IWSAV($380$) – INTEGER arrayCommunication Array
 33: RWSAV($285$) – REAL (KIND=nag_wp) arrayCommunication Array
The arrays
LWSAV,
IWSAV and
RWSAV must not be altered between calls to any of the routines E04NKA,
E04NLA,
E04NMA or
E04WBF.
 34: IFAIL – INTEGERInput/Output
Note: see the parameter description for
IFAIL above.
6 Error Indicators and Warnings
If on entry
${\mathbf{IFAIL}}={\mathbf{0}}$ or
${{\mathbf{1}}}$, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: E04NKF/E04NKA may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
 ${\mathbf{IFAIL}}=1$
Weak solution found. The final $x$ is not unique, although $x$ gives the global minimum value of the objective function.
 ${\mathbf{IFAIL}}=2$
The problem is unbounded (or badly scaled). The objective function is not bounded below in the feasible region.
 ${\mathbf{IFAIL}}=3$
The problem is infeasible. The general constraints cannot all be satisfied simultaneously to within the value of the optional parameter
Feasibility Tolerance (
$\text{default value}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({10}^{6},\sqrt{\epsilon}\right)$, where
$\epsilon $ is the
machine precision).
 ${\mathbf{IFAIL}}=4$
Too many iterations. The value of the optional parameter
Iteration Limit (
$\text{default value}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(50,5\left(n+m\right)\right)$) is too small.
 ${\mathbf{IFAIL}}=5$
The reduced Hessian matrix
${Z}^{\mathrm{T}}HZ$ (see
Section 10.2) exceeds its assigned dimension. The value of the optional parameter
Superbasics Limit (
$\text{default value}=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({n}_{H}+1,n\right)$) is too small.
 ${\mathbf{IFAIL}}=6$
The Hessian matrix
$H$ appears to be indefinite. This sometimes occurs because the values of the optional parameters
LU Factor Tolerance (
$\text{default value}=100.0$) and
LU Update Tolerance (
$\text{default value}=10.0$) are too large. Check also that
QPHX has been coded correctly and that all relevant elements of
$Hx$ have been assigned their correct values.
 ${\mathbf{IFAIL}}=7$

An input parameter is invalid.
 ${\mathbf{IFAIL}}=8$
Numerical error in trying to satisfy the general constraints. The basis is very illconditioned.
 ${\mathbf{IFAIL}}=9$
Not enough integer workspace for the basis factors. Increase
LENIZ and rerun E04NKF/E04NKA.
 ${\mathbf{IFAIL}}=10$
Not enough real workspace for the basis factors. Increase
LENZ and rerun E04NKF/E04NKA.
 ${\mathbf{IFAIL}}=11$
The basis is singular after
$15$ attempts to factorize it (adding slacks where necessary). Either the problem is badly scaled or the value of the optional parameter
LU Factor Tolerance (
$\text{default value}=100.0$) is too large.
 ${\mathbf{IFAIL}}=12$
Not enough integer workspace to start solving the problem. Increase
LENIZ to at least
MINIZ and rerun E04NKF/E04NKA.
 ${\mathbf{IFAIL}}=13$
Not enough real workspace to start solving the problem. Increase
LENZ to at least
MINZ and rerun E04NKF/E04NKA.
7 Accuracy
E04NKF/E04NKA implements a numerically stable activeset strategy and returns solutions that are as accurate as the condition of the problem warrants on the machine.
This section contains a description of the printed output.
8.1 Description of the Printed Output
This section describes the intermediate printout and final printout produced by E04NKF/E04NKA. The intermediate printout is a subset of the monitoring information produced by the routine at every iteration (see
Section 12). You can control the level of printed output (see the description of the optional parameter
Print Level). Note that the intermediate printout and final printout are produced only if
${\mathbf{Print\; Level}}\ge 10$ (the default for E04NKF, by default no output is produced by E04NKA).
The following line of summary output (
$\text{}<80$ characters) is produced at every iteration. In all cases, the values of the quantities printed are those in effect
on
completion of the given iteration.
Itn 
is the iteration count.

Step 
is the step taken along the computed search direction.

Ninf 
is the number of violated constraints (infeasibilities). This will be zero during the optimality phase.

Sinf/Objective 
is the value of the current objective function. If $x$ is not feasible, Sinf gives the sum of the magnitudes of constraint violations. If $x$ is feasible, Objective is the value of the objective function. The output line for the final iteration of the feasibility phase (i.e., the first iteration for which Ninf is zero) will give the value of the true objective at the first feasible point. During the optimality phase, the value of the objective function will be nonincreasing. During the feasibility phase, the number of constraint infeasibilities will not increase until either a feasible point is found, or the optimality of the multipliers implies that no feasible point exists.

Norm rg 
is $\Vert {d}_{S}\Vert $, the Euclidean norm of the reduced gradient (see Section 10.3). During the optimality phase, this norm will be approximately zero after a unit step. For FP and LP problems, Norm rg is not printed.

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 ${\mathbf{NNAME}}=1$, a default name is assigned to the $\mathit{j}$th variable, for $\mathit{j}=1,2,\dots ,n$. If ${\mathbf{NNAME}}={\mathbf{N}}+{\mathbf{M}}$, the name supplied in ${\mathbf{CRNAME}}\left(\mathit{j}\right)$ is assigned to the $\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$ ( $\text{default value}=2$) 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 bound, there would be no change in the value of the objective function. The values of the other free variables might change, giving a genuine alternative solution. However, if there are any degenerate variables (labelled D), the actual change might prove to be zero, since one of them could encounter a bound immediately. In either case, the values of the Lagrange multipliers might also change.

D 
Degenerate. The variable is basic or superbasic, but it is equal (or very close) to one of its bounds.

I 
Infeasible. The variable is basic or superbasic and is currently violating one of its bounds by more than the value of the Feasibility Tolerance.

N 
Not precisely optimal. The variable is nonbasic or superbasic. If the value of the reduced gradient for the variable exceeds the value of the optional parameter Optimality Tolerance, the solution would not be declared optimal because the reduced gradient for the variable would not be considered negligible.


Value 
is the value of the variable at the final iteration.

Lower Bound 
is the lower bound specified for the variable. None indicates that ${\mathbf{BL}}\left(j\right)\le \mathit{bigbnd}$.

Upper Bound 
is the upper bound specified for the variable. None indicates that ${\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$ is optimal, the multiplier should be nonnegative if State is LL, nonpositive 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 ${\mathbf{BL}}\left(j\right)$ and ${\mathbf{BU}}\left(j\right)$. A blank entry indicates that the associated variable is not bounded (i.e., ${\mathbf{BL}}\left(j\right)\le \mathit{bigbnd}$ and ${\mathbf{BU}}\left(j\right)\ge \mathit{bigbnd}$).

The meaning of the printout for linear constraints is the same as that given above for variables, with ‘variable’ replaced by ‘constraint’,
$n$ replaced by
$m$,
${\mathbf{CRNAME}}\left(j\right)$ replaced by
${\mathbf{CRNAME}}\left(n+j\right)$,
${\mathbf{BL}}\left(j\right)$ and
${\mathbf{BU}}\left(j\right)$ are replaced by
${\mathbf{BL}}\left(n+j\right)$ and
${\mathbf{BU}}\left(n+j\right)$ respectively, and with the following change in the heading:
Constrnt 
gives the name of the linear constraint.

Note that movement off a constraint (as opposed to a variable moving away from its bound) can be interpreted as allowing the entry in the Residual column to become positive.
Numerical values are output with a fixed number of digits; they are not guaranteed to be accurate to this precision.
9 Example
This example minimizes the quadratic function
$f\left(x\right)={c}^{\mathrm{T}}x+\frac{1}{2}{x}^{\mathrm{T}}Hx$, where
subject to the bounds
and to the linear constraints
The initial point, which is infeasible, is
The optimal solution (to five figures) is
One bound constraint and four linear constraints are active at the solution. Note that the Hessian matrix
$H$ is positive semidefinite.
9.1 Program Text
Note: the following programs illustrate the use of E04NKF and E04NKA.
Program Text (e04nkfe.f90)
Program Text (e04nkae.f90)
9.2 Program Data
Program Data (e04nkfe.d)
Program Data (e04nkae.d)
9.3 Program Results
Program Results (e04nkfe.r)
Program Results (e04nkae.r)
Note: the remainder of this document is intended for more advanced users. Section 10 contains a detailed description of the algorithm which may be needed in order to understand Sections 11 and 12. Section 11 describes the optional parameters which may be set by calls to E04NLF/E04NLA and/or E04NMF/E04NMA. Section 12 describes the quantities which can be requested to monitor the course of the computation.
10 Algorithmic Details
This section contains a detailed description of the method used by E04NKF/E04NKA.
10.1 Overview
E04NKF/E04NKA is based on an inertiacontrolling method that maintains a Cholesky factorization of the reduced Hessian (see below). The method is similar to that of
Gill and Murray (1978), and is described in detail by
Gill et al. (1991). Here we briefly summarise the main features of the method. Where possible, explicit reference is made to the names of variables that are parameters of the routine or appear in the printed output.
The method used has two distinct phases: finding an initial feasible point by minimizing the sum of infeasibilities (the
feasibility phase), and minimizing the quadratic objective function within the feasible region (the
optimality phase). The computations in both phases are performed by the same subroutines. The twophase nature of the algorithm is reflected by changing the function being minimized from the sum of infeasibilities (the printed quantity
Sinf; see
Section 12) to the quadratic objective function (the printed quantity
Objective; see
Section 12).
In general, an iterative process is required to solve a quadratic program. Given an iterate
$\left(x,s\right)$ in both the original variables
$x$ and the slack variables
$s$, a new iterate
$\left(\stackrel{}{x},\stackrel{}{s}\right)$ is defined by
where the
step length
$\alpha $ is a nonnegative scalar (the printed quantity
Step; see
Section 12), and
$p$ is called the
search direction. (For simplicity, we shall consider a typical iteration and avoid reference to the index of the iteration.) Once an iterate is feasible (i.e., satisfies the constraints), all subsequent iterates remain feasible.
10.2 Definition of the Working Set and Search Direction
At each iterate
$\left(x,s\right)$, a
working set of constraints is defined to be a linearly independent subset of the constraints that are satisfied ‘exactly’ (to within the value of the optional parameter
Feasibility Tolerance). The working set is the current prediction of the constraints that hold with equality at a solution of the LP or QP problem. Let
${m}_{W}$ denote the number of constraints in the working set (including bounds), and let
$W$ denote the associated
${m}_{W}$ by
$\left(n+m\right)$ working set matrix consisting of the
${m}_{W}$ gradients of the working set constraints.
The search direction is defined so that constraints in the working set remain
unaltered for any value of the step length. It follows that
$p$ must satisfy the identity
This characterisation allows
$p$ to be computed using any
$n$ by
${n}_{Z}$ fullrank matrix
$Z$ that spans the null space of
$W$. (Thus,
${n}_{Z}=n{m}_{W}$ and
$WZ=0$.) The null space matrix
$Z$ is defined from a sparse
$LU$ factorization of part of
$W$ (see
(6) and
(7)). The direction
$p$ will satisfy
(3) if
where
${p}_{Z}$ is any
${n}_{Z}$vector.
The working set contains the constraints $Axs=0$ and a subset of the upper and lower bounds on the variables $\left(x,s\right)$. Since the gradient of a bound constraint ${x}_{j}\ge {l}_{j}$ or ${x}_{j}\le {u}_{j}$ is a vector of all zeros except for $\pm 1$ in position $j$, it follows that the working set matrix contains the rows of $\left(\begin{array}{cc}A& I\end{array}\right)$ and the unit rows associated with the upper and lower bounds in the working set.
The working set matrix
$W$ can be represented in terms of a certain column partition of the matrix
$\left(\begin{array}{cc}A& I\end{array}\right)$ by (conceptually) partitioning the constraints
$Axs=0$ so that
where
$B$ is a square nonsingular basis and
${x}_{B}$,
${x}_{S}$ and
${x}_{N}$ are the basic, superbasic and nonbasic variables respectively. The nonbasic variables are equal to their upper or lower bounds at
$\left(x,s\right)$, and the superbasic variables are independent variables that are chosen to improve the value of the current objective function. The number of superbasic variables is
${n}_{S}$ (the printed quantity
Ns; see
Section 12). Given values of
${x}_{N}$ and
${x}_{S}$, the basic variables
${x}_{B}$ are adjusted so that
$\left(x,s\right)$ satisfies
(5).
If
$P$ is a permutation matrix such that
$\left(\begin{array}{cc}A& I\end{array}\right)P=\left(\begin{array}{ccc}B& S& N\end{array}\right)$, then
$W$ satisfies
where
${I}_{N}$ is the identity matrix with the same number of columns as
$N$.
The null space matrix
$Z$ is defined from a sparse
$LU$ factorization of part of
$W$. In particular,
$Z$ is maintained in ‘reduced gradient’ form, using the LUSOL package (see
Gill et al. (1991)) to maintain sparse
$LU$ factors of the basis matrix
$B$ that alters as the working set
$W$ changes. Given the permutation
$P$, the null space basis is given by
This matrix is used only as an operator, i.e., it is never computed explicitly. Products of the form
$Zv$ and
${Z}^{\mathrm{T}}g$ are obtained by solving with
$B$ or
${B}^{\mathrm{T}}$. This choice of
$Z$ implies that
${n}_{Z}$, the number of ‘degrees of freedom’ at
$\left(x,s\right)$, is the same as
${n}_{S}$, the number of superbasic variables.
Let
${g}_{Z}$ and
${H}_{Z}$ denote the
reduced gradient and
reduced Hessian of the objective function:
where
$g$ is the objective gradient at
$\left(x,s\right)$. Roughly speaking,
${g}_{Z}$ and
${H}_{Z}$ describe the first and second derivatives of an
${n}_{S}$dimensional
unconstrained problem for the calculation of
${p}_{Z}$. (The condition estimator of
${H}_{Z}$ is the quantity
Cond Hz in the monitoring file output; see
Section 12.)
At each iteration, an upper triangular factor $R$ is available such that ${H}_{Z}={R}^{\mathrm{T}}R$. Normally, $R$ is computed from ${R}^{\mathrm{T}}R={Z}^{\mathrm{T}}HZ$ at the start of the optimality phase and then updated as the QP working set changes. For efficiency, the dimension of $R$ should not be excessive (say, ${n}_{S}\le 1000$). This is guaranteed if the number of nonlinear variables is ‘moderate’.
If the QP problem contains linear variables,
$H$ is positive semidefinite and
$R$ may be singular with at least one zero diagonal element. However, an inertiacontrolling strategy is used to ensure that only the last diagonal element of
$R$ can be zero. (See
Gill et al. (1991) for a discussion of a similar strategy for indefinite quadratic programming.)
If the initial $R$ is singular, enough variables are fixed at their current value to give a nonsingular $R$. This is equivalent to including temporary bound constraints in the working set. Thereafter, $R$ can become singular only when a constraint is deleted from the working set (in which case no further constraints are deleted until $R$ becomes nonsingular).
10.3 Main Iteration
If the reduced gradient is zero,
$\left(x,s\right)$ is a constrained stationary point on the working set. During the feasibility phase, the reduced gradient will usually be zero only at a vertex (although it may be zero elsewhere in the presence of constraint dependencies). During the optimality phase, a zero reduced gradient implies that
$x$ minimizes the quadratic objective function when the constraints in the working set are treated as equalities. At a constrained stationary point, Lagrange multipliers
$\lambda $ are defined from the equations
A Lagrange multiplier
${\lambda}_{j}$ corresponding to an inequality constraint in the working set is said to be
optimal if
${\lambda}_{j}\le \sigma $ when the associated constraint is at its
upper bound, or if
${\lambda}_{j}\ge \sigma $ when the associated constraint is at its
lower bound, where
$\sigma $ depends on the value of the optional parameter
Optimality Tolerance. If a multiplier is nonoptimal, the objective function (either the true objective or the sum of infeasibilities) can be reduced by continuing the minimization with the corresponding constraint excluded from the working set. (This step is sometimes referred to as ‘deleting’ a constraint from the working set.) If optimal multipliers occur during the feasibility phase but the sum of infeasibilities is nonzero, there is no feasible point and the routine terminates immediately with
${\mathbf{IFAIL}}={\mathbf{3}}$ (see
Section 6).
The special form
(6) of the working set allows the multiplier vector
$\lambda $, the solution of
(9), to be written in terms of the vector
where
$\pi $ satisfies the equations
${B}^{\mathrm{T}}\pi ={g}_{B}$, and
${g}_{B}$ denotes the basic elements of
$g$. The elements of
$\pi $ are the Lagrange multipliers
${\lambda}_{j}$ associated with the equality constraints
$Axs=0$. The vector
${d}_{N}$ of nonbasic elements of
$d$ consists of the Lagrange multipliers
${\lambda}_{j}$ associated with the upper and lower bound constraints in the working set. The vector
${d}_{S}$ of superbasic elements of
$d$ is the reduced gradient
${g}_{Z}$ in
(8). The vector
${d}_{B}$ of basic elements of
$d$ is zero, by construction. (The Euclidean norm of
${d}_{S}$ and the final values of
${d}_{S}$,
$g$ and
$\pi $ are the quantities
Norm rg,
Reduced Gradnt,
Obj Gradient and
Dual Activity in the monitoring file output; see
Section 12.)
If the reduced gradient is not zero, Lagrange multipliers need not be computed and the search direction is given by
$p=Z{p}_{Z}$ (see
(7) and
(11)). The step length is chosen to maintain feasibility with respect to the satisfied constraints.
There are two possible choices for
${p}_{Z}$, depending on whether or not
${H}_{Z}$ is singular. If
${H}_{Z}$ is nonsingular,
$R$ is nonsingular and
${p}_{Z}$ in
(4) is computed from the equations
where
${g}_{Z}$ is the reduced gradient at
$x$. In this case,
$\left(x,s\right)+p$ is the minimizer of the objective function subject to the working set constraints being treated as equalities. If
$\left(x,s\right)+p$ is feasible,
$\alpha $ is defined to be unity. In this case, the reduced gradient at
$\left(\stackrel{}{x},\stackrel{}{s}\right)$ will be zero, and Lagrange multipliers are computed at the next iteration. Otherwise,
$\alpha $ is set to
${\alpha}_{{\mathbf{M}}}$, the step to the ‘nearest’ constraint along
$p$. This constraint is then added to the working set at the next iteration.
If
${H}_{Z}$ is singular, then
$R$ must also be singular, and an inertiacontrolling strategy is used to ensure that only the last diagonal element of
$R$ is zero. (See
Gill et al. (1991) for a discussion of a similar strategy for indefinite quadratic programming.) In this case,
${p}_{Z}$ satisfies
which allows the objective function to be reduced by any step of the form
$\left(x,s\right)+\alpha p$,
where
$\alpha >0$. The vector
$p=Z{p}_{Z}$ is a direction of unbounded descent for the QP problem in the sense that the QP
objective is linear and decreases without bound along
$p$. If no finite step of the form
$\left(x,s\right)+\alpha p$ (where
$\alpha >0$) reaches a constraint not in the working set, the QP problem is unbounded and the routine terminates immediately with
${\mathbf{IFAIL}}={\mathbf{2}}$ (see
Section 6). Otherwise,
$\alpha $ is defined as the maximum feasible step along
$p$ and a constraint active at
$\left(x,s\right)+\alpha p$ is added to the working set for the next iteration.
10.4 Miscellaneous
If the basis matrix is not chosen carefully, the condition of the null space matrix
$Z$ in
(7) could be arbitrarily high. To guard against this, the routine implements a ‘basis repair’ feature in which the LUSOL package (see
Gill et al. (1991)) is used to compute the rectangular factorization
returning just the permutation
$P$ that makes
$PL{P}^{\mathrm{T}}$ unit lower triangular. The pivot tolerance is set to require
${\leftPL{P}^{\mathrm{T}}\right}_{ij}\le 2$, and the permutation is used to define
$P$ in
(6). It can be shown that
$\Vert Z\Vert $ is likely to be little more than unity. Hence,
$Z$ should be wellconditioned
regardless of the condition of
$W$. This feature is applied at the beginning of the optimality phase if a potential
$BS$ ordering is known.
The EXPAND procedure (see
Gill et al. (1989)) is used to reduce the possibility of cycling at a point where the active constraints are nearly linearly dependent. Although there is no absolute guarantee that cycling will not occur, the probability of cycling is extremely small (see
Hall and McKinnon (1996)). The main feature of EXPAND is that the feasibility tolerance is increased at the start of every iteration. This allows a positive step to be taken at every iteration, perhaps at the expense of violating the bounds on
$\left(x,s\right)$ by a small amount.
Suppose that the value of the optional parameter
Feasibility Tolerance is
$\delta $. Over a period of
$K$ iterations (where
$K$ is the value of the optional parameter
Expand Frequency), the feasibility tolerance actually used by the routine (i.e., the
working feasibility tolerance) increases from
$0.5\delta $ to
$\delta $ (in steps of
$0.5\delta /K$).
At certain stages the following ‘resetting procedure’ is used to remove small constraint infeasibilities. First, all nonbasic variables are moved exactly onto their bounds. A count is kept of the number of nontrivial adjustments made. If the count is nonzero, the basic variables are recomputed. Finally, the working feasibility tolerance is reinitialized to $0.5\delta $.
If a problem requires more than $K$ iterations, the resetting procedure is invoked and a new cycle of iterations is started. (The decision to resume the feasibility phase or optimality phase is based on comparing any constraint infeasibilities with $\delta $.)
The resetting procedure is also invoked when the routine reaches an apparently optimal, infeasible or unbounded solution, unless this situation has already occurred twice. If any nontrivial adjustments are made, iterations are continued.
The EXPAND procedure not only allows a positive step to be taken at every iteration, but also provides a potential choice of constraints to be added to the working set. All constraints at a distance $\alpha $ (where $\alpha \le {\alpha}_{{\mathbf{M}}}$) along $p$ from the current point are then viewed as acceptable candidates for inclusion in the working set. The constraint whose normal makes the largest angle with the search direction is added to the working set. This strategy helps keep the basis matrix $B$ wellconditioned.
11 Optional Parameters
Several optional parameters in E04NKF/E04NKA define choices in the problem specification or the algorithm logic. In order to reduce the number of formal parameters of E04NKF/E04NKA 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 11.1.
Optional parameters may be specified by calling one, or both, of the routines
E04NLF/E04NLA and
E04NMF/E04NMA before a call to E04NKF/E04NKA.
E04NLF/E04NLA reads options from an external options file, with
Begin and
End as the first and last lines respectively and each intermediate line defining a single optional parameter. For example,
Begin
Print Level = 5
End
The call
CALL E04NLF (IOPTNS, INFORM)
can then be used to read the file on unit
IOPTNS.
INFORM will be zero on successful exit.
E04NLF/E04NLA should be consulted for a full description of this method of supplying optional parameters.
E04NMF/E04NMA can be called to supply options directly, one call being necessary for each optional parameter. For example,
CALL E04NMF ('Print Level = 5')
E04NMF/E04NMA 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 E04NKF/E04NKA (unless they define invalid values) and so remain in effect for subsequent calls unless altered by you.
11.1 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$, $i\text{ and}r$ denote options that take character, integer and real values respectively;
 the default value is used whenever the condition $\lefti\right\ge 100000000$ is satisfied and where the symbol $\epsilon $ is a generic notation for machine precision (see X02AJF);
Keywords and character values are case and white space insensitive.
Check Frequency  $i$  Default $\text{}=60$ 
Every $i$th iteration after the most recent basis factorization, a numerical test is made to see if the current solution $\left(x,s\right)$ satisfies the linear constraints $Axs=0$. If the largest element of the residual vector $r=Axs$ is judged to be too large, the current basis is refactorized and the basic variables recomputed to satisfy the constraints more accurately. If $i<0$, the default value is used. If $i=0$, the value $i=99999999$ is used and effectively no checks are made.
Crash Option  $i$  Default $\text{}=2$ 
Note that this option does not apply when
${\mathbf{START}}=\text{'W'}$ (see
Section 5).
If ${\mathbf{START}}=\text{'C'}$, an internal Crash procedure is used to select an initial basis from various rows and columns of the constraint matrix $\left(\begin{array}{cc}A& I\end{array}\right)$. The value of $i$ determines which rows and columns are initially eligible for the basis, and how many times the Crash procedure is called. If $i=0$, the allslack basis $B=I$ is chosen. If $i=1$, the Crash procedure is called once (looking for a triangular basis in all rows and columns of the linear constraint matrix $A$). If $i=2$, the Crash procedure is called twice (looking at any equality constraints first followed by any inequality constraints). If $i<0$ or $i>2$, the default value is used.
If $i=1\text{ or}2$, certain slacks on inequality rows are selected for the basis first. (If $i=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$, 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$  Default $\text{}=0.1$ 
This value allows the Crash procedure to ignore certain ‘small’ nonzero elements in the constraint matrix $A$ while searching for a triangular basis. For each column of $A$, if ${a}_{\mathrm{max}}$ is the largest element in the column, other nonzeros in that column are ignored if they are less than (or equal to) ${a}_{\mathrm{max}}\times r$.
When $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 with more column variables and fewer (arbitrary) slacks. A feasible solution may be reached earlier for some problems. If $r<0$ or $r\ge 1$, the default value is used.
This special keyword may be used to reset all optional parameters to their default values.
Expand Frequency  $i$  Default $\text{}=10000$ 
This option is part of an anticycling procedure (see
Section 10.4) designed to allow progress even on highly degenerate problems.
For LP problems, 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 the optional parameter
Feasibility Tolerance is
$\delta $. Over a period of
$i$ iterations, the feasibility tolerance actually used by E04NKF/E04NKA (i.e., the
working feasibility tolerance) increases from
$0.5\delta $ to
$\delta $ (in steps of
$0.5\delta /i$).
For QP problems, 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$ 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$, the default value is used. If $i=0$, the value $i=99999999$ is used and effectively no anticycling procedure is invoked.
Factorization Frequency  $i$  Default $\text{}=100$ 
If
$i>0$, at most
$i$ basis changes will occur between factorizations of the basis matrix. For LP problems, the basis factors are usually updated at every iteration. For QP problems, 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 linear constraints
$Axs=0$ are satisfied. If necessary, the basis will be refactorized before the limit of
$i$ updates is reached. If
$i\le 0$, the default value is used.
Feasibility Tolerance  $r$  Default $\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({10}^{6},\sqrt{\epsilon}\right)$ 
If $r\ge \epsilon $, $r$ defines the maximum acceptable absolute violation in each constraint at a ‘feasible’ point (including slack variables). For example, if the variables and the coefficients in the linear constraints are of order unity, and the latter are correct to about five decimal digits, it would be appropriate to specify $r$ as ${10}^{5}$. If $r<\epsilon $, the default value is used.
E04NKF/E04NKA attempts to find a feasible solution before optimizing the objective function. If the sum of infeasibilities cannot be reduced to zero, the problem is assumed to be infeasible. Let Sinf be the corresponding sum of infeasibilities. If Sinf is quite small, it may be appropriate to raise $r$ by a factor of $10$ or $100$. Otherwise, some error in the data should be suspected. Note that the routine does not attempt to find the minimum value of Sinf.
If the constraints and variables have been scaled (see
Scale Option), then feasibility is defined in terms of the scaled problem (since it is more likely to be meaningful).
Infinite Bound Size  $r$  Default $\text{}={10}^{20}$ 
If $r>0$, $r$ defines the ‘infinite’ bound $\mathit{bigbnd}$ in the definition of the problem constraints. Any upper bound greater than or equal to $\mathit{bigbnd}$ will be regarded as $+\infty $ (and similarly any lower bound less than or equal to $\mathit{bigbnd}$ will be regarded as $\infty $). If $r\le 0$, the default value is used.
Infinite Step Size  $r$  Default $\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\mathit{bigbnd},{10}^{20}\right)$ 
If $r>0$, $r$ specifies the magnitude of the change in variables that will be considered a step to an unbounded solution. (Note that an unbounded solution can occur only when the Hessian is not positive definite.) If the change in $x$ during an iteration would exceed the value of $r$, the objective function is considered to be unbounded below in the feasible region. If $r\le 0$, the default value is used.
Iteration Limit  $i$  Default $\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(50,5\left(n+m\right)\right)$ 
The value of $i$ specifies the maximum number of iterations allowed before termination. Setting $i=0$ and ${\mathbf{Print\; Level}}>0$ means that the workspace needed to start solving the problem will be computed and printed, but no iterations will be performed. If $i<0$, the default value is used.
List   Default for $\mathrm{E04NKF}={\mathbf{List}}$ 
Nolist   Default for $\mathrm{E04NKA}={\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 Factor Tolerance  ${r}_{1}$  Default $\text{}=100.0$ 
LU Update Tolerance  ${r}_{2}$  Default $\text{}=10.0$ 
The values of
${r}_{1}$ and
${r}_{2}$ affect the stability and sparsity of the basis factorization
$B=LU$, during refactorization and updates respectively. The lower triangular matrix
$L$ is a product of matrices of the form
where the multipliers
$\mu $ will satisfy
$\left\mu \right\le {r}_{i}$. The default values of
${r}_{1}$ and
${r}_{2}$ usually strike a good compromise between stability and sparsity. For large and relatively dense problems, setting
${r}_{1}$ and
${r}_{2}$ to
$25$ (say) may give a marked improvement in sparsity without impairing stability to a serious degree.
Note that for band matrices it may be necessary to set ${r}_{1}$ in the range $1\le {r}_{1}<2$ in order to achieve stability. If ${r}_{1}<1$ or ${r}_{2}<1$, the default value is used.
LU Singularity Tolerance  $r$  Default $\text{}={\epsilon}^{0.67}$ 
If $r>0$, $r$ defines the singularity tolerance used to guard against illconditioned basis matrices. Whenever the basis is refactorized, the diagonal elements of $U$ are tested as follows. If $\left{u}_{jj}\right\le r$ or $\left{u}_{jj}\right<r\times {\displaystyle \underset{i}{\mathrm{max}}}\phantom{\rule{0.25em}{0ex}}\left{u}_{ij}\right$, the $j$th column of the basis is replaced by the corresponding slack variable. If $r\le 0$, the default value is used.
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\left(x\right)$ and the other maximizes
$f\left(x\right)$, their solutions will be the same but the signs of the dual variables
${\pi}_{i}$ and the reduced gradients
${d}_{j}$ (see
Section 10.3) will be reversed.
Monitoring File  $i$  Default $\text{}=1$ 
If
$i\ge 0$ and
${\mathbf{Print\; Level}}>0$ (see
Print Level), monitoring information produced by E04NKF/E04NKA is sent to a file with logical unit number
$i$. If
$i<0$ and/or
${\mathbf{Print\; Level}}=0$, the default value is used and hence no monitoring information is produced.
Optimality Tolerance  $r$  Default $\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({10}^{6},\sqrt{\epsilon}\right)$ 
If $r\ge \epsilon $, $r$ is used to judge the size of the reduced gradients ${d}_{j}={g}_{j}{\pi}^{\mathrm{T}}{a}_{j}$. By definition, the reduced gradients for basic variables are always zero. Optimality is declared if the reduced gradients for any nonbasic variables at their lower or upper bounds satisfy $r\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\Vert \pi \Vert \right)\le {d}_{j}\le r\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\Vert \pi \Vert \right)$, and if $\left{d}_{j}\right\le r\times \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\Vert \pi \Vert \right)$ for any superbasic variables. If $r<\epsilon $, the default value is used.
Partial Price  $i$  Default $\text{}=10$ 
Note that this option does not apply to QP problems.
This option is recommended for large FP or LP problems that have significantly more variables than constraints (i.e., $n\gg m$). It reduces the work required for each pricing operation (i.e., when a nonbasic variable is selected to enter the basis). If $i=1$, all columns of the constraint matrix $\left(\begin{array}{cc}A& I\end{array}\right)$ are searched. If $i>1$, $A$ and $I$ are partitioned to give $i$ roughly equal segments ${A}_{\mathit{j}},{K}_{\mathit{j}}$, for $\mathit{j}=1,2,\dots ,p$ (modulo $p$). If the previous pricing search was successful on ${A}_{j1},{K}_{j1}$, the next search begins on the segments ${A}_{j},{K}_{j}$. 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 ${A}_{j+1},{K}_{j+1}$, and so on. If $i\le 0$, the default value is used.
Pivot Tolerance  $r$  Default $\text{}={\epsilon}^{0.67}$ 
If $r>0$, $r$ is used to prevent columns entering the basis if they would cause the basis to become almost singular. If $r\le 0$, the default value is used.
Print Level  $i$  Default for E04NKF
$\text{}=10$
Default for E04NKA
$\text{}=0$ 
The value of
$i$ controls the amount of printout produced by E04NKF/E04NKA, as indicated below. A detailed description of the printed output is given in
Section 8.1 (summary output at each iteration and the final solution) and
Section 12 (monitoring information at each iteration). Note that the summary output will not exceed
$80$ characters per line and that the monitoring information will not exceed
$120$ characters per line. If
$i<0$, the default value is used.
The following printout is sent to the current advisory message unit (as defined by
X04ABF):
$i$ 
Output 
$\phantom{\ge 0}0$ 
No output. 
$\phantom{\ge 0}1$ 
The final solution only. 
$\phantom{\ge 0}5$ 
One line of summary output for each iteration (no printout of the final solution). 
$\text{}\ge 10$ 
The final solution and one line of summary output for each iteration. 
The following printout is sent to the logical unit number defined by the optional parameter
Monitoring File:
$i$ 
Output 
$\phantom{\ge 0}0$ 
No output. 
$\phantom{\ge 0}1$ 
The final solution only. 
$\phantom{\ge 0}5$ 
One long line of output for each iteration (no printout of the final solution). 
$\text{}\ge 10$ 
The final solution and one long line of output for each iteration. 
$\text{}\ge 20$ 
The final solution, one long line of output for each 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$ (see the description of the optional parameter Scale Option), basis factorization statistics and details of the initial basis resulting from the Crash procedure (if ${\mathbf{START}}=\text{'C'}$; see Section 5). 
If
${\mathbf{Print\; Level}}>0$ and the unit number defined by optional parameter
Monitoring File is the same as that defined by
X04ABF, then the summary output is suppressed.
Rank Tolerance  $r$  Default $\text{}=100\epsilon $ 
Scale Option  $i$  Default $\text{}=2$ 
This option enables you to scale the variables and constraints using an iterative procedure due to
Fourer (1982), which attempts to compute row scales
${r}_{i}$ and column scales
${c}_{j}$ such that the scaled matrix coefficients
${\stackrel{}{a}}_{ij}={a}_{ij}\times \left({c}_{j}/{r}_{i}\right)$ are as close as possible to unity. This may improve the overall efficiency on some problems. (The lower and upper bounds on the variables and slacks for the scaled problem are redefined as
${\stackrel{}{l}}_{j}={l}_{j}/{c}_{j}$ and
${\stackrel{}{u}}_{j}={u}_{j}/{c}_{j}$ respectively, where
${c}_{j}\equiv {r}_{jn}$ if
$j>n$.)
If $i=0$, no scaling is performed. If $i=1$, all rows and columns of the constraint matrix $A$ are scaled. If $i=2$, an additional scaling is performed that may be helpful when the solution $x$ is large; it takes into account columns of $\left(\begin{array}{cc}A& I\end{array}\right)$ that are fixed or have positive lower bounds or negative upper bounds. If $i<0$ or $i>2$, the default value is used.
Scale Tolerance  $r$  Default $\text{}=0.9$ 
Note that this option does not apply when ${\mathbf{Scale\; Option}}=0$.
If $0<r<1$, $r$ is used to control the number of scaling passes to be made through the constraint matrix $A$. At least $3$ (and at most $10$) passes will be made. More precisely, let ${a}_{p}$ denote the largest column ratio (i.e., $\frac{\text{'biggest'}\text{ element}}{\text{'smallest'}\text{ element}}$ in some sense) after the $p$th scaling pass through $A$. The scaling procedure is terminated if ${a}_{p}\ge {a}_{p1}\times r$ for some $p\ge 3$. Thus, increasing the value of $r$ from $0.9$ to $0.99$ (say) will probably increase the number of passes through $A$.
If $r\le 0$ or $r\ge 1$, the default value is used.
Superbasics Limit  $i$  Default $\text{}=\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({n}_{H}+1,n\right)$ 
Note that this option does not apply to FP or LP problems.
The value of $i$ specifies ‘how nonlinear’ you expect the QP problem to be. If $i\le 0$, the default value is used.
12 Description of Monitoring Information
This section describes the intermediate printout and final printout which constitutes the monitoring information produced by E04NKF/E04NKA. (See also the description of the optional parameters
Monitoring File and
Print Level.) You can control the level of printed output.
When
${\mathbf{Print\; Level}}=5$ or
$\text{}\ge 10$ and
${\mathbf{Monitoring\; File}}\ge 0$, the following line of intermediate printout (
$\text{}<120$ characters) is produced at every 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.
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$ and $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.

+S 
is the variable selected by the pricing operation to be added to the superbasic set.

S 
is the variable chosen to leave the superbasic set.

BS 
is the variable removed from the basis (if any) to become nonbasic.

Step 
is the value of the step length $\alpha $ taken along the current search direction $p$. The variables $x$ have just been changed to $x+\alpha p$. If a variable is made superbasic during the current iteration (i.e., +S 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$th element of a vector $y$ satisfying $By={a}_{q}$ whenever ${a}_{q}$ (the $q$th column of the constraint matrix $\left(\begin{array}{cc}A& I\end{array}\right)$) replaces the $r$th column of the basis matrix $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$ from consideration during the computation of Step.

Ninf 
is the number of violated constraints (infeasibilities). This will be zero during the optimality phase.

Sinf/Objective 
is the value of the current objective function. If $x$ is not feasible, Sinf gives the sum of the magnitudes of constraint violations. If $x$ is feasible, Objective is the value of the objective function. The output line for the final iteration of the feasibility phase (i.e., the first iteration for which Ninf is zero) will give the value of the true objective at the first feasible point. During the optimality phase, the value of the objective function will be nonincreasing. During the feasibility phase, the number of constraint infeasibilities will not increase until either a feasible point is found, or the optimality of the multipliers implies that no feasible point exists.

L 
is the number of nonzeros in the basis factor $L$. Immediately after a basis factorization $B=LU$, this entry contains lenL. Further nonzeros are added to L when various columns of $B$ are later replaced. (Thus, L increases monotonically.)

U 
is the number of nonzeros in the basis factor $U$. Immediately after a basis factorization $B=LU$, this entry contains lenU. As columns of $B$ are replaced, the matrix $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$. 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 $\mathtt{L}+\mathtt{U}$ and rerun E04NKF/E04NKA (possibly using ${\mathbf{START}}=\text{'W'}$; see Section 5).

Norm rg 
is $\Vert {d}_{S}\Vert $, the Euclidean norm of the reduced gradient (see Section 10.3). During the optimality phase, this norm will be approximately zero after a unit step. For FP and LP problems, Norm rg is not printed.

Ns 
is the current number of superbasic variables. For FP and LP problems, Ns is not printed.

Cond Hz 
is a lower bound on the condition number of the reduced Hessian (see Section 10.2). The larger this number, the more difficult the problem. For FP and LP problems, Cond Hz is not printed.

When
${\mathbf{Print\; Level}}\ge 20$ and
${\mathbf{Monitoring\; File}}\ge 0$, the following lines of intermediate printout (
$\text{}<120$ characters) are produced on the unit number specified by optional parameter
Monitoring File whenever the matrix
$B$ or
${B}_{S}={\left(\begin{array}{cc}B& S\end{array}\right)}^{\mathrm{T}}$ is factorized. Gaussian elimination is used to compute an
$LU$ factorization of
$B$ or
${B}_{S}$, where
$PL{P}^{\mathrm{T}}$ is a lower triangular matrix and
$PUQ$ is an upper triangular matrix for some permutation matrices
$P$ and
$Q$. The factorization is stabilized in the manner described under the optional parameter
LU Factor Tolerance (
$\text{default value}=100.0$).
Factorize 
is the factorization count.

Demand 
is a code giving the reason for the present factorization as follows:
Code 
Meaning 
$\phantom{01}0$ 
First $LU$ factorization. 
$\phantom{01}1$ 
The number of updates reached the value of the optional parameter Factorization Frequency. 
$\phantom{01}2$ 
The number of nonzeros in the updated factors has increased significantly. 
$\phantom{01}7$ 
Not enough storage to update factors. 
$\phantom{0}10$ 
Row residuals too large (see the description for the optional parameter Check Frequency). 
$\phantom{0}11$ 
Illconditioning has caused inconsistent results. 

Iteration 
is the iteration count.

Nonlinear 
is the number of nonlinear variables in the current basis $B$ (not printed if ${B}_{S}$ is factorized).

Linear 
is the number of linear variables in $B$ (not printed if ${B}_{S}$ is factorized).

Slacks 
is the number of slack variables in $B$ (not printed if ${B}_{S}$ is factorized).

Elems 
is the number of nonzeros in $B$ (not printed if ${B}_{S}$ is factorized).

Density 
is the percentage nonzero density of $B$ (not printed if ${B}_{S}$ is factorized). More precisely, $\mathtt{Density}=100\times \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$ or $4$, increase LENIZ and LENZ and rerun E04NKF/E04NKA (possibly using ${\mathbf{START}}=\text{'W'}$; see Section 5).

Merit 
is the average Markowitz merit count for the elements chosen to be the diagonals of $PUQ$. Each merit count is defined to be $\left(c1\right)\left(r1\right)$, where $c$ and $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$.

lenU 
is the number of nonzeros in $U$.

Increase 
is the percentage increase in the number of nonzeros in $L$ and $U$ relative to the number of nonzeros in $B$. More precisely, $\mathtt{Increase}=100\times \left(\mathtt{lenL}+\mathtt{lenU}\phantom{\rule{0ex}{0ex}}\mathtt{Elems}\right)/\mathtt{Elems}$.

m 
is the number of rows in the problem. Note that $\mathtt{m}=\mathtt{Ut}+\mathtt{Lt}+\mathtt{bp}$.

Ut 
is the number of triangular rows of $B$ at the top of $U$.

d1 
is the number of columns remaining when the density of the basis matrix being factorized reached $0.3$.

Lmax 
is the maximum subdiagonal element in the columns of $L$. This will not exceed the value of the optional parameter LU Factor Tolerance.

Bmax 
is the maximum nonzero element in $B$ (not printed if ${B}_{S}$ is factorized).

BSmax 
is the maximum nonzero element in ${B}_{S}$ (not printed if $B$ is factorized).

Umax 
is the maximum nonzero element in $U$, excluding elements of $B$ that remain in $U$ unchanged. (For example, if a slack variable is in the basis, the corresponding row of $B$ will become a row of $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$ 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 ${B}_{S}$ is factorized.

Umin 
is the magnitude of the smallest diagonal element of $PUQ$ (not printed if ${B}_{S}$ is factorized).

Growth 
is the value of the ratio Umax/Bmax, which should not be too large. Providing Lmax is not large (say, $\text{}<10.0$), the ratio $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\mathtt{Bmax},\mathtt{Umax}\right)/\mathtt{Umin}$ is an estimate of the condition number of $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 nearsingularity by using slacks to replace columns of $B$ that would have made Umin extremely small and the modified basis is refactorized.) Growth is not printed if ${B}_{S}$ is factorized. 
Lt 
is the number of triangular columns of $B$ at the left of $L$.

bp 
is the size of the ‘bump’ or block to be factorized nontrivially after the triangular rows and columns of $B$ have been removed.

d2 
is the number of columns remaining when the density of the basis matrix being factorized has reached $0.6$.

When
${\mathbf{Print\; Level}}\ge 20$ and
${\mathbf{Monitoring\; File}}\ge 0$, the following lines of intermediate printout (
$\text{}<80$ characters) are produced on the unit number specified by optional parameter
Monitoring File whenever
${\mathbf{START}}=\text{'C'}$ (see
Section 5). They refer to the number of columns selected by the Crash procedure during each of several passes through
$A$, whilst 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., ${\mathbf{ISTATE}}\left(j\right)=3$ for some $j\le n$). It will be a subset of the columns for which ${\mathbf{ISTATE}}\left(j\right)=3$ was specified.

Unit 
is the number of unit columns in the basis.

Double 
is the number of double columns in the basis.

Triangle 
is the number of triangular columns in the basis.

Pad 
is the number of slacks used to pad the basis (to make it a nonsingular triangle).

When
${\mathbf{Print\; Level}}\ge 20$ and
${\mathbf{Monitoring\; File}}\ge 0$, the following lines of intermediate printout (
$\text{}<80$ characters) are produced on the unit number specified by optional parameter
Monitoring File. They refer to the elements of the
NAMES array (see
Section 5).
Name 
gives the name for the problem (blank if problem unnamed).

Status 
gives the exit status for the problem (i.e., Optimal soln, Weak soln, Unbounded, Infeasible, Excess itns, Error condn or Feasble soln) followed by details of the direction of the optimization (i.e., (Min) or (Max)).

Objective 
gives the name of the free row for the problem (blank if objective unnamed).

RHS 
gives the name of the constraint righthand side for the problem (blank if objective unnamed).

Ranges 
gives the name of the ranges for the problem (blank if objective unnamed).

Bounds 
gives the name of the bounds for the problem (blank if objective unnamed).

When
${\mathbf{Print\; Level}}=1$ or
$\text{}\ge 10$ and
${\mathbf{Monitoring\; File}}\ge 0$, the following lines of final printout (
$\text{}<120$ characters) are produced on the unit number specified by optional parameter
Monitoring File.
Let
${a}_{\mathit{j}}$ denote the
$\mathit{j}$th column of
$A$, for
$\mathit{j}=1,2,\dots ,n$. 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$. (This is used internally to refer to ${x}_{j}$ in the intermediate output.)

Column 
gives the name of ${x}_{j}$.

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 bound, there would be no change in the value of the objective function. The values of the other free variables might change, giving a genuine alternative solution. However, if there are any degenerate variables (labelled D), the actual change might prove to be zero, since one of them could encounter a bound immediately. In either case, the values of the Lagrange multipliers might also change.

D 
Degenerate. The variable is basic or superbasic, but it is equal (or very close) to one of its bounds.

I 
Infeasible. The variable is basic or superbasic and is currently violating one of its bounds by more than the value of the Feasibility Tolerance.

N 
Not precisely optimal. The variable is nonbasic or superbasic. If the value of the reduced gradient for the variable exceeds the value of the optional parameter Optimality Tolerance, the solution would not be declared optimal because the reduced gradient for the variable would not be considered negligible.


Activity 
is the value of ${x}_{j}$ at the final iterate.

Obj Gradient 
is the value of ${g}_{j}$ at the final iterate. For FP problems, ${g}_{j}$ is set to zero.

Lower Bound 
is the lower bound specified for the variable. None indicates that ${\mathbf{BL}}\left(j\right)\le \mathit{bigbnd}$.

Upper Bound 
is the upper bound specified for the variable. None indicates that ${\mathbf{BU}}\left(j\right)\ge \mathit{bigbnd}$.

Reduced Gradnt 
is the value of ${d}_{j}$ at the final iterate (see Section 10.3). For FP problems, ${d}_{j}$ is set to zero.

m + j 
is the value of $m+j$.

Let
${v}_{\mathit{i}}$ denote the
$\mathit{i}$th row of
$A$, for
$\mathit{i}=1,2,\dots ,m$. 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$. (This is used internally to refer to ${s}_{i}$ in the intermediate output.)

Row 
gives the name of ${\nu}_{i}$.

State 
gives the state of ${v}_{i}$ (LL if active on its lower bound, UL if active on its upper bound, EQ if active and fixed, BS if inactive when ${s}_{i}$ is basic and SBS if inactive when ${s}_{i}$ is 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 bound, there would be no change in the value of the objective function. The values of the other free variables might change, giving a genuine alternative solution. However, if there are any degenerate variables (labelled D), the actual change might prove to be zero, since one of them could encounter a bound immediately. In either case, the values of the Lagrange multipliers might also change.

D 
Degenerate. The variable is basic or superbasic, but it is equal (or very close) to one of its bounds.

I 
Infeasible. The variable is basic or superbasic and is currently violating one of its bounds by more than the value of the Feasibility Tolerance.

N 
Not precisely optimal. The variable is nonbasic or superbasic. If the value of the reduced gradient for the variable exceeds the value of the optional parameter Optimality Tolerance, the solution would not be declared optimal because the reduced gradient for the variable would not be considered negligible.


Activity 
is the value of ${v}_{i}$ 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 the lower bound specified for the variable. None indicates that ${\mathbf{BL}}\left(j\right)\le \mathit{bigbnd}$.

Upper Bound 
is the upper bound specified for the variable. None indicates that ${\mathbf{BU}}\left(j\right)\ge \mathit{bigbnd}$.

Dual Activity 
is the value of the dual variable ${\pi}_{i}$ (the Lagrange multiplier for ${\nu}_{i}$; see Section 10.3). For FP problems, ${\pi}_{i}$ is set to zero.

i 
gives the index $i$ of the $i$th row.

Numerical values are output with a fixed number of digits; they are not guaranteed to be accurate to this precision.