NAG Library Function Document
nag_opt_qp (e04nfc)
1 Purpose
nag_opt_qp (e04nfc) solves general quadratic programming problems. It is not intended for large sparse problems.
2 Specification
#include <nag.h> 
#include <nage04.h> 
void 
nag_opt_qp (Integer n,
Integer nclin,
const double a[],
Integer tda,
const double bl[],
const double bu[],
const double cvec[],
const double h[],
Integer tdh,
void 
(*qphess)(Integer n,
Integer jthcol,
const double h[],
Integer tdh,
const double x[],
double hx[],
Nag_Comm *comm),


double x[],
double *objf,
Nag_E04_Opt *options,
Nag_Comm *comm,
NagError *fail) 

3 Description
nag_opt_qp (e04nfc) is designed to solve a class of quadratic programming problems stated in the following general form:
where
$A$ is an
${m}_{\mathrm{lin}}$ by
$n$ matrix and
$f\left(x\right)$ may be specified in a variety of ways depending upon the particular problem to be solved. The available forms for
$f\left(x\right)$ are listed in
Table 1 below, in which the prefixes FP, LP and QP stand for ‘feasible point’, ‘linear programming’ and ‘quadratic programming’ respectively and
$c$ is an
$n$ element vector.
Problem Type 
$f\left(x\right)$ 
Matrix $H$ 
FP 
Not applicable 
Not applicable 
LP 
${c}^{\mathrm{T}}x$ 
Not applicable 
QP1 
$\phantom{{c}^{\mathrm{T}}x+}\frac{1}{2}{x}^{\mathrm{T}}Hx$ 
symmetric 
QP2 
${c}^{\mathrm{T}}x+\frac{1}{2}{x}^{\mathrm{T}}Hx$ 
symmetric 
QP3 
$\phantom{{c}^{\mathrm{T}}x+}\frac{1}{2}{x}^{\mathrm{T}}{H}^{\mathrm{T}}Hx$ 
$m$ by $n$ upper trapezoidal

QP4 
${c}^{\mathrm{T}}x+\frac{1}{2}{x}^{\mathrm{T}}{H}^{\mathrm{T}}Hx$ 
$m$ by $n$ upper trapezoidal

Table 1
For problems of type FP a feasible point with respect to a set of linear inequality constraints is sought. The default problem type is QP2, other objective functions are selected by using the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}$.
The constraints involving $A$ are called the general constraints. Note that upper and lower bounds are specified for all the variables and for all the general constraints. An equality constraint can be specified by setting ${l}_{i}={u}_{i}$. If certain bounds are not present, the associated elements of $l$ or $u$ can be set to special values that will be treated as $\infty $ or $+\infty $. (See the description of the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$.)
The defining feature of a quadratic function
$f\left(x\right)$ is that the secondderivative matrix
${\nabla}^{2}f\left(x\right)$ (the
Hessian matrix) is constant. For the LP case,
${\nabla}^{2}f\left(x\right)=0$; for QP1 and QP2,
${\nabla}^{2}f\left(x\right)=H$; and for QP3 and QP4,
${\nabla}^{2}f\left(x\right)={H}^{\mathrm{T}}H$. If
$H$ is defined as the zero matrix, nag_opt_qp (e04nfc) will solve the resulting linear programming problem; however, this can be accomplished more efficiently by setting the optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_LP}$, or by using
nag_opt_lp (e04mfc).
You must supply an initial estimate of the solution.
In the QP case, you may supply
$H$ either
explicitly as an
$m$ by
$n$ matrix, or
implicitly in a C function that computes the product
$Hx$ for any given vector
$x$. An example of such a function is included in
Section 9. There is no restriction on
$H$ apart from symmetry. In general, a successful run of nag_opt_qp (e04nfc) will indicate one of three situations: (i) a minimizer has been found; (ii) the algorithm has terminated at a socalled
deadpoint; or (iii) the problem has no bounded solution. If a minimizer is found, and
$H$ is positive definite or positive semidefinite, nag_opt_qp (e04nfc) will obtain a global minimizer; otherwise, the solution will be a
local minimizer (which may or may not be a global minimizer). A deadpoint is a point at which the necessary conditions for optimality are satisfied but the sufficient conditions are not. At such a point, a feasible direction of decrease may or may not exist, so that the point is not necessarily a local solution of the problem. Verification of optimality in such instances requires further information, and is in general an NPhard problem (see
Pardalos and Schnitger (1988)). Termination at a deadpoint can occur only if
$H$ is not positive definite. If
$H$ is positive semidefinite, the deadpoint will be a
weak minimizer (i.e., with a unique optimal objective value, but an infinite set of optimal
$x$).
Details about the algorithm are described in
Section 10, but it is not necessary to read this more advanced section before using nag_opt_qp (e04nfc).
4 References
Bunch J R and Kaufman L C (1980) A computational method for the indefinite quadratic programming problem Linear Algebra and its Applications 34 341–370
Gill P E, Hammarling S, Murray W, Saunders M A and Wright M H (1986) Users' guide for LSSOL (Version 1.0) Report SOL 861 Department of Operations Research, Stanford University
Gill P E and Murray W (1978) Numerically stable methods for quadratic programming Math. Programming 14 349–372
Gill P E, Murray W, Saunders M A and Wright M H (1984) Procedures for optimization problems with a mixture of bounds and general linear constraints ACM Trans. Math. Software 10 282–298
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
Pardalos P M and Schnitger G (1988) Checking local optimality in constrained quadratic programming is NPhard Operations Research Letters 7 33–35
5 Arguments
 1:
n – IntegerInput

On entry: $n$, the number of variables.
Constraint:
${\mathbf{n}}>0$.
 2:
nclin – IntegerInput

On entry: ${m}_{\mathrm{lin}}$, the number of general linear constraints.
Constraint:
${\mathbf{nclin}}\ge 0$.
 3:
a[${\mathbf{nclin}}\times {\mathbf{tda}}$] – const doubleInput

Note: the $\left(i,j\right)$th element of the matrix $A$ is stored in ${\mathbf{a}}\left[\left(i1\right)\times {\mathbf{tda}}+j1\right]$.
On entry: the
$\mathit{i}$th row of
a must contain the coefficients of the
$\mathit{i}$th general linear constraint (the
$\mathit{i}$th row of
$A$), for
$\mathit{i}=1,2,\dots ,{m}_{\mathrm{lin}}$. If
${\mathbf{nclin}}=0$, the array
a is not referenced.
 4:
tda – IntegerInput

On entry: the stride separating matrix column elements in the array
a.
Constraint:
if ${\mathbf{nclin}}>0$, ${\mathbf{tda}}\ge {\mathbf{n}}$
 5:
bl[${\mathbf{n}}+{\mathbf{nclin}}$] – const doubleInput
 6:
bu[${\mathbf{n}}+{\mathbf{nclin}}$] – const doubleInput

On entry:
bl must contain the lower bounds and
bu the upper bounds, for all the constraints in the following order. The first
$n$ elements of each array must contain the bounds on the variables, and the next
${m}_{\mathrm{lin}}$ elements the bounds for the general linear constraints (if any). To specify a nonexistent lower bound (i.e.,
${l}_{j}=\infty $), set
${\mathbf{bl}}\left[j\right]\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$, and to specify a nonexistent upper bound (i.e.,
${u}_{j}=+\infty $), set
${\mathbf{bu}}\left[j\right]\ge {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$;
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$ is the optional argument, whose default value is
${10}^{20}$. 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<{\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$.
Constraints:
 ${\mathbf{bl}}\left[\mathit{j}\right]\le {\mathbf{bu}}\left[\mathit{j}\right]$, for $\mathit{j}=0,1,\dots ,{\mathbf{n}}+{\mathbf{nclin}}1$;
 if ${\mathbf{bl}}\left[j\right]={\mathbf{bu}}\left[j\right]=\beta $, $\left\beta \right<{\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$.
 7:
cvec[n] – const doubleInput

On entry: the coefficients of the explicit linear term of the objective function when the problem is of type
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_LP}$,
$\mathrm{Nag\_QP2}$ or
$\mathrm{Nag\_QP4}$. The default problem type is
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_QP2}$ corresponding to QP2 described in
Section 3; other problem types can be specified using the optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}$.
If the problem is of type
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_FP}$,
$\mathrm{Nag\_QP1}$ or
$\mathrm{Nag\_QP3}$,
cvec is not referenced and therefore a
NULL pointer may be given.
 8:
h[${\mathbf{n}}\times {\mathbf{tdh}}$] – const doubleInput

On entry:
h may be used to store the quadratic term
$H$ of the QP objective function if desired. The elements of
h are accessed only by the function
qphess; thus
h is not accessed if the problem is of type
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_FP}$ or
$\mathrm{Nag\_LP}$. The number of rows of
$H$ is denoted by
$m$, its default value is equal to
$n$. (The optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ may be used to specify a value of
$m<n$.)
If the problem is of type
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_QP1}$ or
$\mathrm{Nag\_QP2}$, the first
$m$ rows and columns of
h must contain the leading
$m$ by
$m$ rows and columns of the symmetric Hessian matrix. Only the diagonal and upper triangular elements of the leading
$m$ rows and columns of
h are referenced. The remaining elements need not be assigned.
For problems
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_QP3}$ or
$\mathrm{Nag\_QP4}$, the first
$m$ rows of
h must contain an
$m$ by
$n$ upper trapezoidal factor of the Hessian matrix. The factor need not be of full rank, i.e., some of the diagonals may be zero. However, as a general rule, the larger the dimension of the leading nonsingular submatrix of
$H$, the fewer iterations will be required. Elements outside the upper trapezoidal part of the first
$m$ rows of
$H$ are assumed to be zero and need not be assigned.
In some cases, you need not use
h to store
$H$ explicitly (see the specification of function
qphess).
 9:
tdh – IntegerInput

