Skip to content
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

Merged
merged 7 commits into from
Mar 14, 2023

Conversation

odow
Copy link
Member

@odow odow commented Mar 9, 2023

x-ref #2115

This is actually a rabbit hole that I'm yet to make my way out of...

@odow odow added Type: Bug Submodule: Bridges About the Bridges submodule labels Mar 9, 2023
::Type{<:RSOCtoSOCBridge},
)
return false
end
Copy link
Member Author

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.

Copy link
Member

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

"""
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

Copy link
Member

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

Copy link
Member

@blegat blegat Mar 13, 2023

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

@odow odow changed the title WIP: test support for VariablePrimalStart in Bridges.Variable Test support for VariablePrimalStart in Bridges.Variable Mar 10, 2023
@@ -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)
Copy link
Member

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.

@odow
Copy link
Member Author

odow commented Mar 13, 2023

Happy?

@blegat
Copy link
Member

blegat commented Mar 14, 2023

Yes, I just wanted to let you take a look

@blegat blegat merged commit 065e1b0 into master Mar 14, 2023
@blegat blegat deleted the od/bridge-variable-primal-start branch March 14, 2023 07:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Submodule: Bridges About the Bridges submodule Type: Bug
Development

Successfully merging this pull request may close these issues.

2 participants