Skip to content

Commit 1ad6f61

Browse files
committed
Fix set! ConstraintFunction for mock optimizer
1 parent 0e48a2a commit 1ad6f61

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Test/UnitTests/modifications.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function solve_func_scalaraffine_lessthan(model::MOI.ModelLike, config::TestConf
150150
)
151151
@test MOI.canget(model, MOI.ConstraintFunction(), typeof(c))
152152
foo = MOI.get(model, MOI.ConstraintFunction(), c)
153-
@test_broken foo == MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(2.0, x)], 0.0)
153+
@test foo MOI.ScalarAffineFunction([MOI.ScalarAffineTerm(2.0, x)], 0.0)
154154
if config.solve
155155
test_model_solution(model, config;
156156
objective_value = 0.5,

src/Utilities/mockoptimizer.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ end
216216

217217
MOI.canset(mock::MockOptimizer, ::MOI.ConstraintFunction, ::Type{C}) where C <: CI = true
218218
function MOI.set!(mock::MockOptimizer, ::MOI.ConstraintFunction, c::CI{F,S}, func::F) where {F<:MOI.AbstractFunction, S<:MOI.AbstractSet}
219-
MOI.set!(mock.inner_model, MOI.ConstraintFunction(), xor_index(c), func)
219+
MOI.set!(mock.inner_model, MOI.ConstraintFunction(), xor_index(c), xor_variables(func))
220220
end
221221

222222
function MOI.canmodify(mock::MockOptimizer, obj::MOI.ObjectiveFunction, change)

0 commit comments

Comments
 (0)