On entry: the stride separating matrix column elements in the array
h.
Constraint:
${\mathbf{tdh}}\ge {\mathbf{n}}$ or at least the value of the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ if it is set.
 10:
qphess – function, supplied by the userExternal Function

In general, you need not provide a version of
qphess, because a ‘default’ function is included in the NAG C Library. If the default function is required then the NAG defined null void function pointer,
NULLFN, should be supplied in the call to nag_opt_qp (e04nfc). The algorithm of nag_opt_qp (e04nfc) requires only the product of
$H$ and a vector
$x$; and in some cases you may obtain increased efficiency by providing a version of
qphess that avoids the need to define the elements of the matrix
$H$ explicitly.
qphess is not referenced if the problem is of type
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_FP}$ or
$\mathrm{Nag\_LP}$, in which case
qphess should be replaced by
NULLFN.
The specification of
qphess is:
void 
qphess (Integer n,
Integer jthcol,
const double h[],
Integer tdh,
const double x[],
double hx[],
Nag_Comm *comm)


 1:
n – IntegerInput

On entry: $n$, the number of variables.
 2:
jthcol – IntegerInput

On entry:
jthcol specifies whether or not the vector
$x$ is a column of the identity matrix.
 ${\mathbf{jthcol}}=j>0$
 The vector $x$ is the $j$th column of the identity matrix, and hence $Hx$ is the $j$th column of $H$, which can sometimes be computed very efficiently and qphess may be coded to take advantage of this. However special code is not necessary because $x$ is always stored explicitly in the array x.
 ${\mathbf{jthcol}}=0$
 $x$ has no special form.
 3:
h[${\mathbf{n}}\times {\mathbf{tdh}}$] – const doubleInput

On entry: the matrix
$H$ of the QP objective function. The matrix element
${H}_{\mathit{i}\mathit{j}}$ is stored in
${\mathbf{h}}\left[\left(\mathit{i}1\right)\times {\mathbf{tdh}}+\mathit{j}1\right]$, for
$\mathit{i}=1,2,\dots ,n$ and
$\mathit{j}=1,2,\dots ,n$. In some situations, it may be desirable to compute
$Hx$ without accessing
h – for example, if
$H$ is sparse or has special structure. (This is illustrated in the function
qphess1 in
Section 9.) The arguments
h and
tdh may then refer to any convenient array.
 4:
tdh – IntegerInput

On entry: the stride separating matrix column elements in the array
h.
 5:
x[n] – const doubleInput

On entry: the vector $x$.
 6:
hx[n] – doubleOutput

On exit: the product $Hx$.
 7:
comm – Nag_Comm *

Pointer to structure of type Nag_Comm; the following members are relevant to
qphess.
 flag – IntegerInput/Output

On entry: $\mathbf{comm}\mathbf{\to}\mathbf{flag}$ contains a nonnegative number.
On exit: if
qphess resets
$\mathbf{comm}\mathbf{\to}\mathbf{flag}$ to some negative number nag_opt_qp (e04nfc) will terminate immediately with the error indicator
NE_USER_STOP. If
fail is supplied to nag_opt_qp (e04nfc),
${\mathbf{fail}}\mathbf{.}\mathbf{errnum}$ will be set to your setting of
$\mathbf{comm}\mathbf{\to}\mathbf{flag}$.
 first – Nag_BooleanInput

On entry: will be set to Nag_TRUE on the first call to
qphess and Nag_FALSE for all subsequent calls.
 nf – IntegerInput

On entry: the number of calls made to
qphess including the current one.
 user – double *
 iuser – Integer *
 p – Pointer

The type Pointer will be
void * with a C compiler that defines
void * and
char * otherwise. Before calling nag_opt_qp (e04nfc) you may allocate memory to these pointers and they may be initialized with various quantities for use by
qphess when called from nag_opt_qp (e04nfc).
Note: qphess should be tested separately before being used in conjunction with nag_opt_qp (e04nfc). The input arrays
h and
x must
not be changed within
qphess.
 11:
x[n] – doubleInput/Output

On entry: an initial estimate of the solution.
On exit: the point at which nag_opt_qp (e04nfc) terminated. If
${\mathbf{fail}}\mathbf{.}\mathbf{code}=\mathrm{NE\_NOERROR}$,
NW_DEAD_POINT,
NW_SOLN_NOT_UNIQUE or
NW_NOT_FEASIBLE,
x contains an estimate of the solution.
 12:
objf – double *Output

On exit: the value of the objective function at
$x$ if
$x$ is feasible, or the sum of infeasibilities at
$x$ otherwise. If the problem is of type
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_FP}$ and
$x$ is feasible,
objf is set to zero.
 13:
options – Nag_E04_Opt *Input/Output

On entry/exit: a pointer to a structure of type Nag_E04_Opt whose members are optional arguments for nag_opt_qp (e04nfc). These structure members offer the means of adjusting some of the argument values of the algorithm and on output will supply further details of the results. A description of the members of
options is given in
Section 11. Some of the results returned in
options can be used by nag_opt_qp (e04nfc) to perform a ‘warm start’ if it is reentered (see the optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}$).
If any of these optional arguments are required then the structure
options should be declared and initialized by a call to
nag_opt_init (e04xxc) and supplied as an argument to nag_opt_qp (e04nfc). However, if the optional arguments are not required the NAG defined null pointer,
E04_DEFAULT, can be used in the function call.
 14:
comm – Nag_Comm *Input/Output

Note: comm is a NAG defined type (see
Section 3.2.1.1 in the Essential Introduction).
On entry/exit: structure containing pointers for user communication with usersupplied functions; see the description of
qphess for details. If you do not need to make use of this communication feature the null pointer
NAGCOMM_NULL may be used in the call to nag_opt_qp (e04nfc);
comm will then be declared internally for use in calls to usersupplied functions.
 15:
fail – NagError *Input/Output

The NAG error argument (see
Section 3.6 in the Essential Introduction).
5.1 Description of Printed Output
Intermediate and final results are printed out by default. You can control the level of printed output with the structure member ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}$. The default, ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Soln\_Iter}$ provides a single line of output at each iteration and the final result. This section describes the default printout produced by nag_opt_qp (e04nfc).
The convention for numbering the constraints in the iteration results is that indices 1 to $n$ refer to the bounds on the variables, and indices $n+1$ to $n+{m}_{\mathrm{lin}}$ refer to the general constraints. When the status of a constraint changes, the index of the constraint is printed, along with the designation L (lower bound), U (upper bound), E (equality), F (temporarily fixed variable) or A (artificial constraint).
The single line of intermediate results output on completion of each iteration gives:
Itn 
is the iteration count. 
Jdel 
is the index of the constraint deleted from the working set. If Jdel is zero, no constraint was deleted. 
Jadd 
is the index of the constraint added to the working set. If Jadd is zero, no constraint was added. 
Step 
is the step taken along the computed search direction. If a constraint is added during the current iteration (i.e., Jadd is positive), Step will be the step to the nearest constraint. During the optimality phase, the step can be greater than $1.0$ only if the reduced Hessian is not positive definite. 
Ninf 
is the number of violated constraints (infeasibilities). This will be zero during the optimality phase. 
Sinf/Obj 
is the value of the current objective function. If $x$ is not feasible, Sinf gives a weighted sum of the magnitudes of constraint violations. If $x$ is feasible, Obj 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. Once optimal multipliers are obtained, the number of infeasibilities can increase, but the sum of infeasibilities will either remain constant or be reduced until the minimum sum of infeasibilities is found. 
Bnd 
the number of simple bound constraints in the current working set. 
Lin 
the number of general linear constraints in the current working set. 
Nart 
the number of artificial constraints in the working set. At the start of the optimality phase, Nart provides an estimate of the number of nonpositive eigenvalues in the reduced Hessian. 
Nrz 
the dimension of the subspace in which the objective function is currently being minimized. The value of Nrz is the number of variables minus the number of constraints in the working set; i.e., $\mathtt{Nrz}=n\left(\mathtt{Bnd}+\mathtt{Lin}+\mathtt{Nart}\right)$. 
Norm Gz 
the Euclidean norm of the reduced gradient. During the optimality phase, this norm will be approximately zero after a unit step. 
The printout of the final result consists of:
Varbl 
the name (V) and index $\mathit{j}$, for $\mathit{j}=1,2,\dots ,n$ of the variable. 
State 
the state of the variable (FR if neither bound is in the working set, EQ if a fixed variable, LL if on its lower bound, UL if on its upper bound, TF if temporarily fixed at its current value). If Value lies outside the upper or lower bounds by more than the feasibility tolerance, State will be ++ or  respectively. 
Value 
the value of the variable at the final iteration. 
Lower bound 
the lower bound specified for the variable. (None indicates that ${\mathbf{bl}}\left[j1\right]\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$.) 
Upper bound 
the upper bound specified for the variable. (None indicates that ${\mathbf{bu}}\left[j1\right]\ge {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$.) 
Lagr mult 
the value of the Lagrange multiplier for the associated bound constraint. This will be zero if State is FR. If $x$ is optimal, the multiplier should be nonnegative if State is LL, and nonpositive if State is UL. 
Residual 
the difference between the variable Value and the nearer of its bounds ${\mathbf{bl}}\left[j1\right]$ and ${\mathbf{bu}}\left[j1\right]$. 
The meaning of the printout for general constraints is the same as that given above for variables, with ‘variable’ replaced by ‘constraint’, and with the following change in the heading:
LCon 
the name (L) and index $\mathit{j}$, for $\mathit{j}=1,2,\dots ,{m}_{\mathrm{lin}}$ of the constraint. 
6 Error Indicators and Warnings
 If one of NE_USER_STOP, NE_2_INT_ARG_LT, NE_OPT_NOT_INIT, NE_BAD_PARAM, NE_INVALID_INT_RANGE_1, NE_INVALID_INT_RANGE_2, NE_INVALID_REAL_RANGE_FF, NE_INVALID_REAL_RANGE_F, NE_CVEC_NULL, NE_H_NULL, NE_WARM_START, NE_BOUND, NE_BOUND_LCON, NE_STATE_VAL and NE_ALLOC_FAIL occurs, no values will have been assigned to objf, or to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ax}}$ and ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{lambda}}$. x and ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ will be unchanged.
 NE_2_INT_ARG_LT
