42 namespace Test {
namespace Set {
63 template<
class I,
class J>
65 sol(I&
i, J& j)
const {
89 :
SetTest(
"RelOp::"+str(sot0)+
"::"+str(srt0)+
"::S"+str(share0),
90 share0 == 0 ? 3 : 2,ds_22,false)
91 , sot(sot0), srt(srt0), share(share0) {}
96 case 0:
a=
x[0];
b=
x[1];
c=
x[2];
break;
97 case 1:
a=
x[0];
b=
x[0];
c=
x[0];
break;
98 case 2:
a=
x[0];
b=
x[0];
c=
x[1];
break;
99 case 3:
a=
x[0];
b=
x[1];
c=
x[0];
break;
100 case 4:
a=
x[0];
b=
x[1];
c=
x[1];
break;
146 case 0:
a=
x[0];
b=
x[1];
c=
x[2];
break;
147 case 1:
a=
x[0];
b=
x[0];
c=
x[0];
break;
148 case 2:
a=
x[0];
b=
x[0];
c=
x[1];
break;
149 case 3:
a=
x[0];
b=
x[1];
c=
x[0];
break;
150 case 4:
a=
x[0];
b=
x[1];
c=
x[1];
break;
164 for (
int i=0;
i<=4;
i++) {
165 (void)
new Rel(sots.sot(),srts.srt(),
i);
185 :
SetTest(
"RelOp::N::"+str(sot0)+
"::"+str(n0)+
"::S"+str(shared0)+
186 "::C"+str(withConst0 ? 1 : 0),
187 shared0 == 0 ? n0+1 : (shared0 <= 2 ? 3 : 2),ds_12,false)
188 , sot(sot0),
n(n0),
shared(shared0), withConst(withConst0)
193 int realN =
shared == 0 ?
n : 3;
199 for (
int i=realN;
i--; )
200 isrs[
i].init(
x.lub,
x[
i]);
203 isrs[0].
init(
x.lub,
x[0]);
204 isrs[1].
init(
x.lub,
x[0]);
205 isrs[2].
init(
x.lub,
x[1]);
208 isrs[0].
init(
x.lub,
x[0]);
209 isrs[1].
init(
x.lub,
x[1]);
210 isrs[2].
init(
x.lub,
x[2]);
213 isrs[0].
init(
x.lub,
x[0]);
214 isrs[1].
init(
x.lub,
x[1]);
215 isrs[2].
init(
x.lub,
x[0]);
221 int result =
shared == 0 ?
x.size() - 1 : (
shared <= 2 ? 2 : 0);
227 if (
shared == 1 && (isrs[0]() || isrs[1]())) {
228 delete[] isrs;
return false;
230 if (
shared == 3 && (isrs[0]() || isrs[2]())) {
231 delete[] isrs;
return false;
233 unsigned int cardSum = 0;
238 for (
int i=0;
i<realN;
i++) {
247 delete[] isrs;
return false;
321 for (
int i=
x.size()-1;
i--;)
326 xs[0] =
x[0]; xs[1] =
x[0]; xs[2] =
x[1]; xn =
x[2];
329 xs[0] =
x[0]; xs[1] =
x[1]; xs[2] =
x[2]; xn =
x[2];
332 xs[0] =
x[0]; xs[1] =
x[1]; xs[2] =
x[0]; xn =
x[0];
350 for (
int wc=0; wc<=1; wc++) {
351 for (
int i=0;
i<=3;
i++) {
378 :
SetTest(
"RelOp::IntN::"+str(sot0)+
"::"+str(n0)+
379 "::C"+str(withConst0 ? 1 : 0),
381 , sot(sot0),
n(n0), withConst(withConst0)
386 int* isrs =
new int[
n];
387 for (
int i=0;
i<
n;
i++)
388 isrs[
i] =
x.ints()[
i];
398 if (cardSum != static_cast<unsigned int>(
n)) {
429 bool allEqual =
true;
430 for (
int i=1;
i<
n;
i++) {
431 if (isrs[
i] != isrs[0]) {
490 for (
int wc=0; wc<=1; wc++) {
491 for (
int i=0;
i<=3;
i++) {
Test for n-ary partition constraint
Create(void)
Perform creation and registration.
Iterator for Boolean operation types.
SetRelType
Common relation types for sets.
Iterator for set relation types.
void post(Space &home, SetVarArray &x, IntVarArray &)
Post constraint on x.
union Gecode::@579::NNF::@61 u
Union depending on nodetype t.
Range iterator for singleton range.
Range iterator for integer sets.
void post(Space &home, SetVarArray &x, IntVarArray &y)
Post constraint on x.
Fake space for creation of regions.
CreateIntN(void)
Perform creation and registration.
bool solution(const SetAssignment &x) const
Test whether x is solution
bool equal(I &i, J &j)
Check whether range iterators i and j are equal.
Test for ternary relation constraint
SetOpType
Common operations for sets.
const unsigned int card
Maximum cardinality of an integer set.
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
CreateN(void)
Perform creation and registration.
void post(Space &home, SetVarArray &x, IntVarArray &)
Post constraint on x.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
Help class to create and register tests.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Range iterator for computing intersection (binary)
Range iterator for union of iterators.
A complement iterator spezialized for the BndSet limits.
unsigned int size(I &i)
Size of all ranges of range iterator i.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
bool solution(const SetAssignment &x) const
Test whether x is solution
RelIntN(Gecode::SetOpType sot0, int n0, bool withConst0)
Create and register test.
Range iterator for computing union (binary)
Post propagator for SetVar SetOpType SetVar SetRelType r
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
Rel(Gecode::SetOpType sot0, Gecode::SetRelType srt0, int share0=0)
Create and register test.
Post propagator for SetVar SetOpType SetVar y
Help class to create and register tests.
Range iterator for intersection of iterators.
bool solution(const SetAssignment &x) const
Test whether x is solution
Base class for tests with set constraints
Generate all set assignments.
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Range iterator producing subsets of an IntSet.
Post propagator for SetVar x
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
bool shared(const ConstView< ViewA > &, const ConstView< ViewB > &)
Test whether views share same variable.
RelN(Gecode::SetOpType sot0, int n0, int shared0, bool withConst0)
Create and register test.
Gecode toplevel namespace
Range iterator for computing set difference.
#define GECODE_NEVER
Assert that this command is never executed.
Help class to create and register tests.