38namespace Test {
namespace Int {
70 :
Test(
"Bool::Bin::XYZ::"+
str(op0),3,0,1),
op(op0) {}
73 return check(x[0],
op,x[1]) == x[2];
79 channel(home,x[0]),
op, channel(home,x[1]),
92 :
Test(
"Bool::Bin::XXY::"+
str(op0),2,0,1),
op(op0) {}
95 return check(x[0],
op,x[0]) == x[1];
100 BoolVar b = channel(home,x[0]);
101 rel(home, b,
op, b, channel(home,x[1]));
113 :
Test(
"Bool::Bin::XYX::"+
str(op0),2,0,1),
op(op0) {}
116 return check(x[0],
op,x[1]) == x[0];
121 BoolVar b = channel(home,x[0]);
122 rel(home, b,
op, channel(home,x[1]), b);
134 :
Test(
"Bool::Bin::XYY::"+
str(op0),2,0,1),
op(op0) {}
137 return check(x[0],
op,x[1]) == x[1];
142 BoolVar b = channel(home,x[1]);
143 rel(home, channel(home,x[0]),
op, b, b);
155 :
Test(
"Bool::Bin::XXX::"+
str(op0),1,0,1),
op(op0) {}
158 return check(x[0],
op,x[0]) == x[0];
163 BoolVar b = channel(home,x[0]);
164 rel(home, b,
op, b, b);
178 :
Test(
"Bool::Bin::XY::"+
str(op0)+
"::"+
str(c0),2,0,1),
187 rel(home, channel(home,x[0]),
op, channel(home,x[1]),
c);
201 :
Test(
"Bool::Bin::XX::"+
str(op0)+
"::"+
str(c0),1,0,1),
210 BoolVar b = channel(home,x[0]);
211 rel(home, b,
op, b,
c);
223 :
Test(
"Bool::Nary::"+
str(op0)+
"::"+
str(n),n+1,0,1),
op(op0) {}
227 int b =
check(x[n-2],
op,x[n-1]);
228 for (
int i=0; i<n-2; i++)
236 for (
int i=x.size()-1; i--; )
237 b[i]=channel(home,x[i]);
238 rel(home,
op, b, channel(home,x[x.size()-1]));
250 :
Test(
"Bool::Nary::Shared::"+
str(op0)+
"::"+
str(n),n,0,1),
258 int b =
check(x[n-2],
op,x[n-1]);
259 for (
int i=0; i<n-2; i++)
267 for (
int i=x.size(); i--; )
268 b[i]=channel(home,x[i]);
269 rel(home,
op, b, b[x.size()-1]);
283 :
Test(
"Bool::Nary::"+
str(op0)+
"::"+
str(n)+
"::"+
str(c0),n,0,1),
288 int b =
check(x[n-2],
op,x[n-1]);
289 for (
int i=0; i<n-2; i++)
297 for (
int i=x.size(); i--; )
298 b[i]=channel(home,x[i]);
312 :
Test(
"Bool::Clause::XYZ::"+
str(op0)+
"::"+
str(n),n+1,0,1),
op(op0) {}
315 int n = (x.size()-1) / 2;
321 for (
int i=1; i<n; i++)
324 return b == x[x.size()-1];
329 int n = (x.size()-1) / 2;
331 for (
int i=n; i--; ) {
332 a[i]=channel(home,x[i]);
333 b[i]=channel(home,x[i+n]);
335 clause(home,
op, a, b, channel(home,x[x.size()-1]));
347 :
Test(
"Bool::Clause::XXYYX::"+
str(op0)+
"::"+
str(n),n,0,1),
351 int n = x.size() / 2;
357 for (
int i=1; i<n; i++)
365 int n = x.size() / 2;
367 for (
int i=n; i--; ) {
368 a[i]=a[i+n]=channel(home,x[i]);
369 b[i]=b[i+n]=channel(home,x[i+n]);
371 clause(home,
op, a, b, a[0]);
383 :
Test(
"Bool::Clause::XXY::"+
str(op0)+
"::"+
str(n),n,0,1),
392 int n = x.size() / 2;
394 for (
int i=n; i--; ) {
395 a[i]=b[i+n]=channel(home,x[i]);
396 b[i]=a[i+n]=channel(home,x[i+n]);
398 clause(home,
op, a, b, a[0]);
412 :
Test(
"Bool::Clause::"+
str(op0)+
"::"+
str(n)+
"::"+
str(c0),n,0,1),
416 int n = x.size() / 2;
422 for (
int i=1; i<n; i++)
430 int n = x.size() / 2;
432 for (
int i=n; i--; ) {
433 a[i]=channel(home,x[i]);
434 b[i]=channel(home,x[i+n]);
436 clause(home,
op, a, b,
c);
448 if ((x[0] < 0) || (x[0] > 1))
459 ite(home,channel(home,x[0]),x[1],x[2],x[3]);
461 rel(home, ite(channel(home,x[0]),x[1],x[2]) == x[3]);
470 :
Test(
"ITE::Bool",4,0,1,false) {}
481 ite(home,channel(home,x[0]),channel(home,x[1]),
482 channel(home,x[2]),channel(home,x[3]));
493 (void)
new BinXYZ(bots.bot());
494 (void)
new BinXXY(bots.bot());
495 (void)
new BinXYX(bots.bot());
496 (void)
new BinXYY(bots.bot());
497 (void)
new BinXXX(bots.bot());
502 (void)
new Nary(bots.bot(),2);
503 (void)
new Nary(bots.bot(),6);
504 (void)
new Nary(bots.bot(),10);
514 if ((bots.bot() == BOT_AND) || (bots.bot() == BOT_OR)) {
Passing Boolean variables.
Boolean integer variables.
static Gecode::Support::RandomGenerator rand
Random number generator.
Base class for assignments
Iterator for Boolean operation types.
Test for binary Boolean operation with shared variables and constant
virtual bool solution(const Assignment &x) const
Check whether x is solution.
BinConstXX(Gecode::BoolOpType op0, int c0)
Construct and register test.
Gecode::BoolOpType op
Boolean operation type for test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Test for binary Boolean operation with constant
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Gecode::BoolOpType op
Boolean operation type for test.
BinConstXY(Gecode::BoolOpType op0, int c0)
Construct and register test.
Test for binary Boolean operation with shared variables
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
BinXXX(Gecode::BoolOpType op0)
Construct and register test.
Test for binary Boolean operation with shared variables
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
BinXXY(Gecode::BoolOpType op0)
Construct and register test.
Test for binary Boolean operation with shared variables
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Gecode::BoolOpType op
Boolean operation type for test.
BinXYX(Gecode::BoolOpType op0)
Construct and register test.
Test for binary Boolean operation with shared variables
Gecode::BoolOpType op
Boolean operation type for test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
BinXYY(Gecode::BoolOpType op0)
Construct and register test.
Test for binary Boolean operation
BinXYZ(Gecode::BoolOpType op0)
Construct and register test.
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Test for Clause Boolean operation with constant
ClauseConst(Gecode::BoolOpType op0, int n, int c0)
Construct and register test.
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Test for Clause Boolean operation
ClauseXXYYX(Gecode::BoolOpType op0, int n)
Construct and register test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Gecode::BoolOpType op
Boolean operation type for test.
Test for Clause Boolean operation
ClauseXXY(Gecode::BoolOpType op0, int n)
Construct and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Test for Clause Boolean operation
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
ClauseXYZ(Gecode::BoolOpType op0, int n)
Construct and register test.
Help class to create and register tests.
Create(void)
Perform creation and registration.
Test for if-then-else-constraint
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
ITEBool(void)
Construct and register test.
Test for if-then-else-constraint
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
ITEInt(Gecode::IntPropLevel ipl)
Construct and register test.
Test for Nary Boolean operation with constant
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
NaryConst(Gecode::BoolOpType op0, int n, int c0)
Construct and register test.
Test for Nary Boolean operation
virtual bool solution(const Assignment &x) const
Check whether x is solution.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
NaryShared(Gecode::BoolOpType op0, int n)
Construct and register test.
Gecode::BoolOpType op
Boolean operation type for test.
Test for Nary Boolean operation
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint.
Gecode::BoolOpType op
Boolean operation type for test.
virtual bool solution(const Assignment &x) const
Check whether x is solution.
Nary(Gecode::BoolOpType op0, int n)
Construct and register test.
bool testfix
Whether to perform fixpoint test.
Gecode::IntPropLevel ipl
Propagation level.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
BoolOpType
Operation types for Booleans.
IntPropLevel
Propagation levels for integer propagators.
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
@ IPL_BND
Bounds propagation.
Gecode toplevel namespace
int check(int x0, Gecode::BoolOpType op, int x1)
ITEInt itebnd(Gecode::IPL_BND)
ITEInt itedom(Gecode::IPL_DOM)
#define GECODE_NEVER
Assert that this command is never executed.