On entry, ${\mathbf{tda}}=\u2329\mathit{\text{value}}\u232a$ while ${\mathbf{n}}=\u2329\mathit{\text{value}}\u232a$. These arguments must satisfy ${\mathbf{tda}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{tdh}}=\u2329\mathit{\text{value}}\u232a$ while ${\mathbf{n}}=\u2329\mathit{\text{value}}\u232a$. These arguments must satisfy ${\mathbf{tdh}}\ge {\mathbf{n}}$.
On entry, ${\mathbf{tdh}}=\u2329\mathit{\text{value}}\u232a$ while ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}=\u2329\mathit{\text{value}}\u232a$. These arguments must satisfy ${\mathbf{tdh}}\ge {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$.
 NE_ALLOC_FAIL
Dynamic memory allocation failed.
 NE_BAD_PARAM
On entry, argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}$ had an illegal value.
On entry, argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}$ had an illegal value.
On entry, argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}$ had an illegal value.
 NE_BOUND
The lower bound for variable $\u2329\mathit{\text{value}}\u232a$ (array element ${\mathbf{bl}}\left[\u2329\mathit{\text{value}}\u232a\right]$) is greater than the upper bound.
 NE_BOUND_LCON
The lower bound for linear constraint $\u2329\mathit{\text{value}}\u232a$ (array element ${\mathbf{bl}}\left[\u2329\mathit{\text{value}}\u232a\right]$) is greater than the upper bound.
 NE_CVEC_NULL
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\u2329\mathit{\text{value}}\u232a$ but argument ${\mathbf{cvec}}=\text{}$ NULL.
 NE_H_NULL
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\u2329\mathit{\text{value}}\u232a$,
qphess is
NULL but argument
h is also
NULL. If the default function for
qphess is to be used for this problem then an array must be supplied in argument
h.
 NE_HESS_TOO_BIG
Reduced Hessian exceeds assigned dimension. ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}=\u2329\mathit{\text{value}}\u232a$.
The algorithm needed to expand the reduced Hessian when it was already at its maximum dimension, as specified by the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}$.
The value of the argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}$ is too small. Rerun nag_opt_qp (e04nfc) with a larger value (possibly using the ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Warm}$ facility to specify the initial working set).
 NE_INT_ARG_LT
On entry, ${\mathbf{n}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{n}}\ge 1$.
On entry, ${\mathbf{nclin}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{nclin}}\ge 0$.
 NE_INVALID_INT_RANGE_1
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fcheck}}$ not valid. Correct range is ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fcheck}}\ge 1$.
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fmax\_iter}}$ not valid. Correct range is ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fmax\_iter}}\ge 0$.
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ not valid. Correct range is ${\mathbf{n}}\ge {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}\ge 0$.
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}$ not valid. Correct range is ${\mathbf{n}}\ge {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}\ge 1$.
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_iter}}$ not valid. Correct range is ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_iter}}\ge 0$.
 NE_INVALID_INT_RANGE_2
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$ not valid. Correct range is $0<{\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}<10000000$.
 NE_INVALID_REAL_RANGE_F
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ not valid. Correct range is ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}>0.0$.
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$ not valid. Correct range is ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}>0.0$.
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_step}}$ not valid. Correct range is ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_step}}>0.0$.
 NE_INVALID_REAL_RANGE_FF
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{crash\_tol}}$ not valid. Correct range is $0.0\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{crash\_tol}}\le 1.0$.
Value $\u2329\mathit{\text{value}}\u232a$ given to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{rank\_tol}}$ not valid. Correct range is $0.0\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{rank\_tol}}<1.0$.
 NE_NOT_APPEND_FILE
Cannot open file $\u2329\mathit{string}\u232a$ for appending.
 NE_NOT_CLOSE_FILE
Cannot close file $\u2329\mathit{string}\u232a$.
 NE_OPT_NOT_INIT
Options structure not initialized.
 NE_STATE_VAL
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[\u2329\mathit{\text{value}}\u232a\right]$ is out of range. ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[\u2329\mathit{\text{value}}\u232a\right]=\u2329\mathit{\text{value}}\u232a$.
 NE_UNBOUNDED
Solution appears to be unbounded.
This value of
fail implies that a step as large as
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_step}}$ would have to be taken in order to continue the algorithm. This situation can occur only when
$H$ is not positive definite and at least one variable has no upper or lower bound.
 NE_USER_STOP
User requested termination, user flag value
$\text{}=\u2329\mathit{\text{value}}\u232a$.
This exit occurs if you set
$\mathbf{comm}\mathbf{\to}\mathbf{flag}$ to a negative value in
qphess. If
fail is supplied the value of
${\mathbf{fail}}\mathbf{.}\mathbf{errnum}$ will be the same as your setting of
$\mathbf{comm}\mathbf{\to}\mathbf{flag}$.
 NE_WARM_START
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Warm}$ but pointer ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}=\text{}$ NULL.
 NE_WRITE_ERROR
Error occurred when writing to file $\u2329\mathit{string}\u232a$.
 NW_DEAD_POINT
Iterations terminated at a dead point (check the optimality conditions).
The necessary conditions for optimality have been satisfied but the sufficient conditions are not. (The reduced gradient is negligible, the Lagrange multipliers are optimal, but ${H}_{r}$ is singular or there are some very small multipliers.) If $H$ is not positive definite, $x$ is not necessarily a local solution of the problem and verification of optimality requires further information.
 NW_NOT_FEASIBLE
No feasible point was found for the linear constraints.
It was not possible to satisfy all the constraints to within the feasibility tolerance. In this case, the constraint violations at the final $x$ will reveal a value of the tolerance for which a feasible point will exist – for example, if the feasibility tolerance for each violated constraint exceeds its Residual at the final point. You should check that there are no constraint redundancies. If the data for the constraints are accurate only to the absolute precision $\sigma $, you should ensure that the value of the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ is greater than $\sigma $. For example, if all elements of $A$ are of order unity and are accurate only to three decimal places, the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ should be at least ${10}^{3}$.
 NW_OVERFLOW_WARN
Serious ill conditioning in the working set after adding constraint $\u2329\mathit{\text{value}}\u232a$. Overflow may occur in subsequent iterations.
If overflow occurs preceded by this warning then serious ill conditioning has probably occurred in the working set when adding a constraint. It may be possible to avoid the difficulty by increasing the magnitude of the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ and rerunning the program. If the message recurs even after this change, the offending linearly dependent constraint $j$ must be removed from the problem.
 NW_SOLN_NOT_UNIQUE
Optimal solution is not unique.
The necessary conditions for optimality have been satisfied but the sufficient conditions are not. (The reduced gradient is negligible, the Lagrange multipliers are optimal, but ${H}_{r}$ is singular or there are some very small multipliers.) If $H$ is positive semidefinite, $x$ gives the global minimum value of the objective function, but the final $x$ is not unique.
 NW_TOO_MANY_ITER
