The MPS file format

 
MOSEK supports the standard MPS format with some extensions. For a detailed description of the MPS format see the book by Nazareth [2].

E.1.1 MPS file structure

The version of the MPS format supported by MOSEK allows specification of an optimization problem on the form
 \begin{array}{rcccl} \displaystyle{} l^{c} &\displaystyle{} \leq{}&\displaystyle{} A x + q(x) &\displaystyle{} \leq{}&\displaystyle{} u^{c}, \\[0pt] \displaystyle{} l^{x} &\displaystyle{} \leq{}&\displaystyle{} x &\displaystyle{} \leq{}&\displaystyle{} u^{x}, \\[0pt] \displaystyle{} &\displaystyle{} &\displaystyle{} x \in{}\mathcal{C}, &\displaystyle{} &\displaystyle{} \\[0pt] \displaystyle{} &\displaystyle{} &\displaystyle{} x_{\mathcal{J}} \mbox{ integer}, &\displaystyle{} &\displaystyle{} \\[0pt] \end{array} (E.1.1.1)
where
An MPS file with one row and one column can be illustrated like this:
  1. * 1 2 3 4 5 6 
  2. *23456789012345678901234567890123456789012345678901234567890 
  3. NAME [name] 
  4. OBJSENSE 
  5. [objsense] 
  6. OBJNAME 
  7. [objname] 
  8. ROWS 
  9. ? [cname1] 
  10. COLUMNS 
  11. [vname1] [cname1] [value1] [vname3] [value2] 
  12. RHS 
  13. [name] [cname1] [value1] [cname2] [value2] 
  14. RANGES 
  15. [name] [cname1] [value1] [cname2] [value2] 
  16. QSECTION [cname1] 
  17. [vname1] [vname2] [value1] [vname3] [value2] 
  18. BOUNDS 
  19. ?? [name] [vname1] [value1] 
  20. CSECTION [kname1] [value1] [ktype] 
  21. [vname1] 
  22. ENDATA 
Here the names in capitals are keywords of the MPS format and names in brackets are custom defined names or values. A couple of notes on the structure:
Fields:
All items surrounded by brackets appear in fields. The fields named “valueN” are numerical values. Hence, they must have the format
  1. [+|-]XXXXXXX.XXXXXX[[e|E][+|-]XXX] 
where
  1. X = [0|1|2|3|4|5|6|7|8|9]. 
Sections:
The MPS file consists of several sections where the names in capitals indicate the beginning of a new section. For example, COLUMNS denotes the beginning of the columns section.
Comments:
Lines starting with an “*” are comment lines and are ignored by MOSEK.
Keys:
The question marks represent keys to be specified later.
Extensions:
The sections QSECTION and CSECTION are MOSEK specific extensions of the MPS format.
The standard MPS format is a fixed format, i.e. everything in the MPS file must be within certain fixed positions. MOSEK also supports a free format. See Section E.1.5 for details.

E.1.1.1 Linear example lo1.mps

A concrete example of a MPS file is presented below:
  1. * File: lo1.mps 
  2. NAME lo1 
  3. OBJSENSE 
  4. MAX 
  5. ROWS 
  6. N obj 
  7. E c1  
  8. G c2  
  9. L c3  
  10. COLUMNS 
  11. x1 obj 3 
  12. x1 c1 3 
  13. x1 c2 2 
  14. x2 obj 1 
  15. x2 c1 1 
  16. x2 c2 1 
  17. x2 c3 2 
  18. x3 obj 5 
  19. x3 c1 2 
  20. x3 c2 3 
  21. x4 obj 1 
  22. x4 c2 1 
  23. x4 c3 3 
  24. RHS 
  25. rhs c1 30 
  26. rhs c2 15 
  27. rhs c3 25 
  28. RANGES 
  29. BOUNDS 
  30. UP bound x2 10 
  31. ENDATA 
Subsequently each individual section in the MPS format is discussed.

E.1.1.2 NAME

In this section a name ([name]) is assigned to the problem.

