## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

e04saf initializes a data structure for the NAG optimization modelling suite from a data file for problems such as, Linear Programming (LP), Quadratic Programming (QP), Second-order Cone Programming (SOCP), or linear Semidefinite Programming (SDP).

## 2Specification

Fortran Interface
 Subroutine e04saf ( file,
 Integer, Intent (Inout) :: ifail Integer, Intent (Out) :: pinfo(100) Character (*), Intent (In) :: file, ftype Type (c_ptr), Intent (Out) :: handle
#include <nag.h>
 void e04saf_ (void **handle, const char *file, const char *ftype, Integer pinfo[], Integer *ifail, const Charlen length_file, const Charlen length_ftype)
The routine may be called by the names e04saf or nagf_opt_handle_read_file.

## 3Description

e04saf reads a file in one of the supported file formats and stores the data in a new handle. The supported formats are MPS and its derivatives (for LP, QP, SOCP) and sparse SDPA for linear semidefinite programming problems. See Section 9 for more details on the supported file formats. It might be useful to refer to the file format you use to fully understand the possible error messages. Once the file is successfuly processed, the problem can be solved by a compatible solver from the suite or queried via the printing routine e04ryf. Once the problem is not needed any more, e04rzf should be called to destroy the handle and deallocate the memory held within. See Section 3.1 in the E04 Chapter Introduction for more details about the NAG optimization modelling suite. Also see Section 2.2 in the E04 Chapter Introduction for more details on the standard formulations of the optimization problems (e.g., LP, QP, SOCP and SDP) for better understanding on the notations used in this document.

## 4References

Borchers B (1999) SDPLIB 1.2, A Library of semidefinite programming test problems Optimization Methods and Software 11(1) 683–690 http://euler.nmt.edu/~brian/sdplib/
Fujisawa K, Kojima M and Nakata K (1998) SDPA (Semidefinite Programming Algorithm) User's Manual Technical Report B-308 Department of Mathematical and Computing Sciences, Tokyo Institute of Technology.
IBM (1971) MPSX – Mathematical programming system Program Number 5734 XM4 IBM Trade Corporation, New York

## 5Arguments

1: $\mathbf{handle}$Type (c_ptr) Output
Note: handle does not need to be set on input.
On exit: holds a handle to the internal data structure. It must not be changed between calls to the NAG optimization modelling suite.
2: $\mathbf{file}$Character(*) Input
On entry: the name of the file to be opened.
Constraint: must contain a valid filename for the computer system being used.
3: $\mathbf{ftype}$Character(*) Input
On entry: the expected file format of the input file. ftype is case insensitive.
${\mathbf{ftype}}=\text{'MPS'}$ or $\text{'M'}$
The input file is in MPS format.
${\mathbf{ftype}}=\text{'SDPA'}$ or $\text{'S'}$
The input file is in SDPA format.
Constraint: ${\mathbf{ftype}}=\text{'MPS'}$, $\text{'M'}$, $\text{'SDPA'}$ or $\text{'S'}$.
4: $\mathbf{pinfo}\left(100\right)$Integer array Output
On exit: problem sizes and statistics as given in the table below:
 $1$ Number of variables (nvar). $2$ Number of integer variables. $3$ Number of binary variables. $11$ Number of Lagrange multipliers (dual variables) for the bound constraints and linear constraints (nnzu). $12$ Number of Lagrange multipliers (dual variables) for the cone constraints (nnzuc). $13$ Number of nonzeros in all Lagrange multipliers for the matrix constraints (nnzua). $21$ Flag indicating the objective function type, $0$: no objective, $1$: linear objective, $2$: quadratic without linear term, $3$: quadratic with linear term, $4$: general nonlinear, $5$: nonlinear least square with dense Jacobian, $6$: nonlinear least square with sparse Jacobian. $22$ Number of residuals defined in a nonlinear least square problem. $31$ Definition of box constraints, $0$: not defined, $1$: defined. $32$ Number of linear constraints. $33$ Number of nonlinear constraints. $34$ Definition of Hessian for nonlinear objective and constraints, $0$: not defined, $-1$: defined as Lagrangian, $1$: defined as individual Hessians of the objective and the constraints. $41$ Number of cone constraints. $42$ Number of matrix inequality constraints. $43$ Number of quadratic constraints. otherwise Reserved for future use.
nvar, nnzu, nnzuc and nnzua define the problem size and are required by other routines such as e04mtf, e04ptf and e04svf in the optimization suite.
5: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ 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).

