Prev Next Top MpsInputFile

The MPS Input Format
This is a specification of sufficient conditions for a file to be an MPS input file; i.e., if a file meets these specifications, it will be an MPS input file. You can find these specifications in Section 9-2 of Murtagh . You can also find a discussion of this input format in Chapter 3 of Nazareth .

Notation
We use  x \in \R^n to denote the problem variable vector,  b \in \R^m to denote the problem right hand side vector, and  A \in \R^{m \times n} to denote the problem matrix.

File Structure
An MPS input file has the following structure.
     
Name Record
     
Rows Record
     
Columns Record
     
Rhs Record
     
Bounds Record
     
Endata

Fields
Each line has a set of fields defined as follows:
Field Keyword Op Name0 Name1 Value1 Name2 Value2
Columns 1-* 2-3 5-12 15-22 25-36 40-47 50-61
The Keyword field is special in that it always begins in column one and extends to the first space character in the line. If the Keyword field extends into another field, that field is not present in the line.

It is unspecified if leading and trailing white space has any significance in the fields Name0, Name1, and Name2. For example, the seven characters
     "x1     "
may or may not signify the same information as the seven characters
     "     x1"
.

Comments
A comment line has a * is column 1 and any characters in the rest of the line.

Name Record
The Name record is a single line with the following structure:
     NAME 
Name1
where NAME begins in column 1 and the string in the Name1 field is the problem name for this input file.

Rows Record
The first line of the Rows record contains the text
     ROWS
where ROW begins in column 1. Each of the other lines has the following structure:
     
Op Name0
The string in the Name0 field in the i-th line below ROWS specifies the name of the i-th row of the matrix; i.e., the name associated with the value  \[
     A_{i,1} x_1 + \ldots + A_{i,n} x_n 
\] 
The character in the Op field specifies the type of the row and is one of the following values:
Op Equation or inequality
E  A_{i,1} x_1 + \ldots + A_{i,n} x_n = b_i
G  A_{i,1} x_1 + \ldots + A_{i,n} x_n \geq b_i
L  A_{i,1} x_1 + \ldots + A_{i,n} x_n \leq b_i
N  A_{i,1} x_1 + \ldots + A_{i,n} x_n = z
The objective function  z is associated with the first row with the Op field equal to N. The other rows with the Op field equal to N are ignored.

Columns Record
This record is used to names corresponding to the variables  x_1 , through  x_n and the value of the non-zero coefficients in the matrix  A (zero is the default value for  A_{i,j} ). The first line of the Columns record contains the text
     COLUMNS
where COLUMNS begins in column 1. Each of the other lines has the structure
     
Name0 Name1 Value1
or it has the structure
     
Name0 Name1 Value1 Name2 Value2
The string in the Name0 specifies the name corresponding to the variable  x_j for the information on the line. All of the lines corresponding to one variable (all the lines with the same value for Name0) must be grouped together. The record is called Columns because each variable corresponds to a column of the matrix  A .

The string in the Name1 field must be equal to one of the row names in the Rows record. The floating point number in the Value1 field specifies the value of A_{i,j} where  i corresponds to the string in the Name1 field and  j corresponds to the string in the Name0 for this line.

If a string is present in the Name2 field it must be equal to one of the row names in the Rows record. In this case, the floating point number in the Value2 field specifies the value of A_{i,j} where  i corresponds to the string in the Name2 field and  j corresponds to the string in the Name0 for this line.

Rhs Record
This record is used to specify non-zero coefficients for the right hand side for each row corresponding to an equation or inequality (zero is the default right hand side value). The first line of the Rhs record contains the text
     RHS
where RHS begins in column 1. Each of the other lines has the structure
     
Name0 Name1 Value1
The string in the Name0 field is a name for the entire right hand side vector  b \in \R^m . It must be the same for all of these lines. The string in the Name1 field must be equal to one of the row names in the Rows record. It specifies the row index  i corresponding to the information on this line. The floating point number in the Value1 field specifies the value for this right hand side coefficient  b_i .

Bounds Record
The default lower bound for each variable is zero and the default upper bound is plus infinity; i.e., by default  \[
     0 \leq x_j < \infty
\] 
If these are the only bounds you want, you need not include a Bounds record. The first line of the Bounds record contains the text
     BOUNDS
where BOUNDS begins in column 1. Each of the other lines has the structure
     
Op Name0 Name1 Value1
or the structure
     
Op Name0 Name1

Op
The string in the Op field specifies the type of each bound and is one of the following values:
Op Description
LO lower bound  \ell_j \leq x_j <    +\infty
UP upper bound  0      \leq x_j \leq     u_j
FX fixed variable              x_j =        e_j
FR free variable  -\infty <   x_j <    +\infty
MI minus infinity  -\infty <   x_j \leq       0
PL plus infinity  0      \leq x_j <    +\infty

Name0
The string in the Name0 field specifies a name for the bound. It must be the same for all of these lines.

Name1
The string in the Name1 field identifies which component of  x (which column) is having it's bounds modified by the current line. The string in the Name1 field must be equal to one of the variable names in a Name0 field of the Columns record.

Value1
If the string in the Op field is LO, UP, or FX the floating point number in the Value1 field defines  \ell_j ,  u_j ,  e_j respectively. Otherwise, the Value1 field should be left empty.

Endata Record
The entire Endata record is just the text
     ENDATA
where ENDATA begins in column 1.

Example
The following is an example MPS input file:
*Op Name0---  Name1---  Value1------   Name2---  Value2------
*23 56789012  56789012  567890123456   01234567  012345678901
NAME          CE-2.1
ROWS
 N  z
 L  r1
 L  r2
 L  r3
COLUMNS
    x1        z         5              r1        2
    x1        r2        4              r3        3
*
    x2        z         4              r1        3
    x2        r2        1              r3        4
*
    x3        z         3              r1        1
    x3        r2        2              r3        2
RHS
    b         r1        5
    b         r2        11
    b         r3        8
ENDATA
This input file corresponds to the following optimization problem:
Equation 2.1 in Vasek Chvatal's book: Linear Programming
maximize    5*x1 + 4*x2 + 3*x3
subject to  2*x1 + 3*x2 +   x3 <= 5
            4*x1 +   x2 + 2*x3 <= 11
            3*x1 + 4*x2 + 2*x3 <= 8
              x1 ,   x2 ,   x3 >= 0
The solution is x1 = 2, x2 = 0, x3 = 1
The residuals are 0=s1=5-r1, 1=s2=11-r2, 0=s3=8-r3

Input File: MpsInputFile.omh