The maximum number of iterations, $\u2329\mathit{\text{value}}\u232a$, have been performed.
The value of the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_iter}}$ may be too small. If the method appears to be making progress (e.g., the objective function is being satisfactorily reduced), increase the value of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_iter}}$ and rerun nag_opt_qp (e04nfc) (possibly using the ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Warm}$ facility to specify the initial working set).
7 Accuracy
nag_opt_qp (e04nfc) implements a numerically stable active set strategy and returns solutions that are as accurate as the condition of the problem warrants on the machine.
Sensible scaling of the problem is likely to reduce the number of iterations required and make the problem less sensitive to perturbations in the data, thus improving the condition of the problem. In the absence of better information it is usually sensible to make the Euclidean lengths of each constraint of comparable magnitude. See the
e04 Chapter Introduction and
Gill et al. (1986) for further information and advice.
9 Example
To minimize the quadratic function
$f\left(x\right)={c}^{\mathrm{T}}x+\frac{1}{2}{x}^{\mathrm{T}}Hx$, where
subject to the bounds
and the general constraints
The initial point, which is infeasible, is
The computed solution (to five figures) is
One bound constraint and four general constraints are active at the solution.
This example shows the use of certain optional arguments. Option values are assigned directly within the program text and by reading values from a data file. The
options structure is declared and initialized by
nag_opt_init (e04xxc). Values are then assigned directly to
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{outfile}}$ and
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$ and two further options are read from the data file by use of
nag_opt_read (e04xyc). nag_opt_qp (e04nfc) is then called to solve the problem using the function
qphess1, with the Hessian implicit, for argument
qphess. On successful return two further options are set, selecting a warm start and a reduced level of printout, and the problem is solved again using the function
qphess2. In this case the Hessian is defined explicitly. Finally the memory freeing function
nag_opt_free (e04xzc) is used to free the memory assigned to the pointers in the options structure. You must
not use the standard C function
free() for this purpose.
9.1 Program Text
Program Text (e04nfce.c)
9.2 Program Data
Program Data (e04nfce.d)
Program Options (e04nfce.opt)
9.3 Program Results
Program Results (e04nfce.r)
10 Further Description
This section gives a detailed description of the algorithm used in nag_opt_qp (e04nfc). This, and possibly the next section,
Section 11, may be omitted if the more sophisticated features of the algorithm and software are not currently of interest.
10.1 Overview
nag_opt_qp (e04nfc) is based on an inertiacontrolling method that maintains a Cholesky factorization of the reduced Hessian (see below). The method is based on that of
Gill and Murray (1978) and is described in detail by
Gill et al. (1991). Here we briefly summarize the main features of the method. Where possible, explicit reference is made to the names of variables that are arguments of nag_opt_qp (e04nfc) or appear in the printed output. nag_opt_qp (e04nfc) has two 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 functions. The twophase nature of the algorithm is reflected by changing the function being minimized from the sum of infeasibilities to the quadratic objective function. The feasibility phase does
not perform the standard simplex method (i.e., it does not necessarily find a vertex), except in the LP case when
${m}_{\mathrm{lin}}\le n$. Once any iterate is feasible, all subsequent iterates remain feasible.
nag_opt_qp (e04nfc) has been designed to be efficient when used to solve a sequence of related problems – for example, within a sequential quadratic programming method for nonlinearly constrained optimization. In particular, you may specify an initial working set (the indices of the constraints believed to be satisfied exactly at the solution); see the discussion of the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}$.
In general, an iterative process is required to solve a quadratic program. (For simplicity, we shall always consider a typical iteration and avoid reference to the index of the iteration.) Each new iterate
$\stackrel{}{x}$ is defined by
where the
steplength $\alpha $ is a nonnegative scalar, and
$p$ is called the
search direction.
At each point $x$, a working set of constraints is defined to be a linearly independent subset of the constraints that are satisfied ‘exactly’ (to within the tolerance defined by the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$). The working set is the current prediction of the constraints that hold with equality at a solution of a linearly constrained QP problem. The search direction is constructed so that the constraints in the working set remain unaltered for any value of the step length. For a bound constraint in the working set, this property is achieved by setting the corresponding component of the search direction to zero. Thus, the associated variable is fixed, and specification of the working set induces a partition of $x$ into fixed and free variables. During a given iteration, the fixed variables are effectively removed from the problem; since the relevant components of the search direction are zero, the columns of $A$ corresponding to fixed variables may be ignored.
Let ${m}_{w}$ denote the number of general constraints in the working set and let ${n}_{fx}$ denote the number of variables fixed at one of their bounds (${m}_{w}$ and ${n}_{fx}$ are the quantities Lin and Bnd in the printed output from nag_opt_qp (e04nfc)). Similarly, let ${n}_{fr}$ (${n}_{fr}=n{n}_{fx}$) denote the number of free variables. At every iteration, the variables are reordered so that the last ${n}_{fx}$ variables are fixed, with all other relevant vectors and matrices ordered accordingly.
10.2 Definition of the Search Direction
Let
${A}_{fr}$ denote the
${m}_{w}$ by
${n}_{fr}$ submatrix of general constraints in the working set corresponding to the free variables, and let
${p}_{fr}$ denote the search direction with respect to the free variables only. The general constraints in the working set will be unaltered by any move along
$p$ if
In order to compute
${p}_{fr}$, the
$TQ$ factorization of
${A}_{fr}$ is used:
where
$T$ is a nonsingular
${m}_{w}$ by
${m}_{w}$ upper triangular matrix (i.e.,
${t}_{ij}=0$ if
$i>j$), and the nonsingular
${n}_{fr}$ by
${n}_{fr}$ matrix
${Q}_{fr}$ is the product of orthogonal transformations (see
Gill et al. (1984)). If the columns of
${Q}_{fr}$ are partitioned so that
where
$Y$ is
${n}_{fr}\times {m}_{w}$, then the
${n}_{z}$ (
${n}_{z}={n}_{fr}{m}_{w}$) columns of
$Z$ form a basis for the null space of
${A}_{fr}$. Let
${n}_{r}$ be an integer such that
$0\le {n}_{r}\le {n}_{z}$, and let
${Z}_{r}$ denote a matrix whose
${n}_{r}$ columns are a subset of the columns of
$Z$. (The integer
${n}_{r}$ is the quantity
Nrz in the printed output from nag_opt_qp (e04nfc). In many cases,
${Z}_{r}$ will include
all the columns of
$Z$.) The direction
${p}_{fr}$ will satisfy
(2) if
where
${p}_{r}$ is any
${n}_{r}$vector.
Let
$Q$ denote the
$n$ by
$n$ matrix
where
${I}_{fx}$ is the identity matrix of order
${n}_{fx}$. Let
${H}_{q}$ and
${g}_{q}$ denote the
$n$ by
$n$ transformed Hessian and the
transformed gradient
and let the matrix of first
${n}_{r}$ rows and columns of
${H}_{q}$ be denoted by
${H}_{r}$ and the vector of the first
${n}_{r}$ elements of
${g}_{q}$ be denoted by
${g}_{r}$. The quantities
${H}_{r}$ and
${g}_{r}$ are known as the
reduced Hessian and
reduced gradient of
$f\left(x\right)$, respectively. Roughly speaking,
${g}_{r}$ and
${H}_{r}$ describe the first and second derivatives of an
unconstrained problem for the calculation of
${p}_{r}$.
At each iteration, a triangular factorization of ${H}_{r}$ is available. If ${H}_{r}$ is positive definite, ${H}_{r}={R}^{\mathrm{T}}R$, where $R$ is the upper triangular Cholesky factor of ${H}_{r}$. If ${H}_{r}$ is not positive definite, ${H}_{r}={R}^{\mathrm{T}}DR$, where $D=\mathrm{diag}\left(1,1,\dots ,1,\mu \right)$, with $\mu \le 0$.
The computation is arranged so that the reduced gradient vector is a multiple of
${e}_{r}$, a vector of all zeros except in the last (i.e.,
${n}_{r}$th) position. This allows the vector
${p}_{r}$ in
(4) to be computed from a single backsubstitution
where
$\gamma $ is a scalar that depends on whether or not the reduced Hessian is positive definite at
$x$. In the positive definite case,
$x+p$ is the minimizer of the objective function subject to the constraints (bounds and general) in the working set treated as equalities. If
${H}_{r}$ is not positive definite,
${p}_{r}$ satisfies the conditions
which allow the objective function to be reduced by any positive step of the form
$x+\alpha p$.
10.3 The Main Iteration
If the reduced gradient is zero,
$x$ is a constrained stationary point in the subspace defined by
$Z$. During the feasibility phase, the reduced gradient will usually be zero only at a vertex (although it may be zero at nonvertices in the presence of constraint dependencies). During the optimality phase, a zero reduced gradient implies that
$x$ minimizes the quadratic objective when the constraints in the working set are treated as equalities. At a constrained stationary point, Lagrange multipliers
${\lambda}_{c}$ and
${\lambda}_{b}$ for the general and bound constraints are defined from the equations
Given a positive constant
$\delta $ of the order of the
machine precision, a Lagrange multiplier
${\lambda}_{j}$ corresponding to an inequality constraint in the working set is said to be
optimal if
${\lambda}_{j}\le \delta $ when the associated constraint is at its
upper bound, or if
${\lambda}_{j}\ge \delta $ when the associated constraint is at its
lower bound. If a multiplier is nonoptimal, the objective function (either the true objective or the sum of infeasibilities) can be reduced by deleting the corresponding constraint (with index
Jdel; see
Section 11.3) from the working set.
If optimal multipliers occur during the feasibility phase and the sum of infeasibilities is nonzero, there is no feasible point, and you can force nag_opt_qp (e04nfc) to continue until the minimum value of the sum of infeasibilities has been found (see the discussion of the optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{min\_infeas}}$ in
Section 11.2). At this point, the Lagrange multiplier
${\lambda}_{j}$ corresponding to an inequality constraint in the working set will be such that
$\left(1+\delta \right)\le {\lambda}_{j}\le \delta $ when the associated constraint is at its
upper bound, and
$\delta \le {\lambda}_{j}\le 1+\delta $ when the associated constraint is at its
lower bound. Lagrange multipliers for equality constraints will satisfy
$\Vert {\lambda}_{j}\Vert \le 1+\delta $.
If the reduced gradient is not zero, Lagrange multipliers need not be computed and the nonzero elements of the search direction
$p$ are given by
${Z}_{r}{p}_{r}$ (see
(5)). The choice of step length is influenced by the need to maintain feasibility with respect to the satisfied constraints. If
${H}_{r}$ is positive definite and
$x+p$ is feasible,
$\alpha $ will be taken as unity. In this case, the reduced gradient at
$\stackrel{}{x}$ will be zero, and Lagrange multipliers are computed. Otherwise,
$\alpha $ is set to
${\alpha}_{m}$, the step to the ‘nearest’ constraint (with index
Jadd; see
Section 11.3), which is added to the working set at the next iteration.
Each change in the working set leads to a simple change to ${A}_{fr}$: if the status of a general constraint changes, a row of ${A}_{fr}$ is altered; if a bound constraint enters or leaves the working set, a column of ${A}_{fr}$ changes. Explicit representations are recurred of the matrices $T$, ${Q}_{fr}$ and $R$; and of vectors ${Q}^{\mathrm{T}}g$, and ${Q}^{\mathrm{T}}c$. The triangular factor $R$ associated with the reduced Hessian is only updated during the optimality phase.
One of the most important features of nag_opt_qp (e04nfc) is its control of the conditioning of the working set, whose nearness to linear dependence is estimated by the ratio of the largest to smallest diagonal elements of the
$TQ$ factor
$T$ (the printed value
Cond T; see
Section 11.3). In constructing the initial working set, constraints are excluded that would result in a large value of
Cond T.
nag_opt_qp (e04nfc) includes a rigorous procedure that prevents the possibility of cycling at a point where the active constraints are nearly linearly dependent (see
Gill et al. (1989)). The main feature of the anticycling procedure is that the feasibility tolerance is increased slightly at the start of every iteration. This not only allows a positive step to be taken at every iteration, but also provides, whenever possible, a
choice of constraints to be added to the working set. Let
${\alpha}_{m}$ denote the maximum step at which
$x+{\alpha}_{m}p$ does not violate any constraint by more than its feasibility tolerance. All constraints at a distance
$\alpha $ (
$\alpha \le {\alpha}_{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.
10.4 Choosing the Initial Working Set
At the start of the optimality phase, a positive definite ${H}_{r}$ can be defined if enough constraints are included in the initial working set. (The matrix with no rows and columns is positive definite by definition, corresponding to the case when ${A}_{fr}$ contains ${n}_{fr}$ constraints.) The idea is to include as many general constraints as necessary to ensure that the reduced Hessian is positive definite.
Let
${H}_{z}$ denote the matrix of the first
${n}_{z}$ rows and columns of the matrix
${H}_{q}={Q}^{\mathrm{T}}HQ$ at the beginning of the optimality phase. A partial Cholesky factorization is used to find an upper triangular matrix
$R$ that is the factor of the largest positive definite leading submatrix of
${H}_{z}$. The use of interchanges during the factorization of
${H}_{z}$ tends to maximize the dimension of
$R$. (The condition of
$R$ may be controlled using the optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{rank\_tol}}$.) Let
${Z}_{r}$ denote the columns of
$Z$ corresponding to
$R$, and let
$Z$ be partitioned as
$Z=\left({Z}_{r}{Z}_{a}\right)$. A working set, for which
${Z}_{r}$ defines the null space, can be obtained by including
the rows of
${Z}_{a}^{\mathrm{T}}$ as ‘artificial constraints’. Minimization of the objective function then proceeds within the subspace defined by
${Z}_{r}$, as described in
Section 10.2.
The artificially augmented working set is given by
so that
${p}_{fr}$ will satisfy
${A}_{fr}{p}_{fr}=0$ and ${Z}_{a}^{\mathrm{T}}{p}_{fr}=0$. By definition of the
$TQ$ factorization,
${\stackrel{}{A}}_{fr}$ automatically satisfies the following:
where
and hence the
$TQ$ factorization of
(7) is available trivially from
$T$ and
${Q}_{fr}$ without additional expense.
The matrix
${Z}_{a}$ is not kept fixed, since its role is purely to define an appropriate null space; the
$TQ$ factorization can therefore be updated in the normal fashion as the iterations proceed. No work is required to ‘delete’ the artificial constraints associated with
${Z}_{a}$ when
${Z}_{r}^{\mathrm{T}}{g}_{fr}=0$, since this simply involves repartitioning
${Q}_{fr}$. The ‘artificial’ multiplier vector associated with the rows of
${Z}_{a}^{\mathrm{T}}$ is equal to
${Z}_{a}^{\mathrm{T}}{g}_{fr}$, and the multipliers corresponding to the rows of the ‘true’ working set are the multipliers that would be obtained if the artificial constraints were not present. If an artificial constraint is ‘deleted’ from the working set, an
A appears alongside the entry in the
Jdel column of the printed output (see
Section 11.3).
The number of columns in
${Z}_{a}$ and
${Z}_{r}$, the Euclidean norm of
${Z}_{r}^{\mathrm{T}}{g}_{fr}$, and the condition estimator of
$R$ appear in the printed output as
Nart,
Nrz,
Norm Gz and
Cond Rz (see
Section 11.3).
Under some circumstances, a different type of artificial constraint is used when solving a linear program. Although the algorithm of nag_opt_qp (e04nfc) does not usually perform simplex steps (in the traditional sense), there is one exception: a linear program with fewer general constraints than variables (i.e.,
${m}_{\mathrm{lin}}\le n$). (Use of the simplex method in this situation leads to savings in storage.) At the starting point, the ‘natural’ working set (the set of constraints exactly or nearly satisfied at the starting point) is augmented with a suitable number of ‘temporary’ bounds, each of which has the effect of temporarily fixing a variable at its current value. In subsequent iterations, a temporary bound is treated as a standard constraint until it is deleted from the working set, in which case it is never added again. If a temporary bound is ‘deleted’ from the working set, an
F (for ‘Fixed’) appears alongside the entry in the
Jdel column of the printed output (see
Section 11.3).
11 Optional Arguments
A number of optional input and output arguments to nag_opt_qp (e04nfc) are available through the structure argument
options, type Nag_E04_Opt. An argument may be selected by assigning an appropriate value to the relevant structure member; those arguments not selected will be assigned default values. If no use is to be made of any of the optional arguments you should use the NAG defined null pointer,
E04_DEFAULT, in place of
options when calling nag_opt_qp (e04nfc); the default settings will then be used for all arguments.
Before assigning values to
options directly the structure
must be initialized by a call to the function
nag_opt_init (e04xxc). Values may then be assigned to the structure members in the normal C manner.
Option settings may also be read from a text file using the function
nag_opt_read (e04xyc) in which case initialization of the
options structure will be performed automatically if not already done. Any subsequent direct assignment to the
options structure must
not be preceded by initialization.
If assignment of functions and memory to pointers in the
options structure is required, this must be done directly in the calling program; they cannot be assigned using
nag_opt_read (e04xyc).
11.1 Optional Argument Checklist and Default Values
For easy reference, the following list shows the members of
options which are valid for nag_opt_qp (e04nfc) together with their default values where relevant. The number
$\epsilon $ is a generic notation for
machine precision (see
nag_machine_precision (X02AJC)).
Nag_ProblemType prob

Nag_QP2

Nag_Start start

Nag_Cold

Boolean list

Nag_TRUE

Nag_PrintType print_level

Nag_Soln_Iter

char outfile[80]

stdout

void (*print_fun)()

NULL 
Integer fmax_iter

$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(50,5\left({\mathbf{n}}+{\mathbf{nclin}}\right)\right)$ 
Integer max_iter

$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(50,5\left({\mathbf{n}}+{\mathbf{nclin}}\right)\right)$ 
Boolean min_infeas

Nag_FALSE

double crash_tol

0.01 
double ftol

$\sqrt{\epsilon}$ 
double optim_tol

${\epsilon}^{0.8}$ 
Integer reset_ftol

10000 
Integer fcheck

50 
double inf_bound

${10}^{20}$ 
double inf_step

$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}},{10}^{20}\right)$ 
Integer hrows

