Try our new documentation site (beta).

Tolerances and user-scaling

Gurobi will solve the model as defined by the user. However, when evaluating a candidate solution for feasibility, in order to account for possible round-off errors in the floating-point evaluations, we must allow for some tolerances.

To be more precise, satisfying Optimality Conditions requires us to test at least the following three criteria:

Integrality of solutions, i.e., whether a integer variable <span>$</span>x<span>$</span> takes an integer value or not. More precisely, <span>$</span>x<span>$</span> will be considered integral if abs(x - floor(x + 0.5)) <span>$</span>\mathtt{\leq}<span>$</span> IntFeasTol.
Feasibility of primal constraints, i.e., whether <span>$</span>a \cdot x \leq b<span>$</span> holds for the primal solution. More precisely, <span>$</span>a \cdot x \leq b<span>$</span> will be considered to hold if (a * x) - b <span>$</span>\mathtt{\leq}<span>$</span> FeasibilityTol.
Feasibility of dual constraints, i.e., whether <span>$</span>a \cdot y \leq c<span>$</span> holds for the dual solution. More precisely, <span>$</span>a \cdot y \leq c<span>$</span> will be considered to hold if (a * y) - c <span>$</span>\mathtt{\leq}<span>$</span> OptimalityTol.
Note that these tolerances are absolute; they do not depend on the scale of the quantities involved in the computation. This means that when formulating a problem, these tolerances should be taken into account, specially to select the units in which variables and constraints will be expressed.

It is very important to note that the usage of these tolerances implicitly defines a gray zone in the search space in which solutions that are very slightly infeasible can still be accepted as feasible. However, the solver will not explicitly search for such solutions.

For this reason, it is actually possible (although highly unlikely for well-posed problems) for a model to be reported as being both feasible and infeasible (in the sense stated above). This can occur if the model is infeasible in exact arithmetic, but there exists a solution that is feasible within the solver tolerances. For instance, consider:

s.t.&x \leq&0\
&x\geq &10^{-10}\


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.