42 namespace Test {
namespace Int {
52 template<
bool useCount>
59 :
Test(
std::string(useCount ?
"Count::Distinct::" :
"Distinct::")+
60 str(icl)+
"::Sparse::"+
str(
n),
n,d0,false,icl) {}
63 :
Test(
std::string(useCount ?
"Count::Distinct::" :
"Distinct::")+
64 str(icl)+
"::Dense",6,min,max,false,icl) {}
68 for (
int j=
i+1; j<x.
size(); j++)
93 :
Test(
"Distinct::Offset::Sparse::"+
str(icl),6,d,false,icl) {}
96 :
Test(
"Distinct::Offset::Dense::"+
str(icl),6,min,max,false,icl) {}
100 for (
int j=
i+1; j<x.
size(); j++)
119 :
Test(
"Distinct::Random::"+
str(icl),n,min,max,false,icl) {
129 for (
int j=
i+1; j<x.
size(); j++)
163 :
Base(
"Int::Distinct::Pathological::"+
164 Test::str(n0)+
"::"+
Test::str(icl0)), n(n0), icl(icl0) {}
171 for (
int i=0;
i<
n;
i++)
175 delete s;
return false;
177 for (
int i=0;
i<
n;
i++)
179 delete s;
return false;
186 for (
int i=0;
i<
n;
i++) {
191 for (
int i=n;
i<2*
n;
i++)
195 delete s;
return false;
197 for (
int i=0;
i<
n;
i++)
199 delete s;
return false;
207 const int v[7] = {-1001,-1000,-10,0,10,1000,1001};
211 Gecode::Int::Limits::min+2,
213 Gecode::Int::Limits::max-1,
214 Gecode::Int::Limits::max-0};
Distinct< false > dom_l(dl, Gecode::ICL_DOM, 5)
TestSpace(void)
Constructor.
Offset bnd_os(d, Gecode::ICL_BND)
Pathological p_16_b(16, Gecode::ICL_BND)
Propagator for negated equality
Offset dom_od(-3, 3, Gecode::ICL_DOM)
IntConLevel
Consistency levels for integer propagators.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Distinct< true > count_bnd_d(-3, 3, Gecode::ICL_BND)
Offset val_od(-3, 3, Gecode::ICL_VAL)
Offset bnd_od(-3, 3, Gecode::ICL_BND)
Range iterator for integer sets.
const FloatNum max
Largest allowed float value.
Distinct< true > count_dom_s(d, Gecode::ICL_DOM)
Distinct< true > count_bnd_s(d, Gecode::ICL_BND)
Value propagation or consistency (naive)
Gecode::IntSet dom
Domain of variables.
Offset dom_os(d, Gecode::ICL_DOM)
Distinct< false > bnd_d(-3, 3, Gecode::ICL_BND)
Random dom_r(20,-50, 50, Gecode::ICL_DOM)
Pathological p_16_d(16, Gecode::ICL_DOM)
TestSpace(bool share, TestSpace &s)
Constructor for cloning s.
virtual Assignment * assignment(void) const
Create and register initial assignment.
Pathological p_32_v(32, Gecode::ICL_VAL)
const int max
Largest allowed integer value.
Generate random selection of assignments.
const int min
Smallest allowed integer value.
static std::string str(Gecode::ExtensionalPropKind epk)
Map extensional propagation kind to string.
Pathological p_32_d(32, Gecode::ICL_DOM)
Random(int n, int min, int max, Gecode::IntConLevel icl)
Create and register test.
Pathological p_32_b(32, Gecode::ICL_BND)
Gecode::FloatVal c(-8, 8)
const FloatNum min
Smallest allowed float value.
Distinct< false > bnd_s(d, Gecode::ICL_BND)
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Randomized test for distinct constraint.
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
Random val_r(50,-500, 500, Gecode::ICL_VAL)
Gecode::IntConLevel icl
Consistency level.
Distinct< true > count_val_d(-3, 3, Gecode::ICL_VAL)
Simple test for distinct constraint.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Pathological p_16_v(16, Gecode::ICL_VAL)
Distinct< false > val_s(d, Gecode::ICL_VAL)
Offset(const Gecode::IntSet &d, Gecode::IntConLevel icl)
Create and register test.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Base class for all tests to be run
Random bnd_r(50,-500, 500, Gecode::ICL_BND)
Distinct< false > bnd_l(dl, Gecode::ICL_BND, 5)
Distinct< false > dom_d(-3, 3, Gecode::ICL_DOM)
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Offset(int min, int max, Gecode::IntConLevel icl)
Create and register test.
Passing integer variables.
Passing integer arguments.
Pathological(int n0, Gecode::IntConLevel icl0)
Create and register test.
Distinct(int min, int max, Gecode::IntConLevel icl)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Node * x
Pointer to corresponding Boolean expression node.
Space(void)
Default constructor.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntConLevel)
Post propagator for .
bool testsearch
Whether to perform search test.
Base class for assignments
bool assigned(View x, int v)
Whether x is assigned to value v.
Value iterator for integer sets.
void distinct(Home home, const IntArgs &c, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Distinct< true > count_dom_d(-3, 3, Gecode::ICL_DOM)
void distinct(Home home, const IntVarArgs &x, IntConLevel icl)
Post propagator for for all .
Gecode::IntConLevel icl
Consistency level.
Bounds propagation or consistency.
Distinct(const Gecode::IntSet &d0, Gecode::IntConLevel icl, int n=6)
Create and register test.
Testing pathological cases
Gecode toplevel namespace
Offset val_os(d, Gecode::ICL_VAL)
int arity
Number of variables.
virtual bool run(void)
Perform test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Simple test for distinct constraint with offsets.
Distinct< false > val_d(-3, 3, Gecode::ICL_VAL)
Distinct< true > count_val_s(d, Gecode::ICL_VAL)
int size(void) const
Return size of array (number of elements)
Distinct< false > dom_s(d, Gecode::ICL_DOM)
int size(void) const
Return number of variables.
Domain propagation or consistency.
int n
Number of variables.
Distinct< false > val_l(dl, Gecode::ICL_VAL, 5)
virtual bool solution(const Assignment &x) const
Check whether x is solution.