-
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
Test support for VariablePrimalStart in Bridges.Variable #2116
Conversation
::Type{<:RSOCtoSOCBridge}, | ||
) | ||
return false | ||
end |
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.
I've opted-out here, since setting or getting the start can't be done in isolation.
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.
Yes, this is part of the optional API. By the way, this should be default as in
MathOptInterface.jl/src/Bridges/bridge.jl
Lines 105 to 149 in 5025b50
""" | |
MOI.supports( | |
model::MOI.ModelLike, | |
attr::MOI.AbstractConstraintAttribute, | |
BT::Type{<:AbstractBridge}, | |
) | |
Return a `Bool` indicating whether `BT` supports setting `attr` to `model`. | |
""" | |
function MOI.supports( | |
::MOI.ModelLike, | |
::MOI.AbstractConstraintAttribute, | |
::Type{<:AbstractBridge}, | |
) | |
return false | |
end | |
""" | |
function MOI.get( | |
model::MOI.ModelLike, | |
attr::MOI.AbstractConstraintAttribute, | |
bridge::AbstractBridge, | |
) | |
Return the value of the attribute `attr` of the model `model` for the | |
constraint bridged by `bridge`. | |
""" | |
function MOI.get( | |
::MOI.ModelLike, | |
attr::MOI.AbstractConstraintAttribute, | |
bridge::AbstractBridge, | |
) | |
return throw( | |
ArgumentError( | |
"Bridge of type `$(typeof(bridge))` does not support accessing " * | |
"the attribute `$attr`. If you encountered this error " * | |
"unexpectedly, it probably means your model has been " * | |
"reformulated using the bridge, and you are attempting to query " * | |
"an attribute that we haven't implemented yet for this bridge. " * | |
"Please open an issue at https://github.com/jump-dev/MathOptInterface.jl/issues/new " * | |
"and provide a reproducible example explaining what you were " * | |
"trying to do.", | |
), | |
) | |
end |
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.
Bridges should have to implement it to return false
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.
I've opted-out here, since setting or getting the start can't be done in isolation.
I understand what you mean now, so I reverted back to your solution and opened #2117
src/Bridges/bridge_optimizer.jl
Outdated
@@ -1149,7 +1149,12 @@ function MOI.supports( | |||
attr::MOI.AbstractVariableAttribute, | |||
::Type{MOI.VariableIndex}, | |||
) | |||
return MOI.supports(b.model, attr, MOI.VariableIndex) | |||
if !MOI.supports(b.model, attr, MOI.VariableIndex) |
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.
We supports
, we prefer false positive than false negative. Previously, there were false positive but here, there might be false negative in case not all variables are set.
Happy? |
Yes, I just wanted to let you take a look |
x-ref #2115
This is actually a rabbit hole that I'm yet to make my way out of...