ILOG CPLEX 11.0 File Formats > > ILOG CPLEX File Formats > MPS File Format: Industry Standard > Records in MPS Format

MPS data files are analogous to a deck of computer input cards: each line of the MPS file represents a single card record. Records in an MPS data file consist of two types: indicator records and data records. The records contain fields delimited by blank spaces.

Indicator Records

Indicator records separate the individual sections of the MPS file. Each indicator record contains a single word that begins in the first column. There are seven kinds of indicator records, each corresponding to sections of the MPS file. They are listed in Table 1.

Table 1 Indicator records 
Section name/indicator record 
Purpose 
NAME 
specifies the problem name; unlike other indicator records, the name record contains data 
ROWS 
specifies name and sense for each constraint 
COLUMNS 
specifies the name assigned to each variable (column) and the nonzero constraint coefficients corresponding to that variable 
RHS 
specifies the names of righthand side vectors and values for each constraint (row) 
RANGES 
specifies constraints that are restricted to lie in the interval between two values; interval endpoints are also specified 
BOUNDS 
specifies the limits within which each variable (column) must remain 
ENDATA 
signals the end of the data; always the last entry in an MPS file 

Each section of the MPS file except the RANGES and BOUNDS sections is mandatory. If no BOUNDS section is present, all variables have their bounds set from 0 (zero) to + (positive infinity). Failure to include an RHS section causes ILOG CPLEX to generate a warning message and set all righthand side values to 0 (zero). Variables and constraints must be declared in the ROWS and COLUMNS sections before they are referenced in the RHS, RANGES, and BOUNDS sections.

Data Records

Data records contain the information that describes the LP problem. Each data record comprises six fields, as in Table 2. The fields must be separated by white space (that is, blank space, tab, etc.), and the first field must begin in column 2 or beyond. Not all fields are used within each section of the input file.

Table 2 Fields of a data record in MPS file format

 
Field 1 
Field 2 
Field 3 
Field 4 
Field 5 
Field 6 
Contents 
Indicator 
Name 
Name 
Value 
Name 
Value 

Any ASCII character (32 through 126) is legal, but names must contain no embedded blanks. In addition, names over 255 characters are truncated. CPLEX issues an error message if truncation causes the names to lose their uniqueness. Numeric fields can be at most 25 characters long.

If the first character in Field 3 or 5 is a dollar sign ($), the remaining characters in the record are treated as a comment. Another method for inserting comments is to place an asterisk (*) in column 1. Everything on such a line is treated as a comment.

Values may be defined with decimal or exponential notation and may utilize 25 characters. In exponential notation, plus (+) and minus (-) signs must precede the exponent value. If an exponent value is missing where one is expected, it is assigned a value of 0 (zero).

ROWS Section

In the ROWS section, each row of the problem is specified with its name and sense, one row per record.

Field 1 contains a single letter designating the sense of each row. Acceptable values are:
Field 2 contains a character identifier, maximum length of 255 characters, specifying the name of the row.
Fields 3-6 are not used in the ROWS section.

If more than one free row is specified, the first one is used as the objective function and the others are discarded.

The ROWS section of our example looks like this:

ROWS
 N  obj
 L  c1
 L  c2

COLUMNS Section

In the COLUMNS section, all the columns of the constraint matrix are specified with their name and all of the nonzero elements. Multiple records may be required to completely specify a given column.

Field 1: Blank
Field 2: Column identifier
Field 3: Row identifier
Field 4: Value of matrix coefficient specified by Fields 2 and 3
Field 5: Row identifier (optional)
Field 6: Value of matrix coefficient specified by Fields 2 and 5 (optional)

After a matrix element is specified for a column, all other nonzero elements in that same column should be specified.

The COLUMNS section of our example looks like this:

COLUMNS
    x1        obj                 -1   c1                  -1
    x1        c2                   1
    x2        obj                 -2   c1                   1
    x2        c2                  -3
    x3        obj                 -3   c1                   1
    x3        c2                   1

RHS Section

In the RHS section, the nonzero righthand-side values of the constraints are specified.

Field 1: Blank
Field 2: RHS identifier
Field 3: Row identifier
Field 4: Value of RHS coefficient specified by Field 2 and 3
Field 5: Row identifier (optional)
Field 6: Value of RHS coefficient specified by Field 2 and 5 (optional)

Several RHS vectors can exist. The name of each RHS vector appears in Field 2. However, only the first RHS vector is selected when a problem is read. Additional RHS vectors are discarded.

The RHS section of our example looks like this:

RHS
    rhs       c1                  20   c2                  30

RANGES Section

In the RANGES section, RHS range values to be applied to constraints may be specified.

Field 1: Blank
Field 2: Righthand side range vector identifier
Field 3: Row identifier
Field 4: Value of the range applied to row specified by Field 3
Field 5: Row identifier (optional)
Field 6: Value of the range applied to row specified by Field 5 (optional)

The effect of specifying a righthand side range depends on the sense of the specified row and whether the range has a positive or negative coefficient. Table 3 specifies how range values are interpreted. For a given row, rhs is the righthand side value and range is the corresponding range value.

Table 3 How range values are interpreted in data records of MPS files
Row type 
Range value sign 
Resulting rhs upper limit 
Resulting rhs lower limit 
+ or - 
rhs + |range| 
rhs 
+ or - 
rhs 
rhs - |range| 
rhs + range 
rhs 
rhs 
rhs + range 

The name of each range vector appears in Field 2. More than one range vector can be specified within an MPS file. However, only the first range vector is selected when a problem is read. Additional range vectors are discarded.

In our example, there are no ranged rows, but suppose we want to add the following constraint to our problem:

x1 - 3x2 + x3 >= 15

Instead of explicitly adding another row to the problem, we can represent this additional constraint by modifying row 2 of the example to make it a ranged row in this way:

15 <= x1 - 3x2 + x3 <= 30

The RANGES section of the MPS file to support this modification looks like this:

RANGES
    rhs       c2                  15

The name of each range vector appears in Field 2. However, only the first range vector is selected when a problem is read. Additional range vectors are discarded.

BOUNDS Section

In the BOUNDS section, bound values for variables may be specified.

Field 1: Type of bound. Acceptable values are:
Field 2: Bound identifier
Field 3: Column identifier to be bounded
Field 4: Value of the specified bound
Fields 5 and 6 are not used in the BOUNDS section.

In our example, the BOUNDS section looks like this:

BOUNDS
 UP BOUND     x1                  40

If no bounds are specified, ILOG CPLEX assumes a lower bound of 0 (zero) and an upper bound of +. If only a single bound is specified, the unspecified bound remains at 0 or +, whichever applies, with one exception. If an upper bound of less than 0 is specified and no other bound is specified, the lower bound is automatically set to -. ILOG CPLEX deviates slightly from a convention used by some MPS readers when it encounters an upper bound of 0 (zero). Rather than automatically set this variable's lower bound to -, ILOG CPLEX accepts both a lower and upper bound of 0, effectively fixing that variable at 0. ILOG CPLEX resets the lower bound to - only if the upper bound is less than 0. A warning message is issued when this exception is encountered.

More than one bound vector may exist. The name of each bound vector appears in Field 2. However, only the first bound vector is selected when a problem is read. Additional bound vectors are discarded.

Complete Example of MPS File Format
NAME          example2.mps
ROWS
 N  obj     
 L  c1      
 L  c2      
COLUMNS
    x1        obj                 -1   c1                  -1
    x1        c2                   1
    x2        obj                 -2   c1                   1
    x2        c2                  -3
    x3        obj                 -3   c1                   1
    x3        c2                   1
RHS
    rhs       c1                  20   c2                  30
BOUNDS
 UP BOUND     x1                  40
ENDATA