MPS format small example The following example defines a linear programming problem in MPS format. The line numbers are included for reference, they are not part of the MPS input.
0 * This is a comment
1 NAME smallExample
2 OBJSENSE
3 MAX
4 OBJNAME
5 obj
6 ROWS
7 N obj
8 L r1
9 G r2
10 COLUMNS
11 x obj 1 r1 1 r2 2
12 y obj -2.3 r1 -1
13 z obj 0.5
14 z r2 -1
15 s r2 -1
16 s r1 1
17 RHS
18 RIGHT r1 10.75
19 RIGHT r2 -100
20 ENDATA
This example describes the same problem instance as the following LP-format
input.
Problem
smallExample
Maximize
obj: x - 2.3 y + 0.5 z
Subject To
r1: x - y + s <= 10.75
r2: 2.0 x - z - s >= -100.0
End
Whereas the LP-format input specifies the objective function and constraints row by row, the MPS-format input describes these objects in a column by column fashion.
The following table summarizes the lines in the MPS input that define the different components of smallExample's objective and constraints.
| |
|
|
|
|
|
|
|
|
|
||
| line 11 | line 12 | line 13 | line 14 | line 15 | line 16 | line 8 | line 18 | line 9 | line 19 | ||
|
|
|||||||||||
| obj | x | -2.3y | +0.5z | ||||||||
| r1 | x | -y | s | ≤ | 10.75 | ||||||
| r2 | 2x | -z | -s | ≥ | -100 | ||||||
The remaining lines in the MPS input are interpreted as follows. Line 1 defines the problem's name to be "smallExample". Line 3 states that the objective value should be maximized. Line 5 picks the row "obj" as the objective and line 7 defines "obj" to be an "N" row, that is, "obj" has no right-hand-side.