n

Integer max_df

n

double rank_tol

$100\epsilon $ 
Integer *state

size ${\mathbf{n}}+{\mathbf{nclin}}$ 
double *ax

size nclin

double *lambda

size ${\mathbf{n}}+{\mathbf{nclin}}$ 
Integer iter


Integer nf


11.2 Description of the Optional Arguments
prob – Nag_ProblemType   Default $\text{}=\mathrm{Nag\_QP2}$ 
On entry: specifies the type of objective function to be minimized during the optimality phase. The following are the six possible values of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}$ and the size of the arrays
h and
cvec that are required to define the objective function:
Nag_FP

h and cvec not accessed; 
Nag_LP

h not accessed, ${\mathbf{cvec}}\left[{\mathbf{n}}\right]$ required; 
Nag_QP1

${\mathbf{h}}\left[{\mathbf{n}}\times {\mathbf{tdh}}\right]$ symmetric, cvec not referenced; 
Nag_QP2

${\mathbf{h}}\left[{\mathbf{n}}\times {\mathbf{tdh}}\right]$ symmetric, ${\mathbf{cvec}}\left[{\mathbf{n}}\right]$ required; 
Nag_QP3

${\mathbf{h}}\left[{\mathbf{n}}\times {\mathbf{tdh}}\right]$ upper trapezoidal, cvec not referenced; 
Nag_QP4

${\mathbf{h}}\left[{\mathbf{n}}\times {\mathbf{tdh}}\right]$ upper trapezoidal, ${\mathbf{cvec}}\left[{\mathbf{n}}\right]$ required. 
If $H=0$, i.e., the objective function is purely linear, the efficiency of nag_opt_qp (e04nfc) may be increased by specifying ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}$ as Nag_LP.
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_FP}$, $\mathrm{Nag\_LP}$, $\mathrm{Nag\_QP1}$, $\mathrm{Nag\_QP2}$, $\mathrm{Nag\_QP3}$ or $\mathrm{Nag\_QP4}$.
start – Nag_Start   Default $\text{}=\mathrm{Nag\_Cold}$ 
On entry: specifies how the initial working set is chosen. With
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Cold}$, nag_opt_qp (e04nfc) chooses the initial working set based on the values of the variables and constraints at the initial point. Broadly speaking, the initial working set will include equality constraints and bounds or inequality constraints that violate or ‘nearly’ satisfy their bounds (to within
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{crash\_tol}}$).
With
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Warm}$, you must provide a valid definition of every element of the array pointer
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ (see below for the definition of this member of
options). nag_opt_qp (e04nfc) will override your specification of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ if necessary, so that a poor choice of the working set will not cause a fatal error. Nag_Warm will be advantageous if a good estimate of the initial working set is available – for example, when nag_opt_qp (e04nfc) is called repeatedly to solve related problems.
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Cold}$ or $\mathrm{Nag\_Warm}$.
list – Nag_Boolean   Default $\text{}=\mathrm{Nag\_TRUE}$ 
On entry: if ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{list}}=\mathrm{Nag\_TRUE}$ the argument settings in the call to nag_opt_qp (e04nfc) will be printed.
print_level – Nag_PrintType   Default $\text{}=\mathrm{Nag\_Soln\_Iter}$ 
On entry: the level of results printout produced by nag_opt_qp (e04nfc). The following values are available:
Nag_NoPrint

No output. 
Nag_Soln

The final solution. 
Nag_Iter

One line of output for each iteration. 
Nag_Iter_Long

A longer line of output for each iteration with more information (line exceeds 80 characters). 
Nag_Soln_Iter

The final solution and one line of output for each iteration. 
Nag_Soln_Iter_Long

The final solution and one long line of output for each iteration (line exceeds 80 characters). 
Nag_Soln_Iter_Const

As Nag_Soln_Iter_Long with the Lagrange multipliers, the variables $x$, the constraint values $Ax$ and the constraint status also printed at each iteration. 
Nag_Soln_Iter_Full

As Nag_Soln_Iter_Const with the diagonal elements of the upper triangular matrix $T$ associated with the $TQ$ factorization (3) of the working set, and the diagonal elements of the upper triangular matrix $R$ printed at each iteration. 
Details of each level of results printout are described in
Section 11.3.
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_NoPrint}$, $\mathrm{Nag\_Soln}$, $\mathrm{Nag\_Iter}$, $\mathrm{Nag\_Soln\_Iter}$, $\mathrm{Nag\_Iter\_Long}$, $\mathrm{Nag\_Soln\_Iter\_Long}$, $\mathrm{Nag\_Soln\_Iter\_Const}$ or $\mathrm{Nag\_Soln\_Iter\_Full}$.
outfile – const char[80]   Default $\text{}=\mathtt{stdout}$ 
On entry: the name of the file to which results should be printed. If ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{outfile}}\left[0\right]=\text{' 0 '}$ then the stdout stream is used.
print_fun – pointer to function   Default $\text{}=\text{}$ NULL 
On entry: printing function defined by you; the prototype of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_fun}}$ is
void (*print_fun)(const Nag_Search_State *st, Nag_Comm *comm);
See
Section 11.3.1 below for further details.
fmax_iter – Integer   Default $\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(50,5\left({\mathbf{n}}+{\mathbf{nclin}}\right)\right)$ 
max_iter – Integer   Default $\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(50,5\left({\mathbf{n}}+{\mathbf{nclin}}\right)\right)$ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fmax\_iter}}$ specifies the maximum number of iterations allowed in the feasibility phase.
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_iter}}$ specifies the maximum number of iterations permitted in the optimality phase.
If you wish to check that a call to nag_opt_qp (e04nfc) is correct before attempting to solve the problem in full then ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fmax\_iter}}$ may be set to 0. No iterations will then be performed but the initialization stages prior to the first iteration will be processed and a listing of argument settings output, if ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{list}}=\mathrm{Nag\_TRUE}$ (the default setting).
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fmax\_iter}}\ge 0$ and ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_iter}}\ge 0$.
min_infeas – Nag_Boolean   Default $\text{}=\mathrm{Nag\_FALSE}$ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{min\_infeas}}$ specifies whether nag_opt_qp (e04nfc) should minimize the sum of infeasibilities if no feasible point exists for the constraints.
 ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{min\_infeas}}=\mathrm{Nag\_FALSE}$
 nag_opt_qp (e04nfc) will terminate as soon as it is evident that the problem is infeasible, in which case the final point will generally not be the point at which the sum of infeasibilities is minimized.
 ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{min\_infeas}}=\mathrm{Nag\_TRUE}$
 nag_opt_qp (e04nfc) will continue until the sum of infeasibilities is minimized.
crash_tol – double   Default $\text{}=0.01$ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{crash\_tol}}$ is used in conjunction with the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}$ when ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}$ has the default setting, i.e., ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Cold}$, nag_opt_qp (e04nfc) selects an initial working set. The initial working set will include bounds or general inequality constraints that lie within ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{crash\_tol}}$ of their bounds. In particular, a constraint of the form ${a}_{j}^{\mathrm{T}}x\ge l$ will be included in the initial working set if $\left{a}_{j}^{\mathrm{T}}xl\right\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{crash\_tol}}\times \left(1+\leftl\right\right)$.
Constraint:
$0.0\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{crash\_tol}}\le 1.0$.
ftol – double   Default $\text{}=\sqrt{\epsilon}$ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ defines the maximum acceptable
absolute violation in each constraint at a ‘feasible’ point. For example, if the variables and the coefficients in the general constraints are of order unity, and the latter are correct to about 6 decimal digits, it would be appropriate to specify
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ as
${10}^{6}$.
nag_opt_qp (e04nfc) attempts to find a feasible solution before optimizing the objective function. If the sum of infeasibilities cannot be reduced to zero, ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{min\_infeas}}$ can be used to find the minimum value of the sum. Let Sinf be the corresponding sum of infeasibilities. If Sinf is quite small, it may be appropriate to raise ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ by a factor of 10 or 100. Otherwise, some error in the data should be suspected.
Note that a ‘feasible solution’ is a solution that satisfies the current constraints to within the tolerance ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$.
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}>0.0$.
optim_tol – double   Default $\text{}={\epsilon}^{0.8}$ 
On entry: ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{optim\_tol}}$ defines the tolerance used to determine whether the bounds and generated constraints have the correct sign for the solution to be judged optimal.
reset_ftol – Integer   Default $\text{}=5$ 
On entry: this option is part of an anticycling procedure designed to guarantee progress even on highly degenerate 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 argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$ is $\delta $. Over a period of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$ iterations, the feasibility tolerance actually used by nag_opt_qp (e04nfc) increases from $0.5\delta $ to $\delta $ (in steps of $0.5\delta /{\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$).
At certain stages the following ‘resetting procedure’ is used to remove constraint infeasibilities. First, all variables whose upper or lower bounds are in the working set are moved exactly onto their bounds. A count is kept of the number of nontrivial adjustments made. If the count is positive, iterative refinement is used to give variables that satisfy the working set to (essentially) machine precision. Finally, the current feasibility tolerance is reinitialized to $0.5\delta $.
If a problem requires more than ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$ iterations, the resetting procedure is invoked and a new cycle of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$ iterations is started with ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$ incremented by 10. (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 nag_opt_qp (e04nfc) reaches an apparently optimal, infeasible or unbounded solution, unless this situation has already occurred twice. If any nontrivial adjustments are made, iterations are continued.
Constraint:
$0<{\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}<10000000$.
fcheck – Integer   Default $\text{}=50$ 
On entry: every ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fcheck}}$ iterations, a numerical test is made to see if the current solution $x$ satisfies the constraints in the working set. If the largest residual of the constraints in the working set is judged to be too large, the current working set is refactorized and the variables are recomputed to satisfy the constraints more accurately.
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{fcheck}}\ge 1$.
inf_bound – double   Default $\text{}={10}^{20}$ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$ defines the ‘infinite’ bound in the definition of the problem constraints. Any upper bound greater than or equal to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$ will be regarded as $+\infty $ (and similarly for a lower bound less than or equal to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$).
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}>0.0$.
inf_step – double   Default $\text{}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}},{10}^{20}\right)$ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_step}}$ 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 ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_step}}$, the objective function is considered to be unbounded below in the feasible region.
Constraint:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_step}}>0.0$.
hrows – Integer   Default $\text{}={\mathbf{n}}$ 
On entry: specifies
$m$, the number of rows of the quadratic term
$H$ of the QP objective function. The default value of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ is
$n$, the number of variables of the problem, except that if the problem is specified as type
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_FP}$ or
$\mathrm{Nag\_LP}$, the default value of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ is zero.
If the problem is of type QP, ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ will usually be $n$, the number of variables. However, a value of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ less than $n$ is appropriate for ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_QP3}$ or $\mathrm{Nag\_QP4}$ if $H$ is an upper trapezoidal matrix with $m$ rows. Similarly, ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ may be used to define the dimension of a leading block of nonzeros in the Hessian matrices of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_QP1}$ or $\mathrm{Nag\_QP2}$, in which case the last $nm$ rows and columns of $H$ are assumed to be zero.
Constraint:
$0\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}\le {\mathbf{n}}$.
max_df – Integer   Default $\text{}={\mathbf{n}}$ 
On entry: places a limit on the storage allocated for the triangular factor
$R$ of the reduced Hessian
${H}_{r}$. Ideally,
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}$ should be set slightly larger than the value of
${n}_{r}$ expected at the solution. It need not be larger than
${m}_{n}+1$, where
${m}_{n}$ is the number of variables that appear nonlinearly in the quadratic objective function. For many problems it can be much smaller than
${m}_{n}$.
For quadratic problems, a minimizer may lie on any number of constraints, so that
${n}_{r}$ may vary between
$1$ and
$n$. The default value is therefore normally
n but if the optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$ is specified then the default value of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}$ is set to the value in
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{hrows}}$.
Constraint:
$1\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{max\_df}}\le {\mathbf{n}}$.
rank_tol – double   Default $\text{}=100\epsilon $ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{rank\_tol}}$ enables you to control the condition number of the triangular factor
$R$ (see
Section 10). If
${\rho}_{i}$ denotes the function
${\rho}_{i}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left\{\left{R}_{11}\right,\left{R}_{22}\right,\dots ,\left{R}_{ii}\right\right\}$, the dimension of
$R$ is defined to be smallest index
$i$ such that
$\left{R}_{i+1,i+1}\right\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{rank\_tol}}\times \left{\rho}_{i+1}\right$.
Constraint:
$0.0\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{rank\_tol}}<1.0$.
state – Integer *   Default memory $\text{}={\mathbf{n}}+{\mathbf{nclin}}$ 
On entry:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ need not be set if the default option of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Cold}$ is used as
${\mathbf{n}}+{\mathbf{nclin}}$ values of memory will be automatically allocated by nag_opt_qp (e04nfc).
If the option
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Warm}$ has been chosen,
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ must point to a minimum of
${\mathbf{n}}+{\mathbf{nclin}}$ elements of memory. This memory will already be available if the
options structure has been used in a previous call to nag_opt_qp (e04nfc) from the calling program, using the same values of
n and
nclin and
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}=\mathrm{Nag\_Cold}$. If a previous call has not been made you must be allocate sufficient memory to
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$.
When a warm start is chosen
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ should specify the desired status of the constraints at the start of the feasibility phase. More precisely, the first
$n$ elements of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ refer to the upper and lower bounds on the variables, and the next
${m}_{\mathrm{lin}}$ elements refer to the general linear constraints (if any). Possible values for
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]$ are as follows:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]$ 
Meaning 
0 
The corresponding constraint should not be in the initial working set. 
1 
The constraint should be in the initial working set at its lower bound. 
2 
The constraint should be in the initial working set at its upper bound. 
3 
The constraint should be in the initial working set as an equality. This value should only be specified if ${\mathbf{bl}}\left[j\right]={\mathbf{bu}}\left[j\right]$. The values 1, 2 or 3 all have the same effect when ${\mathbf{bl}}\left[j\right]={\mathbf{bu}}\left[j\right]$. 
The values
$2$,
$1$ and 4 are also acceptable but will be reset to zero by the function. In particular, if nag_opt_qp (e04nfc) has been called previously with the same values of
n and
nclin,
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ already contains satisfactory information. (See also the description of the optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{start}}$.) The function also adjusts (if necessary) the values supplied in
x to be consistent with the values supplied in
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$.
On exit: if nag_opt_qp (e04nfc) exits with a value of
${\mathbf{fail}}\mathbf{.}\mathbf{code}=\mathrm{NE\_NOERROR}$,
NW_DEAD_POINT,
NW_SOLN_NOT_UNIQUE or
NW_NOT_FEASIBLE, the values in
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ indicate the status of the constraints in the working set at the solution. Otherwise,
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ indicates the composition of the working set at the final iterate. The significance of each possible value of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]$ is as follows:
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]$ 
Meaning 
$2$ 
The constraint violates its lower bound by more than the feasibility tolerance. 
$1$ 
The constraint violates its upper bound by more than the feasibility tolerance. 
$\phantom{}0$ 
The constraint is satisfied to within the feasibility tolerance, but is not in the working set. 
$\phantom{}1$ 
This inequality constraint is included in the working set at its lower bound. 
$\phantom{}2$ 
This inequality constraint is included in the working set at its upper bound. 
$\phantom{}3$ 
This constraint is included in the working set as an equality. This value of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ can occur only when ${\mathbf{bl}}\left[j\right]={\mathbf{bu}}\left[j\right]$. 
$\phantom{}4$ 
This corresponds to optimality being declared with ${\mathbf{x}}\left[j\right]$ being temporarily fixed at its current value. This value of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ can only occur when ${\mathbf{fail}}\mathbf{.}\mathbf{code}={\mathbf{NW\_DEAD\_POINT}}$ or NW_SOLN_NOT_UNIQUE. 
ax – double *   Default memory $\text{}={\mathbf{nclin}}$ 
On entry:
nclin values of memory will be automatically allocated by nag_opt_qp (e04nfc) and this is the recommended method of use of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ax}}$. However you may supply memory from the calling program.
On exit: if ${\mathbf{nclin}}>0$, ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ax}}$ points to the final values of the linear constraints $Ax$.
lambda – double *   Default memory $\text{}={\mathbf{n}}+{\mathbf{nclin}}$ 
On entry: ${\mathbf{n}}+{\mathbf{nclin}}$ values of memory will be automatically allocated by nag_opt_qp (e04nfc) and this is the recommended method of use of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{lambda}}$. However you may supply memory from the calling program.
On exit: the values of the Lagrange multipliers for each constraint with respect to the current working set. The first $n$ elements contain the multipliers for the bound constraints on the variables, and the next ${m}_{\mathrm{lin}}$ elements contain the multipliers for the general linear constraints (if any). If ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]=0$ (i.e., constraint $j$ is not in the working set), ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{lambda}}\left[j\right]$ is zero. If $x$ is optimal, ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{lambda}}\left[j\right]$ should be nonnegative if ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]=1$, nonpositive if ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]=2$ and zero if ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}\left[j\right]=4$.
On exit: the total number of iterations performed in the feasibility phase and (if appropriate) the optimality phase.
On exit: the number of times the product
$Hx$ has been calculated (i.e., number of calls of
qphess).
11.3 Description of Printed Output
You can control the level of printed output with the structure members
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{list}}$ and
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}$ (see
Section 11.2). If
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{list}}=\mathrm{Nag\_TRUE}$ then the argument values to nag_opt_qp (e04nfc) are listed, whereas the printout of results is governed by the value of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}$. The default of
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Soln\_Iter}$ provides a single line of output at each iteration and the final result. This section describes all of the possible levels of results printout available from nag_opt_qp (e04nfc).
The convention for numbering the constraints in the iteration results is that indices 1 to $n$ refer to the bounds on the variables, and indices $n+1$ to $n+{m}_{\mathrm{lin}}$ refer to the general constraints. When the status of a constraint changes, the index of the constraint is printed, along with the designation L (lower bound), U (upper bound), E (equality), F (temporarily fixed variable) or A (artificial constraint).
When
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Iter}$ or
$\mathrm{Nag\_Soln\_Iter}$ the following line of output 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

the iteration count. 
Jdel

the index of the constraint deleted from the working set. If Jdel is zero, no constraint was deleted. 
Jadd

the index of the constraint added to the working set. If Jadd is zero, no constraint was added. 
Step

the step taken along the computed search direction. If a constraint is added during the current iteration (i.e., Jadd is positive), Step will be the step to the nearest constraint. During the optimality phase, the step can be greater than $1.0$ only if the reduced Hessian is not positive definite. 
Ninf

the number of violated constraints (infeasibilities). This will be zero during the optimality phase. 
Sinf/Obj

the value of the current objective function. If $x$ is not feasible, Sinf gives a weighted sum of the magnitudes of constraint violations. If $x$ is feasible, Obj 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. Once optimal multipliers are obtained, the number of infeasibilities can increase, but the sum of infeasibilities will either remain constant or be reduced until the minimum sum of infeasibilities is found. 
Bnd

the number of simple bound constraints in the current working set. 
Lin

the number of general linear constraints in the current working set. 
Nart

the number of artificial constraints in the working set, i.e., the number of columns of ${Z}_{a}$ (see Section 10). At the start of the optimality phase, Nart provides an estimate of the number of nonpositive eigenvalues in the reduced Hessian. 
Nrz

the number of columns of ${Z}_{r}$ (see Section 10). Nrz is the dimension of the subspace in which the objective function is currently being minimized. The value of Nrz is the number of variables minus the number of constraints in the working set; i.e., $\mathtt{Nrz}=n\left(\mathtt{Bnd}+\mathtt{Lin}+\mathtt{Nart}\right)$. 

The value of ${n}_{z}$, the number of columns of $Z$ (see Section 10) can be calculated as ${n}_{z}=n\left(\mathtt{Bnd}+\mathtt{Lin}\right)$. A zero value of ${n}_{z}$ implies that $x$ lies at a vertex of the feasible region. 
Norm Gz

$\Vert {Z}_{r}^{\mathrm{T}}{g}_{fr}\Vert $, the Euclidean norm of the reduced gradient with respect to ${Z}_{r}$. During the optimality phase, this norm will be approximately zero after a unit step. 
If ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Iter\_Long}$, $\mathrm{Nag\_Soln\_Iter\_Long}$, $\mathrm{Nag\_Soln\_Iter\_Const}$ or $\mathrm{Nag\_Soln\_Iter\_Full}$ the line of printout is extended to give the following information. (Note this longer line extends over more than 80 characters.)
NOpt

the number of nonoptimal Lagrange multipliers at the current point. NOpt is not printed if the current $x$ is infeasible or no multipliers have been calculated. At a minimizer, NOpt will be zero. 
Min LM

the value of the Lagrange multiplier associated with the deleted constraint. If Min LM is negative, a lower bound constraint has been deleted; if Min LM is positive, an upper bound constraint has been deleted. If no multipliers are calculated during a given iteration, Min LM will be zero. 
Cond T

a lower bound on the condition number of the working set. 
Cond Rz

a lower bound on the condition number of the triangular factor $R$ (the Cholesky factor of the current reduced Hessian). If the problem is specified to be of type ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_LP}$, Cond Rz is not printed. 
Rzz

the last diagonal element $\mu $ of the matrix $D$ associated with the ${R}^{\mathrm{T}}DR$ factorization of the reduced Hessian ${H}_{r}$ (see Section 10.2). Rzz is only printed if ${H}_{r}$ is not positive definite (in which case $\mu \ne 1$). If the printed value of Rzz is small in absolute value, then ${H}_{r}$ is approximately singular. A negative value of Rzz implies that the objective function has negative curvature on the current working set. 
When
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Soln\_Iter\_Const}$ or
$\mathrm{Nag\_Soln\_Iter\_Full}$ more detailed results are given at each iteration. For the setting
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Soln\_Iter\_Const}$ additional values output are:
Value of x

the value of $x$ currently held in x. 
State

the current value of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ associated with $x$. 
Value of Ax

the value of $Ax$ currently held in ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ax}}$. 
State

the current value of ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ associated with $Ax$. 
Also printed are the Lagrange Multipliers for the bound constraints, linear constraints and artificial constraints.
If ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Soln\_Iter\_Full}$ then the diagonal of $T$ and ${Z}_{r}$ are also output at each iteration.
When
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}=\mathrm{Nag\_Soln}$,
$\mathrm{Nag\_Soln\_Iter}$,
$\mathrm{Nag\_Soln\_Iter\_Const}$ or
$\mathrm{Nag\_Soln\_Iter\_Full}$ the final printout from nag_opt_qp (e04nfc) includes a listing of the status of every variable and constraint. The following describes the printout for each variable.
Varbl

gives the name (V) and index $\mathit{j}$, for $\mathit{j}=1,2,\dots ,n$, of the variable. 
State

gives the state of the variable (FR if neither bound is in the working set, EQ if a fixed variable, LL if on its lower bound, UL if on its upper bound, TF if temporarily fixed at its current value). If Value lies outside the upper or lower bounds by more than the feasibility tolerance, State will be ++ or  respectively. 
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[j1\right]\le {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$.) 
Upper bound

is the upper bound specified for the variable. (None indicates that ${\mathbf{bu}}\left[j1\right]\ge {\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{inf\_bound}}$.) 
Lagr mult

