Go to the documentation of this file.
38 namespace Test {
namespace Set {
59 template<
class I,
class J>
61 sol(I&
i, J& j)
const {
85 :
SetTest(
"RelOp::"+str(sot0)+
"::"+str(srt0)+
"::S"+str(share0),
86 share0 == 0 ? 3 : 2,ds_22,false)
87 , sot(sot0), srt(srt0), share(share0) {}
92 case 0:
a=
x[0];
b=
x[1];
c=
x[2];
break;
93 case 1:
a=
x[0];
b=
x[0];
c=
x[0];
break;
94 case 2:
a=
x[0];
b=
x[0];
c=
x[1];
break;
95 case 3:
a=
x[0];
b=
x[1];
c=
x[0];
break;
96 case 4:
a=
x[0];
b=
x[1];
c=
x[1];
break;
143 case 0:
a=
x[0];
b=
x[1];
c=
x[2];
break;
144 case 1:
a=
x[0];
b=
x[0];
c=
x[0];
break;
145 case 2:
a=
x[0];
b=
x[0];
c=
x[1];
break;
146 case 3:
a=
x[0];
b=
x[1];
c=
x[0];
break;
147 case 4:
a=
x[0];
b=
x[1];
c=
x[1];
break;
161 for (
int i=0;
i<=4;
i++) {
162 (void)
new Rel(sots.sot(),srts.srt(),
i);
182 :
SetTest(
"RelOp::N::"+str(sot0)+
"::"+str(n0)+
"::S"+str(shared0)+
183 "::C"+str(withConst0 ? 1 : 0),
184 shared0 == 0 ? n0+1 : (shared0 <= 2 ? 3 : 2),ds_12,false)
185 , sot(sot0),
n(n0),
shared(shared0), withConst(withConst0)
190 int realN =
shared == 0 ?
n : 3;
196 for (
int i=realN;
i--; )
197 isrs[
i].init(
x.lub,
x[
i]);
200 isrs[0].
init(
x.lub,
x[0]);
201 isrs[1].
init(
x.lub,
x[0]);
202 isrs[2].
init(
x.lub,
x[1]);
205 isrs[0].
init(
x.lub,
x[0]);
206 isrs[1].
init(
x.lub,
x[1]);
207 isrs[2].
init(
x.lub,
x[2]);
210 isrs[0].
init(
x.lub,
x[0]);
211 isrs[1].
init(
x.lub,
x[1]);
212 isrs[2].
init(
x.lub,
x[0]);
218 int result =
shared == 0 ?
x.size() - 1 : (
shared <= 2 ? 2 : 0);
224 if (
shared == 1 && (isrs[0]() || isrs[1]())) {
225 delete[] isrs;
return false;
227 if (
shared == 3 && (isrs[0]() || isrs[2]())) {
228 delete[] isrs;
return false;
230 unsigned int cardSum = 0;
235 for (
int i=0;
i<realN;
i++) {
244 delete[] isrs;
return false;
312 for (
int i=
x.size()-1;
i--;)
317 xs[0] =
x[0]; xs[1] =
x[0]; xs[2] =
x[1]; xn =
x[2];
320 xs[0] =
x[0]; xs[1] =
x[1]; xs[2] =
x[2]; xn =
x[2];
323 xs[0] =
x[0]; xs[1] =
x[1]; xs[2] =
x[0]; xn =
x[0];
341 for (
int wc=0; wc<=1; wc++) {
342 for (
int i=0;
i<=3;
i++) {
369 :
SetTest(
"RelOp::IntN::"+str(sot0)+
"::"+str(n0)+
370 "::C"+str(withConst0 ? 1 : 0),
372 , sot(sot0),
n(n0), withConst(withConst0)
377 int* isrs =
new int[
n];
378 for (
int i=0;
i<
n;
i++)
379 isrs[
i] =
x.ints()[
i];
389 if (cardSum !=
static_cast<unsigned int>(
n)) {
420 bool allEqual =
true;
421 for (
int i=1;
i<
n;
i++) {
422 if (isrs[
i] != isrs[0]) {
481 for (
int wc=0; wc<=1; wc++) {
482 for (
int i=0;
i<=3;
i++) {
Post propagator for SetVar x
Post propagator for SetVar SetOpType SetVar y
bool solution(const SetAssignment &x) const
Test whether x is solution
unsigned int size(I &i)
Size of all ranges of range iterator i.
Help class to create and register tests.
Test for ternary relation constraint
Test for n-ary partition constraint
void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
SetOpType
Common operations for sets.
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
Range iterator for integer sets.
RelN(Gecode::SetOpType sot0, int n0, int shared0, bool withConst0)
Create and register test.
Generate all set assignments.
Gecode toplevel namespace
union Gecode::@602::NNF::@65 u
Union depending on nodetype t.
const unsigned int card
Maximum cardinality of an integer set.
A complement iterator spezialized for the BndSet limits.
Create(void)
Perform creation and registration.
Help class to create and register tests.
Range iterator for computing intersection (binary)
Post propagator for SetVar SetOpType SetVar SetRelType r
Range iterator for computing set difference.
Help class to create and register tests.
CreateIntN(void)
Perform creation and registration.
Base class for tests with set constraints
struct Gecode::@602::NNF::@65::@66 b
For binary nodes (and, or, eqv)
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
Range iterator for union of iterators.
SetRelType
Common relation types for sets.
Iterator for Boolean operation types.
#define GECODE_NEVER
Assert that this command is never executed.
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
Iterator for set relation types.
Range iterator for computing union (binary)
@ SOT_DUNION
Disjoint union.
Rel(Gecode::SetOpType sot0, Gecode::SetRelType srt0, int share0=0)
Create and register test.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
bool shared(ViewArray< ViewX > x, ViewArray< ViewY > y)
bool solution(const SetAssignment &x) const
Test whether x is solution
Test for n-ary partition constraint
void init(const Gecode::IntSet &d, int cur)
Initialize with set d0 and bit-pattern cur0.
Test for Region memory area
bool solution(const SetAssignment &x) const
Test whether x is solution
void post(Space &home, SetVarArray &x, IntVarArray &)
Post constraint on x.
Range iterator producing subsets of an IntSet.
Range iterator for intersection of iterators.
void post(Space &home, SetVarArray &x, IntVarArray &)
Post constraint on x.
CreateN(void)
Perform creation and registration.
Range iterator for singleton range.
int n
Number of negative literals for node type.
Gecode::IntArgs i({1, 2, 3, 4})
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
RelIntN(Gecode::SetOpType sot0, int n0, bool withConst0)
Create and register test.