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

# Other File Formats

## HNT Format

A MIP hint (HNT) file is used to provide hints for the values of the variables in a mixed integer programming model (typically obtained from a solution to a related model). The file lists values for variables in the model, and priorities for those hints. When MIP hints are imported into a MIP model before optimization begins (using `GRBread`, for example), the MIP search is guided towards the values captured in those hints. Good hints often allow the MIP solver to find high-quality solutions much more quickly.

A MIP hint file consists of variable-value-priority triples, each on its own line. Any line that begins with the hash sign (#) is a comment line and is ignored. The following is a simple example:

    # MIP hints
    x1  1 2
    x2  0 1
    x3  1 1

Importing hints into a model is equivalent to setting the VarHintVal and VarHintPri attributes for each listed variable to the associated values. If the same variable appears more than once in a hint file, the last assignment is used. Importing multiple hint files is equivalent to reading the concatenation of the imported files.

Note that hint files don’t need to specify values for all variables. When values are left unspecified, the Gurobi MIP solver won’t attempt to adjust the search strategy for those variables.

Please refer to the VarHintVal discussion for more details on the role of variable hints.

## ORD Format

A priority ordering (ORD) file is used to input a set of variable priority orders. Reading a priority file (using `GRBread`, for example) modifies the MIP branch variable selection. When choosing a branching variable from among a set of fractional variables, the Gurobi MIP solver will always choose a variable with higher priority over one with a lower priority.

The file consists of variable-value pairs, each on its own line. The file contains at most one line for each variable in the model. Any line that starts with the hash sign (#) is treated as a comment line and is ignored. The following is a simple example:

    # Branch priority file
    x 1
    y 1
    z -1

Variables have a default branch priority value of 0, so it is not necessary to specify values for all variables.

Importing a priority order file is equivalent to replacing the BranchPriority attribute value for each variable in the model. Note that you can still modify the BranchPriority attribute after importing an ordering file.

## ATTR Format

A Gurobi attribute (ATTR) file is used to store, and read, attribute information of a model – provided by the user or generated during a previous solution call – that affects the optimization process.

More precisely, this file stores – if available – the following attributes: X, the primal solution to the last optimization call. Pi, the dual solution to the last optimization call. Start, all the stored MIP start vectors. Partition, the variable partition. VarHintVal and VarHintPri, the variable hint information. BranchPriority, the variable branch priority vector. Lazy, the lazy attribute for each constraint. VTag, CTag and QCTag, the tagged elements of the model. VBasis and CBasis, the basis information for variables and constraints. PStart and DStart, the simplex-start information for variables and constraints.

Any line starting with the character ‘#’, or empty lines, are considered as comments, and will be discarded at reading time. The file should start by a line of the form:

    GRB_ATTR_FILE_VERSION 0110000

which indicate the version of the file. Older versions are backward-compatible. Then follows a number of sections, each storing one set of attributes. Each section starts with one of the following:

- SECTION SOLUTION

- SECTION MIPSTART

- SECTION PARTITION

- SECTION VARHINTS

- SECTION BRANCHPRIORITY

- SECTION LAZYCONSTRS

- SECTION BASIS

- SECTION PSTART

- SECTION DSTART

- SECTION VTAG

- SECTION CTAG

- SECTION QCTAG

For those attributes for which there is a dedicated file extension, the following format is exactly the same as described in the corresponding file format description.

For sections involving other variable attributes, each line is a tuple describing the variable name, and the attribute(s) value related to it. Variables with attribute values at default may be omitted.

For sections involving other constraint attributes, each line is a tuple describing the constraint name, and the attribute(s) value related to it. Constraints with attribute values at default may be omitted.

If a model has multiple MIP starts, each of them will be saved in a different `SECTION MIPSTART`. Whenever an attribute file is loaded into a model, each `SECTION MIPSTART` will be loaded into a new MIP start vector.

The tags of variables and constraints must be enclosed in double quotes. If the tag itself contains a double quote, this needs to be escaped by a backslash. Moreover, if the tag contains a backslash, this also needs to be escaped, which yields two consecutive backslashes. For example, if a variable named `"V01"` has as a tag the string: `"My Tag"\"`, the corresponding line in the attribute file will contain:

    V01 "My Tag \"\\"

Note that tags can only consist of US-ASCII printable characters.

## PRM Format

A Gurobi parameter (PRM) file is used to specify parameter settings. Reading a parameter file (using `GRBread`, for example) causes the parameters specified in the file to take the specified values.

The file consists of parameter-value pairs, each on its own line. Any line that begins with the hash sign (#) is a comment line and is ignored. The following is a simple example:

    # Parameter settings
    Cuts       2
    Heuristics 0.5

If an unknown parameter name is listed in the file, a warning is printed and the associated line is ignored.

Note that when you write a Gurobi parameter file (using `GRBwrite` in C, `Model.write` in Python, or in any of the other APIs), both integer or double parameters not at their default value will be saved, but no string parameter will be saved into the file.

### Multiple Parameter Settings

A parameter file could also include several parameter settings. This can be relevant when working with concurrent environments (refer to ConcurrentSettings), multiple objectives (refer to MultiObjSettings) or when working with the tuner (see TuneBaseSettings or TuneIgnoreSettings). Each parameter setting is introduced with the line `PARAMETERSET`, in particular, the file must start with this line. The following example contains three parameter settings in one prm file:

    PARAMETERSET
    PARAMETERSET
    Cuts       2
    Heuristics 0.5
    PARAMETERSET
    Method 2

The first setting is the default setting, no parameter is changed. The second setting sets the parameter Cuts to 2 and Heuristics to 0.5, and the third setting sets Method to 2.

Help and Feedback

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