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

Indicator and SOS to MILP bridges #2316

Closed
odow opened this issue Oct 23, 2023 · 3 comments
Closed

Indicator and SOS to MILP bridges #2316

odow opened this issue Oct 23, 2023 · 3 comments
Labels
Project: constraint programming Issues relating to constraint programming Submodule: Bridges About the Bridges submodule Type: Enhancement
Milestone

Comments

@odow
Copy link
Member

odow commented Oct 23, 2023

I talked to @fdabrandao (AMPL) at INFORMS. They have a lot of new stuff for reformulating indicator constraints to MILP. We can't offer the same full flexibility as AMPL, but we could write a few XXXtoMILPBridges, just like we've done for constraint programming.

In all cases, M is based on bounds of x, and we error if bounds are not present.

  • z --> {a'x <= b} => a'x <= b + M(1 - z)
  • !z --> {a'x <= b} => a'x <= b + Mz
  • z --> {a'x >= b} => a'x >= b - M(1 - z)
  • !z --> {a'x >= b} => a'x >= b - Mz
  • z --> {a'x == b} => a'x == b + y, -M(1-z) <= y <= M(1 - z)
  • !z --> {a'x == b} => a'x == b + y, -Mz <= y <= Mz
  • x in SOS1 => -l_i z_i <= x_i <= u_i z_i, sum z_i == 1
  • x in SOS2 => -l_i (z_i+z_j) <= x_i <= u_i (z_i + z_j), sum z_i == 1

cc @glebbelov

@odow odow added Type: Enhancement Submodule: Bridges About the Bridges submodule Project: constraint programming Issues relating to constraint programming labels Oct 23, 2023
@odow odow added this to the v1.x milestone Oct 23, 2023
@odow
Copy link
Member Author

odow commented Oct 23, 2023

We have IndicatorSOS1Bridge:

"""
IndicatorSOS1Bridge{T,S} <: Bridges.Constraint.AbstractBridge
`IndicatorSOS1Bridge` implements the following reformulation:
* ``z \\implies {f(x) \\in S}`` into ``f(x) + y \\in S``,
``SOS1(y, z)``
!!! warning
This bridge assumes that the solver supports [`MOI.SOS1{T}`](@ref)
constraints in which one of the variables (``y``) is continuous.
## Source node
`IndicatorSOS1Bridge` supports:
* [`MOI.VectorAffineFunction{T}`](@ref) in
[`MOI.Indicator{MOI.ACTIVATE_ON_ONE,S}`](@ref)
## Target nodes
`IndicatorSOS1Bridge` creates:
* [`MOI.ScalarAffineFunction{T}`](@ref) in `S`
* [`MOI.VectorOfVariables`](@ref) in [`MOI.SOS1{T}`](@ref)
"""
struct IndicatorSOS1Bridge{T,S<:MOI.AbstractScalarSet} <: AbstractBridge

So it might be sufficient to have SOS1ToMILPBridge, and then optionally add bounds to the slack indicator variable if possible.

@odow
Copy link
Member Author

odow commented Oct 23, 2023

Ah, but this would need final_touch, and so would SOS1toMILPBridge, which would require #1980

@odow
Copy link
Member Author

odow commented Oct 30, 2023

Closed by #2318

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project: constraint programming Issues relating to constraint programming Submodule: Bridges About the Bridges submodule Type: Enhancement
Development

No branches or pull requests

1 participant