Go to the documentation of this file.
40 namespace 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) {
306 testsubsumed =
false;
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)
439 x.intval() >= minWeight &&
x.intval() <= maxWeight;
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};
LinFloatExpr sum(const FloatVarArgs &x)
Construct linear float expression as sum of float variables.
Post propagator for SetVar x
IntRel _intrel_gq(Gecode::IRT_GQ, false)
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
IntRelType
Relation types for integers.
Post propagator for SetVar SetOpType SetVar y
Rel _rel_disjs(Gecode::SRT_DISJ, true)
IntRel _intrel_lq(Gecode::IRT_LQ, false)
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.
Test for set weight constraint
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for r.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
@ IRT_GQ
Greater or equal ( )
int max(int i) const
Return maximum of range at position i.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
NoElem _noelem("Int::NoElem")
Rel _rel_sub(Gecode::SRT_SUB, false)
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
int val(void) const
Return current value.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x.
Rel _rel_cmpls(Gecode::SRT_CMPL, true)
void notMin(Home home, SetVar s, IntVar x)
IntRel _intrel_nq(Gecode::IRT_NQ, false)
NotMax(const char *t)
Create and register test.
Test for cardinality constraint
IntRel _intrel_eqs(Gecode::IRT_EQ, true)
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
IntRel _intrel_grs(Gecode::IRT_GR, true)
Weights _weights3("Int::Weights::3", el1, w2, 3)
Range iterator for integer sets.
Test for minimal element constraint
Weights _weights2("Int::Weights::2", el1, w2)
Generate all set assignments.
Test for negated maximal element constraint
Rel _rel_sups(Gecode::SRT_SUP, true)
NotMin _notmin("Int::NotMin")
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.
Rel _rel_nq(Gecode::SRT_NQ, false)
Gecode toplevel namespace
Test for negated element constraint
Min(const char *t)
Create and register test.
NotMin(const char *t)
Create and register test.
Rel _rel_sup(Gecode::SRT_SUP, false)
A complement iterator spezialized for the BndSet limits.
int min(void) const
Return smallest value of range.
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.
Reification specification.
@ RM_EQV
Equivalence for reification (default)
Value iterator from range iterator.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Range iterator for computing intersection (binary)
Rel(Gecode::SetRelType srt0, bool s)
Create and register test.
IntRel _intrel_gr(Gecode::IRT_GR, false)
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Test for maximal element constraint
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Value iterator producing subsets of an IntSet.
Base class for tests with set constraints
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
IntRel _intrel_gqs(Gecode::IRT_GQ, true)
SetRelType
Common relation types for sets.
virtual bool solution(const SetAssignment &x) const
Test whether x is solution
Test for element constraint
void weights(Home home, IntSharedArray elements, IntSharedArray weights, SetVar x, IntVar y)
IntRel _intrel_eq(Gecode::IRT_EQ, false)
NoElem(const char *t)
Create and register test.
Weights _weights4("Int::Weights::4", el1, w4)
void notMax(Home home, SetVar s, IntVar x)
#define GECODE_NEVER
Assert that this command is never executed.
IntRel(Gecode::IntRelType irt0, 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 bool solution(const SetAssignment &x) const
Test whether x is solution
Rel _rel_eqs(Gecode::SRT_EQ, true)
Rel _rel_eq(Gecode::SRT_EQ, false)
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Rel _rel_nqs(Gecode::SRT_NQ, true)
virtual void post(Space &home, SetVarArray &x, IntVarArray &y, Reify r)
Post reified constraint on x for b.
Elem(const char *t)
Create and register test.
IntRel _intrel_nqs(Gecode::IRT_NQ, true)
Test for integer relation constraint
IntRel _intrel_les(Gecode::IRT_LE, true)
Card(const char *t)
Create and register test.
Range iterator producing subsets of an IntSet.
Max(const char *t)
Create and register test.
Rel _rel_subs(Gecode::SRT_SUB, true)
NotMax _notmax("Int::NotMax")
IntRel _intrel_le(Gecode::IRT_LE, false)
IntRel _intrel_lqs(Gecode::IRT_LQ, true)
Test for negated minimal element constraint
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Test for relation constraint
Rel _rel_disj(Gecode::SRT_DISJ, false)
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.
Passing integer arguments.
virtual void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Gecode::IntArgs i({1, 2, 3, 4})
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.
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
Weights _weights1("Int::Weights::1", el1, w1)
Rel _rel_cmpl(Gecode::SRT_CMPL, false)
int weightI(const IntArgs &elements, const IntArgs &weights, I &iter)
int ranges(void) const
Return number of ranges of the specification.
@ IRT_LQ
Less or equal ( )
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.