> > ILOG CPLEX File Formats > MPS File Format > Records in MPS Format |
Records in MPS Format |
INDEX PREVIOUS NEXT |
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 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 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.
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).
In the ROWS
section, each row of the problem is specified with its name and sense, one row per record.
N
indicates a free row.
G
indicates a greater-than-or-equal-to row.
L
indicates a less-than-or-equal-to row.
E
indicates an equality row.
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 |
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.
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 |
In the RHS
section, the nonzero right-hand-side values of the constraints are specified.
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 |
In the RANGES
section, RHS range values to be applied to constraints may be specified.
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 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:
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 |
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.
LO
Lower bound
UP
Upper bound
FX
Fixed value (upper and lower bound the same)
FR
Free variable (lower bound - and upper bound +)
MI
Minus infinity (lower bound = -)
PL
Plus infinity (upper bound = +)
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.
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 |
Copyright © 1987-2003 ILOG, S.A. All rights reserved. Legal terms. | PREVIOUS NEXT |