Gurobi tolerances and the limitations of double-precision arithmetic

The default values for these primal and dual feasibility tolerances are <span>$</span>10^{-6}<span>$</span>, and the default for the integrality tolerance is <span>$</span>10^{-5}<span>$</span>. If you choose the range for your inequalities and variables correctly, you can typically ignore tolerance issues entirely.

To give an example, if your constraint right-hand side is on the order of <span>$</span>10^3<span>$</span>, then relative numeric errors from computations involving the constraint (if any) are likely to be less than <span>$</span>10^{-9}<span>$</span>, i.e., less than one in a billion. This is usually far more accurate than the accuracy of input data, or even of what can be measured in practice.

However, if you define a variable <span>$</span>x\in[-10^{-6},10^{-6}]<span>$</span>, then relative numeric error may be as big as 50% of the variable range.

If, on the other hand, you have a variable <span>$</span>x\in[-10^{10},10^{10}]<span>$</span>, and you are using default primal feasibility tolerances; then what you are really asking is for the relative numeric error (if any) to be less than <span>$</span>10^{-16}<span>$</span>. However, this is beyond the limits of comparison for double-precision numbers. This implies that you are not allowing any round-off error at all when testing feasible solutions for this particular variable. And although this might sound as a good idea, in fact, it is really bad, as any round-off computation may result in your truly optimal solution being rejected as infeasible.

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.