## 6Error 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{ftype}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ftype}}=\text{'MPS'}$, $\text{'M'}$, $\text{'SDPA'}$ or $\text{'S'}$.
${\mathbf{ifail}}=2$
Cannot open file $⟨\mathit{\text{value}}⟩$ for reading.
${\mathbf{ifail}}=3$
Cannot close file.
${\mathbf{ifail}}=4$
The input file seems to be empty. No data was read.
${\mathbf{ifail}}=5$
Reading from the file caused an unknown error on line $⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=50$
The token on line $⟨\mathit{\text{value}}⟩$ at position $⟨\mathit{\text{value}}⟩$ to $⟨\mathit{\text{value}}⟩$ was not recognized as a valid integer.
${\mathbf{ifail}}=51$
The token on line $⟨\mathit{\text{value}}⟩$ at position $⟨\mathit{\text{value}}⟩$ to $⟨\mathit{\text{value}}⟩$ was not recognized as a valid real number.
${\mathbf{ifail}}=52$
The token on line $⟨\mathit{\text{value}}⟩$ starting at position $⟨\mathit{\text{value}}⟩$ was too long and was not recognized.
${\mathbf{ifail}}=53$
An invalid number of variables was given on line $⟨\mathit{\text{value}}⟩$.
The number stated there is $⟨\mathit{\text{value}}⟩$ and needs to be at least $1$.
${\mathbf{ifail}}=54$
An invalid number of blocks was given on line $⟨\mathit{\text{value}}⟩$.
The number stated there is $⟨\mathit{\text{value}}⟩$ and needs to be at least $1$.
${\mathbf{ifail}}=55$
An invalid size of the block number $⟨\mathit{\text{value}}⟩$ was given on line $⟨\mathit{\text{value}}⟩$.
The number stated there is $⟨\mathit{\text{value}}⟩$ and needs to be nonzero.
${\mathbf{ifail}}=56$
Not enough data was given on line $⟨\mathit{\text{value}}⟩$ specifying block sizes.
Expected ${m}_{A}$ tokens but found only $⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=57$
Not enough data was given on line $⟨\mathit{\text{value}}⟩$ specifying the objective function.
Expected $n$ tokens but found only $⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=58$
Not enough data was given on line $⟨\mathit{\text{value}}⟩$ specifying nonzero matrix elements.
Expected $⟨\mathit{\text{value}}⟩$ tokens but found only $⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=59$
Invalid structural data found on line $⟨\mathit{\text{value}}⟩$.
The given matrix number is out of bounds. Its value $⟨\mathit{\text{value}}⟩$ must be between $0$ and $n$ (inclusive).
${\mathbf{ifail}}=60$
Invalid structural data found on line $⟨\mathit{\text{value}}⟩$.
The given block number is out of bounds. Its value $⟨\mathit{\text{value}}⟩$ must be between $1$ and ${m}_{A}$ (inclusive).
${\mathbf{ifail}}=61$
Invalid structural data found on line $⟨\mathit{\text{value}}⟩$.
The given row index is out of bounds, it must respect the size of the block. Its value $⟨\mathit{\text{value}}⟩$ must be between $⟨\mathit{\text{value}}⟩$ and $⟨\mathit{\text{value}}⟩$ (inclusive).
${\mathbf{ifail}}=62$
Invalid structural data found on line $⟨\mathit{\text{value}}⟩$.
The given column index is out of bounds, it must respect the size of the block. Its value $⟨\mathit{\text{value}}⟩$ must be between $⟨\mathit{\text{value}}⟩$ and $⟨\mathit{\text{value}}⟩$ (inclusive).
${\mathbf{ifail}}=63$
Invalid structural data found on line $⟨\mathit{\text{value}}⟩$.
The specified nonzero element is not in the upper triangle.
The row index is $⟨\mathit{\text{value}}⟩$ and column index is $⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=64$
Invalid structural data found on line $⟨\mathit{\text{value}}⟩$.
The specified element belongs to a diagonal block but is not diagonal.
The row index is $⟨\mathit{\text{value}}⟩$ and column index is $⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=65$
An entry in the constraints with $\mathbit{matno}=⟨\mathit{\text{value}}⟩$, $\mathbit{blkno}=⟨\mathit{\text{value}}⟩$, row index $⟨\mathit{\text{value}}⟩$ and column index $⟨\mathit{\text{value}}⟩$ was defined more than once. All entries need to be unique.
${\mathbf{ifail}}=66$
A premature end of the input stream. The part defining the dimensions of the blocks was not found.
A premature end of the input stream. The part defining the nonzero entries was not found.
A premature end of the input stream. The part defining the number of blocks was not found.
A premature end of the input stream. The part defining the number of variables was not found.
A premature end of the input stream. The part defining the objective function was not found.
${\mathbf{ifail}}=100$
Incorrect ordering of indicator lines.
OBJNAME indicator line found after ROWS indicator line.
${\mathbf{ifail}}=101$
Incorrect ordering of indicator lines.
COLUMNS indicator line found before ROWS indicator line.
${\mathbf{ifail}}=102$
Incorrect ordering of indicator lines.
RHS indicator line found before COLUMNS indicator line.
${\mathbf{ifail}}=103$
Incorrect ordering of indicator lines.
RANGES indicator line found before RHS indicator line.
${\mathbf{ifail}}=104$
Incorrect ordering of indicator lines.
BOUNDS indicator line found before COLUMNS indicator line.
${\mathbf{ifail}}=105$
Incorrect ordering of indicator lines.
QUADOBJ indicator line found before BOUNDS indicator line.
${\mathbf{ifail}}=106$
Incorrect ordering of indicator lines.
QUADOBJ indicator line found before COLUMNS indicator line.
${\mathbf{ifail}}=107$
Incorrect ordering of indicator lines.
CSECTION indicator line found before COLUMNS indicator line.
${\mathbf{ifail}}=108$
Unknown indicator line ‘$⟨\mathit{\text{value}}⟩$’.
${\mathbf{ifail}}=109$
Indicator line ‘$⟨\mathit{\text{value}}⟩$’ has been found more than once in the MPS file.
${\mathbf{ifail}}=110$
End of file found before ENDATA indicator line.
${\mathbf{ifail}}=111$
${\mathbf{ifail}}=112$
An illegal line was detected in ‘$⟨\mathit{\text{value}}⟩$’ section.
This is neither a comment nor a valid data line.
${\mathbf{ifail}}=113$
Unknown inequality key ‘$⟨\mathit{\text{value}}⟩$’ in ROWS section.
Expected ‘N’, ‘G’, ‘L’ or ‘E’.
${\mathbf{ifail}}=114$
Empty ROWS section.
Neither the objective row nor the constraints were defined.
${\mathbf{ifail}}=115$
The supplied name in OBJNAME of the objective row was not found among the free rows in the ROWS section.
${\mathbf{ifail}}=116$
Illegal row name.
Row names must consist of printable characters only.
${\mathbf{ifail}}=117$
Illegal column name.
Column names must consist of printable characters only.
${\mathbf{ifail}}=118$
Row name ‘$⟨\mathit{\text{value}}⟩$’ has been defined more than once in the ROWS section.
${\mathbf{ifail}}=119$
Column ‘$⟨\mathit{\text{value}}⟩$’ has been defined more than once in the COLUMNS section. Column definitions must be continuous. (See Section 9.1.5).
${\mathbf{ifail}}=120$
Found 'INTORG' marker within 'INTORG' to 'INTEND' range.
${\mathbf{ifail}}=121$
Found 'INTEND' marker without previous marker being 'INTORG'.
${\mathbf{ifail}}=122$
Found 'INTORG' but not 'INTEND' before the end of the COLUMNS section.
${\mathbf{ifail}}=123$
Illegal marker type ‘$⟨\mathit{\text{value}}⟩$’.
Should be either 'INTORG' or 'INTEND'.
${\mathbf{ifail}}=124$
Unknown row name ‘$⟨\mathit{\text{value}}⟩$’ in $⟨\mathit{\text{value}}⟩$ section.
All row names must be specified in the ROWS section.
${\mathbf{ifail}}=125$
Unknown column name ‘$⟨\mathit{\text{value}}⟩$’ in $⟨\mathit{\text{value}}⟩$ section.
All column names must be specified in the COLUMNS section.
${\mathbf{ifail}}=126$
Inconsistent bounds for column ‘$⟨\mathit{\text{value}}⟩$’.
Inconsistent bounds for row ‘$⟨\mathit{\text{value}}⟩$’.
Unknown bound type ‘$⟨\mathit{\text{value}}⟩$’ in BOUNDS section.
Inconsistent bounds are reported when the lower bound is greater than or equal to $\text{1.0E+20}$ or the upper bound is less than or equal to $-\text{1.0E+20}$, or when the lower bound is greater than the upper bound. Any upper bound greater than or equal to $\text{1.0E+20}$ will be regarded as $+\infty$ (and similarly any lower bound less than or equal to $-\text{1.0E+20}$ will be regarded as $-\infty$).
${\mathbf{ifail}}=127$
More than one nonzero of $A$ has row name ‘$⟨\mathit{\text{value}}⟩$’ and column name ‘$⟨\mathit{\text{value}}⟩$’ in the COLUMNS section.
${\mathbf{ifail}}=128$
Field $⟨\mathit{\text{value}}⟩$ did not contain a number (see Section 9.1).
${\mathbf{ifail}}=129$
Both quadratic objective and cone constraints found, not supported.
${\mathbf{ifail}}=130$
Rotated second-order cone ‘$⟨\mathit{\text{value}}⟩$’ should have at least $3$ variables.
Second-order cone ‘$⟨\mathit{\text{value}}⟩$’ should have at least $2$ variables.
${\mathbf{ifail}}=131$
Unknown cone type ‘$⟨\mathit{\text{value}}⟩$’.
${\mathbf{ifail}}=132$
Illegal cone name.
Cone names must consist of printable characters only.
${\mathbf{ifail}}=133$
Cone name ‘$⟨\mathit{\text{value}}⟩$’ has been defined more than once.
${\mathbf{ifail}}=134$
Column name ‘$⟨\mathit{\text{value}}⟩$’ has been defined more than once in cone constraint.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

