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 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 5.1.
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 at 0 (zero) to + (positive infinity). Failure to include an RHS
section causes ILOG CPLEX to generate a warning message and set all right-hand 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 contain the information that describes the LP problem. Each data record comprises six fields, as in Table 5.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.
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).
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:
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:
In the RHS
section, the nonzero right-hand-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:
In the RANGES
section, RHS range values to be applied to constraints may be specified.
- Field 1: Blank
- Field 2: Right-hand 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 right-hand side range depends on the sense of the specified row and whether the range has a positive or negative coefficient. Table 5.3 specifies how range values are interpreted. For a given row, rhs
is the right-hand side value and range
is the corresponding range value.
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:
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:
The RANGES
section of the MPS file to support this modification looks like this:
More than one range vector may exist in an MPS file. 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.
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:
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.