Skip to content

Commit 38ae419

Browse files
committed
use MA
1 parent 85e00fb commit 38ae419

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/_eval_variables.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ function _eval_variables(value_fn::Function, t::MOI.ScalarAffineTerm)
99
return t.coefficient * value_fn(t.variable)
1010
end
1111

12-
function _eval_variables(value_fn::Function, t::MOI.ScalarQuadraticTerm)
13-
out = t.coefficient * value_fn(t.variable_1) * value_fn(t.variable_2)
14-
return t.variable_1 == t.variable_2 ? out / 2 : out
15-
end
16-
1712
_eval_variables(value_fn::Function, f::MOI.VariableIndex) = value_fn(f)
1813

1914
function _eval_variables(
@@ -22,7 +17,7 @@ function _eval_variables(
2217
) where {T}
2318
# TODO: this conversion exists in JuMP, but not in MOI
2419
S = Base.promote_op(value_fn, MOI.VariableIndex)
25-
U = Base.promote_op(*, T, S)
20+
U = MOI.MA.promote_operation(*, T, S)
2621
out = convert(U, f.constant)
2722
for t in f.terms
2823
out += _eval_variables(value_fn, t)

src/intervals.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ function Interval(lo::T, hi::T) where {T<:Real}
6363
return Interval{T}(lo, hi)
6464
end
6565

66+
function Base.zero(::Type{Interval{T}}) where {T<:Real}
67+
return Interval(zero(T), zero(T))
68+
end
69+
6670
function Base.iszero(a::Interval)
6771
return iszero(a.hi) && iszero(a.lo)
6872
end

0 commit comments

Comments
 (0)