-
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
Allow SetMapBridge to use bridge value #2509
Conversation
For
|
src/Bridges/set_map.jl
Outdated
The default implementation of [`Variable.bridge_constraint`](@ref) uses | ||
[`map_set`](@ref) with the bridge type so if this function is defined | ||
on the bridge type, [`Variable.bridge_constraint`](@ref) does not need | ||
to be implemented. |
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 don't understand this comment. Variable.bridge_constraint
does not exist.
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.
Do you mean
MathOptInterface.jl/src/Bridges/Constraint/set_map.jl
Lines 37 to 45 in 193aec6
function bridge_constraint( | |
BT::Type{<:MultiSetMapBridge{T,S1,G}}, | |
model::MOI.ModelLike, | |
func::G, | |
set::S1, | |
) where {T,S1,G} | |
mapped_func = MOI.Bridges.map_function(BT, func) | |
mapped_set = MOI.Bridges.map_set(BT, set) | |
constraint = MOI.add_constraint(model, mapped_func, mapped_set) |
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 just removed the comment
When I decided that these functions would only depend on the type, it was for consistency for
map_function
becausemap_function
clearly cannot depend on anything else given that it is used inbridge_constraint
. However, you could also have a bridge that implements its ownbridge_constraint
, storing extra information then in the bridge to be able to implementinverse_map_function
, etc... This is the case of the Sum-of-Squares bridge.Needed for jump-dev/SumOfSquares.jl#355