-
Notifications
You must be signed in to change notification settings - Fork 92
[Bridges] Method error with quadratic indicator constraints #2506
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
Comments
MethodError: no method matching bridge_constraint(::Type{MathOptInterface.Bridges.Constraint.IndicatorSOS1Bridge{Float64, MathOptInterface.EqualTo{Float64}}}, ::MathOptInterface.Bridges.LazyBridgeOptimizer{HiGHS.Optimizer}, ::MathOptInterface.VectorQuadraticFunction{Float64}, ::MathOptInterface.Indicator{MathOptInterface.ACTIVATE_ON_ONE, MathOptInterface.EqualTo{Float64}})
Reproducer: 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})
z --> {x*z = 0}
julia> optimize!(model)
Running HiGHS 1.7.0 (git hash: 50670fd4c): Copyright (c) 2024 HiGHS under MIT licence terms
ERROR: MethodError: no method matching bridge_constraint(::Type{…}, ::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, ::MathOptInterface.VectorQuadraticFunction{…}, ::MathOptInterface.Indicator{…})
Closest candidates are:
bridge_constraint(::Type{MathOptInterface.Bridges.Constraint.VectorSlackBridge{T, F, S}}, ::Any, ::MathOptInterface.AbstractVectorFunction, ::S) where {T, F, S}
@ MathOptInterface ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/Constraint/bridges/slack.jl:351
bridge_constraint(::Type{<:MathOptInterface.Bridges.Constraint.MultiSetMapBridge{T, S1, G}}, ::MathOptInterface.ModelLike, ::G, ::S1) where {T, S1, G}
@ MathOptInterface ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/Constraint/set_map.jl:37
bridge_constraint(::Type{MathOptInterface.Bridges.Constraint.NumberConversionBridge{T, F1, S1, F2, S2}}, ::MathOptInterface.ModelLike, ::F1, ::S1) where {T, F1, S1, F2, S2}
@ MathOptInterface ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/Constraint/bridges/number_conversion.jl:46
...
Stacktrace:
[1] add_bridged_constraint(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, BridgeType::Type, f::MathOptInterface.VectorQuadraticFunction{…}, s::MathOptInterface.Indicator{…})
@ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/bridge_optimizer.jl:1786
[2] add_constraint(b::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, f::MathOptInterface.VectorQuadraticFunction{…}, s::MathOptInterface.Indicator{…})
@ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/bridge_optimizer.jl:1916
[3] _copy_constraints(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, index_map_FS::MathOptInterface.Utilities.DoubleDicts.IndexDoubleDictInner{…}, cis_src::Vector{…})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2CULs/src/Utilities/copy.jl:259
[4] _copy_constraints(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, cis_src::Vector{…})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2CULs/src/Utilities/copy.jl:271
[5] pass_nonvariable_constraints_fallback(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, constraint_types::Vector{…})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2CULs/src/Utilities/copy.jl:282
[6] pass_nonvariable_constraints(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, idxmap::MathOptInterface.Utilities.IndexMap, constraint_types::Vector{…})
@ MathOptInterface.Bridges ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/bridge_optimizer.jl:445
[7] _pass_constraints(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…}, index_map::MathOptInterface.Utilities.IndexMap, variable_constraints_not_added::Vector{…})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2CULs/src/Utilities/copy.jl:330
[8] default_copy_to(dest::MathOptInterface.Bridges.LazyBridgeOptimizer{…}, src::MathOptInterface.Utilities.UniversalFallback{…})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2CULs/src/Utilities/copy.jl:505
[9] copy_to
@ ~/.julia/packages/MathOptInterface/2CULs/src/Bridges/bridge_optimizer.jl:455 [inlined]
[10] optimize!
@ ~/.julia/packages/MathOptInterface/2CULs/src/MathOptInterface.jl:84 [inlined]
[11] optimize!(m::MathOptInterface.Utilities.CachingOptimizer{…})
@ MathOptInterface.Utilities ~/.julia/packages/MathOptInterface/2CULs/src/Utilities/cachingoptimizer.jl:316
[12] optimize!(model::Model; ignore_optimize_hook::Bool, _differentiation_backend::MathOptInterface.Nonlinear.SparseReverseMode, kwargs::@Kwargs{})
@ JuMP ~/.julia/packages/JuMP/Gwn88/src/optimizer_interface.jl:457
[13] optimize!(model::Model)
@ JuMP ~/.julia/packages/JuMP/Gwn88/src/optimizer_interface.jl:409
[14] top-level scope
@ REPL[264]:1
Some type information was truncated. Use `show(err)` to see complete types. |
That reproducer results in
which seems like a different issue from the one i posted. |
No, it results in the same issue and it is the reproducer. I have identified the fix. I don't know what you've done to your Julia instance, but you must be |
Fix is #2507 Your underlying issue is that you cannot solve this constraint with HiGHS.jl. The next version of MOI will throw a better error instead of the uninformative MethodError. [f=1:NUM_FRAMES, s=1:NUM_SWITCHES], SwitchDrivePower[f,s] --> { SwitchDriveDirection[f,s] == SwitchDrivePower[f,s] * SwitchDriveState[f,s] - 1 } |
@odow thank you for taking a look! Yup, i very much expected that it would be too good to work :)
|
HiGHS does not support quadratic constraints. |
Yes, i've understood that from the docs. |
HiGHS does not support nonlinear constraints either. It is a mixed-integer linear solver, with additional support for continuous linear problems with a quadratic objective function. |
@odow thank you. Question:
?
Again, i get that :) What i meant is, there seems to be (some?) support in JuMP for user-defined functions, |
No. We won't bridge constraints based on some numerical structure. Bridges must (with some limited exceptions) support any input data. In this case, you are asking if Instead of trying to write JuMP models using the high-level syntax like |
I've trimmed the reproducer somewhat, but it should be reducible further.
The text was updated successfully, but these errors were encountered: