E04 Chapter Contents
E04 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentE04MWF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

E04MWF writes data for sparse linear programming, mixed integer linear programming, quadratic programming or mixed integer quadratic programming problems to a file in MPS format.

## 2  Specification

 SUBROUTINE E04MWF ( OUTFILE, N, M, NNZC, NNZA, NCOLH, NNZH, LINTVAR, IDXC, C, IOBJ, A, IROWA, ICCOLA, BL, BU, PNAMES, NNAME, CRNAME, H, IROWH, ICCOLH, MINMAX, INTVAR, IFAIL)
 INTEGER OUTFILE, N, M, NNZC, NNZA, NCOLH, NNZH, LINTVAR, IDXC(NNZC), IOBJ, IROWA(NNZA), ICCOLA(N+1), NNAME, IROWH(NNZH), ICCOLH(NCOLH+1), MINMAX, INTVAR(LINTVAR), IFAIL REAL (KIND=nag_wp) C(NNZC), A(NNZA), BL(N+M), BU(N+M), H(NNZH) CHARACTER(8) PNAMES(5), CRNAME(NNAME)

## 3  Description

E04MWF writes data for linear programming (LP) or quadratic programming (QP) problems (or their mixed integer variants) from an optimization problem to a MPS output file, see Section 3.1 in E04MXF for the format description. The problem is expected in the form
 $minimize x ⁡ cTx+12xTHx subject to l≤ x Ax ≤u.$
Where $n$ is the number of variables, $m$ is the number of general linear constraints, $A$ is the linear constraint matrix with dimension $m$ by $n$, the vectors $l$ and $u$ are the lower and upper bounds, respectively. $H$ is the Hessian matrix with dimension $n$ by $n$, however, only leading NCOLH columns might contain nonzero elements and the rest is assumed to be zero.
Note that the linear term of the objective function $c$ might be supplied either as C or via IOBJ. If C is supplied then IDXC contains the indices of the nonzero elements of sparse vector $c$, whereas if IOBJ is supplied (${\mathbf{IOBJ}}>0$), row IOBJ of matrix $A$ is a free row storing the nonzero elements of $c$.
Note: that this routine uses fixed MPS format, see IBM (1971).

## 4  References

IBM (1971) MPSX – Mathematical programming system Program Number 5734 XM4 IBM Trade Corporation, New York

## 5  Arguments

