42 namespace Test {
namespace Int {
52 template<
bool useCount>
58 :
Test(std::string(useCount ?
"Count::Distinct::" :
"Distinct::")+
62 :
Test(std::string(useCount ?
"Count::Distinct::" :
"Distinct::")+
66 for (
int i=0;
i<
x.size();
i++)
67 for (
int j=
i+1; j<
x.size(); j++)
98 for (
int i=0;
i<
x.size();
i++)
99 for (
int j=
i+1; j<
x.size(); j++)
107 for (
int i=0;
i<
x.size();
i++)
127 for (
int i=0;
i<
x.size();
i++)
128 for (
int j=
i+1; j<
x.size(); j++)
162 :
Base(
"Int::Distinct::Pathological::"+
163 Test::str(n0)+
"::"+
Test::str(icl0)),
n(n0),
icl(icl0) {}
170 for (
int i=0;
i<
n;
i++)
174 delete s;
return false;
176 for (
int i=0;
i<
n;
i++)
178 delete s;
return false;
185 for (
int i=0;
i<
n;
i++) {
190 for (
int i=
n;
i<2*
n;
i++)
194 delete s;
return false;
196 for (
int i=0;
i<
n;
i++)
198 delete s;
return false;
206 const int v[7] = {-1001,-1000,-10,0,10,1000,1001};
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.
virtual Assignment * assignment(void) const
Create and register initial assignment.
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.
Pathological p_32_v(32, Gecode::ICL_VAL)
Generate random selection of assignments.
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 > dom_d(-3, 3, Gecode::ICL_DOM)
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(const Gecode::IntSet &d0, Gecode::IntConLevel icl)
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.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
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.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
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.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Testing pathological cases
Gecode toplevel namespace
Offset val_os(d, Gecode::ICL_VAL)
int arity
Number of variables.
virtual bool run(void)
Perform test.
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)
Distinct< false > dom_s(d, Gecode::ICL_DOM)
Domain propagation or consistency.
int n
Number of variables.