diff --git a/Project.toml b/Project.toml index ad59664..5f18172 100644 --- a/Project.toml +++ b/Project.toml @@ -6,5 +6,5 @@ version = "0.1.1" MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" [compat] -MathOptInterface = "1.42.0" +MathOptInterface = "1.43.0" julia = "1.6" diff --git a/src/MathOptIIS.jl b/src/MathOptIIS.jl index 8bdbf39..0faa6fb 100644 --- a/src/MathOptIIS.jl +++ b/src/MathOptIIS.jl @@ -12,4 +12,7 @@ include("bound.jl") include("range.jl") include("solver.jl") +@deprecate ConflictCount MOI.ConflictCount +@deprecate ConstraintConflictStatus MOI.ConstraintConflictStatus + end # module MathOptIIS diff --git a/src/iis.jl b/src/iis.jl index 30463d9..ad037b5 100644 --- a/src/iis.jl +++ b/src/iis.jl @@ -200,30 +200,13 @@ function MOI.get(optimizer::Optimizer, ::MOI.ConflictStatus) return optimizer.status end -function MOI.get( - optimizer::Optimizer, - ::MOI.ConstraintConflictStatus, - con::MOI.ConstraintIndex, -) - return MOI.get(optimizer, ConstraintConflictStatus(1), con) -end - -# this should be moved to MOI -struct ConflictCount <: MOI.AbstractModelAttribute end - -function MOI.get(optimizer::Optimizer, ::ConflictCount) +function MOI.get(optimizer::Optimizer, ::MOI.ConflictCount) return length(optimizer.results) end -# the MOI version must be generalized -struct ConstraintConflictStatus <: MOI.AbstractModelAttribute - conflict_index::Int - ConstraintConflictStatus(conflict_index = 1) = new(conflict_index) -end - function MOI.get( optimizer::Optimizer, - attr::ConstraintConflictStatus, + attr::MOI.ConstraintConflictStatus, con::MOI.ConstraintIndex, ) if attr.conflict_index > length(optimizer.results) diff --git a/test/runtests.jl b/test/runtests.jl index 692be44..2e2050b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -52,28 +52,28 @@ function test_bounds() MOI.ConstraintConflictStatus(), index(UpperBoundRef(y)), ) == MOI.IN_CONFLICT - @test MOI.get(solver, MOIIS.ConflictCount()) == 1 + @test MOI.get(solver, MOI.ConflictCount()) == 1 @test MOI.get( solver, - MOIIS.ConstraintConflictStatus(1), + MOI.ConstraintConflictStatus(1), index(LowerBoundRef(y)), ) == MOI.IN_CONFLICT @test MOI.get( solver, - MOIIS.ConstraintConflictStatus(1), + MOI.ConstraintConflictStatus(1), index(UpperBoundRef(y)), ) == MOI.IN_CONFLICT - @test MOI.get(solver, MOIIS.ConstraintConflictStatus(1), index(c)) == + @test MOI.get(solver, MOI.ConstraintConflictStatus(1), index(c)) == MOI.NOT_IN_CONFLICT # the next two could be errors @test MOI.get( solver, - MOIIS.ConstraintConflictStatus(2), + MOI.ConstraintConflictStatus(2), index(LowerBoundRef(y)), ) == MOI.NOT_IN_CONFLICT @test MOI.get( solver, - MOIIS.ConstraintConflictStatus(2), + MOI.ConstraintConflictStatus(2), index(UpperBoundRef(y)), ) == MOI.NOT_IN_CONFLICT # @@ -749,6 +749,13 @@ function test_iis_binary() return end +function test_deprecated() + @test (@test_deprecated MOIIS.ConflictCount()) == MOI.ConflictCount() + @test (@test_deprecated MOIIS.ConstraintConflictStatus(2)) == + MOI.ConstraintConflictStatus(2) + return +end + end # module TestMathOptIIS.runtests()