jump-dev / MathOptInterface.jl

A data structure for mathematical optimization problems
http://jump.dev/MathOptInterface.jl/
Other
380 stars 86 forks source link

Allow SetMapBridge to use bridge value #2509

Closed blegat closed 1 month ago

blegat commented 2 months ago

When I decided that these functions would only depend on the type, it was for consistency for map_function because map_function clearly cannot depend on anything else given that it is used in bridge_constraint. However, you could also have a bridge that implements its own bridge_constraint, storing extra information then in the bridge to be able to implement inverse_map_function, etc... This is the case of the Sum-of-Squares bridge.

Needed for https://github.com/jump-dev/SumOfSquares.jl/pull/355

blegat commented 1 month ago

For map_function, there are two cases:

  1. The bridge can implement bridge_constraint and map_function(::AbstractBridge, ...) in which case in case the map depends on values stored in the bridge. map_function is used for setting the ConstraintPrimalStart so actually is not a huge priority to implement it
  2. The bridge implement map_function(::Type, ...) in which case the default fallback for bridge_constraint is enough. Since the second cases is useful as well, we shouldn't say map_function(::Type, ...) is legacy even if for the other ones I wrote in the docstring that they were legacy :thinking: