Content-Length: 331058 | pFad | http://github.com/jump-dev/CPLEX.jl/commit/6cc6dd72942abb965c6cb151f1d20b9118331f08

7D Fix Indicator constraints in ListOfConstraintTypesPresent (#454) · jump-dev/CPLEX.jl@6cc6dd7 · GitHub
Skip to content

Commit 6cc6dd7

Browse files
authored
Fix Indicator constraints in ListOfConstraintTypesPresent (#454)
1 parent eb76473 commit 6cc6dd7

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/MOI/MOI_wrapper.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ function MOI.empty!(model::Optimizer)
326326
empty!(model.affine_constraint_info)
327327
empty!(model.quadratic_constraint_info)
328328
empty!(model.sos_constraint_info)
329+
empty!(model.indicator_constraint_info)
329330
model.name_to_variable = nothing
330331
model.name_to_constraint_index = nothing
331332
model.ret_optimize = Cint(0)
@@ -3586,6 +3587,12 @@ function MOI.get(model::Optimizer, ::MOI.ListOfConstraintTypesPresent)
35863587
for info in values(model.sos_constraint_info)
35873588
push!(constraints, (MOI.VectorOfVariables, typeof(info.set)))
35883589
end
3590+
for (info, _) in values(model.indicator_constraint_info)
3591+
push!(
3592+
constraints,
3593+
(MOI.VectorAffineFunction{Float64}, typeof(info.set)),
3594+
)
3595+
end
35893596
return collect(constraints)
35903597
end
35913598

test/MathOptInterface/MOI_wrapper.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,22 @@ function test_example_biobjective_knapsack()
313313
return
314314
end
315315

316+
function test_ListOfConstraintTypesPresent_indicator()
317+
model = CPLEX.Optimizer()
318+
x = MOI.add_variable(model)
319+
z = MOI.add_variable(model)
320+
MOI.add_constraint(model, z, MOI.ZeroOne())
321+
c = MOI.add_constraint(
322+
model,
323+
MOI.Utilities.operate(vcat, Float64, 1.0 * z, 1.0 * x),
324+
MOI.Indicator{MOI.ACTIVATE_ON_ONE}(MOI.EqualTo(1.0)),
325+
)
326+
F = MOI.VectorAffineFunction{Float64}
327+
S = MOI.Indicator{MOI.ACTIVATE_ON_ONE,MOI.EqualTo{Float64}}
328+
@test (F, S) in MOI.get(model, MOI.ListOfConstraintTypesPresent())
329+
return
330+
end
331+
316332
end # module TestMOIwrapper
317333

318334
TestMOIwrapper.runtests()

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/jump-dev/CPLEX.jl/commit/6cc6dd72942abb965c6cb151f1d20b9118331f08

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy