e04ug solves sparse nonlinear programming problems.

# Syntax

C#
```public static void e04ug(
E04..::..E04UG_CONFUN confun,
E04..::..E04UG_OBJFUN objfun,
int n,
int m,
int ncnln,
int nonln,
int njnln,
int iobj,
int nnz,
double[] a,
int[] ha,
int[] ka,
double[] bl,
double[] bu,
string start,
int nname,
string[] names,
ref int ns,
double[] xs,
int[] istate,
double[] clamda,
out int miniz,
out int minz,
out int ninf,
out double sinf,
out double obj,
int[] iz,
double[] z,
E04..::..e04ugOptions options,
out int ifail
)```
Visual Basic
```Public Shared Sub e04ug ( _
confun As E04..::..E04UG_CONFUN, _
objfun As E04..::..E04UG_OBJFUN, _
n As Integer, _
m As Integer, _
ncnln As Integer, _
nonln As Integer, _
njnln As Integer, _
iobj As Integer, _
nnz As Integer, _
a As Double(), _
ha As Integer(), _
ka As Integer(), _
bl As Double(), _
bu As Double(), _
start As String, _
nname As Integer, _
names As String(), _
ByRef ns As Integer, _
xs As Double(), _
istate As Integer(), _
clamda As Double(), _
<OutAttribute> ByRef miniz As Integer, _
<OutAttribute> ByRef minz As Integer, _
<OutAttribute> ByRef ninf As Integer, _
<OutAttribute> ByRef sinf As Double, _
<OutAttribute> ByRef obj As Double, _
iz As Integer(), _
z As Double(), _
options As E04..::..e04ugOptions, _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void e04ug(
E04..::..E04UG_CONFUN^ confun,
E04..::..E04UG_OBJFUN^ objfun,
int n,
int m,
int ncnln,
int nonln,
int njnln,
int iobj,
int nnz,
array<double>^ a,
array<int>^ ha,
array<int>^ ka,
array<double>^ bl,
array<double>^ bu,
String^ start,
int nname,
array<String^>^ names,
int% ns,
array<double>^ xs,
array<int>^ istate,
array<double>^ clamda,
[OutAttribute] int% miniz,
[OutAttribute] int% minz,
[OutAttribute] int% ninf,
[OutAttribute] double% sinf,
[OutAttribute] double% obj,
array<int>^ iz,
array<double>^ z,
E04..::..e04ugOptions^ options,
[OutAttribute] int% ifail
)```
F#
```static member e04ug :
confun : E04..::..E04UG_CONFUN *
objfun : E04..::..E04UG_OBJFUN *
n : int *
m : int *
ncnln : int *
nonln : int *
njnln : int *
iobj : int *
nnz : int *
a : float[] *
ha : int[] *
ka : int[] *
bl : float[] *
bu : float[] *
start : string *
nname : int *
names : string[] *
ns : int byref *
xs : float[] *
istate : int[] *
clamda : float[] *
miniz : int byref *
minz : int byref *
ninf : int byref *
sinf : float byref *
obj : float byref *
iz : int[] *
z : float[] *
options : E04..::..e04ugOptions *
ifail : int byref -> unit
```

#### Parameters

confun
Type: NagLibrary..::..E04..::..E04UG_CONFUN
confun must calculate the vector $F\left(x\right)$ of nonlinear constraint functions and (optionally) its Jacobian $\left(=\frac{\partial F}{\partial x}\right)$ for a specified ${n}_{1}^{\prime \prime }$ ($\text{}\le n$) element vector $x$. If there are no nonlinear constraints (i.e., ${\mathbf{ncnln}}=0$), confun will never be called by e04ug and confun may be the dummy method E04UGM. (E04UGM is included in the NAG Library.) If there are nonlinear constraints, the first call to confun will occur before the first call to objfun.

A delegate of type E04UG_CONFUN.

objfun
Type: NagLibrary..::..E04..::..E04UG_OBJFUN
objfun must calculate the nonlinear part of the objective function $f\left(x\right)$ and (optionally) its gradient $\left(=\frac{\partial f}{\partial x}\right)$ for a specified ${n}_{1}^{\prime }$ ($\text{}\le n$) element vector $x$. If there are no nonlinear objective variables (i.e., ${\mathbf{nonln}}=0$), objfun will never be called by e04ug and objfun may be the dummy method E04UGN. (E04UGN is included in the NAG Library.)