e04saf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
e04saf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

### 9.1MPS input format

The input file of data may only contain two types of lines:
1. 1.Indicator lines (specifying the type of data which is to follow).
2. 2.Data lines (specifying the actual data).
A section is a combination of an indicator line and its corresponding data line(s). Any characters beyond column 80 are ignored. Indicator lines must not contain leading blank characters (in other words they must begin in column 1). The following displays the order in which the indicator lines must appear in the file:
 NAME user-supplied name (optional) OBJSENSE (optional) data line OBJNAME (optional) data line ROWS data line(s) COLUMNS data line(s) RHS data line(s) RANGES (optional) data line(s) BOUNDS (optional) data line(s) QUADOBJ (optional) data line(s) CSECTION user-supplied name parameter cone type (optional) data line(s) ENDATA
A data line follows a fixed format, being made up of fields as defined below. The contents of the fields may have different significance depending upon the section of data in which they appear.
Field 1 Field 2 Field 3 Field 4 Field 5 Field 6
Columns $2–3$ $5–12$ $15–22$ $25–36$ $40–47$ $50–61$
Contents Code Name Name Value Name Value
Each name and code must consist of ‘printable’ characters only; names and codes supplied must match the case used in the following descriptions. Values are read using a field width of $12$. This allows values to be entered in several equivalent forms. For example, $1.2345678$, $\text{1.2345678E+0}$, $\text{123.45678E−2}$ and $\text{12345678E−07}$ all represent the same number. It is safest to include an explicit decimal point.
Lines with an asterisk ($*$) in column $1$ will be considered comment lines and will be ignored by the routine.
Columns outside the six fields must be blank, except for columns 72–80, whose contents are ignored by the routine. A non-blank character outside the predefined six fields and columns 72–80 is considered to be a major error (${\mathbf{ifail}}={\mathbf{112}}$; see Section 6), unless it is part of a comment.

