The ILOG CPLEX Reference Manual documents the file formats that ILOG CPLEX supports. Here is a brief description of these file formats:
- BAS files are text files governed by MPS conventions (that is, they are not binary) for saving a problem basis.
- BIN files are binary files. ILOG CPLEX uses this format when it writes solution files containing the binary representation of real numbers.
- DPE is the format ILOG CPLEX uses to write a problem in a binary SAV file after the objective of a problem has been perturbed for use with the dual simplex optimizer.
- DUA format, governed by MPS conventions, writes the dual formulation of a problem currently in memory so that the MPS file can later be read back in and the dual formulation can then be optimized explicitly. This file format is largely obsolete now since you can use the command
set preprocessing dual
in the Interactive Optimizer to tell ILOG CPLEX to solve the dual formulation of an LP automatically. (You no longer have to tell ILOG CPLEX to write the dual formulation to a DUA file and then tell ILOG CPLEX to read the file back in and solve it.)
- EMB is the format ILOG CPLEX uses to save an embedded network it extracts from a problem. EMB files are written in MPS format.
- IIS is the format ILOG CPLEX uses to represent irreducible inconsistent sets of constraints. Finding a Set of Irreducibly Inconsistent Constraints and Example: Writing an IIS-Type File explain more about these kinds of files.
- LP (Linear Programming) is a ILOG CPLEX-specific file formatted for entering problems in an algebraic, row-oriented form. In other words, LP format allows you to enter problems in terms of their constraints. When you enter problems interactively in the Interactive Optimizer, you are implicitly using LP format. ILOG CPLEX will also read in files in LP format. Working with LP Files explains more fully how to use LP files with ILOG CPLEX.
- MIN format for representing minimum-cost network-flow problems was introduced by DIMACS in 1991. More information about DIMACS network file formats is available via anonymous ftp from
ftp://dimacs.rutgers.edu/pub/netflow/general-info/specs.tex
.
- MPS (Mathematical Programming System) is an industry-standard, ASCII-text file format for mathematical programming problems. Besides the industry conventions, ILOG CPLEX also supports extensions to this format for ILOG CPLEX-specific cases, such as names of more than eight characters, blank space as delimiters between columns, etc. Working with MPS Files in this manual explains more fully how to use MPS files with ILOG CPLEX.
- MST is a text format ILOG CPLEX uses to enter a starting solution for a MIP.
- NET is a ILOG CPLEX-specific ASCII format for network-flow problems. It is flexible and supports named nodes and arcs.
- ORD is a format available only if you are licensed to use the ILOG CPLEX MIP Optimizer. It is used to enter and to save priority orders for branching. It may contain branching instructions for individual variables.
- PPE is the format ILOG CPLEX uses to write a problem in a binary SAV file after the bounds of a problem have been perturbed for use with the primal simplex optimizer.
- PRE is the format ILOG CPLEX uses to write a presolved, reduced problem formulation to a binary SAV file. Since a presolved problem has been reduced, it will not correspond to the original problem.
- QP is a format available only if you are licensed to use the ILOG CPLEX Barrier Optimizer. It contains the coefficients of nonzero coefficients in the Q matrix of a quadratic programming problem. You must enter the linear part of that quadratic programming problem first (by whichever means you choose).
- REW is a format to write a problem in MPS format with disguised row and column names. This format may be useful, for example, for problems that you consider highly proprietary.
- SAV is a ILOG CPLEX-specific binary format for reading and writing problems and their associated basis information. ILOG CPLEX includes the basis in a SAV file only if the problem currently in memory has been optimized and a basis exists. This format offers the advantage of being numerically accurate (to the same degree as your platform) in contrast to text file formats that may lose numerical accuracy. It also has the additional benefit of being efficient with respect to read and write time. However, since a SAV file is binary, you cannot read nor edit it with your favorite text editor.
- SOS is a format available only if you are licensed to use the ILOG CPLEX MIP Optimizer. It declares special ordered sets, the set branching order, and weights for each set member.
- TRE is a format available only if you are licensed to use the ILOG CPLEX MIP Optimizer. It saves information about progress through the branch & cut tree. It is a binary format.
- TXT files are ASCII-text files. ILOG CPLEX uses this format when it writes solution files in text.
- VEC is a format available only if you are licensed to use the ILOG CPLEX Barrier Optimizer. It saves the solution to a pure barrier optimization prior to crossover (that is, a nonbasis solution) that can later be read back in and used to initiate crossover. Using VEC File Format explains how to use this file format.
LP files are row-oriented so you can look at a problem as you enter it in a naturally and intuitively algebraic way. However, ILOG CPLEX represents a problem internally in a column-ordered format. This difference between the way ILOG CPLEX accepts a problem in LP format and the way it stores the problem internally may have an impact on memory use and on the order in which variables are displayed on screen or in files.
Whenever ILOG CPLEX reads a file in LP format, it converts from row-orientation to column-orientation. The conversion requires memory. On a platform with limited memory, if there is insufficient memory to read a given problem in LP format, there may still be sufficient memory to read the problem in MPS format. Generally, the ILOG CPLEX MPS file reader will load MPS format files more efficiently than will the LP reader loading LP format files.
As ILOG CPLEX reads an LP format file by rows, it adds columns as it encounters them in a row. This convention will have an impact on the order in which variables are named and displayed. For example, consider this problem:
Since ILOG CPLEX reads the objective function as the first row, the two columns appearing there will become the first two variables. When the problem is displayed or rewritten into another LP file, the variables there will appear in a different order within each row. In this example, if you execute the command display problem all
, you will see this:
That is, x1
appears at the end of each constraint in which it has a nonzero coefficient. This re-ordering does not affect the optimal value of the problem, but you may find it disconcerting when you first encounter it.
The ILOG CPLEX MPS file reader is highly compatible with existing modeling systems. There is generally no need to modify existing problem files to use them with ILOG CPLEX. However, there are ILOG CPLEX-specific conventions that may be useful for you to know. This section explains those conventions, and the ILOG CPLEX Reference Manual documents MPS format more fully.
In an MPS file, ILOG CPLEX selects the first free row or N-type row as the objective function, and it discards all subsequent free rows unless it is instructed otherwise by an OBJNAME
section in the file. To retain free rows in an MPS file, reformulate them as equality rows with an additional free variable. For example, replace the free row x + y
by the equality row x + y - s = 0
where s
is free. Generally, the ILOG CPLEX presolver will remove rows like that before optimization so they will have no impact on performance.
To handle ranged rows, ILOG CPLEX introduces a temporary range variable, creates appropriate bounds for this variable, and changes the sense of the row to an equality (that is, MPS type EQ). The added range variables will have the same name as the ranged row with the characters Rg
prefixed. When ILOG CPLEX generates solution reports, it removes these temporary range variables from the constraint matrix.
The MPS format allows multiple right-hand sides (RHS), multiple bounds, and multiple range vectors. It also allows extra free rows. Together, these features are known as extra rim vectors. By default, the ILOG CPLEX MPS reader selects the first RHS, bound, and range definitions that it finds. The first free row (that is, N-type row) becomes the objective function, and the remaining free rows are discarded. The extra rim data are also discarded.
ILOG CPLEX accepts any noncontrol-character within a name. However, ILOG CPLEX recognizes blanks (that is, space) as delimiters, so you must avoid them in names. You should also avoid $
(dollar sign) and *
(asterisk) as characters in names because they normally indicate a comment within a data record.
Fairly common problems in MPS files include split vectors, unnamed columns, and duplicated names. ILOG CPLEX checks for these conditions and reports them. If repeated rows or columns occur in an MPS file, ILOG CPLEX reports an error and stops reading the file. You can then edit the MPS file to correct the source of the problem.
You may often want to save a modified MPS file for later use. To that end, ILOG CPLEX will write out a problem exactly as it appears in memory. All your revisions of that problem will appear in the new file. One potential area for confusion occurs when a maximization problem is saved. Since MPS conventionally represents all problems as minimizations, ILOG CPLEX reverses the sign of the objective-function coefficients when it writes a maximization problem to an MPS file. When you read and optimize this new problem, the values of the variables will be valid for the original model. However, since the problem has been converted from a maximization to the equivalent minimization, the objective, dual, and reduced-cost values will have reversed signs.
MPS, Mathematical Programming System, an industry-standard format based on ASCII-text has historically been restricted to a fixed format in which data fields were limited to eight characters and specific fields had to appear in specific columns on specific lines. ILOG CPLEX supports extensions to MPS that allow more descriptive names (that is, more than eight characters), greater accuracy for numerical data, and greater flexibility in data positions.
Most MPS files in fixed format conform to the ILOG CPLEX extensions and thus can be read by the ILOG CPLEX MPS reader without error. However, the ILOG CPLEX MPS reader will not accept the following conventions:
You can convert fixed-format MPS files that contain those conventions into acceptable ILOG CPLEX-extended MPS files. To do so, use the convert
utility supplied in the standard distribution of ILOG CPLEX. The convert
utility removes unreadable features from fixed-format MPS, REW, BAS, SOS, and ORD files. It runs from the operating system prompt of your platform. Here is the syntax of the convert utility:
convert -option inputfilename outputfilename
Your command must include an input-file name and an output-file name; they must be different from each other. The options, summarized in Table 8.1, indicate the file type. You may specify only one option. If you do not specify an option, ILOG CPLEX attempts to deduce the file type from the extension in the file name.