E.1.1.3 OBJSENSE (optional)

This is an optional section that can be used to specify the sense of the objective function. The OBJSENSE section contains one line at most which can be one of the following
  1. MIN 
  2. MINIMIZE 
  3. MAX 
  4. MAXIMIZE 
It should be obvious what the implication is of each of these four lines.

E.1.1.4 OBJNAME (optional)

This is an optional section that can be used to specify the name of the row that is used as objective function. The OBJNAME section contains one line at most which has the form
  1. objname  
objname should be a valid row name.

E.1.1.5 ROWS

A record in the ROWS section has the form
  1. ? [cname1] 
where the requirements for the fields are as follows:
Field
Starting
Maximum
Re-
Description
position
width
quired
?
2
1
Yes
Constraint key
[cname1]
5
8
Yes
Constraint name
Hence, in this section each constraint is assigned an unique name denoted by [cname1]. Please note that [cname1] starts in position 5 and the field can be at most 8 characters wide. An initial key (?) must be present to specify the type of the constraint. The key can have the values E, G, L, or N with the following interpretation:
Constraint
l_{i}^{c}
u_{i}^{c}
type
E
finite
l_{i}^{c}
G
finite
\infty{}
L
-\infty{}
finite
N
-\infty{}
\infty{}
In the MPS format an objective vector is not specified explicitly, but one of the constraints having the key N will be used as the objective vector c . In general, if multiple N type constraints are specified, then the first will be used as the objective vector c .

E.1.1.6 COLUMNS

In this section the elements of A are specified using one or more records having the form
  1. [vname1] [cname1] [value1] [cname2] [value2] 
where the requirements for each field are as follows:
Field
Starting
Maximum
Re-
Description
position
width
quired
[vname1]
5
8
Yes
Variable name
[cname1]
15
8
Yes
Constraint name
[value1]
25
12
Yes
Numerical value
[cname2]
40
8
No
Constraint name
[value2]
50
12
No
Numerical value
Hence, a record specifies one or two elements a_{ij} of A using the principle that [vname1] and [cname1] determines j and i respectively. Please note that [cname1] must be a constraint name specified in the ROWS section. Finally, [value1] denotes the numerical value of a_{ij} . Another optional element is specified by [cname2], and [value2] for the variable specified by [vname1]. Some important comments are:
  • All elements belonging to one variable must be grouped together.
  • Zero elements of A should not be specified.
  • At least one element for each variable should be specified.

E.1.1.7 RHS (optional)

A record in this section has the format
  1. [name] [cname1] [value1] [cname2] [value2] 
where the requirements for each field are as follows:
Field
Starting
Maximum
Re-
Description
position
width
quired
[name]
5
8
Yes
Name of the RHS vector
[cname1]
15
8
Yes
Constraint name
[value1]
25
12
Yes
Numerical value
[cname2]
40
8
No
Constraint name
[value2]
50
12
No
Numerical value
The interpretation of a record is that [name] is the name of the RHS vector to be specified. In general, several vectors can be specified. [cname1] denotes a constraint name previously specified in the ROWS section. Now, assume that this name has been assigned to the i th constraint and v_{1} denotes the value specified by [value1], then the interpretation of v_{1} is:
Constraint
l_{i}^{c}
u_{i}^{c}
type
E
v_{1}
v_{1}
G
v_{1}
L
v_{1}
N
An optional second element is specified by [cname2] and [value2] and is interpreted in the same way. Please note that it is not necessary to specify zero elements, because elements are assumed to be zero.

E.1.1.8 RANGES (optional)

A record in this section has the form
  1.  
  2. [name] [cname1] [value1] [cname2] [value2] 