#### 9.1.1NAME Section (optional)

The NAME section is the only section where the data must be on the same line as the indicator. The ‘user-supplied name’ must be in Field $3$ but may be blank.
Field Required Description
$3$ No Name of the problem

#### 9.1.2OBJSENSE Section (optional)

The data line in this section can be used to specify the sense of the objective function. If this section is present it must contain only one data line. If the section is missing or empty, minimization is assumed.
Field Required Description
$2$ No Sense of the objective function
Field $2$ may contain either MIN, MAX, MINIMIZE or MAXIMIZE.

#### 9.1.3OBJNAME Section (optional)

The data line in this section can be used to specify the name of a free row (see Section 9.1.4) that should be used as the objective function. If this section is present it must contain only one data line. If the section is missing or is empty, the first free row will be chosen instead.
Field Required Description
$2$ No Row name to be used as the objective function
Field $2$ must contain a valid row name.

#### 9.1.4ROWS Section

The data lines in this section specify unique row (constraint) names and their inequality types (i.e., unconstrained, $=$, $\ge$ or $\le$).
Field Required Description
$1$ Yes Inequality key
$2$ Yes Row name
The inequality key specifies each row's type. It must be E, G, L or N and can be in either column $2$ or $3$.
Inequality
Key

Description

$\mathbit{l}$

$\mathbit{u}$
N Free row $-\infty$ $\infty$
G Greater than or equal to finite $\infty$
L Less than or equal to $-\infty$ finite
E Equal to finite $l$
Row type N stands for ‘Not binding’. It can be used to define the objective row. The objective row is a free row that specifies the vector $c$ in the linear objective term ${c}^{\mathrm{T}}x$. If there is more than one free row, the first free row is chosen, unless another free row name is specified by OBJNAME (see Section 9.1.3). Note that $c$ is assumed to be zero if either the chosen row does not appear in the COLUMNS section (i.e., has no nonzero elements) or there are no free rows defined in the ROWS section.

#### 9.1.5COLUMNS Section

Data lines in this section specify the names to be assigned to the variables (columns) in the general linear constraint matrix $A$, and define, in terms of column vectors, the actual values of the corresponding matrix elements.
Field Required Description
$2$ Yes Column name
$3$ Yes Row name
$4$ Yes Value
$5$ No Row name
$6$ No Value
Each data line in the COLUMNS section defines the nonzero elements of $A$ or $c$. Any elements of $A$ or $c$ that are undefined are assumed to be zero. Nonzero elements of $A$ must be grouped by column, that is to say that all of the nonzero elements in the jth column of $A$ must be specified before those in the $\mathit{j}+1$th column, for $\mathit{j}=1,2,\dots ,n-1$. Rows may appear in any order within the column.
##### 9.1.5.1Integer Markers
For backward compatibility e04saf allows you to define the integer variables within the COLUMNS section using integer markers, although this is not recommended as markers can be treated differently by different MPS readers; you should instead define any integer variables in the BOUNDS section (see below). Each marker line must have the following format:
Field Required Description
$2$ No Marker ID
$3$ Yes Marker tag
$5$ Yes Marker type
The marker tag must be 'MARKER'. The marker type must be 'INTORG' to start reading integer variables and 'INTEND' to finish reading integer variables. This implies that a row cannot be named 'MARKER', 'INTORG' or 'INTEND'. Please note that both marker tag and marker type comprise of $8$ characters as a ' is the mandatory first and last character in the string. You may wish to have several integer marker sections within the COLUMNS section, in which case each marker section must begin with an 'INTORG' marker and end with an 'INTEND' marker and there should not be another marker between them.
Field 2 is ignored by e04saf. When an integer variable is declared it will keep its default bounds unless they are changed in the BOUNDS section. This may vary between different MPS readers.

#### 9.1.6RHS Section

