42 using namespace Gecode;
44 namespace Test {
namespace Set {
55 static const int d1r[4][2] = {
56 {-4,-3},{-1,-1},{1,1},{3,5}
79 return s==(
unsigned int)x.
intval();
86 Card
_card(
"Int::Card");
109 Min
_min(
"Int::Min");
116 :
SetTest(t,1,ds_33,false,1) {}
120 return !(xr0() && xr0.
min()==x.
intval());
151 Max
_max(
"Int::Max");
158 :
SetTest(t,1,ds_33,false,1) {}
195 Elem
_elem(
"Int::Elem");
202 :
SetTest(t,1,ds_33,false,1) {}
225 :
SetTest(
"Int::Rel::"+str(srt0)+(inverse0 ?
"::i" :
""),
299 :
SetTest(
"Int::IntRel::"+Test::Int::Test::str(irt0)+
300 (inverse0 ?
"::i" :
""),1,ds_33,false,1)
311 if (xr.
val() != x.
intval())
return false;
314 if (xr.
val() == x.
intval())
return false;
369 while (elements[i]<
v.val()) i++;
370 assert(elements[i] ==
v.val());
385 int min = -10000,
int max = 10000)
402 const int el1v[] = {-3,-2,-1,0,1,2,3};
404 const int w1v[] = {1,-2,1,1,1,6,1};
408 const int w2v[] = {-1,-1,-1,10,-1,-1,-1};
413 const int w4v[] = {1,1,0,0,0,0,0};
Rel _rel_sub(Gecode::SRT_SUB, false)
IntRelType inverse(const IntRelType irt)
Inverse the relation.
IntRel _intrel_nqi(Gecode::IRT_NQ, true)
Rel _rel_subi(Gecode::SRT_SUB, true)
Rel _rel_nq(Gecode::SRT_NQ, false)
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
NotMax(const char *t)
Create and register test.
SetRelType
Common relation types for sets.
Weights(const char *t, IntArgs &el, IntArgs &w, int min=-10000, int max=10000)
Create and register test.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Range iterator for integer sets.
Max(const char *t)
Create and register test.
IntRel(Gecode::IntRelType irt0, bool inverse0)
Create and register test.
Elem(const char *t)
Create and register test.
IntRel _intrel_nq(Gecode::IRT_NQ, false)
Test for integer relation constraint
IntRel _intrel_eq(Gecode::IRT_EQ, false)
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
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 set weight constraint
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Test for negated maximal element constraint
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for b.
Card(const char *t)
Create and register test.
Rel _rel_cmpl(Gecode::SRT_CMPL, false)
NoElem _noelem("Int::NoElem")
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 bool solution(const SetAssignment &x) const
Test whether x is solution
IntRel _intrel_gr(Gecode::IRT_GR, false)
NotMax _notmax("Int::NotMax")
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
int min(void) const
Return smallest value of range.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Test for maximal element constraint
Gecode::IntArgs i(4, 1, 2, 3, 4)
IntRel _intrel_lei(Gecode::IRT_LE, true)
IntRel _intrel_gri(Gecode::IRT_GR, true)
int weightI(SharedArray< int > &elements, SharedArray< int > &weights, I &iter)
Compute the weight of the elements in the iterator I.
IntRelType
Relation types for integers.
Range iterator for computing intersection (binary)
int ranges(void) const
Return number of ranges of the specification.
Rel _rel_eq(Gecode::SRT_EQ, false)
NotMin _notmin("Int::NotMin")
A complement iterator spezialized for the BndSet limits.
Rel _rel_disj(Gecode::SRT_DISJ, false)
IntRel _intrel_le(Gecode::IRT_LE, false)
Weights _weights3("Int::Weights::3", el1, w2, 3)
Value iterator from range iterator.
Reification specification.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
IntRel _intrel_eqi(Gecode::IRT_EQ, true)
IntRel _intrel_lq(Gecode::IRT_LQ, false)
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.
Gecode::IntSet lub
The common superset for all domains.
NoElem(const char *t)
Create and register test.
int val(void) const
Return current value.
Rel _rel_sup(Gecode::SRT_SUP, false)
Value iterator producing subsets of an IntSet.
Passing integer arguments.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
void notMax(Home home, SetVar s, IntVar x)
Post propagator that propagates that x is not the maximal element of s.
Weights _weights1("Int::Weights::1", el1, w1)
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Rel _rel_eqi(Gecode::SRT_EQ, true)
int intval(void) const
Return value for first integer variable.
Min(const char *t)
Create and register test.
Node * x
Pointer to corresponding Boolean expression node.
Rel _rel_supi(Gecode::SRT_SUP, true)
Rel(Gecode::SetRelType srt0, bool inverse0)
Create and register test.
IntRel _intrel_lqi(Gecode::IRT_LQ, true)
Base class for tests with set constraints
Generate all set assignments.
Weights _weights4("Int::Weights::4", el1, w4)
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Test for negated minimal element constraint
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
Post propagator for .
Range iterator producing subsets of an IntSet.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
IntRel _intrel_gq(Gecode::IRT_GQ, false)
Rel _rel_nqi(Gecode::SRT_NQ, true)
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
Test for negated element constraint
LinFloatExpr sum(const FloatVarArgs &x)
Construct linear float expression as sum of float variables.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for b.
Test for minimal element constraint
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Rel _rel_disji(Gecode::SRT_DISJ, true)
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Test for cardinality constraint
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
void notMin(Home home, SetVar s, IntVar x)
Post propagator that propagates that x is not the minimal element of s.
NotMin(const char *t)
Create and register test.
Rel _rel_cmpli(Gecode::SRT_CMPL, true)
#define GECODE_NEVER
Assert that this command is never executed.
Test for relation constraint
int max(int i) const
Return maximum of range at position i.
Test for element constraint
IntRel _intrel_gqi(Gecode::IRT_GQ, true)
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Weights _weights2("Int::Weights::2", el1, w2)