Skip to content

Commit 09d21f5

Browse files
committed
Workaround for issue #980
1 parent c4beceb commit 09d21f5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Utilities/functions.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,8 @@ end
811811
function operate_term(::typeof(*), α::T, t::MOI.ScalarAffineTerm{T}) where T
812812
MOI.ScalarAffineTerm* t.coefficient, t.variable_index)
813813
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
815816
MOI.ScalarAffineTerm(t.coefficient * β, t.variable_index)
816817
end
817818
function operate_term(::typeof(*), α::T, t::MOI.ScalarAffineTerm{T}, β::T) where T
@@ -1421,9 +1422,10 @@ function operate(::typeof(*), ::Type{T},
14211422
return operate(*, T, α, f)
14221423
end
14231424

1425+
# `<:Number` is a workaround for https://github.com/JuliaOpt/MathOptInterface.jl/issues/980
14241426
function operate!(::typeof(*), ::Type{T},
14251427
f::Union{MOI.ScalarAffineFunction{T},
1426-
MOI.ScalarQuadraticFunction{T}}, α::T) where T
1428+
MOI.ScalarQuadraticFunction{T}}, α::T) where T<:Number
14271429
map_terms!(term -> operate_term(*, term, α), f)
14281430
f.constant *= α
14291431
return f

0 commit comments

Comments
 (0)