Try our new documentation site (beta).
BAS format
An LP basis (BAS) file is used to specify an initial basis for a continuous model. The file provides basis status information for each variable and constraint in the model. If written by Gurobi, to reduce the size of the file, it only includes the difference to the slack basis. In a slack basis for each row the corresponding slack variable is basic while all other problem variables are at their lower bound. If a basis has been imported into a continuous model before optimization begins (using GRBread, for example), and if a simplex optimizer has been selected (through the Method parameter), the Gurobi simplex optimizer begins from the specified basis.
A BAS file begins with a NAME
line, and ends with an ENDATA
statement. No information is retrieved from these lines, but they are
required by the format. Between these two lines are basis status lines,
each consisting of two or three fields and starting with a white space
character. If the first field is LL
, UL
, or BS
, the
variable named (slack variables are not allowed) in the second field is
non-basic at its lower bound, non-basic at its upper bound, or basic,
respectively. Any additional fields are ignored. If the first field is
XL
or XU
, the variable named in the second field is basic,
while the row named in the third field states that the corresponding slack
variable is non-basic at its lower or upper bound, respectively.
The following is a simple example:
NAME example.bas XL x1 c1 XU x2 c2 UL x3 LL x4 ENDATA
Importing a basis into a model is equivalent to setting the VBasis and CBasis attributes for each listed variable and constraint to the specified basis status.
A near-optimal basis can speed the solution of a difficult LP model. However, specifying a start basis that is not extremely close to an optimal solution will often slow down the solution process. Exercise caution when providing start bases.