A delegate of type E04UG_OBJFUN.

n
Type: System..::..Int32
On entry: $n$, the number of variables (excluding slacks). This is the number of columns in the full Jacobian matrix $A$.
Constraint: ${\mathbf{n}}\ge 1$.
m
Type: System..::..Int32
On entry: $m$, the number of general constraints (or slacks). This is the number of rows in $A$, including the free row (if any; see iobj). Note that $A$ must contain at least one row. If your problem has no constraints, or only upper and lower bounds on the variables, then you must include a dummy ‘free’ row consisting of a single (zero) element subject to ‘infinite’ upper and lower bounds. Further details can be found under the descriptions for iobj, nnz, a, ha, ka, bl and bu.
Constraint: ${\mathbf{m}}\ge 1$.
ncnln
Type: System..::..Int32
On entry: ${n}_{N}$, the number of nonlinear constraints.
Constraint: $0\le {\mathbf{ncnln}}\le {\mathbf{m}}$.
nonln
Type: System..::..Int32
On entry: ${n}_{1}^{\prime }$, the number of nonlinear objective variables. If the objective function is nonlinear, the leading ${n}_{1}^{\prime }$ columns of $A$ belong to the nonlinear objective variables. (See also the description for njnln.)
Constraint: $0\le {\mathbf{nonln}}\le {\mathbf{n}}$.
njnln
Type: System..::..Int32
On entry: ${n}_{1}^{\prime \prime }$, the number of nonlinear Jacobian variables. If there are any nonlinear constraints, the leading ${n}_{1}^{\prime \prime }$ columns of $A$ belong to the nonlinear Jacobian variables. If ${n}_{1}^{\prime }>0$ and ${n}_{1}^{\prime \prime }>0$, the nonlinear objective and Jacobian variables overlap. The total number of nonlinear variables is given by $\stackrel{-}{n}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({n}_{1}^{\prime },{n}_{1}^{\prime \prime }\right)$.
Constraints:
• if ${\mathbf{ncnln}}=0$, ${\mathbf{njnln}}=0$;
• if ${\mathbf{ncnln}}>0$, $1\le {\mathbf{njnln}}\le {\mathbf{n}}$.
iobj
Type: System..::..Int32
On entry: if ${\mathbf{iobj}}>{\mathbf{ncnln}}$, row iobj of $A$ is a free row containing the nonzero elements of the linear part of the objective function.
${\mathbf{iobj}}=0$
There is no free row.
${\mathbf{iobj}}=-1$
There is a dummy ‘free’ row.
Constraints:
• if ${\mathbf{iobj}}>0$, ${\mathbf{ncnln}}<{\mathbf{iobj}}\le {\mathbf{m}}$;
• otherwise ${\mathbf{iobj}}\ge -1$.
nnz
Type: System..::..Int32
On entry: the number of nonzero elements in $A$ (including the Jacobian for any nonlinear constraints). If ${\mathbf{iobj}}=-1$, set ${\mathbf{nnz}}=1$.
Constraint: $1\le {\mathbf{nnz}}\le {\mathbf{n}}×{\mathbf{m}}$.
a
Type: array<System..::..Double>[]()[][]
An array of size [nnz]
On entry: the nonzero elements of the Jacobian matrix $A$, ordered by increasing column index. Since the constraint Jacobian matrix $J\left({x}^{\prime \prime }\right)$ must always appear in the top left-hand corner of $A$, those elements in a column associated with any nonlinear constraints must come before any elements belonging to the linear constraint matrix $G$ and the free row (if any; see iobj).
In general, a is partitioned into a nonlinear part and a linear part corresponding to the nonlinear variables and linear variables in the problem. Elements in the nonlinear part may be set to any value (e.g., zero) because they are initialized at the first point that satisfies the linear constraints and the upper and lower bounds.
If ${\mathbf{Derivative Level}}=2$ or $3$, the nonlinear part may also be used to store any constant Jacobian elements. Note that if confun does not define the constant Jacobian element ${\mathbf{fjac}}\left[i-1\right]$ then the missing value will be obtained directly from ${\mathbf{a}}\left[j\right]$ for some $j\ge i$.
If ${\mathbf{Derivative Level}}=0$ or $1$, unassigned elements of fjac are not treated as constant; they are estimated by finite differences, at nontrivial expense.
The linear part must contain the nonzero elements of $G$ and the free row (if any). If ${\mathbf{iobj}}=-1$, set ${\mathbf{a}}\left[0\right]=0$. Elements with the same row and column indices are not allowed. (See also the descriptions for ha and ka.)
On exit: elements in the nonlinear part corresponding to nonlinear Jacobian variables are overwritten.
ha
Type: array<System..::..Int32>[]()[][]
An array of size [nnz]
On entry: ${\mathbf{ha}}\left[\mathit{i}-1\right]$ must contain the row index of the nonzero element stored in ${\mathbf{a}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{nnz}}$. The row indices for a column may be supplied in any order subject to the condition that those elements in a column associated with any nonlinear constraints must appear before those elements associated with any linear constraints (including the free row, if any). Note that confun must define the Jacobian elements in the same order. If ${\mathbf{iobj}}=-1$, set ${\mathbf{ha}}\left[0\right]=1$.
Constraint: $1\le {\mathbf{ha}}\left[\mathit{i}-1\right]\le {\mathbf{m}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{nnz}}$.
ka
Type: array<System..::..Int32>[]()[][]
An array of size [${\mathbf{n}}+1$]
On entry: ${\mathbf{ka}}\left[\mathit{j}-1\right]$ must contain the index in a of the start of the $\mathit{j}$th column, for $\mathit{j}=1,2,\dots ,{\mathbf{n}}$. To specify the $\mathit{j}$th column as empty, set ${\mathbf{ka}}\left[\mathit{j}-1\right]={\mathbf{ka}}\left[\mathit{j}\right]$. Note that the first and last elements of ka must be such that ${\mathbf{ka}}\left[0\right]=1$ and ${\mathbf{ka}}\left[{\mathbf{n}}\right]={\mathbf{nnz}}+1$. If ${\mathbf{iobj}}=-1$, set ${\mathbf{ka}}\left[\mathit{j}-1\right]=2$, for $\mathit{j}=2,3,\dots ,{\mathbf{n}}$.
Constraints:
• ${\mathbf{ka}}\left[0\right]=1$;
• ${\mathbf{ka}}\left[\mathit{j}-1\right]\ge 1$, for $\mathit{j}=2,3,\dots ,{\mathbf{n}}$;
• ${\mathbf{ka}}\left[{\mathbf{n}}\right]={\mathbf{nnz}}+1$;
• $0\le {\mathbf{ka}}\left[\mathit{j}\right]-{\mathbf{ka}}\left[\mathit{j}-1\right]\le {\mathbf{m}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{n}}$.
bl
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{n}}+{\mathbf{m}}$]
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$, the next ncnln elements the bounds for the nonlinear constraints $F\left(x\right)$ (if any) and the next (${\mathbf{m}}-{\mathbf{ncnln}}$) elements the bounds for the linear constraints $Gx$ and the free row (if any). To specify a nonexistent lower bound (i.e., ${l}_{j}=-\infty$), set ${\mathbf{bl}}\left[j-1\right]\le -\mathit{bigbnd}$. To specify the $j$th constraint as an equality, set ${\mathbf{bl}}\left[j-1\right]={\mathbf{bu}}\left[j-1\right]=\beta$, say, where $\left|\beta \right|<\mathit{bigbnd}$. If ${\mathbf{iobj}}=-1$, set ${\mathbf{bl}}\left[{\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)-1\right]\le \phantom{\rule{0ex}{0ex}}-\mathit{bigbnd}$.
Constraint: if ${\mathbf{ncnln}}<{\mathbf{iobj}}\le {\mathbf{m}}$ or ${\mathbf{iobj}}=-1$, ${\mathbf{bl}}\left[{\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)-1\right]\le -\mathit{bigbnd}$
bu
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{n}}+{\mathbf{m}}$]
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$, the next ncnln elements the bounds for the nonlinear constraints $F\left(x\right)$ (if any) and the next (${\mathbf{m}}-{\mathbf{ncnln}}$) elements the bounds for the linear constraints $Gx$ and the free row (if any). To specify a nonexistent upper bound (i.e., ${u}_{j}=+\infty$), set ${\mathbf{bu}}\left[j-1\right]\ge \mathit{bigbnd}$. To specify the $j$th constraint as an equality, set ${\mathbf{bu}}\left[j-1\right]={\mathbf{bl}}\left[j-1\right]=\beta$, say, where $\left|\beta \right|<\mathit{bigbnd}$. If ${\mathbf{iobj}}=-1$, set ${\mathbf{bu}}\left[{\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)-1\right]\ge \mathit{bigbnd}$.
Constraints:
• if ${\mathbf{ncnln}}<{\mathbf{iobj}}\le {\mathbf{m}}$ or ${\mathbf{iobj}}=-1$, ${\mathbf{bu}}\left[{\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)-1\right]\ge \mathit{bigbnd}$;
• ${\mathbf{bl}}\left[\mathit{j}-1\right]\le {\mathbf{bu}}\left[\mathit{j}-1\right]$, for $\mathit{j}=1,2,\dots ,{\mathbf{n}}+{\mathbf{m}}$;
• if ${\mathbf{bl}}\left[j-1\right]={\mathbf{bu}}\left[j-1\right]=\beta$, $\left|\beta \right|<\mathit{bigbnd}$.
start
Type: System..::..String
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.
${\mathbf{start}}=\text{"W"}$
A basis is already defined in istate and ns (probably from a previous call).
Constraint: ${\mathbf{start}}=\text{"C"}$ or $\text{"W"}$.
nname
Type: System..::..Int32
On entry: the number of column (i.e., variable) and row (i.e., constraint) names supplied in names.
${\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}}$.
names
Type: array<System..::..String>[]()[][]
An array of size [nname]
On entry: specifies the column and row names to be used in the printed output.
If ${\mathbf{nname}}=1$, names 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, the next ncnln elements must contain the names for the nonlinear rows (if any) and the next $\left({\mathbf{m}}-{\mathbf{ncnln}}\right)$ elements must contain the names for the linear rows (if any) to be used in the printed output. Note that the name for the free row or dummy ‘free’ row must be stored in ${\mathbf{names}}\left[{\mathbf{n}}+\mathrm{abs}\left({\mathbf{iobj}}\right)-1\right]$.
ns
Type: System..::..Int32%
On entry: ${n}_{S}$, the number of superbasics. It need not be specified if ${\mathbf{start}}=\text{"C"}$, but must retain its value from a previous call when ${\mathbf{start}}=\text{"W"}$.
On exit: the final number of superbasics.
xs
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{n}}+{\mathbf{m}}$]
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)$.
istate
Type: array<System..::..Int32>[]()[][]
An array of size [${\mathbf{n}}+{\mathbf{m}}$]
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-1\right]$ are as follows:
 ${\mathbf{istate}}\left[j-1\right]$ State of ${\mathbf{xs}}\left[j-1\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}-1\right]=0$ and ${\mathbf{xs}}\left[\mathit{j}-1\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 $j$th variable will probably be equal to one of its bounds, set ${\mathbf{istate}}\left[j-1\right]=4$ and ${\mathbf{xs}}\left[j-1\right]={\mathbf{bl}}\left[j-1\right]$ or ${\mathbf{istate}}\left[j-1\right]=5$ and ${\mathbf{xs}}\left[j-1\right]={\mathbf{bu}}\left[j-1\right]$ as appropriate.
Following the Crash procedure, variables for which ${\mathbf{istate}}\left[j-1\right]=2$ are made superbasic. Other variables not selected for the basis are then made nonbasic at the value ${\mathbf{xs}}\left[j-1\right]$ if ${\mathbf{bl}}\left[j-1\right]\le {\mathbf{xs}}\left[j-1\right]\le {\mathbf{bu}}\left[j-1\right]$, or at the value ${\mathbf{bl}}\left[j-1\right]$ or ${\mathbf{bu}}\left[j-1\right]$ closest to ${\mathbf{xs}}\left[j-1\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 the method 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}-1\right]\le 5$, for $\mathit{j}=1,2,\dots ,{\mathbf{n}}$;
• if ${\mathbf{start}}=\text{"W"}$, $0\le {\mathbf{istate}}\left[\mathit{j}-1\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-1\right]$ is as follows:
 ${\mathbf{istate}}\left[j-1\right]$ State of variable $j$ Normal value of ${\mathbf{xs}}\left[j-1\right]$ $0$ Nonbasic ${\mathbf{bl}}\left[j-1\right]$ $1$ Nonbasic ${\mathbf{bu}}\left[j-1\right]$ $2$ Superbasic Between ${\mathbf{bl}}\left[j-1\right]$ and ${\mathbf{bu}}\left[j-1\right]$ $3$ Basic Between ${\mathbf{bl}}\left[j-1\right]$ and ${\mathbf{bu}}\left[j-1\right]$
If ${\mathbf{ninf}}=0$, basic and superbasic variables may be outside their bounds by as much as the value of the optional parameter Minor Feasibility Tolerance. Note that if scaling is specified, the optional parameter Minor Feasibility Tolerance applies to the variables of the scaled problem. In this case, the variables of the original problem may be as much as $0.1$ outside their bounds, but this is unlikely unless the problem is very badly scaled.
Very occasionally some nonbasic variables may be outside their bounds by as much as the optional parameter Minor Feasibility Tolerance and there may be some nonbasic variables for which ${\mathbf{xs}}\left[j-1\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 scaling was not used).
clamda
Type: array<System..::..Double>[]()[][]
An array of size [${\mathbf{n}}+{\mathbf{m}}$]
On entry: if ${\mathbf{ncnln}}>0$, ${\mathbf{clamda}}\left[\mathit{j}-1\right]$ must contain a Lagrange multiplier estimate for the $\mathit{j}$th nonlinear constraint ${F}_{\mathit{j}}\left(x\right)$, for $\mathit{j}={\mathbf{n}}+1,\dots ,{\mathbf{n}}+{\mathbf{ncnln}}$. If nothing special is known about the problem, or there is no wish to provide special information, you may set ${\mathbf{clamda}}\left[j-1\right]=0.0$. The remaining elements need not be set.
On exit: a set of Lagrange multipliers for the bounds on the variables (reduced costs) and the general constraints (shadow costs). More precisely, the first n elements contain the multipliers for the bounds on the variables, the next ncnln elements contain the multipliers for the nonlinear constraints $F\left(x\right)$ (if any) and the next (${\mathbf{m}}-{\mathbf{ncnln}}$) elements contain the multipliers for the linear constraints $Gx$ and the free row (if any).
miniz
Type: System..::..Int32%
On exit: the minimum value of _leniz required to start solving the problem. If ${\mathbf{ifail}}={12}$, e04ug may be called again with _leniz suitably larger than miniz. (The bigger the better, since it is not certain how much workspace the basis factors need.)
minz
Type: System..::..Int32%
On exit: the minimum value of lenz required to start solving the problem. If ${\mathbf{ifail}}={13}$, e04ug may be called again with lenz suitably larger than minz. (The bigger the better, since it is not certain how much workspace the basis factors need.)
ninf
Type: System..::..Int32%
On exit: the number of constraints that lie outside their bounds by more than the value of the optional parameter Minor Feasibility Tolerance.
If the linear constraints are infeasible, the sum of the infeasibilities of the linear constraints is minimized subject to the upper and lower bounds being satisfied. In this case, ninf contains the number of elements of $Gx$ that lie outside their upper or lower bounds. Note that the nonlinear constraints are not evaluated.
Otherwise, the sum of the infeasibilities of the nonlinear constraints is minimized subject to the linear constraints and the upper and lower bounds being satisfied. In this case, ninf contains the number of elements of $F\left(x\right)$ that lie outside their upper or lower bounds.
sinf
Type: System..::..Double%
On exit: the sum of the infeasibilities of constraints that lie outside their bounds by more than the value of the optional parameter Minor Feasibility Tolerance.
obj
Type: System..::..Double%
On exit: the value of the objective function.
iz
Type: array<System..::..Int32>[]()[][]
An array of size [dim1]
Note: dim1 must satisfy the constraint: $\mathbf{_leniz}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(500,{\mathbf{n}}+{\mathbf{m}}\right)$
z
Type: array<System..::..Double>[]()[][]
An array of size [lenz]
the dimension of the array z.
On entry: the dimension of the array z as declared in the (sub)program from which e04ug is called.
Constraint: ${\mathbf{lenz}}\ge 500$.
The amounts of workspace provided (i.e., _leniz and lenz) and required (i.e., miniz and minz) are (by default) output on the current advisory message unit (as defined by (X04ABF not in this release)). Since the minimum values of _leniz and lenz required to start solving the problem are returned in miniz and minz respectively, you may prefer to obtain appropriate values from the output of a preliminary run with _leniz set to $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(500,{\mathbf{n}}+{\mathbf{m}}\right)$ and/or lenz set to $500$. (e04ug will then terminate with ${\mathbf{ifail}}={15}$ or ${16}$.)
options
Type: NagLibrary..::..E04..::..e04ugOptions
An Object of type E04.e04ugOptions. Used to configure optional parameters to this method.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

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

