Gurobi.jl icon indicating copy to clipboard operation
Gurobi.jl copied to clipboard

Add support for Absolute/Relative gap tolerances

Open mtanneau opened this issue 3 years ago • 8 comments

I went for the easy way: fall back to the RawOptimizerAttribute


EDIT: I have updated the PR to follow the conclusions of https://github.com/jump-dev/MathOptInterface.jl/issues/1936 At the moment, the present branch only works with MOI#master

mtanneau avatar Jul 05 '22 12:07 mtanneau

Should I mark RelativeGap as supported around here?

mtanneau avatar Jul 05 '22 13:07 mtanneau

Hmmmmmm. I don't know if we've ever classified RelativeGap as a settable attribute. It's not solver-independent because every solver implements it differently.

odow avatar Jul 05 '22 20:07 odow

It's not solver-independent because every solver implements it differently.

That's already the case for the getter part, and there's a warning for that in the MOI docs.

That being said, RelativeGap is currently a AbstractModelAttribute. I'm wondering whether its usage as a tolerance would count as optimizer attribute? Would that warrant some sort of differentiation?

mtanneau avatar Jul 05 '22 22:07 mtanneau

Yeah so the difference is:

  • ModelAttributes are typically part of the solution information. In this case, is_set_by_optimize(::RelativeGap) = true: https://github.com/jump-dev/MathOptInterface.jl/blob/bcc869f09bc3916683c6d296237ba5bfe25aa6f9/src/attributes.jl#L1968
  • OptimizerAttributes are things like solver parameters.

So RelativeGap is really "what is the gap of the final solution," rather than the solver parameter that controls the relative gap. You could see there might be a difference, when if you set RelativeGap, what you get back might be smaller than that.

odow avatar Jul 05 '22 22:07 odow

I'll move the high-level discussion to the MOI issue. I'll update this PR based on whatever is decided there.

mtanneau avatar Jul 05 '22 23:07 mtanneau

I'll update this PR to use MOI.AbsoluteGapTolerance and MOI.RelativeGapTolerance

mtanneau avatar Jul 18 '22 12:07 mtanneau

PR updated. Only works on MOI#master at the moment.

mtanneau avatar Jul 18 '22 19:07 mtanneau

Waiting for MOI v1.7 to be released, which will include the definitions of RelativeGapTolerance and AbsoluteGapTolerance as OptimizerAttributes.

I have updated the compat entry for MOI to 1.7.

mtanneau avatar Aug 06 '22 22:08 mtanneau