1:     $\mathrm{OUTFILE}$ – INTEGERInput
On entry: the ID of the file to store the problem data as associated by a call to X04ACF.
Constraint: ${\mathbf{OUTFILE}}\ge 0$.
2:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the number of variables in the problem.
Constraint: ${\mathbf{N}}\ge 1$.
3:     $\mathrm{M}$ – INTEGERInput
On entry: $m$, the number of constraints in the problem. This is the number of rows in the linear constraint matrix $A$, including the free row (if any; see IOBJ).
Constraint: ${\mathbf{M}}\ge 0$.
4:     $\mathrm{NNZC}$ – INTEGERInput
On entry: the number of nonzero elements in the sparse vector $c$.
If ${\mathbf{NNZC}}=0$, the vector $c$ is considered empty and the arrays IDXC and C will not be referenced. In this case the linear term of the objective function, if any, might be provided via IOBJ.
Constraints:
• ${\mathbf{NNZC}}\ge 0$;
• if ${\mathbf{NNZC}}>0$, ${\mathbf{IOBJ}}=0$.
5:     $\mathrm{NNZA}$ – INTEGERInput
On entry: the number of nonzero elements in matrix $A$.
If ${\mathbf{NNZA}}=0$, matrix $A$ is considered empty, arrays A and IROWA will not be referenced, and ICCOLA should be the array of $1$.
Constraint: ${\mathbf{NNZA}}\ge 0$.
6:     $\mathrm{NCOLH}$ – INTEGERInput
On entry: the number of leading nonzero columns of the Hessian matrix $H$.
If ${\mathbf{NCOLH}}=0$, the quadratic term $H$ of the objective function is considered zero (e.g., LP problems), and arrays H, IROWH and ICCOLH will not be referenced.
Constraint: $0\le {\mathbf{NCOLH}}\le {\mathbf{N}}$.
7:     $\mathrm{NNZH}$ – INTEGERInput
On entry: the number of nonzero elements of the Hessian matrix $H$.
Constraints:
• if ${\mathbf{NCOLH}}>0$, ${\mathbf{NNZH}}>0$;
• otherwise ${\mathbf{NNZH}}=0$.
8:     $\mathrm{LINTVAR}$ – INTEGERInput
On entry: the number of integer variables in the problem.
If ${\mathbf{LINTVAR}}=0$, all variables are considered continuous and array INTVAR will not be referenced.
Constraint: ${\mathbf{LINTVAR}}\ge 0$.
9:     $\mathrm{IDXC}\left({\mathbf{NNZC}}\right)$ – INTEGER arrayInput
10:   $\mathrm{C}\left({\mathbf{NNZC}}\right)$ – REAL (KIND=nag_wp) arrayInput
On entry: the nonzero elements of sparse vector $c$. ${\mathbf{IDXC}}\left(\mathit{i}\right)$ must contain the index of ${\mathbf{C}}\left(\mathit{i}\right)$ in the vector, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZC}}$.
The elements are stored in ascending order.
Constraints:
• $1\le {\mathbf{IDXC}}\left(\mathit{i}\right)\le {\mathbf{N}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZC}}$;
• ${\mathbf{IDXC}}\left(\mathit{i}\right)<{\mathbf{IDXC}}\left(\mathit{i}+1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZC}}$.
11:   $\mathrm{IOBJ}$ – INTEGERInput
On entry: if ${\mathbf{IOBJ}}>0$, row IOBJ of $A$ is a free row containing the nonzero coefficients of the linear terms of the objective function. In this case NNZC is set to $0$.
If ${\mathbf{IOBJ}}=0$, there is no free row in $A$, and the linear terms might be supplied in array C.
Constraint: if ${\mathbf{IOBJ}}>0$, ${\mathbf{NNZC}}=0$.
12:   $\mathrm{A}\left({\mathbf{NNZA}}\right)$ – REAL (KIND=nag_wp) arrayInput
13:   $\mathrm{IROWA}\left({\mathbf{NNZA}}\right)$ – INTEGER arrayInput
14:   $\mathrm{ICCOLA}\left({\mathbf{N}}+1\right)$ – INTEGER arrayInput
On entry: the nonzero elements of matrix $A$ in compressed column storage (see Section 2.1.3 in the F11 Chapter Introduction). Arrays IROWA and A store the row indices and the values of the nonzero elements, respectively. The elements are sorted by columns and within each column in nondecreasing order. Duplicate entries are not allowed. ICCOLA contains the (one-based) indices to the beginning of each column in A and IROWA.
If ${\mathbf{NNZA}}=0$, A and IROWA are not referenced.
Constraints:
• $1\le {\mathbf{IROWA}}\left(\mathit{i}\right)\le {\mathbf{M}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZA}}$;
• ${\mathbf{ICCOLA}}\left(1\right)=1$;
• ${\mathbf{ICCOLA}}\left(\mathit{i}\right)\le {\mathbf{ICCOLA}}\left(\mathit{i}+1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$;
• ${\mathbf{ICCOLA}}\left({\mathbf{N}}+1\right)={\mathbf{NNZA}}+1$.
15:   $\mathrm{BL}\left({\mathbf{N}}+{\mathbf{M}}\right)$ – REAL (KIND=nag_wp) arrayInput
16:   $\mathrm{BU}\left({\mathbf{N}}+{\mathbf{M}}\right)$ – REAL (KIND=nag_wp) arrayInput
On entry: BL and BU contains the lower bounds $l$ and the upper bounds $u$, respectively.
The first N elements refer to the bounds for the variables $x$ and the rest to the bounds for the linear constraints (including the objective row IOBJ if present).
To specify a nonexistent lower bound (i.e., ${l}_{j}=-\mathrm{inf}$), set ${\mathbf{BL}}\left(j\right)\le {-10}^{20}$; to specify a nonexistent upper bound, set ${\mathbf{BU}}\left(j\right)\ge {10}^{20}$.
Constraints:
• ${\mathbf{BL}}\left(\mathit{j}\right)\le {\mathbf{BU}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}+{\mathbf{M}}$;
• ${\mathbf{BL}}\left(\mathit{j}\right)<{10}^{20}$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}+{\mathbf{M}}$;
• ${\mathbf{BU}}\left(\mathit{j}\right)>-{10}^{20}$, for $\mathit{j}=1,2,\dots ,{\mathbf{N}}+{\mathbf{M}}$;
• if ${\mathbf{IOBJ}}>0$, ${\mathbf{BL}}\left({\mathbf{IOBJ}}+{\mathbf{N}}\right)\le -{10}^{20}$ and ${\mathbf{BU}}\left({\mathbf{IOBJ}}+{\mathbf{N}}\right)\ge {10}^{20}$.
17:   $\mathrm{PNAMES}\left(5\right)$ – CHARACTER(8) arrayInput
On entry: a set of names associated with the MPSX form of the problem.
The names can be composed only from ‘printable’ characters (ASCII codes between $32$ and $126$).
If any of the names are blank, the default name is used.
${\mathbf{PNAMES}}\left(1\right)$
Contains the name of the problem.
${\mathbf{PNAMES}}\left(2\right)$
Contains the name of the objective row if the objective is provided in C instead of IOBJ and all names CRNAME are given. The name must be nonempty and unique. In all other cases ${\mathbf{PNAMES}}\left(2\right)$ is not used.
${\mathbf{PNAMES}}\left(3\right)$
Contains the name of the RHS set.
${\mathbf{PNAMES}}\left(4\right)$
Contains the name of the RANGE.
${\mathbf{PNAMES}}\left(5\right)$
Contains the name of the BOUNDS.
18:   $\mathrm{NNAME}$ – INTEGERInput
On entry: the number of column (i.e., variable) and row names supplied in the array CRNAME.
If ${\mathbf{NNAME}}=0$, the names are automatically generated and the array CRNAME is not referenced.
Constraint: ${\mathbf{NNAME}}=0$ or ${\mathbf{N}}+{\mathbf{M}}$.
19:   $\mathrm{CRNAME}\left({\mathbf{NNAME}}\right)$ – CHARACTER(8) arrayInput
On entry: the names of all the variables and constraints in the problem in that order.
The names can be composed only from 'printable' characters and must be unique.
20:   $\mathrm{H}\left({\mathbf{NNZH}}\right)$ – REAL (KIND=nag_wp) arrayInput
21:   $\mathrm{IROWH}\left({\mathbf{NNZH}}\right)$ – INTEGER arrayInput
22:   $\mathrm{ICCOLH}\left({\mathbf{NCOLH}}+1\right)$ – INTEGER arrayInput
On entry: the nonzero elements of the Hessian matrix $H$ in compressed column storage (see Section 2.1.3 in the F11 Chapter Introduction). The Hessian matrix, $H$, is symmetric and its elements are stored in a lower triangular matrix.
Arrays IROWH and H store the row indices and the values of the nonzero elements, respectively. The elements are sorted by columns and within each column in nondecreasing order. Duplicate entries are not allowed. ICCOLH contains the (one-based) indices to the beginning of each column in H and IROWH.
If ${\mathbf{NCOLH}}=0$, H is not referenced.
Constraints:
• $1\le {\mathbf{IROWH}}\left(\mathit{i}\right)\le {\mathbf{NCOLH}}$, for $\mathit{i}=1,2,\dots ,{\mathbf{NNZH}}$;
• ${\mathbf{ICCOLH}}\left(1\right)=1$;
• ${\mathbf{ICCOLH}}\left(\mathit{i}\right)\le {\mathbf{ICCOLH}}\left(\mathit{i}+1\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{NCOLH}}$;
• ${\mathbf{ICCOLH}}\left({\mathbf{NCOLH}}+1\right)={\mathbf{NNZH}}+1$.
23:   $\mathrm{MINMAX}$ – INTEGERInput
On entry: MINMAX defines the direction of optimization problem.
${\mathbf{MINMAX}}=-1$
Minimization.
${\mathbf{MINMAX}}=1$
Maximization.
Constraint: ${\mathbf{MINMAX}}=-1$ or $1$.
24:   $\mathrm{INTVAR}\left({\mathbf{LINTVAR}}\right)$ – INTEGER arrayInput
On entry: INTVAR contains the indices $k$ of variables ${x}_{k}$ which are defined as integers. Duplicate indices are not allowed.
If ${\mathbf{LINTVAR}}=0$, INTVAR is not referenced.
Constraint: $1\le {\mathbf{INTVAR}}\left(\mathit{j}\right)\le {\mathbf{N}}$, for $\mathit{j}=1,2,\dots ,{\mathbf{LINTVAR}}$.
25:   $\mathrm{IFAIL}$ – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=1$
On entry, ${\mathbf{OUTFILE}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{OUTFILE}}\ge 0$.
${\mathbf{IFAIL}}=2$
On entry, ${\mathbf{M}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{M}}\ge 0$.
On entry, ${\mathbf{N}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{N}}\ge 1$.
${\mathbf{IFAIL}}=3$
On entry, ${\mathbf{LINTVAR}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{LINTVAR}}\ge 0$.
On entry, ${\mathbf{NNAME}}=〈\mathit{\text{value}}〉$, ${\mathbf{N}}=〈\mathit{\text{value}}〉$ and ${\mathbf{M}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{NNAME}}=0$ or ${\mathbf{N}}+{\mathbf{M}}$.
On entry, ${\mathbf{NNZA}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{NNZA}}\ge 0$.
On entry, ${\mathbf{NNZC}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{NNZC}}\ge 0$.
${\mathbf{IFAIL}}=4$
On entry, ${\mathbf{NCOLH}}=〈\mathit{\text{value}}〉$ and ${\mathbf{N}}=〈\mathit{\text{value}}〉$.
Constraint: $0\le {\mathbf{NCOLH}}\le {\mathbf{N}}$.
On entry, ${\mathbf{NCOLH}}=〈\mathit{\text{value}}〉$ and ${\mathbf{NNZH}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{NCOLH}}>0$, ${\mathbf{NNZH}}>0$.
On entry, ${\mathbf{NCOLH}}=〈\mathit{\text{value}}〉$ and ${\mathbf{NNZH}}=〈\mathit{\text{value}}〉$.
Constraint: if ${\mathbf{NCOLH}}=0$, ${\mathbf{NNZH}}=0$ .
${\mathbf{IFAIL}}=5$
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{IDXC}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{IDXC}}\left(j+1\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{IDXC}}\left(j\right)<{\mathbf{IDXC}}\left(j+1\right)$.
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{IDXC}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{N}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{IDXC}}\left(\mathit{j}\right)\le {\mathbf{N}}$.
${\mathbf{IFAIL}}=6$
On entry, ${\mathbf{MINMAX}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{MINMAX}}=-1$ or $1$.
${\mathbf{IFAIL}}=7$
On entry, ${\mathbf{IOBJ}}=〈\mathit{\text{value}}〉$ and ${\mathbf{M}}=〈\mathit{\text{value}}〉$.
Constraint: $0\le {\mathbf{IOBJ}}\le {\mathbf{M}}$.
On entry, ${\mathbf{IOBJ}}=〈\mathit{\text{value}}〉$ and ${\mathbf{NNZC}}=〈\mathit{\text{value}}〉$.
Constraint: at most one of IOBJ or NNZC may be nonzero.
${\mathbf{IFAIL}}=8$
On entry, ${\mathbf{IOBJ}}=〈\mathit{\text{value}}〉$, ${\mathbf{BL}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{BU}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$, if ${\mathbf{IOBJ}}>0$ the bounds must be infinite.
Constraints: ${\mathbf{BL}}\left(\mathit{j}\right)\le -\text{1E+20}$, ${\mathbf{BU}}\left(\mathit{j}\right)\ge \text{1E+20}$.
On entry, $\mathit{j}=〈\mathit{\text{value}}〉$, ${\mathbf{BL}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{BU}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$, the integer variable $\mathit{j}$ requires at least one bound finite.
Constraint: at least one of the following conditions must be met for integer variable j: ${\mathbf{BL}}\left(\mathit{j}\right)>\text{−1E+20}$, ${\mathbf{BU}}\left(\mathit{j}\right)<\text{1E+20}$.
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{BL}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{BU}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ are incorrect.
Constraint: ${\mathbf{BL}}\left(\mathit{j}\right)\le {\mathbf{BU}}\left(\mathit{j}\right)$.
On entry, $j=〈\mathit{\text{value}}〉$ and ${\mathbf{BL}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$, ${\mathbf{BL}}\left(\mathit{j}\right)$ is incorrect.
Constraint: ${\mathbf{BL}}\left(\mathit{j}\right)<\text{1E+20}$.
On entry, $j=〈\mathit{\text{value}}〉$ and ${\mathbf{BU}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$, ${\mathbf{BU}}\left(\mathit{j}\right)$ is incorrect.
Constraint: ${\mathbf{BU}}\left(\mathit{j}\right)>-\text{1E+20}$.
${\mathbf{IFAIL}}=9$
On entry, ${\mathbf{CRNAME}}\left(\mathit{j}\right)$ for $j=〈\mathit{\text{value}}〉$ has been already used.
Constraint: the names in CRNAME must be unique.
On entry, ${\mathbf{CRNAME}}\left(\mathit{j}\right)$ for $j=〈\mathit{\text{value}}〉$ is incorrect.
Constraint: the names in CRNAME must consist only of printable characters.
On entry, ${\mathbf{PNAMES}}\left(\mathit{j}\right)$ for $j=〈\mathit{\text{value}}〉$ is incorrect.
Constraint: the names in PNAMES must consist only of printable characters.
The name specified in ${\mathbf{PNAMES}}\left(2\right)$ is empty or has been already used among row names.
Constraint: the names in ${\mathbf{PNAMES}}\left(2\right)$ must be unique and nonempty if CRNAME is provided and ${\mathbf{NNZC}}>0$.
${\mathbf{IFAIL}}=10$
On entry, ${\mathbf{INTVAR}}\left(〈\mathit{\text{value}}〉\right)={\mathbf{INTVAR}}\left(〈\mathit{\text{value}}〉\right)=$ $〈\mathit{\text{value}}〉$.
Constraint: all entries in INTVAR must be unique.
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{INTVAR}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{LINTVAR}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{INTVAR}}\left(\mathit{j}\right)\le {\mathbf{LINTVAR}}$.
${\mathbf{IFAIL}}=11$
On entry, $i=〈\mathit{\text{value}}〉$, ${\mathbf{IROWA}}\left(\mathit{i}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{M}}=〈\mathit{\text{value}}〉$.
Constraint: $1\le {\mathbf{IROWA}}\left(\mathit{i}\right)\le {\mathbf{M}}$.
On entry, more than one element of A has row index $〈\mathit{\text{value}}〉$ and column index $〈\mathit{\text{value}}〉$.
Constraint: each element of A must have a unique row and column index.
${\mathbf{IFAIL}}=12$
On entry, ${\mathbf{ICCOLA}}\left(1\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ICCOLA}}\left(1\right)=1$.
On entry, ${\mathbf{ICCOLA}}\left({\mathbf{N}}+1\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{NNZA}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ICCOLA}}\left({\mathbf{N}}+1\right)={\mathbf{NNZA}}+1$.
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{ICCOLA}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{ICCOLA}}\left(j+1\right)=〈\mathit{\text{value}}〉$, the values of ICCOLA must be nondecreasing.
Constraint: ${\mathbf{ICCOLA}}\left(\mathit{j}\right)\le {\mathbf{ICCOLA}}\left(j+1\right)$.
${\mathbf{IFAIL}}=13$
On entry, $j=〈\mathit{\text{value}}〉$, $i=〈\mathit{\text{value}}〉$, ${\mathbf{NCOLH}}=〈\mathit{\text{value}}〉$ and ${\mathbf{IROWH}}\left(i\right)=〈\mathit{\text{value}}〉$
Constraint: $j\le {\mathbf{IROWH}}\left(\mathit{i}\right)\le {\mathbf{NCOLH}}$ (within the lower triangle).
On entry, more than one element of H has row index $〈\mathit{\text{value}}〉$ and column index $〈\mathit{\text{value}}〉$.
Constraint: each element of H must have a unique row and column index.
${\mathbf{IFAIL}}=14$
On entry, ${\mathbf{ICCOLH}}\left(1\right)=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ICCOLH}}\left(1\right)=1$.
On entry, ${\mathbf{ICCOLH}}\left({\mathbf{NCOLH}}+1\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{NNZH}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{ICCOLH}}\left({\mathbf{NCOLH}}+1\right)={\mathbf{NNZH}}+1$.
On entry, $j=〈\mathit{\text{value}}〉$, ${\mathbf{ICCOLH}}\left(\mathit{j}\right)=〈\mathit{\text{value}}〉$ and ${\mathbf{ICCOLH}}\left(j+1\right)=〈\mathit{\text{value}}〉$, the values of ICCOLH must be nondecreasing.
Constraint: ${\mathbf{ICCOLH}}\left(\mathit{j}\right)\le {\mathbf{ICCOLH}}\left(j+1\right)$.
${\mathbf{IFAIL}}=15$
An error occurred when writing to file.
${\mathbf{IFAIL}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{IFAIL}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{IFAIL}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

Not applicable.

## 8  Parallelism and Performance

E04MWF is not threaded in any implementation.

None.

## 10  Example

This example shows how to store an optimization problem to a file in MPS format after it has been solved by E04NQF. The problem is a minimization of the quadratic function $f\left(x\right)={c}^{\mathrm{T}}x+\frac{1}{2}{x}^{\mathrm{T}}Hx$, where
 $c=-200.0,-2000.0,-2000.0,-2000.0,-2000.0,400.0,400.0T$
 $H= 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 2 2 0 0 0 0 0 2 2 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 2 2 0 0 0 0 0 2 2$
subject to the bounds
 $000≤x1≤0200 000≤x2≤2500 400≤x3≤0800 100≤x4≤0700 000≤x5≤1500 000≤x6≤1500 000≤x7≤1500$
and to the linear constraints
 $x1 + x2 + x3 + x4 + x5 + x6 + x7 = 2000 0.15x1 + 0.04x2 + 0.02x3 + 0.04x4 + 0.02x5 + 0.01x6 + 0.03x7 ≤ 60 0.03x1 + 0.05x2 + 0.08x3 + 0.02x4 + 0.06x5 + 0.01x6 ≤ 100 0.02x1 + 0.04x2 + 0.01x3 + 0.02x4 + 0.02x5 ≤ 40 0.02x1 + 0.03x2 + 0.01x5 ≤ 30 1500 ≤ 0.70x1 + 0.75x2 + 0.80x3 + 0.75x4 + 0.80x5 + 0.97x6 250 ≤ 0.02x1 + 0.06x2 + 0.08x3 + 0.12x4 + 0.02x5 + 0.01x6 + 0.97x7 ≤ 300$
The initial point, which is infeasible, is
 $x0=0.0,0.0,0.0,0.0,0.0,0.0,0.0T.$
The optimal solution (to five figures) is
 $x*=0.0,349.40,648.85,172.85,407.52,271.36,150.02T.$
The generated file is called e04mwfe.mps.

### 10.1  Program Text

Program Text (e04mwfe.f90)

### 10.2  Program Data

Program Data (e04mwfe.d)

### 10.3  Program Results

Program Results (e04mwfe.r)