40namespace Test {
namespace Set {
51 static const int d1r[4][2] = {
52 {-4,-3},{-1,-1},{1,1},{3,5}
75 return s==(
unsigned int)
x.intval();
98 return xr0() && xr0.
min()==
x.intval();
121 return !(xr0() && xr0.
min()==
x.intval());
140 return x0.
ranges() > 0 && x0.
max()==
x.intval();
164 return !(x0.
ranges() > 0 && x0.
max()==
x.intval());
182 if (xr.val()==
x.intval())
207 if (xr.val()==
x.intval())
228 :
SetTest(
"Int::Rel::"+
str(srt0)+(s ?
"::s" :
""),
230 srt(srt0), swapped(s) {}
304 (s ?
"::s" :
""),1,ds_33,true,1),
305 irt(irt0), swapped(s) {
316 if (xr.
val() !=
x.intval())
return false;
319 if (xr.
val() ==
x.intval())
return false;
322 if (!swapped && xr.
val() <=
x.intval())
return false;
323 if (swapped && xr.
val() >=
x.intval())
return false;
326 if (!swapped && xr.
val() <
x.intval())
return false;
327 if (swapped && xr.
val() >
x.intval())
return false;
330 if (!swapped && xr.
val() >=
x.intval())
return false;
331 if (swapped && xr.
val() <=
x.intval())
return false;
334 if (!swapped && xr.
val() >
x.intval())
return false;
335 if (swapped && xr.
val() <
x.intval())
return false;
353 assert((
x.size() == 1) && (
y.size() == 1));
359 }
else if (swapped) {
416 while (elements[i]<v.val()) i++;
417 assert(elements[i] == v.val());
432 int min = -10000,
int max = 10000)
449 const int el1v[] = {-3,-2,-1,0,1,2,3};
451 const int w1v[] = {1,-2,1,1,1,6,1};
455 const int w2v[] = {-1,-1,-1,10,-1,-1,-1};
460 const int w4v[] = {1,1,0,0,0,0,0};
Node * x
Pointer to corresponding Boolean expression node.
Passing integer arguments.
Range iterator for integer sets.
int max(int i) const
Return maximum of range at position i.
int ranges(void) const
Return number of ranges of the specification.
Range iterator for computing intersection (binary)
int min(void) const
Return smallest value of range.
Value iterator from range iterator.
Reification specification.
A complement iterator spezialized for the BndSet limits.
static Gecode::Support::RandomGenerator rand
Random number generator.
Range iterator producing subsets of an IntSet.
Value iterator producing subsets of an IntSet.
int val(void) const
Return current value.
Test for cardinality constraint
Card(const char *t)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Test for element constraint
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Elem(const char *t)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for b.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Test for integer relation constraint
IntRel(Gecode::IntRelType irt0, bool s)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for r.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Test for maximal element constraint
Max(const char *t)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Test for minimal element constraint
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Min(const char *t)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Test for negated element constraint
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
NoElem(const char *t)
Create and register test.
Test for negated maximal element constraint
NotMax(const char *t)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Test for negated minimal element constraint
NotMin(const char *t)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Test for relation constraint
Rel(Gecode::SetRelType srt0, bool s)
Create and register test.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for r.
Test for set weight constraint
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Weights(const char *t, IntArgs &el, IntArgs &w, int min=-10000, int max=10000)
Create and register test.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Generate all set assignments.
Base class for tests with set constraints
static std::string str(Gecode::SetRelType srt)
Map set relation to string.
bool testsubsumed
Whether to check for subsumption.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
IntRelType
Relation types for integers.
@ IRT_GQ
Greater or equal ( )
@ IRT_LQ
Less or equal ( )
@ RM_EQV
Equivalence for reification (default)
SetRelType
Common relation types for sets.
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
Gecode toplevel namespace
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
void notMin(Home home, SetVar s, IntVar x)
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
SetExpr inter(const SetVarArgs &)
Intersection of set variables.
Post propagator for SetVar SetOpType SetVar y
LinIntExpr sum(const IntVarArgs &x)
Construct linear expression as sum of integer variables.
void notMax(Home home, SetVar s, IntVar x)
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
LinIntExpr cardinality(const SetExpr &)
Cardinality of set expression.
IntRel _intrel_gq(Gecode::IRT_GQ, false)
Rel _rel_sup(Gecode::SRT_SUP, false)
IntRel _intrel_nq(Gecode::IRT_NQ, false)
NoElem _noelem("Int::NoElem")
int weightI(const IntArgs &elements, const IntArgs &weights, I &iter)
IntRel _intrel_eq(Gecode::IRT_EQ, false)
IntRel _intrel_gr(Gecode::IRT_GR, false)
IntRel _intrel_nqs(Gecode::IRT_NQ, true)
Weights _weights1("Int::Weights::1", el1, w1)
Weights _weights4("Int::Weights::4", el1, w4)
NotMin _notmin("Int::NotMin")
Rel _rel_nq(Gecode::SRT_NQ, false)
Rel _rel_disj(Gecode::SRT_DISJ, false)
IntRel _intrel_gqs(Gecode::IRT_GQ, true)
NotMax _notmax("Int::NotMax")
Rel _rel_cmpl(Gecode::SRT_CMPL, false)
Rel _rel_sups(Gecode::SRT_SUP, true)
Weights _weights3("Int::Weights::3", el1, w2, 3)
Rel _rel_subs(Gecode::SRT_SUB, true)
Rel _rel_eqs(Gecode::SRT_EQ, true)
IntRel _intrel_grs(Gecode::IRT_GR, true)
Rel _rel_eq(Gecode::SRT_EQ, false)
IntRel _intrel_le(Gecode::IRT_LE, false)
IntRel _intrel_eqs(Gecode::IRT_EQ, true)
IntRel _intrel_les(Gecode::IRT_LE, true)
Rel _rel_cmpls(Gecode::SRT_CMPL, true)
IntRel _intrel_lq(Gecode::IRT_LQ, false)
Weights _weights2("Int::Weights::2", el1, w2)
Rel _rel_sub(Gecode::SRT_SUB, false)
IntRel _intrel_lqs(Gecode::IRT_LQ, true)
Rel _rel_disjs(Gecode::SRT_DISJ, true)
Rel _rel_nqs(Gecode::SRT_NQ, true)
#define GECODE_NEVER
Assert that this command is never executed.