39 namespace Test {
namespace Int {
58 :
Test(
"Element::Int::Int::Var::"+s,2,
min,
max),
62 return (
x[0]>= 0) && (
x[0]<
c.
size()) &&
c[
x[0]]==
x[1];
66 Gecode::element(home,
c,
x[0],
x[1]);
80 :
Test(
"Element::Int::Int::Int::"+s+
"::"+
str(r0),1,-4,8),
84 return (
x[0]>= 0) && (
x[0]<
c.
size()) &&
c[
x[0]]==
r;
88 Gecode::element(home,
c,
x[0],
r);
101 :
Test(
"Element::Int::Int::Shared::"+s,1,minDomain,8),
c(c0) {}
104 return (
x[0]>= 0) && (
x[0]<
c.
size()) &&
c[
x[0]]==
x[0];
108 Gecode::element(home,
c,
x[0],
x[0]);
120 :
Test(
"Element::Int::Bool::Var::"+s,2,-4,8),
c(c0) {}
123 return (
x[0]>= 0) && (
x[0]<
c.
size()) &&
c[
x[0]]==
x[1];
127 Gecode::element(home,
c,
x[0], Gecode::channel(home,
x[1]));
141 :
Test(
"Element::Int::Bool::Int::"+s+
"::"+
str(r0),1,-4,8),
145 return (
x[0]>= 0) && (
x[0]<
c.
size()) &&
c[
x[0]]==
r;
149 Gecode::element(home,
c,
x[0],
r);
158 :
Test(
"Element::Var::Int::Var::"+
str(
ipl),6,-1,3,false,
ipl) {}
161 return (
x[0]>= 0) && (
x[0]<
x.size()-2) &&
x[2+
x[0]]==
x[1];
166 for (
int i=0;
i<
x.size()-2;
i++)
168 Gecode::element(home,
c,
x[0],
x[1],
ipl);
181 5,-1,3,false,
ipl),
r(r0) {
186 return (
x[0]>= 0) && (
x[0]<
x.size()-1) &&
x[1+
x[0]]==
r;
191 for (
int i=0;
i<
x.size()-1;
i++)
193 Gecode::element(home,
c,
x[0],
r,
ipl);
202 :
Test(
"Element::Var::Int::Shared::"+
str(
ipl),5,-1,3,false,
ipl) {
207 return (
x[0]>= 0) && (
x[0]<
x.size()-1) &&
x[1+
x[0]]==
x[0];
212 for (
int i=0;
i<
x.size()-1;
i++)
214 Gecode::element(home,
c,
x[0],
x[0],
ipl);
225 for (
int i=0;
i<
x.size()-2;
i++)
226 if ((
x[2+
i] < 0) || (
x[2+
i]>1))
228 return ((
x[0]>= 0) && (
x[0]<
x.size()-2) &&
x[2+
x[0]]==
x[1]
229 && (
x[1]>=0) && (
x[1]<=1));
233 using namespace Gecode;
235 for (
int i=0;
i<
x.size()-2;
i++)
249 :
Test(
"Element::Var::Bool::Int::"+
str(r0),5,-1,3,false),
r(r0) {}
252 for (
int i=0;
i<
x.size()-1;
i++)
253 if ((
x[1+
i] < 0) || (
x[1+
i]>1))
255 return ((
x[0]>= 0) && (
x[0]<
x.size()-1) &&
x[1+
x[0]]==
r);
259 using namespace Gecode;
261 for (
int i=0;
i<
x.size()-1;
i++)
294 :
Test(
"Element::Matrix::Int::IntVar::XY",3,0,5,false),
299 using namespace Gecode;
300 if ((
x[0] > 2) || (
x[1] > 1))
303 return m(
x[0],
x[1]) ==
x[2];
308 using namespace Gecode;
322 :
Test(
"Element::Matrix::Int::IntVar::XX",2,0,3,false),
327 using namespace Gecode;
331 return m(
x[0],
x[0]) ==
x[1];
336 using namespace Gecode;
350 :
Test(
"Element::Matrix::Int::BoolVar::XY",3,0,3,false),
355 using namespace Gecode;
356 if ((
x[0] > 1) || (
x[1] > 1))
359 return m(
x[0],
x[1]) ==
x[2];
364 using namespace Gecode;
378 :
Test(
"Element::Matrix::Int::BoolVar::XX",2,0,3,false),
383 using namespace Gecode;
387 return m(
x[0],
x[0]) ==
x[1];
392 using namespace Gecode;
403 :
Test(
"Element::Matrix::IntVar::IntVar::XY",3+4,0,3,false) {}
408 using namespace Gecode;
409 if ((
x[0] > 1) || (
x[1] > 1))
412 tm[0]=
x[3]; tm[1]=
x[4]; tm[2]=
x[5]; tm[3]=
x[6];
414 return m(
x[0],
x[1]) ==
x[2];
419 using namespace Gecode;
421 tm[0]=
x[3]; tm[1]=
x[4]; tm[2]=
x[5]; tm[3]=
x[6];
432 :
Test(
"Element::Matrix::IntVar::IntVar::XX",2+4,0,3,false) {}
437 using namespace Gecode;
441 tm[0]=
x[2]; tm[1]=
x[3]; tm[2]=
x[4]; tm[3]=
x[5];
443 return m(
x[0],
x[0]) ==
x[1];
448 using namespace Gecode;
450 tm[0]=
x[2]; tm[1]=
x[3]; tm[2]=
x[4]; tm[3]=
x[5];
461 :
Test(
"Element::Matrix::BoolVar::BoolVar::XY",3+4,0,1,false) {}
466 using namespace Gecode;
468 tm[0]=
x[3]; tm[1]=
x[4]; tm[2]=
x[5]; tm[3]=
x[6];
470 return m(
x[0],
x[1]) ==
x[2];
475 using namespace Gecode;
489 :
Test(
"Element::Matrix::BoolVar::BoolVar::XX",2+4,0,1,false) {}
494 using namespace Gecode;
496 tm[0]=
x[2]; tm[1]=
x[3]; tm[2]=
x[4]; tm[3]=
x[5];
498 return m(
x[0],
x[0]) ==
x[1];
503 using namespace Gecode;
521 for (
int i=0;
i<idx;
i++)
531 using namespace Gecode;
533 IntArgs ic2({-1,1,-1,1,-1,1,0,0});
535 IntArgs ic4({0,-1,2,-2,4,-3,6});
539 IntArgs bc2({1,1,0,1,0,1,0,0});
550 SCHAR_MAX-1,SCHAR_MAX,
554 for (
int i=0; ov[
i] != 0;
i++)
555 for (
int j=0; ov[j] != 0; j++)
556 optimized(ov[
i],ov[j]);
559 for (
int i=-4;
i<=4;
i++) {
576 for (
int i=0;
i<=1;
i++) {
585 for (
int i=-4;
i<=4;
i++) {
Node * x
Pointer to corresponding Boolean expression node.
int size(void) const
Return size of array (number of elements)
Passing Boolean variables.
Boolean integer variables.
Passing integer arguments.
Passing integer variables.
Matrix-interface for arrays.
static Gecode::Support::RandomGenerator rand
Random number generator.
Base class for assignments
Help class to create and register tests.
void optimized(int idx, int val)
Test size-dependent optimizations
Create(void)
Perform creation and registration.
Test for element with integer array and integer and Boolean variable
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntArgs c
Array of integers.
virtual bool solution(const Assignment &x) const
Test whether x is solution
IntBoolInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Test for element with integer array and integer and Boolean variable
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntArgs c
Array of integers.
IntBoolVar(const std::string &s, const Gecode::IntArgs &c0)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test for element with integer array and integer variables
IntIntInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Gecode::IntArgs c
Array of integers.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for element with integer array and single shared integer variable
Gecode::IntArgs c
Array of integers.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
IntIntShared(const std::string &s, const Gecode::IntArgs &c0, int minDomain=-4)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test for element with integer array and integer variables
Gecode::IntArgs c
Array of integers.
IntIntVar(const std::string &s, const Gecode::IntArgs &c0, int min, int max)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for matrix element with Boolean variable array and Boolean variable
MatrixBoolVarBoolVarXX(void)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for matrix element with Boolean variable array and Boolean variable
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
MatrixBoolVarBoolVarXY(void)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test for matrix element with integer array and Boolean variable
MatrixIntBoolVarXX(void)
Create and register test.
Gecode::IntArgs tm
Array for test matrix.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for matrix element with integer array and Boolean variable
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
MatrixIntBoolVarXY(void)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode::IntArgs tm
Array for test matrix.
Test for matrix element with integer array and integer variable
Gecode::IntArgs tm
Array for test matrix.
virtual bool solution(const Assignment &x) const
Test whether x is solution
MatrixIntIntVarXX(void)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for matrix element with integer array and integer variable
virtual bool solution(const Assignment &x) const
Test whether x is solution
MatrixIntIntVarXY(void)
Create and register test.
Gecode::IntArgs tm
Array for test matrix.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for matrix element with integer variable array and integer variable
MatrixIntVarIntVarXX(void)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for matrix element with integer variable array and integer variable
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
MatrixIntVarIntVarXY(void)
Create and register test.
Test for element with Boolean variable array and integer variable
virtual bool solution(const Assignment &x) const
Test whether x is solution
VarBoolInt(int r0)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for element with Boolean variable array and integer variable
VarBoolVar(void)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test for element with variable array and integer variables
virtual bool solution(const Assignment &x) const
Test whether x is solution
VarIntInt(Gecode::IntPropLevel ipl, int r0)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for element with variable array and shared integer variable
virtual bool solution(const Assignment &x) const
Test whether x is solution
VarIntShared(Gecode::IntPropLevel ipl)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Test for element with variable array and integer variables
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
VarIntVar(Gecode::IntPropLevel ipl)
Create and register test.
Gecode::IntPropLevel ipl
Propagation level.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
ConTestLevel contest
Whether to test for certain consistency.
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
IntPropLevel
Propagation levels for integer propagators.
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
@ IPL_BND
Bounds propagation.
const FloatNum max
Largest allowed float value.
const FloatNum min
Smallest allowed float value.
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Gecode::IntArgs i({1, 2, 3, 4})
@ CTL_NONE
No consistency-test.
#define GECODE_NEVER
Assert that this command is never executed.