-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RelativeGap() calculation inconsistency #590
Comments
This isn't strictly a MOI issue. Here is the offending code in Gurobi.jl: We probably need a test in MOI for this, but it's really hard to do... For consistency, we should probably adopt Gurobi's definition and return |
I seem to remember also that SCIP and Gurobi use different definitions of the MIP gap. We should double check before going all in on Gurobi's definition. |
@odow not sure if this goes here as well, but when I tested it for GLPK to see what happens when the solver can't find the Incumbent, got an error for the method. It seems
|
Would it make more sense to get the Gap directly from the solver's API? |
It wouldn't hurt to make this accessible by some attribute if it's clearly documented as returning the gap using the solver's definition. But doesn't this only hide the issue? What if you want to compare the performance of different solvers? |
@mlubin I think using the solver's definition makes everything more transparent and that's a value added. Even if it complicates the comparison of performance, the user interested in that can get the bound and solution using I would also say, from a user perspective, that general approach in |
Why don't we define a |
for completeness:
|
The documentation for the attribute
RelativeGap()
shows that it is calculated as\\frac{|b-f|}{|f|}
, whereb
is the best bound andf
is the best feasible objective value. However, it seems that the implementation is\\frac{|b-f|}{|b|}
.See the result from Gurobi's log after defining the MIPGap = 0.8 for testing purposes.
When I ran the line
MathOptInterface.get(model, MathOptInterface.RelativeGap())
the result I got was 2.333 corresponding to (10-3)/3 instead of 0.7.The text was updated successfully, but these errors were encountered: