Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# File Formats

Instead of building a model using one of the APIs, all model information can be read from a text file. It is also possible to write model information into a text file. Moreover, other information, such as solution values, attributes, or parameters, can be read and written via text files as well. The Gurobi Optimizer works with a variety of text file formats which are discussed in this section.

Note that all of the Gurobi file I/O routines can work with compressed versions of these files. Specifically, the Gurobi Optimizer can read or write files with the following extensions: `.zip`, `.gz`, `.bz2`, `.7z` or `.xz` (assuming that the associated compression tool, e.g., `7zip` for `.7z`, is installed on your machine and a corresponding entry is part of your PATH environment variable).

Model File Formats

These text file formats can be used to read or write model information:

File format | Description
--- | ---
MPS | This is the most widely used format for storing math programming models. It is recommended to use this format (or REW) for optimization.
REW | This format is identical to the MPS format but with anonymized variable and constraint names.
DUA | This format is identical to the MPS format but it holds the dual formulation of a pure LP model.
LP | This format is a human readable version of MPS file format. It, however, does not preserve column order when read, and typically does not preserve the exact numerical values of the coefficients.
RLP | This format is identical to the LP format but with anonymized variable and constraint names.
DLP | This format is identical to the LP format but it holds the dual formulation of a pure LP model.
ILP | This format is identical to the LP format but it is used for Irreducible Inconsistent Subsystem (IIS) models.
OPB | This format is used to store pseudo-boolean satisfaction and pseudo-boolean optimization models.

Solution File Formats

These text file formats can be used to read or write solution information:

File format | Description
--- | ---
SOL | This format holds solution information, i.e., solution values for all variables.
JSON solution | This format holds solution information, i.e., solution values for all variables and additional information about the results of the optimization.
MST | This format holds the solution information necessary for a full MIP start.
BAS | This format holds simplex basis information. Importing this data into a continuous models allows the simplex algorithm to start from the given simplex basis.

Solution information can only be written after the model has been optimized and a solution is available. On the other hand, all solution file formats can be used to import solution information to start optimization with a known feasible solution. However, preferably an MST file is used when providing MIP start information for a MIP model. It is also possible to hand over partial solution information, i.e., MST or SOL files that contain only a subset of variables with values.

Other File Formats

File format | Description
--- | ---
HNT | This format is used to hold MIP hints. Importing this data into a MIP model guides the MIP search towards a guess at a high-quality feasible solution.
ORD | This format is used to hold MIP variable branching priorities. Importing this data into a MIP model affects the search strategy.
ATTR | This format stores a collection of attributes of a model, including (multiple) MIP starts, solution, basis information, partitions, variable hints and branching priorities.
PRM | This format holds parameter values. Importing this data into a model changes the values of the referenced parameters.

Help and Feedback

Press `/` or click to search this documentation | Gurobi website | Gurobi community forum
Go to other Gurobi documentation | Gurobi download | Contact support