Skip to main content

Difference in relative gap calculation

Answered

Comments

2 comments

  • Eli Towle
    Gurobi Staff Gurobi Staff

    The output "MIP Solution", "Final Solve", etc. comes from GAMS, not Gurobi. Gurobi and GAMS use different formulas to calculate the relative MIP gap.

    Gurobi calculates the relative MIP gap as

    $$\begin{align}\textrm{gap} = \frac{|z_P - z_D|}{|z_P|},\end{align}$$

    where \(z_P\) is the primal objective bound and \(z_D\) is the dual objective bound. In contrast, GAMS calculates the relative MIP gap as

    $$\begin{align}\textrm{gap} = \frac{|z_P - z_D|}{\max\{|z_P|, |z_D|\}}.\end{align}$$

    1
  • Shuheng Wang
    Gurobi-versary
    First Comment
    First Question

    Oh, that makes sense. Thank you so much!

    0

Please sign in to leave a comment.