Try our new documentation site (beta).


Integrality focus
 Type: int
 Default value: 0
 Minimum value: 0
 Maximum value: 1

One unfortunate reality in MIP is that integer variables don't always take exact integral values. While this typically doesn't create significant problems, in some situations the side-effects can be quite undesirable. The best-known example is probably a trickle flow, where a continuous variable that is meant to be zero when an associated binary variable is zero instead takes a non-trivial value. More precisely, given a constraint <span>$</span>y \leq M b<span>$</span>, where <span>$</span>y<span>$</span> is a non-negative continuous variable, <span>$</span>b<span>$</span> is a binary variable, and <span>$</span>M<span>$</span> is a constant that captures the largest possible value of <span>$</span>y<span>$</span>, the constraint is intended to enforce the relationship that <span>$</span>y<span>$</span> must be zero if <span>$</span>b<span>$</span> is zero. With the default integer feasibility tolerance, the binary variable is allowed to take a value as large as <span>$</span>1e-5<span>$</span> while still being considered as taking value zero. If the <span>$</span>M<span>$</span> value is large, then the <span>$</span>M b<span>$</span> upper bound on the <span>$</span>y<span>$</span> variable can be substantial.

Reducing the value of the IntFeasTol parameter can mitigate the effects of such trickle flows, but often at a significant cost, and often with limited success. The IntegralityFocus parameter provides a better alternative. Setting this parameter to 1 requests that the solver work harder to try to avoid solutions that exploit integrality tolerances. More precisely, the solver tries to find solutions that are still (nearly) feasible if all integer variables are rounded to exact integral values. We should say that the solver won't always succeed in finding such solutions, and that this setting introduces a modest performance penalty, but the setting will significantly reduce the frequency and magnitude of such violations.

For examples of how to query or modify parameter values from our different APIs, refer to our Parameter Examples.

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.