where the requirements for each fields are as follows:
Field
Starting
Maximum
Re-
Description
position
width
quired
[name]
5
8
Yes
Name of the RANGE vector
[cname1]
15
8
Yes
Constraint name
[value1]
25
12
Yes
Numerical value
[cname2]
40
8
No
Constraint name
[value2]
50
12
No
Numerical value
The records in this section are used to modify the bound vectors for the constraints, i.e. the values in l^{c} and u^{c} . A record has the following interpretation: [name] is the name of the RANGE vector and [cname1] is a valid constraint name. Assume that [cname1] is assigned to the i th constraint and let v_{1} be the value specified by [value1], then a record has the interpretation:
Constraint
Sign of v_{1}
l_{i}^{c}
u_{i}^{c}
type
E
-
u_{i}^{c}+v_{1}
E
+
l_{i}^{c}+v_{1}
G
- or +
l_{i}^{c}+|v_{1}|
L
- or +
u_{i}^{c}-|v_{1}|
N

E.1.1.9 QSECTION (optional)

Within the QSECTION the label [cname1] must be a constraint name previously specified in the ROWS section. The label [cname1] denotes the constraint to which the quadratic term belongs. A record in the QSECTION has the form
  1. [vname1] [vname2] [value1] [vname3] [value2] 
where the requirements for each field are:
Field
Starting
Maximum
Re-
Description
position
width
quired
[vname1]
5
8
Yes
Variable name
[vname2]
15
8
Yes
Variable name
[value1]
25
12
Yes
Numerical value
[vname3]
40
8
No
Variable name
[value2]
50
12
No
Numerical value
A record specifies one or two elements in the lower triangular part of the Q^{i} matrix where [cname1] specifies the i . Hence, if the names [vname1] and [vname2] have been assigned to the k th and j th variable, then Q_{kj}^{i} is assigned the value given by [value1] An optional second element is specified in the same way by the fields [vname1], [vname3], and [value2].
The example
 \begin{array}{lccl} \displaystyle{} \mbox{minimize}&\displaystyle{} -x_{2} + 0.5(2 x_{1}^{2} - 2 x_{1} x_{3} + 0.2 x_{2}^{2} + 2 x_{3}^{2} ) &\displaystyle{} &\displaystyle{} \\[0pt] \displaystyle{} \mbox{subject to}&\displaystyle{} x_{1}+x_{2}+x_{3} &\displaystyle{} \geq{}&\displaystyle{} 1, \\[0pt] \displaystyle{} &\displaystyle{} x \geq{} 0 &\displaystyle{} &\displaystyle{} \\[0pt] \end{array}
has the following MPS file representation
  1. * File: qo1.mps 
  2. NAME qo1 
  3. ROWS 
  4. N obj 
  5. G c1 
  6. COLUMNS 
  7. x1 c1 1.0 
  8. x2 obj -1.0 
  9. x2 c1 1.0 
  10. x3 c1 1.0 
  11. RHS 
  12. rhs c1 1.0 
  13. QSECTION obj 
  14. x1 x1 2.0 
  15. x1 x3 -1.0 
  16. x2 x2 0.2 
  17. x3 x3 2.0 
  18. ENDATA 
Regarding the QSECTIONs please note that:
  • Only one QSECTION is allowed for each constraint.
  • The QSECTIONs can appear in an arbitrary order after the COLUMNS section.
  • All variable names occurring in the QSECTION must already be specified in the COLUMNS section.
  • All entries specified in a QSECTION are assumed to belong to the lower triangular part of the quadratic term of Q .

E.1.1.10 BOUNDS (optional)

In the BOUNDS section changes to the default bounds vectors l^{x} and u^{x} are specified. The default bounds vectors are l^{x} = 0 and u^{x} = \infty{} . Moreover, it is possible to specify several sets of bound vectors. A record in this section has the form
  1. ?? [name] [vname1] [value1] 