This section specifies the right-hand side values (if any) of the general linear constraint matrix $A$.
Field Required Description
$2$ Yes RHS name
$3$ Yes Row name
$4$ Yes Value
$5$ No Row name
$6$ No Value
The MPS file may contain several RHS sets distinguished by RHS name. However only the first RHS set will be used.
Only the nonzero RHS elements need to be specified. Note that if an RHS is given to the objective function it will be ignored by e04saf. An RHS given to the objective function is dealt with differently by different MPS readers, therefore, it is safer not to define an RHS of the objective function in your MPS file. Note that this section may be empty, in which case the RHS vector is assumed to be zero.

#### 9.1.7RANGES Section (optional)

Ranges are used to modify the interpretation of constraints defined in the ROWS section (see Section 9.1.4) to the form $l\le Ax\le u$, where both $l$ and $u$ are finite. The range of the constraint is $r=u-l$.
Field Required Description
$2$ Yes Range name
$3$ Yes Row name
$4$ Yes Value
$5$ No Row name
$6$ No Value
The range of each constraint implies an upper and lower bound dependent on the inequality key of each constraint, on the RHS $b$ of the constraint (as defined in the RHS section), and on the range $r$.
Inequality
Key

Sign of $\text{}\mathbit{r}$

$\mathbit{l}$

$\mathbit{u}$
E $+$ $b$ $b+r$
E $-$ $b+r$ $b$
G $+/-$ $b$ $b+|r|$
L $+/-$ $b-|r|$ $b$
N $+/-$ $-\infty$ $+\infty$
Only the first range set will be used.

#### 9.1.8BOUNDS Section (optional)

These lines specify limits on the values of the variables (the quantities $l$ and $u$ in $l\le x\le u$). If a variable is not specified in the bound set then it is automatically assumed to lie between $0$ and $+\infty$.
Field Required Description
$1$ Yes Bound type identifier
$2$ Yes Bound name
$3$ Yes Column name
$4$ Yes/No Value
Note: Field $4$ is required only if the bound type identifier is one of UP, LO, FX, UI or LI in which case it gives the value $k$ below. If the bound type identifier is FR, MI, PL or BV, Field $4$ is ignored and it is recommended to leave it blank.
The table below describes the acceptable bound type identifiers and how each determines the variables' bounds.
Bound Type
Identifier

$\mathbit{l}$

$\mathbit{u}$
Integer
Variable?
UP unchanged $k$ No
LO $k$ unchanged No
FX $k$ $k$ No
FR $-\infty$ $\infty$ No
MI $-\infty$ unchanged No
PL unchanged $\infty$ No
BV $0$ $1$ Yes
UI unchanged $k$ Yes
LI $k$ unchanged Yes
Only the first bound set will be used.

The QUADOBJ section defines nonzero elements of the upper or lower triangle of the Hessian matrix $H$.
Field Required Description
$2$ Yes Column name (HColumn Index)
$3$ Yes Column name (HRow Index)
$4$ Yes Value
$5$ No Column name (HRow Index)
$6$ No Value
Each data line in the QUADOBJ section defines one (or optionally two) nonzero elements ${H}_{ij}$ of the matrix $H$. Each element ${H}_{ij}$ is given as a triplet of row index $i$, column index $j$ and a value. The column names (as defined in the COLUMNS section) are used to link the names of the variables and the indices $i$ and $j$.
It is only necessary to define either the upper or lower triangle of the $H$ matrix; either will suffice. Any elements that have been defined in the upper triangle of the matrix will be moved to the lower triangle of the matrix, then any repeated nonzeros will be summed.

#### 9.1.10CSECTION Section (optional)

Data lines in this section specify the cone constraint that has the following form in Second-order Cone Programming (SOCP).
 $xGi ∈ Kmi, i=1,…,r,$
where ${x}_{{G}^{i}}$ is a subvector of decision variables $x$ indexed by ${G}^{i}$, ${\mathcal{K}}^{{m}_{i}}$ is either quadratic cone or rotated quadratic cone of dimension ${m}_{i}$. This section may appear multiple times in the file to define various cone constraints $i=1,\dots ,r$.
The CSECTION has data on the same line as the indicator to store the name, parameter and type of the cone. Cone name is compulsory and must be in Field $3$. The possible cone type key is either QUAD for quadratic cone or RQUAD for rotated quadratic cone. The parameter of cone is not used in all cases.
Field Required Description
$3$ Yes Name of the cone
$4$ No Parameter of the cone
$5$ Yes Cone type
The data lines in this section specify variable names in the cone. Note that we require at least $2$ variables for quadratic cone and $3$ variables for rotated quadratic cone.
Field Required Description
$2$ Yes A valid variable name

