|
811 | 811 | function operate_term(::typeof(*), α::T, t::MOI.ScalarAffineTerm{T}) where T
|
812 | 812 | MOI.ScalarAffineTerm(α * t.coefficient, t.variable_index)
|
813 | 813 | end
|
814 |
| -function operate_term(::typeof(*), t::MOI.ScalarAffineTerm{T}, β::T) where T |
| 814 | +# `<:Number` is a workaround for https://github.com/JuliaOpt/MathOptInterface.jl/issues/980 |
| 815 | +function operate_term(::typeof(*), t::MOI.ScalarAffineTerm{T}, β::T) where T<:Number |
815 | 816 | MOI.ScalarAffineTerm(t.coefficient * β, t.variable_index)
|
816 | 817 | end
|
817 | 818 | function operate_term(::typeof(*), α::T, t::MOI.ScalarAffineTerm{T}, β::T) where T
|
@@ -1421,9 +1422,10 @@ function operate(::typeof(*), ::Type{T},
|
1421 | 1422 | return operate(*, T, α, f)
|
1422 | 1423 | end
|
1423 | 1424 |
|
| 1425 | +# `<:Number` is a workaround for https://github.com/JuliaOpt/MathOptInterface.jl/issues/980 |
1424 | 1426 | function operate!(::typeof(*), ::Type{T},
|
1425 | 1427 | f::Union{MOI.ScalarAffineFunction{T},
|
1426 |
| - MOI.ScalarQuadraticFunction{T}}, α::T) where T |
| 1428 | + MOI.ScalarQuadraticFunction{T}}, α::T) where T<:Number |
1427 | 1429 | map_terms!(term -> operate_term(*, term, α), f)
|
1428 | 1430 | f.constant *= α
|
1429 | 1431 | return f
|
|
0 commit comments