-
Notifications
You must be signed in to change notification settings - Fork 98
Create RelativeGapTolerance and AbsoluteGapTolerance optimizer attributes #1944
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
Conversation
Co-authored-by: Benoît Legat <[email protected]>
Co-authored-by: Benoît Legat <[email protected]>
|
Is there anything I should change in the docs? Maybe around here? MathOptInterface.jl/docs/src/reference/models.md Lines 66 to 77 in 868aa29
|
odow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yip. That's the place to add the docstrings.
You could also add it to:
https://github.com/jump-dev/MathOptInterface.jl/blob/master/docs/src/tutorials/implementing.md#implement-attributes
The attribute value type should be tested:
MathOptInterface.jl/test/attributes.jl
Line 225 in 868aa29
| @test MOI.attribute_value_type(MOI.RelativeGap()) == Float64 |
It also needs a test for solvers implementing this. Something like:
MathOptInterface.jl/src/Test/test_attribute.jl
Lines 164 to 191 in 868aa29
| """ | |
| test_attribute_TimeLimitSec(model::MOI.AbstractOptimizer, config::Config) | |
| Test that the [`MOI.TimeLimitSec`](@ref) attribute is implemented for `model`. | |
| """ | |
| function test_attribute_TimeLimitSec(model::MOI.AbstractOptimizer, ::Config) | |
| @requires MOI.supports(model, MOI.TimeLimitSec()) | |
| # Get the current value to restore it at the end of the test | |
| value = MOI.get(model, MOI.TimeLimitSec()) | |
| MOI.set(model, MOI.TimeLimitSec(), 0.0) | |
| @test MOI.get(model, MOI.TimeLimitSec()) == 0.0 | |
| MOI.set(model, MOI.TimeLimitSec(), 1.0) | |
| @test MOI.get(model, MOI.TimeLimitSec()) == 1.0 | |
| MOI.set(model, MOI.TimeLimitSec(), value) | |
| @test value == MOI.get(model, MOI.TimeLimitSec()) # Equality should hold | |
| _test_attribute_value_type(model, MOI.TimeLimitSec()) | |
| return | |
| end | |
| test_attribute_TimeLimitSec(::MOI.ModelLike, ::Config) = nothing | |
| function setup_test( | |
| ::typeof(test_attribute_TimeLimitSec), | |
| model::MOIU.MockOptimizer, | |
| ::Config, | |
| ) | |
| MOI.set(model, MOI.TimeLimitSec(), nothing) | |
| return | |
| end |
Co-authored-by: Oscar Dowson <[email protected]>
Co-authored-by: Oscar Dowson <[email protected]>
Co-authored-by: Oscar Dowson <[email protected]>
Co-authored-by: Oscar Dowson <[email protected]>
Addresses #1936
I have created a
RelativeGapToleranceattribute. If that's satisfactory code- and doc-wise, I'll do the same withAbsoluteGapTolerance.TODO
RelativeGapToleranceattributeAbsoluteGapToleranceattribute