is the value of the Lagrange multiplier for the associated bound constraint. This will be zero if State is FR. If $x$ is optimal, the multiplier should be nonnegative if State is LL, and nonpositive if State is UL. 
Residual

is the difference between the variable Value and the nearer of its bounds ${\mathbf{bl}}\left[j1\right]$ and ${\mathbf{bu}}\left[j1\right]$. 
The meaning of the printout for general constraints is the same as that given above for variables, with ‘variable’ replaced by ‘constraint’, and with the following change in the heading:
LCon

is the name (L) and index $\mathit{j}$, for $\mathit{j}=1,2,\dots ,{m}_{\mathrm{lin}}$, of the constraint. 
11.3.1 Output of results via a userdefined printing function
You may also specify your own print function for output of iteration results and the final solution by use of the
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_fun}}$ function pointer, which has prototype
void (*print_fun)(const Nag_Search_State *st, Nag_Comm *comm);
The rest of this section can be skipped if you only wish to use the default printing facilities.
When a userdefined function is assigned to
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_fun}}$ this will be called in preference to the internal print function of nag_opt_qp (e04nfc). Calls to the userdefined function are again controlled by means of the
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_level}}$ member. Information is provided through
st and
comm, the two structure arguments to
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_fun}}$.
If $\mathbf{comm}\mathbf{\to}\mathbf{it\_prt}=\mathrm{Nag\_TRUE}$ then the results from the last iteration of nag_opt_qp (e04nfc) are set in the following members of st:
 first – Nag_Boolean

Nag_TRUE on the first call to ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_fun}}$.
 iter – Integer

The number of iterations performed.
 n – Integer

The number of variables.
 nclin – Integer

The number of linear constraints.
 jdel – Integer

Index of constraint deleted.
 jadd – Integer

Index of constraint added.
 step – double

The step taken along the current search direction.
 ninf – Integer

The number of infeasibilities.
 f – double

The value of the current objective function.
 bnd – Integer

Number of bound constraints in the working set.
 lin – Integer

Number of general linear constraints in the working set.
 nart – Integer

Number of artificial constraints in the working set.
 nrz – Integer

Number of columns of ${Z}_{r}$.
 norm_gz – double

Euclidean norm of the reduced gradient, $\Vert {Z}_{r}^{\mathrm{T}}{g}_{fr}\Vert $.
 nopt – Integer

Number of nonoptimal Lagrange multipliers.
 min_lm – double

Value of the Lagrange multiplier associated with the deleted constraint.
 condt – double

A lower bound on the condition number of the working set.
 x – double

x points to the
n memory locations holding the current point
$x$.
 ax – double

${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ax}}$ points to the
nclin memory locations holding the current values
$Ax$.
 state – Integer

${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{state}}$ points to the
${\mathbf{n}}+{\mathbf{nclin}}$ memory locations holding the status of the variables and general linear constraints. See
Section 11.2 for a description of the possible status values.
 t – double

The upper triangular matrix $T$ with $\mathbf{st}\mathbf{\to}\mathbf{lin}$ columns. Matrix element $i,j$ is held in $\mathbf{st}\mathbf{\to}\mathbf{t}\left[\left(i1\right)\times \mathbf{st}\mathbf{\to}\mathbf{tdt}+j1\right]$.
 tdt – Integer

The trailing dimension for $\mathbf{st}\mathbf{\to}\mathbf{t}$.
If $\mathbf{st}\mathbf{\to}\mathbf{rset}=\mathrm{Nag\_TRUE}$ then the problem is QP, nag_opt_qp (e04nfc) is executing the optimality phase and the following members of st are also set:
 r – double

The upper triangular matrix $R$ with $\mathbf{st}\mathbf{\to}\mathbf{nrz}$ columns. Matrix element $i,j$ is held in $\mathbf{st}\mathbf{\to}\mathbf{r}\left[\left(i1\right)\times \mathbf{st}\mathbf{\to}\mathbf{tdr}+j1\right]$.
 tdr – Integer

The trailing dimension for $\mathbf{st}\mathbf{\to}\mathbf{r}$.
 condr – double

A lower bound on the condition number of the triangular factor $R$.
 rzz – double

Last diagonal element $\mu $ of the matrix $D$.
If $\mathbf{comm}\mathbf{\to}\mathbf{new\_lm}=\mathrm{Nag\_TRUE}$ then the Lagrange multipliers have been updated and the following members of st are set:
 kx – Integer

Indices of the bound constraints with associated multipliers. Value of $\mathbf{st}\mathbf{\to}\mathbf{kx}\left[\mathit{i}\right]$ is the index of the constraint with multiplier $\mathbf{st}\mathbf{\to}\mathbf{lambda}\left[\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,\mathbf{st}\mathbf{\to}\mathbf{bnd}1$.
 kactive – Integer

Indices of the linear constraints with associated multipliers. Value of $\mathbf{st}\mathbf{\to}\mathbf{kactive}\left[\mathit{i}\right]$ is the index of the constraint with multiplier $\mathbf{st}\mathbf{\to}\mathbf{lambda}\left[\mathbf{st}\mathbf{\to}\mathbf{bnd}+\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,\mathbf{st}\mathbf{\to}\mathbf{lin}1$.
 lambda – double

The multipliers for the constraints in the working set. ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{lambda}}\left[\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,\mathbf{st}\mathbf{\to}\mathbf{bnd}1$, hold the multipliers for the bound constraints while the multipliers for the linear constraints are held at indices $i=\mathbf{st}\mathbf{\to}\mathbf{bnd},\dots ,\mathbf{st}\mathbf{\to}\mathbf{bnd}+\mathbf{st}\mathbf{\to}\mathbf{lin}1$.
 gq – double

$\mathbf{st}\mathbf{\to}\mathbf{gq}\left[\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,\mathbf{st}\mathbf{\to}\mathbf{nart}1$, hold the multipliers for the artificial constraints.
The following members of st are also relevant and apply when $\mathbf{comm}\mathbf{\to}\mathbf{it\_prt}$ or $\mathbf{comm}\mathbf{\to}\mathbf{new\_lm}$ is Nag_TRUE.
 refactor – Nag_Boolean

Nag_TRUE if iterative refinement performed. See
Section 11.2 and optional argument
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$.
 jmax – Integer

If $\mathbf{st}\mathbf{\to}\mathbf{refactor}=\mathrm{Nag\_TRUE}$ then $\mathbf{st}\mathbf{\to}\mathbf{jmax}$ holds the index of the constraint with the maximum violation.
 errmax – double

If $\mathbf{st}\mathbf{\to}\mathbf{refactor}=\mathrm{Nag\_TRUE}$ then $\mathbf{st}\mathbf{\to}\mathbf{errmax}$ holds the value of the maximum violation.
 moved – Nag_Boolean

Nag_TRUE if some variables have been moved to their bounds. See the optional argument ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{reset\_ftol}}$.
 nmoved – Integer

If $\mathbf{st}\mathbf{\to}\mathbf{moved}=\mathrm{Nag\_TRUE}$ then $\mathbf{st}\mathbf{\to}\mathbf{nmoved}$ holds the number of variables which were moved to their bounds.
 rowerr – Nag_Boolean

Nag_TRUE if some constraints are not satisfied to within ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{ftol}}$.
 feasible – Nag_Boolean

Nag_TRUE when a feasible point has been found.
If $\mathbf{comm}\mathbf{\to}\mathbf{sol\_prt}=\mathrm{Nag\_TRUE}$ then the final result from nag_opt_qp (e04nfc) is available and the following members of st are set:
 iter – Integer

The number of iterations performed.
 n – Integer

The number of variables.
 nclin – Integer

The number of linear constraints.
 x – double

x points to the
n memory locations holding the final point
$x$.
 f – double

The final objective function value or, if $x$ is not feasible, the sum of infeasibilities. If the problem is of type ${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{prob}}=\mathrm{Nag\_FP}$ and $x$ is feasible then $\mathbf{st}\mathbf{\to}\mathbf{f}$ is set to zero.
 ax – double

$\mathbf{st}\mathbf{\to}\mathbf{ax}$ points to the
nclin memory locations holding the final values
$Ax$.
 state – Integer

$\mathbf{st}\mathbf{\to}\mathbf{state}$ points to the
${\mathbf{n}}+{\mathbf{nclin}}$ memory locations holding the final status of the variables and general linear constraints. See
Section 11.2 for a description of the possible status values.
 lambda – double

$\mathbf{st}\mathbf{\to}\mathbf{lambda}$ points to the ${\mathbf{n}}+{\mathbf{nclin}}$ final values of the Lagrange multipliers.
 bl – double

$\mathbf{st}\mathbf{\to}\mathbf{bl}$ points to the ${\mathbf{n}}+{\mathbf{nclin}}$ lower bound values.
 bu – double

$\mathbf{st}\mathbf{\to}\mathbf{bu}$ points to the ${\mathbf{n}}+{\mathbf{nclin}}$ upper bound values.
 endstate – Nag_EndState

The state of termination of nag_opt_qp (e04nfc). Possible values of
$\mathbf{st}\mathbf{\to}\mathbf{endstate}$ and their correspondence to the exit value of
fail.code are:
The relevant members of the structure
comm are:
 it_prt – Nag_Boolean

Will be Nag_TRUE when the print function is called with the result of the current iteration.
 sol_prt – Nag_Boolean

Will be Nag_TRUE when the print function is called with the final result.
 new_lm – Nag_Boolean

Will be Nag_TRUE when the Lagrange multipliers have been updated.
 user – double
 iuser – Integer
 p – Pointer

Pointers for communication of user information. You must allocate memory either before entry to nag_opt_qp (e04nfc) or during a call to
qphess or
${\mathbf{options}}\mathbf{.}\textcolor[rgb]{}{\mathbf{print\_fun}}$. The type Pointer will be
void * with a C compiler that defines
void * and
char * otherwise.