# References

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

# Error Indicators and Warnings

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

# Accuracy

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

# Parallelism and Performance

None.

This section contains a description of the printed output.

# Major Iteration Printout

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

# Minor Iteration Printout

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

# Example

This is a reformulation of Problem 74 in Hock and Schittkowski (1981) and involves the minimization of the nonlinear function
 $fx=10-6x33+23×10-6x43+3x3+2x4$
subject to the bounds
 $-0.55≤x1≤0.55,-0.55≤x2≤0.55,-0.00≤x3≤1200,-0.00≤x4≤1200,$
to the nonlinear constraints
 $1000sin-x1-0.25+1000sin-x2-0.25-x3=-894.8,1000sinx1-0.25+1000sinx1-x2-0.25-x4=-894.8,1000sinx2-0.25+1000sinx2-x1-0.25=-1294.8,$
and to the linear constraints
 $-x1+x2≥-0.55,-x1-x2≥-0.55.$
The initial point, which is infeasible, is
 $x0=0,0,0,0T,$
and $f\left({x}_{0}\right)=0$.
The optimal solution (to five figures) is
 $x*=0.11887,-0.39623,679.94,1026.0T,$
and $f\left({x}^{*}\right)=5126.4$. All the nonlinear constraints are active at the solution.

Example program (C#): e04uge.cs

Example program data: e04uge.d

Example program results: e04uge.r

# Algorithmic Details

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

# Overview

Here we briefly summarise the main features of the method and introduce some terminology. Where possible, explicit reference is made to the names of variables that are parameters of the method or appear in the printed output. Further details can be found in Gill et al. (2002).
At a solution of (1), some of the constraints will be active, i.e., satisfied exactly. Let
 $rx=xFxGx$
and $\mathcal{G}$ denote the set of indices of $r\left(x\right)$ corresponding to active constraints at an arbitrary point $x$. Let ${r}_{j}^{\prime }\left(x\right)$ denote the usual derivative of ${r}_{j}\left(x\right)$, which is the row vector of first partial derivatives of ${r}_{j}\left(x\right)$ (see Ortega and Rheinboldt (1970)). The vector ${r}_{j}^{\prime }\left(x\right)$ comprises the $j$th row of ${r}^{\prime }\left(x\right)$ so that
 $r′x=IJxG,$
where $J\left(x\right)$ is the Jacobian of $F\left(x\right)$.
A point $x$ is a first-order Kuhn–Karesh–Tucker (KKT) point for (1) (see Powell (1974)) if the following conditions hold:
(a) $x$ is feasible;
(b) there exists a vector $\lambda$ (the Lagrange multiplier vector for the bound and general constraints) such that
 $gx=r′xTλ=I JxT GTλ,$ (4)
where $g$ is the gradient of $f$ evaluated at $x$;
(c) the Lagrange multiplier ${\lambda }_{j}$ associated with the $j$th constraint satisfies ${\lambda }_{j}=0$ if ${l}_{j}<{r}_{j}\left(x\right)<{u}_{j}$; ${\lambda }_{j}\ge 0$ if ${l}_{j}={r}_{j}\left(x\right)$; ${\lambda }_{j}\le 0$ if ${r}_{j}\left(x\right)={u}_{j}$; and ${\lambda }_{j}$ can have any value if ${l}_{j}={u}_{j}$.
An equivalent statement of the condition (4) is
 $ZTgx=0,$
where $Z$ is a matrix defined as follows. Consider the set $N$ of vectors orthogonal to the gradients of the active constraints, i.e.,
 $N=z ∣ rj′xz=0 for all j∈G.$
The columns of $Z$ may then be taken as any basis for the vector space $N$. The vector ${Z}^{\mathrm{T}}g$ is termed the reduced gradient of $f$ at $x$. Certain additional conditions must be satisfied in order for a first-order KKT point to be a solution of (1) (see Powell (1974)).
The basic structure of e04ug involves major and minor iterations. The major iterations generate a sequence of iterates $\left\{{x}_{k}\right\}$ that satisfy the linear constraints and converge to a point ${x}^{*}$ that satisfies the first-order KKT optimality conditions. At each iterate a QP subproblem is used to generate a search direction towards the next iterate (${x}_{k+1}$). The constraints of the subproblem are formed from the linear constraints $Gx-{s}_{L}=0$ and the nonlinear constraint linearization
 $Fxk+F′xkx-xk-sN=0,$
where ${F}^{\prime }\left({x}_{k}\right)$ denotes the Jacobian matrix, whose rows are the first partial derivatives of $F\left(x\right)$ evaluated at the point ${x}_{k}$. The QP constraints therefore comprise the $m$ linear constraints
 $F′xkx-sN-sL=-Fxk+F′xkxk,'xkGx-sN-sL=0,Fxk+F′xkxk$
where $x$ and $s={\left({s}_{N},{s}_{L}\right)}^{\mathrm{T}}$ are bounded above and below by $u$ and $l$ as before. If the $m$ by $n$ matrix $A$ and $m$ element vector $b$ are defined as
 $A=F′xkG and b=-Fxk+F′xkxk0,$
then the QP subproblem can be written as
 $minimizex,sqx subject to Ax-s=b, l≤xs≤u,$ (5)
where $q\left(x\right)$ is a quadratic approximation to a modified Lagrangian function (see Gill et al. (2002)).
The linear constraint matrix $A$ is stored in the arrays a, ha and ka (see [Parameters]). This allows you to specify the sparsity pattern of nonzero elements in ${F}^{\prime }\left(x\right)$ and $G$ and to identify any nonzero elements that remain constant throughout the minimization.
Solving the QP subproblem is itself an iterative procedure, with the minor iterations of an SQP method being the iterations of the QP method. At each minor iteration, the constraints $Ax-s=b$ are (conceptually) partitioned into the form
 $BxB+SxS+NxN=b,$
where the basis matrix $B$ is square and nonsingular. The elements of ${x}_{B}$, ${x}_{S}$ and ${x}_{N}$ are called the basic, superbasic and nonbasic variables respectively; 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 bounds, while the nonbasic variables will be equal to one of their upper or lower bounds. At each minor 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 QP objective function $q\left(x\right)$ or sum of infeasibilities (as appropriate). The basic variables are then adjusted in order to ensure that ($x,s$) continues to satisfy $Ax-s=b$. 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 if there are no nonlinear constraints in (1) and $f\left(x\right)$ is linear.
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}$ decreased by one.
Associated with each of the $m$ equality constraints $Ax-s=b$ 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 $q\left(x\right)$; the reduced gradients for the slack variables $s$ are the dual variables $\pi$. The QP subproblem (5) 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 other variables (including superbasics). In practice, an approximate QP solution is found by slightly relaxing these conditions on ${d}_{j}$ (see the description of the optional parameter Minor Optimality Tolerance).
After a QP subproblem has been solved, new estimates of the solution to (1) are computed using a linesearch on the augmented Lagrangian merit function
 $Mx,s,π=fx-πTFx-sN+12Fx-sNTDFx-sN,$ (6)
where $D$ is a diagonal matrix of penalty parameters. If (${x}_{k},{s}_{k},{\pi }_{k}$) denotes the current estimate of the solution and ($\stackrel{^}{x},\stackrel{^}{s},\stackrel{^}{\pi }$) denotes the optimal QP solution, the linesearch determines a step ${\alpha }_{k}$ (where $0<{\alpha }_{k}\le 1$) such that the new point
 $xk+1sk+1πk+1=xkskπk+αkx^k-xks^k-skπ^k-πk$
produces a sufficient decrease in the merit function (6). When necessary, the penalties in $D$ are increased by the minimum-norm perturbation that ensures descent for $\mathcal{M}$ (see Gill et al. (1992)). As in e04wd, ${s}_{N}$ is adjusted to minimize the merit function as a function of $s$ before the solution of the QP subproblem. Further details can be found in Eldersveld (1991) and Gill et al. (1986).

# Treatment of Constraint Infeasibilities

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

# Description of Monitoring Information

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