|
833 | 833 | function operate_term(::typeof(*), α::T, t::MOI.ScalarAffineTerm{T}) where T |
834 | 834 | MOI.ScalarAffineTerm(α * t.coefficient, t.variable_index) |
835 | 835 | end |
836 | | -function operate_term(::typeof(*), t::MOI.ScalarAffineTerm{T}, β::T) where T |
| 836 | +# `<:Number` is a workaround for https://github.com/JuliaOpt/MathOptInterface.jl/issues/980 |
| 837 | +function operate_term(::typeof(*), t::MOI.ScalarAffineTerm{T}, β::T) where T<:Number |
837 | 838 | MOI.ScalarAffineTerm(t.coefficient * β, t.variable_index) |
838 | 839 | end |
839 | 840 | function operate_term(::typeof(*), α::T, t::MOI.ScalarAffineTerm{T}, β::T) where T |
@@ -1443,9 +1444,10 @@ function operate(::typeof(*), ::Type{T}, |
1443 | 1444 | return operate(*, T, α, f) |
1444 | 1445 | end |
1445 | 1446 |
|
| 1447 | +# `<:Number` is a workaround for https://github.com/JuliaOpt/MathOptInterface.jl/issues/980 |
1446 | 1448 | function operate!(::typeof(*), ::Type{T}, |
1447 | 1449 | f::Union{MOI.ScalarAffineFunction{T}, |
1448 | | - MOI.ScalarQuadraticFunction{T}}, α::T) where T |
| 1450 | + MOI.ScalarQuadraticFunction{T}}, α::T) where T<:Number |
1449 | 1451 | map_terms!(term -> operate_term(*, term, α), f) |
1450 | 1452 | f.constant *= α |
1451 | 1453 | return f |
|
0 commit comments