Search code examples
pythonor-toolsmixed-integer-programmingscip

How to get relative MIP gap in Google OR-Tools and Python via SCIP solver?


When cancelling a solution search early, which is not based on a specified rel. MIP gap limit but e.g. via a time limit, is it possible to display the relative MIP gap of the best feasible solution that was found by the solver?


Solution

  • Unfortunately there is no direct API as the definition of relative MIP gap varies across solvers.

    You can always pick one formula and recompute it using the two methods on the objective: MPObjective.Value() and MPObjective.BestBound().