diff --git a/docs/src/mappings/hakank.md b/docs/src/mappings/hakank.md index 975363d..1691754 100644 --- a/docs/src/mappings/hakank.md +++ b/docs/src/mappings/hakank.md @@ -8,7 +8,7 @@ All the constraints that are currently defined in [hakank's constraints_utils.jl * `decreasing_strict`: `Strictly(Decreasing)` * `all_different_except_c`: `AllDifferentExceptConstants` * `count_ctr`: `Count` (except for operators) -* `count_ctr2`: `CountDistinct` (except for operators) +* `count_ctr2`: `MOI.CountDistinct` (except for operators) * `global_cardinality_count`: `Count` * `either_eq`: `Disjunction` * `is_member_of`: `Domain` and `Membership` @@ -29,4 +29,4 @@ All the constraints that are currently defined in [hakank's constraints_utils.jl * `lex_less_eq`: `LexicographicallyLessThan` * `among`: `Count` -Functions: TODO \ No newline at end of file +Functions: TODO diff --git a/docs/src/reference/sets.md b/docs/src/reference/sets.md index b2b29f0..d8e79fa 100644 --- a/docs/src/reference/sets.md +++ b/docs/src/reference/sets.md @@ -64,7 +64,6 @@ KnapsackValueType ```@docs Count CountCompare -CountDistinct ``` ### Global cardinality diff --git a/src/Test/test_countdistinct.jl b/src/Test/test_countdistinct.jl index da516e9..1061dea 100644 --- a/src/Test/test_countdistinct.jl +++ b/src/Test/test_countdistinct.jl @@ -4,7 +4,7 @@ function test_countdistinct_vectorofvariables( ) where {T <: Real} @MOIT.requires MOI.supports_constraint(model, MOI.VariableIndex, MOI.Integer) # x1, x2, x3, x4 @MOIT.requires MOI.supports_constraint(model, MOI.VariableIndex, MOI.EqualTo{T}) # c1, c2, c3 - @MOIT.requires MOI.supports_constraint(model, MOI.VectorOfVariables, CP.CountDistinct) # c4 + @MOIT.requires MOI.supports_constraint(model, MOI.VectorOfVariables, MOI.CountDistinct) # c4 x1, _ = MOI.add_constrained_variable(model, MOI.Integer()) x2, _ = MOI.add_constrained_variable(model, MOI.Integer()) @@ -15,7 +15,7 @@ function test_countdistinct_vectorofvariables( c2 = MOI.add_constraint(model, x2, MOI.EqualTo(1)) c3 = MOI.add_constraint(model, x3, MOI.EqualTo(2)) - c4 = MOI.add_constraint(model, MOI.VectorOfVariables([x4, x1, x2, x3]), CP.CountDistinct(3)) + c4 = MOI.add_constraint(model, MOI.VectorOfVariables([x4, x1, x2, x3]), MOI.CountDistinct(4)) @test MOI.is_valid(model, x1) @test MOI.is_valid(model, x2) @@ -57,7 +57,7 @@ function test_countdistinct_vectoraffinefunction( ) where {T <: Real} @MOIT.requires MOI.supports_constraint(model, MOI.VariableIndex, MOI.Integer) # x1, x2, x3, x4 @MOIT.requires MOI.supports_constraint(model, MOI.ScalarAffineFunction{T}, MOI.EqualTo{T}) # c1, c2, c3 - @MOIT.requires MOI.supports_constraint(model, MOI.VectorAffineFunction{T}, CP.CountDistinct) # c4 + @MOIT.requires MOI.supports_constraint(model, MOI.VectorAffineFunction{T}, MOI.CountDistinct) # c4 x1, _ = MOI.add_constrained_variable(model, MOI.Integer()) x2, _ = MOI.add_constrained_variable(model, MOI.Integer()) @@ -68,7 +68,7 @@ function test_countdistinct_vectoraffinefunction( c2 = MOI.add_constraint(model, one(T) * x2, MOI.EqualTo(1)) c3 = MOI.add_constraint(model, one(T) * x3, MOI.EqualTo(2)) - c4 = MOI.add_constraint(model, MOIU.vectorize(one(T) .* [x4, x1, x2, x3]), CP.CountDistinct(3)) + c4 = MOI.add_constraint(model, MOIU.vectorize(one(T) .* [x4, x1, x2, x3]), MOI.CountDistinct(4)) @test MOI.is_valid(model, x1) @test MOI.is_valid(model, x2) diff --git a/src/sets_count.jl b/src/sets_count.jl index bd968e1..e35a816 100644 --- a/src/sets_count.jl +++ b/src/sets_count.jl @@ -253,31 +253,7 @@ end MOI.dimension(set::CountCompare) = 2 * set.dimension + 1 -""" - CountDistinct(dimension::Int) - -The first variable in the set is forced to be the number of distinct values in -the rest of the expressions. - -This is a relaxed version of `MOI.AllDifferent`; it encodes an `MOI.AllDifferent` -constraint when the first variable is the number of variables in the set. - -Also called `nvalues`. - -## Example - - [x, y, z] in CountDistinct(3) - # x = 1 if y == z, x = 2 if y != z -""" -struct CountDistinct <: MOI.AbstractVectorSet - dimension::Int -end - -MOI.dimension(set::CountDistinct) = set.dimension + 1 - # isbits types, nothing to copy -function copy( - set::Union{CountCompare, CountDistinct}, -) +function copy(set::CountCompare) return set end diff --git a/test/sets.jl b/test/sets.jl index da0487a..995b2e6 100644 --- a/test/sets.jl +++ b/test/sets.jl @@ -24,11 +24,9 @@ # Just a dimension. @testset "$(S)" for S in [ CP.AllEqual, - MOI.AllDifferent, CP.SymmetricAllDifferent, CP.Membership, CP.ElementVariableArray, - CP.CountDistinct, CP.Inverse, CP.Contiguity, CP.LexicographicallyLessThan, @@ -54,7 +52,6 @@ if S in [ CP.AllEqual, - MOI.AllDifferent, CP.SymmetricAllDifferent, CP.Membership, CP.Contiguity, @@ -64,7 +61,6 @@ @test MOI.dimension(S(2)) == 2 @test MOI.dimension(S(3)) == 3 elseif S in [ - CP.CountDistinct, CP.MinimumAmong, CP.MaximumAmong, CP.ArgumentMinimumAmong,