Skip to content

Commit ea109bb

Browse files
authored
Fix Indicator constraints in ListOfConstraintTypesPresent (#629)
1 parent d5b03a9 commit ea109bb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/MOI_wrapper/MOI_wrapper.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3641,6 +3641,12 @@ function MOI.get(model::Optimizer, ::MOI.ListOfConstraintTypesPresent)
36413641
for info in values(model.nl_constraint_info)
36423642
push!(constraints, (MOI.ScalarNonlinearFunction, typeof(info.set)))
36433643
end
3644+
for info in values(model.indicator_constraint_info)
3645+
push!(
3646+
constraints,
3647+
(MOI.VectorAffineFunction{Float64}, typeof(info.set)),
3648+
)
3649+
end
36443650
return collect(constraints)
36453651
end
36463652

test/MOI/MOI_wrapper.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,9 @@ function test_delete_indicator()
963963
MOI.Indicator{MOI.ACTIVATE_ON_ONE}(MOI.EqualTo(1.0 * i)),
964964
)
965965
end
966+
F = MOI.VectorAffineFunction{Float64}
967+
S = MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.EqualTo{Float64}}
968+
@test (F, S) in MOI.get(model, MOI.ListOfConstraintTypesPresent())
966969
f = MOI.get(model, MOI.ConstraintFunction(), c[2])
967970
MOI.delete(model, c[1])
968971
MOI.delete(model, c[3])

0 commit comments

Comments
 (0)