Try our new documentation site (beta).


Relative MIP optimality gap
 Type: double
 Default value: 1e-4
 Minimum value: 0
 Maximum value: Infinity

The MIP solver will terminate (with an optimal result) when the gap between the lower and upper objective bound is less than MIPGap times the absolute value of the incumbent objective value. More precisely, if <span>$</span>z_P<span>$</span> is the primal objective bound (i.e., the incumbent objective value, which is the upper bound for minimization problems), and <span>$</span>z_D<span>$</span> is the dual objective bound (i.e., the lower bound for minimization problems), then the MIP gap is defined as

<span>$</span>gap = \vert z_P - z_D\vert / \vert z_P\vert<span>$</span>.

Note that if <span>$</span>z_P = z_D = 0<span>$</span>, then the gap is defined to be zero. If <span>$</span>z_P = 0<span>$</span> and <span>$</span>z_D \neq 0<span>$</span>, the gap is defined to be infinity.

For most models, <span>$</span>z_P<span>$</span> and <span>$</span>z_D<span>$</span> will have the same sign throughout the optimization process, and then the gap is monotonically decreasing. But if <span>$</span>z_P<span>$</span> and <span>$</span>z_D<span>$</span> have opposite signs, the relative gap may increase after finding a new incumbent solution, even though the absolute gap <span>$</span>\vert z_P - z_D\vert<span>$</span> has decreased.

Note: Only affects mixed integer programming (MIP) models

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.