where the requirements for each field are:
Field
Starting
Maximum
Re-
Description
position
width
quired
??
2
2
Yes
Bound key
[name]
5
8
Yes
Name of the BOUNDS vector
[vname1]
15
8
Yes
Variable name
[value1]
25
12
No
Numerical value
Hence, a record in the BOUNDS section has the following interpretation: [name] is the name of the bound vector and [vname1] is the name of the variable which bounds are modified by the record. ?? and [value1] are used to modify the bound vectors according to the following table:
??
l_{j}^{x}
u_{j}^{x}
Made integer
(added to \mathcal{J} )
FR
-\infty{}
\infty{}
No
FX
v_{1}
v_{1}
No
LO
v_{1}
unchanged
No
MI
-\infty{}
unchanged
No
PL
unchanged
\infty{}
No
UP
unchanged
v_{1}
No
BV
0
1
Yes
LI
\lceil{} v_{1} \rceil{}
unchanged
Yes
UI
unchanged
\lfloor{} v_{1} \rfloor{}
Yes
v_{1} is the value specified by [value1].

E.1.1.11 CSECTION (optional)

The purpose of the CSECTION is to specify the constraint
 x \in{}\mathcal{C}.
in (E.1.1.1).
It is assumed that \mathcal{C} satisfies the following requirements. Let
 x^{t} \in{}\mathbb{R}^{n^{t}}, {\ } t=1,\ldots{} ,k
be vectors comprised of parts of the decision variables x so that each decision variable is a member of exactly one vector x^{t} , for example
 x^{1} = \left[{} \begin{array}{c} \displaystyle{} x_{1} \\[0pt] \displaystyle{} x_{4} \\[0pt] \displaystyle{} x_{7} \\[0pt] \end{array} \right]{} \mbox{ and } x^{2} = \left[{} \begin{array}{c} \displaystyle{} x_{6} \\[0pt] \displaystyle{} x_{5} \\[0pt] \displaystyle{} x_{3} \\[0pt] \displaystyle{} x_{2} \\[0pt] \end{array} \right]{}.
Next define
 \mathcal{C} := \left\{{} x \in{}\mathbb{R}^{n}: {\ } x^{t} \in{}\mathcal{C}_{t},{\ } t=1,\ldots{} ,k \right\}{}
where \mathcal{C}_{t} must have one of the following forms
  • \mathbb{R} set:
     \mathcal{C}_{t} = \{ x \in{}\mathbb{R}^{n^{t}} \}.
  • Quadratic cone:
     \mathcal{C}_{t} = \left\{{} x \in{}\mathbb{R}^{n^{t}}: x_{1} \geq{}\sqrt{\sum_{j=2}^{n^{t}} x_{j}^{2}}\right\}{}. (E.1.1.11.1)
  • Rotated quadratic cone:
     \mathcal{C}_{t} = \left\{{} x \in{}\mathbb{R}^{n^{t}}: 2 x_{1} x_{2} \geq{}\sum_{j=3}^{n^{t}} x_{j}^{2},{\ } x_{1},x_{2} \geq{} 0 \right\}{}. (E.1.1.11.2)
In general, only quadratic and rotated quadratic cones are specified in the MPS file whereas membership of the \mathbb{R} set is not. If a variable is not a member of any other cone then it is assumed to be a member of an \mathbb{R} cone.
Next, let us study an example. Assume that the quadratic cone
 x_{4} \geq{}\sqrt{x_{5}^{2} + x_{8}^{2}}(E.1.1.11.3)
and the rotated quadratic cone
 2 x_{3} x_{7} \geq{} x_{1}^{2} + x_{0}^{2}, {\ } x_{3},x_{7} \geq{} 0, (E.1.1.11.4)
should be specified in the MPS file. One CSECTION is required for each cone and they are specified as follows:
  1. * 1 2 3 4 5 6 
  2. *23456789012345678901234567890123456789012345678901234567890 
  3. CSECTION konea 0.0 QUAD 
  4. x4 
  5. x5 
  6. x8 
  7. CSECTION koneb 0.0 RQUAD 
  8. x7 
  9. x3 
  10. x1 
  11. x0 
This first CSECTION specifies the cone (E.1.1.11.3) which is given the name konea. This is a quadratic cone which is specified by the keyword QUAD in the CSECTION header. The 0.0 value in the CSECTION header is not used by the QUAD cone.
The second CSECTION specifies the rotated quadratic cone (E.1.1.11.4). Please note the keyword RQUAD in the CSECTION which is used to specify that the cone is a rotated quadratic cone instead of a quadratic cone. The 0.0 value in the CSECTION header is not used by the RQUAD cone.
In general, a CSECTION header has the format
  1. CSECTION [kname1] [value1] [ktype] 
where the requirement for each field are as follows:
Field
Starting
Maximum
Re-
Description
position
width
quired
[kname1]
5
8
Yes
Name of the cone
[value1]
15
12
No
Cone parameter
[ktype]
25
Yes
Type of the cone.
The possible cone type keys are:
Cone type key
Members
Interpretation.
QUAD
\geq{} 1
Quadratic cone i.e. (E.1.1.11.1).
RQUAD
\geq{} 2
Rotated quadratic cone i.e. (E.1.1.11.2).
Please note that a quadratic cone must have at least one member whereas a rotated quadratic cone must have at least two members. A record in the CSECTION has the format
  1.  
  2. [vname1] 
where the requirements for each field are
Field
Starting
Maximum
Re-
Description
position
width
quired
[vname1]
2
8
Yes
A valid variable name
The most important restriction with respect to the CSECTION is that a variable must occur in only one CSECTION.

E.1.1.12 ENDATA

This keyword denotes the end of the MPS file.

E.1.2 Integer variables

Using special bound keys in the BOUNDS section it is possible to specify that some or all of the variables should be integer-constrained i.e. be members of \mathcal{J} . However, an alternative method is available.
This method is available only for backward compatibility and we recommend that it is not used. This method requires that markers are placed in the COLUMNS section as in the example:
  1. COLUMNS 
  2. x1 obj -10.0 c1 0.7 
  3. x1 c2 0.5 c3 1.0 
  4. x1 c4 0.1 
  5. * Start of integer-constrained variables. 
  6. MARK000 'MARKER' 'INTORG' 
  7. x2 obj -9.0 c1 1.0 
  8. x2 c2 0.8333333333 c3 0.66666667 
  9. x2 c4 0.25 
  10. x3 obj 1.0 c6 2.0 
  11. MARK001 'MARKER' 'INTEND' 
  12. * End of integer-constrained variables. 
Please note that special marker lines are used to indicate the start and the end of the integer variables. Furthermore be aware of the following
  • IMPORTANT: All variables between the markers are assigned a default lower bound of 0 and a default upper bound of 1. This may not be what is intended. If it is not intended, the correct bounds should be defined in the BOUNDS section of the MPS formatted file.
  • MOSEK ignores field 1, i.e. MARK0001 and MARK001, however, other optimization systems require them.
  • Field 2, i.e. ’MARKER’, must be specified including the single quotes. This implies that no row can be assigned the name ’MARKER’.
  • Field 3 is ignored and should be left blank.
  • Field 4, i.e. ’INTORG’ and ’INTEND’, must be specified.
  • It is possible to specify several such integer marker sections within the COLUMNS section.

E.1.3 General limitations

  • An MPS file should be an ASCII file.

E.1.4 Interpretation of the MPS format

Several issues related to the MPS format are not well-defined by the industry standard. However, MOSEK uses the following interpretation:
  • If a matrix element in the COLUMNS section is specified multiple times, then the multiple entries are added together.
  • If a matrix element in a QSECTION section is specified multiple times, then the multiple entries are added together.

E.1.5 The free MPS format

MOSEK supports a free format variation of the MPS format. The free format is similar to the MPS file format but less restrictive, e.g. it allows longer names. However, it also presents two main limitations:
  • By default a line in the MPS file must not contain more than 1024 characters. However, by modifying the parameter MSK_IPAR_READ_MPS_WIDTH an arbitrary large line width will be accepted.
  • A name must not contain any blanks.
To use the free MPS format instead of the default MPS format the MOSEK parameter MSK_IPAR_READ_MPS_FORMAT should be changed.
 


<