jump-dev / MathOptInterface.jl

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

[Bridges] fix supports_constraint for IndicatorSOS1Bridge #2507

Closed odow closed 4 months ago

odow commented 4 months ago

Closes #2506

This now results in the expected:

julia> using JuMP, HiGHS

julia> model = Model(HiGHS.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: HiGHS

julia> @variable(model, x)
x

julia> @variable(model, z, Bin)
z

julia> @constraint(model, z --> {x * z == 0})
ERROR: Constraints of type MathOptInterface.VectorQuadraticFunction{Float64}-in-MathOptInterface.Indicator{MathOptInterface.ACTIVATE_ON_ONE, MathOptInterface.EqualTo{Float64}} are not supported by the solver.

If you expected the solver to support your problem, you may have an error in your formulation. Otherwise, consider using a different solver.

The list of available solvers, along with the problem types they support, is available at https://jump.dev/JuMP.jl/stable/installation/#Supported-solvers.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] _moi_add_constraint(model::MathOptInterface.Utilities.CachingOptimizer{…}, f::MathOptInterface.VectorQuadraticFunction{…}, s::MathOptInterface.Indicator{…})
   @ JuMP ~/.julia/packages/JuMP/Gwn88/src/constraints.jl:686
 [3] add_constraint(model::Model, con::VectorConstraint{QuadExpr, MathOptInterface.Indicator{…}, VectorShape}, name::String)
   @ JuMP ~/.julia/packages/JuMP/Gwn88/src/constraints.jl:713
 [4] macro expansion
   @ ~/.julia/packages/JuMP/Gwn88/src/macros/@constraint.jl:133 [inlined]
 [5] macro expansion
   @ ~/.julia/packages/JuMP/Gwn88/src/macros.jl:393 [inlined]
 [6] top-level scope
   @ REPL[6]:1
Some type information was truncated. Use `show(err)` to see complete types.