The MPS data format is an industry standard for the description of a variety of linear programming problems.
An MPS file is organized into named sections, which appear in the following order:
An MPS file may also have comment lines. Such lines may occur anywhere in the file. They begin with an asterisk '*' in column 1. They may contain information intended to explain the problem, or other facts of interest to a human, and of no interest to a program parsing the file.
The data lines of an MPS file are divided into fields of a specific width:
| 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 | Indicator | Name 1 | Name 2 | Value 1 | Name 3 | Value 2 |
We now discuss in detail the format of the data lines that occur in each data section.
The code for specifying row type is as follows:
| Type | Symbol | Meaning |
|---|---|---|
| = | E | Equal to. |
| < | L | Less than or equal to. |
| > | G | Greater than or equal to. |
| Objective | N | Objective function. |
| Free | N | No restriction imposed. |
This section of data begins with a card with ROWS in columns 1-4, followed by a data card for each row. The first N-type row encountered is regarded as the objective function.
Linear combinations of rows may also be specified. In this case, the above row types are denoted respectively by the codes DE, DL, DG, and DN, in columns 2-3. Field 2 contains the linear combination rowname. Fields 3-6 contain the rowname(s) in fields 3 and 5, and their multiplier(s) in fields 4 and 6. A linear combination of three or more rows requires additional cards, following the first card contiguously. In the additional cards, field 1 is empty. The right-hand sides of a linear combination row must be specified in the RHS section, described below.
The data card has the column label in field 2 (columns 5-12), the row label in field 3 (columns 15-22), and the value of the coefficient Ai,j or Cj in field 4 (columns 25-36), including a decimal point). If more than one nonzero row entry for the same column is to be made on the card, then field 5 (columns 40-47) has the next row label and field 6 (columns 50-61) has its corresponding coefficient value. The use of fields 5 and 6 is optional.
There is no need to specify columns for slack variables; this is taken care of automatically, based on the definitions of the row types.
hi <= Ai,1x1 + Ai,2x2 + ... + Ai,nxn <= uithat is, both an upper and lower bound are specified for the row. The range of the constraint is
ri = ui - hiThe value of ui or hi is specified in the RHS section data, and the value of ri is specified in the RANGES section data. This information, plus the row type specified in the ROWS section, defines the bounds ui and hi.
If bi is the number entered in the RHS section and ri is the number specified in the RANGES section, the ui and hi are defined as follows:
| Row Symbol | Meaning | Sign of ri | Lower limit hi | Upper limit ui |
|---|---|---|---|---|
| G | >= | + or - | bi | bi+|ri| |
| L | <= | + or - | bi-|ri| | bi |
| E | = | + | bi | bi+|ri| |
| E | = | - | bi-|ri| | bi |
The section begins with a card with RANGES in columns 1-6. The data cards specifying the values of ri are in exactly the same format as the COLUMNS data cards, except that field 2 (columns 5-12) has a label for the column of ranges (which can also be regarded as another column of the matrix). More than one column of ranges may be specified, but all the data cards for each column must be grouped contiguously.
0 <= xj < infinity
More than one bound for a particular variable may be entered, that is, both a lower and an upper bound; when only one bound is specified the other is assumed to be one of the default values of 0 or infinity as shown in parentheses below.
| Symbol | Meaning | Form of the bound |
|---|---|---|
| LO | lower bound | bj <= xj ( < infinity ) |
| UP | upper bound | ( 0 <= ) xj <= bj |
| FX | fixed variable | xj = bj |
| FR | free variable | the value of xj is not restricted. |
| MI | lower bound is negative infinity | -infinity <= xj ( <= 0 ) |
| PL | upper bound is +infinity (default) | ( 0 <= ) xj < infinity |
Example: the file afiro.mps.
NAME AFIRO
ROWS
E R09
E R10
L X05
L X21
E R12
E R13
L X17
L X18
L X19
L X20
E R19
E R20
L X27
L X44
E R22
E R23
L X40
L X41
L X42
L X43
L X45
L X46
L X47
L X48
L X49
L X50
L X51
N COST
COLUMNS
X01 X48 .301 R09 -1.
X01 R10 -1.06 X05 1.
X02 X21 -1. R09 1.
X02 COST -.4
X03 X46 -1. R09 1.
X04 X50 1. R10 1.
X06 X49 .301 R12 -1.
X06 R13 -1.06 X17 1.
X07 X49 .313 R12 -1.
X07 R13 -1.06 X18 1.
X08 X49 .313 R12 -1.
X08 R13 -.96 X19 1.
X09 X49 .326 R12 -1.
X09 R13 -.86 X20 1.
X10 X45 2.364 X17 -1.
X11 X45 2.386 X18 -1.
X12 X45 2.408 X19 -1.
X13 X45 2.429 X20 -1.
X14 X21 1.4 R12 1.
X14 COST -.32
X15 X47 -1. R12 1.
X16 X51 1. R13 1.
X22 X46 .109 R19 -1.
X22 R20 -.43 X27 1.
X23 X44 -1. R19 1.
X23 COST -.6
X24 X48 -1. R19 1.
X25 X45 -1. R19 1.
X26 X50 1. R20 1.
X28 X47 .109 R22 -.43
X28 R23 1. X40 1.
X29 X47 .108 R22 -.43
X29 R23 1. X41 1.
X30 X47 .108 R22 -.39
X30 R23 1. X42 1.
X31 X47 .107 R22 -.37
X31 R23 1. X43 1.
X32 X45 2.191 X40 -1.
X33 X45 2.219 X41 -1.
X34 X45 2.249 X42 -1.
X35 X45 2.279 X43 -1.
X36 X44 1.4 R23 -1.
X36 COST -.48
X37 X49 -1. R23 1.
X38 X51 1. R22 1.
X39 R23 1. COST 10.
RHS
B X50 310. X51 300.
B X05 80. X17 80.
B X27 500. R23 44.
B X40 500.
ENDATA
You can return to the HTML web page.