Providing an initial feasible solution to Gurobi can help reduce the overall solve time (but there is no guarantee). A MIP start can be provided either by using the Start variable attribute or by loading a MIP start (.mst) or a solution (.sol) file.
It is possible to define only values for (a subset of) the binary and integer variables and let Gurobi attempt to compute feasible values for the remaining variables. This can be useful if a full start vector violates constraints by a small amount and is thus not accepted.
A related option is Variable hints. These values guide the solver throughout the solution process. If you know that a variable is likely to have a certain value in the solution, you can set the variable hint to help Gurobi find a solution.
Using Multiple MIP Starts
It is possible to provide multiple feasible starting solutions to Gurobi. This can be done either through our APIs or from our command-line tool.
model.NumStart = 2
# iterate over all MIP starts
for s in range(model.NumStart):
# set StartNumber
model.params.StartNumber = s
# now set MIP start values using the Start attribute, e.g.:
for v in model.getVars():
v.Start = <value>
When using our command-line tool, gurobi_cl, you can use the InputFile argument multiple times, e.g.,
gurobi_cl InputFile=mipstart1.mst InputFile=mipstart2.mst model.mps
With both approaches, Gurobi will investigate all supplied MIP starts and use the best one.
Completing Partial MIP Starts