Gurobi is designed to be deterministic. You always get the same results from the same inputs (model and parameters) on the same computer with the same Gurobi version. Gurobi is also deterministic for parallel optimization: you always get the same results with multiple threads. However, if you change any inputs, including small changes like
- parameter values
- rounding of coefficients
- order of variables or constraints
- starting solution
then you may get different results, even if everything else remains the same.
Gurobi may not be deterministic with time-dependent behavior such as
- the TimeLimit parameter, where the timing can vary with the current machine workload,
- the NoRelHeurTime parameter for the same reason,
- concurrent optimization (Method=3) and concurrent MIP (ConcurrentMIP > 1), which are also time-dependent.
A deterministic substitute for the TimeLimit parameter is the WorkLimit parameter. The respective parameter to control the NoRel heuristic is NoRelHeurWork.
To ensure repeatable results, code that builds models to solve with Gurobi should also be deterministic. Some data structures, such as sets in Python, are not deterministic and may lead to different orderings of variables and constraints in a model, even when running the same code with the same data. To check if two models are the same, compare their fingerprints.
Please sign in to leave a comment.