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.