### 9.2Sparse SDPA file format

The problem data is written in an ASCII input file in a SDPA sparse format which was first introduced in Fujisawa et al. (1998). In the description below we follow closely the specification from Borchers (1999).
The format is line oriented. If more elements are required on the line they need to be separated by a space, a tab, or any of the special characters ‘,’, ‘(’, ‘)’, ‘{’, or ‘}’. The file consists of six sections:
1. 1.Comments. The file can begin with arbitrarily many lines of comments. Each line of comments must begin with ‘"’ or ‘*’.
2. 2.The first line after the comments contains integer $n$, the number of variables. The rest of this line is ignored.
3. 3.The second line after the comments contains integer ${m}_{A}$, the number of blocks in the block diagonal structure of the matrices. Additional text on this line after ${m}_{A}$ is ignored.
4. 4.The third line after the comments contains a vector of ${m}_{A}$ integers that give the sizes of the individual blocks. Negative numbers may be used to indicate that a block is actually a diagonal submatrix. Thus a block size of ‘$-5$’ indicates a $5×5$ block in which only the diagonal elements are nonzero.
5. 5.The fourth line after the comments contains an $n$-dimensional real vector defining the objective function vector $c$.
6. 6.The remaining lines of the file contain nonzero entries in the constraint matrices, with one entry per line. The format for each line is
 $matno blkno i j entry$
where $\mathbit{matno}$ is the number $\left(0,\dots ,n\right)$ of the matrix to which this entry belongs and $\mathbit{blkno}$ specifies the block number $k=1,2,\dots ,{m}_{A}$ within this matrix. Together, they uniquely identify the block ${A}_{\mathbit{matno}}^{\mathbit{blkno}}$. Integers $\mathbit{i}$ and $\mathbit{j}$ are one-based indices which specify a location of the entry within the block. Note that since all matrices are assumed to be symmetric, only entries in the upper triangle of a matrix should be supplied. Finally, $\mathbit{entry}$ should give the real value of the entry in the matrix. Precisely, ${\left({A}_{\mathbit{matno}}^{\mathbit{blkno}}\right)}_{\mathbit{i}\mathbit{j}}={\left({A}_{\mathbit{matno}}^{\mathbit{blkno}}\right)}_{\mathbit{j}\mathbit{i}}=\mathbit{entry}$.
For SDPA format we use the word ‘token’ as a reference to a group of contiguous characters without a space or any other delimeters.

### 9.3Internal Changes

Internal changes have been made to this routine as follows:
• At Mark 27.1: Previously all integer and binary variables defined in the file were relaxed to continuous variables automatically. This behavior has been removed. Now e04saf reads integer and binary variables and stores them in the handle data structure.
For details of all known issues which have been reported for the NAG Library please refer to the Known Issues.

## 10Example

This example demonstrates how to load data of an SOCP problem from an MPS file and solve it using SOCP solver e04ptf.
The data file stores the following SOCP problem
 $minimize⁡ 10.0x1 + 20.0x2 + x3$
subject to the bounds
 $-2.0 ≤ x1 ≤ 2.0 -2.0 ≤ x2 ≤ 2.0$
the general linear constraints
 $-0.1x1 - 0.1x2 + x3 ≤ 1.5 1.0 ≤ -0.06x1 + x2 + x3$
and the cone constraint
 $(x3,x1,x2) ∈ K q 3 .$
The optimal solution (to five significant figures) is
 $x*=(-1.2682,-4.0843,1.3323)T,$
and the objective function value is $-19.518$.

### 10.1Program Text

Program Text (e04safe.f90)

### 10.2Program Data

Program Options (e04safe.opt)

### 10.3Program Results

Program Results (e04safe.r)