Go to the documentation of this file.
39 namespace Test {
namespace Int {
49 template<
bool useCount>
56 :
Test(
std::string(useCount ?
"Count::Distinct::" :
"Distinct::")+
60 :
Test(
std::string(useCount ?
"Count::Distinct::" :
"Distinct::")+
64 for (
int i=0;
i<
x.size();
i++)
65 for (
int j=
i+1; j<
x.size(); j++)
96 for (
int i=0;
i<
x.size();
i++)
97 for (
int j=
i+1; j<
x.size(); j++)
105 for (
int i=0;
i<
x.size();
i++)
120 int n =
x.size() / 2;
121 for (
int i=0;
i<
n;
i++)
122 if ((
x[
i] < 0) || (
x[
i] > 1))
124 for (
int i=0;
i<
n;
i++)
125 for (
int j=
i+1; j<
n; j++)
126 if ((
x[
i] == 1) && (
x[j] == 1) && (
x[
n+
i] ==
x[
n+j]))
132 int n = bx.
size() / 2;
135 for (
int i=0;
i<
n;
i++) {
154 for (
int i=0;
i<
x.size();
i++)
155 for (
int j=
i+1; j<
x.size(); j++)
156 if ((
x[
i] != 0) && (
x[j] != 0) && (
x[
i] ==
x[j]))
180 for (
int i=0;
i<
x.size();
i++)
181 for (
int j=
i+1; j<
x.size(); j++)
215 :
Base(
"Int::Distinct::Pathological::"+
216 Test::str(n0)+
"::"+
Test::str(ipl0)),
n(n0),
ipl(ipl0) {}
223 for (
int i=0;
i<
n;
i++)
227 delete s;
return false;
229 for (
int i=0;
i<
n;
i++)
231 delete s;
return false;
238 for (
int i=0;
i<
n;
i++) {
243 for (
int i=
n;
i<2*
n;
i++)
247 delete s;
return false;
249 for (
int i=0;
i<
n;
i++)
251 delete s;
return false;
259 const int v[7] = {-1001,-1000,-10,0,10,1000,1001};
Optional ov5(v5, Gecode::IPL_VAL)
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
bool testsearch
Whether to perform search test.
ConTestLevel contest
Whether to test for certain consistency.
Gecode::IntArgs v5({0, 1})
Simple test for optional distinct constraint.
Gecode::IntPropLevel ipl
Propagation level.
Simple test for distinct constraint.
Generate random selection of assignments.
Passing integer variables.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &bx)
Post constraint on bx.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Optional od2(v2, Gecode::IPL_DOM)
Distinct< false > val_s(d, Gecode::IPL_VAL)
Distinct< false > dom_s(d, Gecode::IPL_DOM)
Gecode::IntArgs v2({Gecode::Int::Limits::min, 0, 1, Gecode::Int::Limits::max-4})
bool assigned(View x, int v)
Whether x is assigned to value v.
Gecode::IntArgs v1({Gecode::Int::Limits::min+4, 0, 1, Gecode::Int::Limits::max})
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Except ed1(v1, Gecode::IPL_DOM)
virtual Assignment * assignment(void) const
Create and register initial assignment.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Offset(int min, int max, Gecode::IntPropLevel ipl)
Create and register test.
Distinct(const Gecode::IntSet &d0, Gecode::IntPropLevel ipl, int n=6)
Create and register test.
const FloatNum min
Smallest allowed float value.
Random(int n, int min, int max, Gecode::IntPropLevel ipl)
Create and register test.
IntPropLevel
Propagation levels for integer propagators.
Optional(const Gecode::IntArgs &d, Gecode::IntPropLevel ipl)
Create and register test.
Optional ob1(v1, Gecode::IPL_BND)
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on bx.
Except eb5(v5, Gecode::IPL_BND)
Optional ob5(v5, Gecode::IPL_BND)
Range iterator for integer sets.
int size(void) const
Return size of array (number of elements)
Except eb2(v2, Gecode::IPL_BND)
Offset val_od(-3, 3, Gecode::IPL_VAL)
Distinct< false > val_l(dl, Gecode::IPL_VAL, 5)
Random val_r(50,-500, 500, Gecode::IPL_VAL)
Optional ob2(v2, Gecode::IPL_BND)
Optional ov3(v3, Gecode::IPL_VAL)
int n
Number of variables.
Random dom_r(20,-50, 50, Gecode::IPL_DOM)
Gecode toplevel namespace
Except eb1(v1, Gecode::IPL_BND)
Base class for all tests to be run
Distinct< true > count_dom_d(-3, 3, Gecode::IPL_DOM)
Offset dom_od(-3, 3, Gecode::IPL_DOM)
Node * x
Pointer to corresponding Boolean expression node.
Distinct< true > count_bnd_d(-3, 3, Gecode::IPL_BND)
Optional ob4(v4, Gecode::IPL_BND)
Passing Boolean variables.
Randomized test for distinct constraint.
TestSpace(TestSpace &s)
Constructor for cloning s.
Offset bnd_os(d, Gecode::IPL_BND)
Domain propagation Options: basic versus advanced propagation.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Offset val_os(d, Gecode::IPL_VAL)
Optional od4(v4, Gecode::IPL_DOM)
Pathological p_16_b(16, Gecode::IPL_BND)
Except ev2(v2, Gecode::IPL_VAL)
Optional ov2(v2, Gecode::IPL_VAL)
Distinct< true > count_bnd_s(d, Gecode::IPL_BND)
const int max
Largest allowed integer value.
TestSpace(void)
Constructor.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Offset dom_os(d, Gecode::IPL_DOM)
int arity
Number of variables.
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
virtual bool run(void)
Perform test.
Base class for assignments
Distinct< true > count_val_s(d, Gecode::IPL_VAL)
Simple test for distinct except constant constraint.
Offset bnd_od(-3, 3, Gecode::IPL_BND)
Space(void)
Default constructor.
Distinct< false > bnd_s(d, Gecode::IPL_BND)
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
Gecode::IntArgs v3({0, 1, 2, 3})
Pathological p_32_b(32, Gecode::IPL_BND)
Optional ov1(v1, Gecode::IPL_VAL)
Pathological p_32_d(32, Gecode::IPL_DOM)
Optional od5(v5, Gecode::IPL_DOM)
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
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.
Except(const Gecode::IntArgs &d, Gecode::IntPropLevel ipl)
Create and register test.
Except ev1(v1, Gecode::IPL_VAL)
Distinct< false > bnd_l(dl, Gecode::IPL_BND, 5)
Gecode::IntArgs v4({0, 1, 2})
Optional od3(v3, Gecode::IPL_DOM)
Except ed5(v5, Gecode::IPL_DOM)
const int min
Smallest allowed integer value.
Optional od1(v1, Gecode::IPL_DOM)
virtual bool solution(const Assignment &x) const
Check whether x is solution.
void distinct(Home home, const IntVarArgs &x, IntPropLevel ipl)
Post propagator for for all .
Distinct< false > val_d(-3, 3, Gecode::IPL_VAL)
Pathological p_16_d(16, Gecode::IPL_DOM)
Pathological p_16_v(16, Gecode::IPL_VAL)
Except ev5(v5, Gecode::IPL_VAL)
Distinct< false > bnd_d(-3, 3, Gecode::IPL_BND)
Random bnd_r(50,-500, 500, Gecode::IPL_BND)
Gecode::FloatVal c(-8, 8)
Distinct< false > dom_l(dl, Gecode::IPL_DOM, 5)
Distinct< false > dom_d(-3, 3, Gecode::IPL_DOM)
Optional ov4(v4, Gecode::IPL_VAL)
Distinct(int min, int max, Gecode::IntPropLevel ipl)
Create and register test.
int n
Number of negative literals for node type.
Testing pathological cases
Gecode::IntPropLevel ipl
Consistency level.
Distinct< true > count_val_d(-3, 3, Gecode::IPL_VAL)
Offset(const Gecode::IntSet &d, Gecode::IntPropLevel ipl)
Create and register test.
Passing integer arguments.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Value iterator for integer sets.
Gecode::IntArgs i({1, 2, 3, 4})
Distinct< true > count_dom_s(d, Gecode::IPL_DOM)
virtual Gecode::Space * copy(void)
Copy space during cloning.
Pathological p_32_v(32, Gecode::IPL_VAL)
Optional ob3(v3, Gecode::IPL_BND)
Simple test for distinct constraint with offsets.
const FloatNum max
Largest allowed float value.
void distinct(Home home, const IntVarArgs &x, int c, IntPropLevel ipl)
Post propagator for for all .
Pathological(int n0, Gecode::IntPropLevel ipl0)
Create and register test.
Except ed2(v2, Gecode::IPL_DOM)
Gecode::IntSet dom
Domain of variables.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.