element.cpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Christian Schulte, 2005
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
#include "test/int.hh"
#include <gecode/minimodel.hh>
#include <climits>
namespace Test { namespace Int {
namespace Element {
class IntIntVar : public Test {
protected:
Gecode::IntArgs c;
public:
IntIntVar(const std::string& s, const Gecode::IntArgs& c0,
int min, int max)
: Test("Element::Int::Int::Var::"+s,2,min,max),
c(c0) {}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[1];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::element(home, c, x[0], x[1]);
}
};
class IntIntInt : public Test {
protected:
Gecode::IntArgs c;
int r;
public:
IntIntInt(const std::string& s, const Gecode::IntArgs& c0, int r0)
: Test("Element::Int::Int::Int::"+s+"::"+str(r0),1,-4,8),
c(c0), r(r0) {}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==r;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::element(home, c, x[0], r);
}
};
class IntIntShared : public Test {
protected:
Gecode::IntArgs c;
public:
IntIntShared(const std::string& s, const Gecode::IntArgs& c0,
int minDomain=-4)
: Test("Element::Int::Int::Shared::"+s,1,minDomain,8), c(c0) {}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[0];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::element(home, c, x[0], x[0]);
}
};
class IntBoolVar : public Test {
protected:
Gecode::IntArgs c;
public:
IntBoolVar(const std::string& s, const Gecode::IntArgs& c0)
: Test("Element::Int::Bool::Var::"+s,2,-4,8), c(c0) {}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[1];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::element(home, c, x[0], Gecode::channel(home,x[1]));
}
};
class IntBoolInt : public Test {
protected:
Gecode::IntArgs c;
int r;
public:
IntBoolInt(const std::string& s, const Gecode::IntArgs& c0, int r0)
: Test("Element::Int::Bool::Int::"+s+"::"+str(r0),1,-4,8),
c(c0), r(r0) {}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==r;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::element(home, c, x[0], r);
}
};
class VarIntVar : public Test {
public:
VarIntVar(Gecode::IntPropLevel ipl)
: Test("Element::Var::Int::Var::"+str(ipl),6,-1,3,false,ipl) {}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<x.size()-2) && x[2+x[0]]==x[1];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::IntVarArgs c(x.size()-2);
for (int i=0; i<x.size()-2; i++)
c[i]=x[2+i];
Gecode::element(home, c, x[0], x[1], ipl);
}
};
class VarIntInt : public Test {
protected:
int r;
public:
VarIntInt(Gecode::IntPropLevel ipl, int r0)
: Test("Element::Var::Int::Int::"+str(ipl)+"::"+str(r0),
5,-1,3,false,ipl), r(r0) {
contest = CTL_NONE;
}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==r;
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::IntVarArgs c(x.size()-1);
for (int i=0; i<x.size()-1; i++)
c[i]=x[1+i];
Gecode::element(home, c, x[0], r, ipl);
}
};
class VarIntShared : public Test {
public:
VarIntShared(Gecode::IntPropLevel ipl)
: Test("Element::Var::Int::Shared::"+str(ipl),5,-1,3,false,ipl) {
contest = CTL_NONE;
}
virtual bool solution(const Assignment& x) const {
return (x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==x[0];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
Gecode::IntVarArgs c(x.size()-1);
for (int i=0; i<x.size()-1; i++)
c[i]=x[1+i];
Gecode::element(home, c, x[0], x[0], ipl);
}
};
class VarBoolVar : public Test {
public:
VarBoolVar(void) : Test("Element::Var::Bool::Var",6,-1,3,false) {}
virtual bool solution(const Assignment& x) const {
for (int i=0; i<x.size()-2; i++)
if ((x[2+i] < 0) || (x[2+i]>1))
return false;
return ((x[0]>= 0) && (x[0]<x.size()-2) && x[2+x[0]]==x[1]
&& (x[1]>=0) && (x[1]<=1));
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
BoolVarArgs c(x.size()-2);
for (int i=0; i<x.size()-2; i++)
c[i]=channel(home,x[2+i]);
element(home, c, x[0], channel(home,x[1]));
}
};
class VarBoolInt : public Test {
protected:
int r;
public:
VarBoolInt(int r0)
: Test("Element::Var::Bool::Int::"+str(r0),5,-1,3,false), r(r0) {}
virtual bool solution(const Assignment& x) const {
for (int i=0; i<x.size()-1; i++)
if ((x[1+i] < 0) || (x[1+i]>1))
return false;
return ((x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==r);
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
using namespace Gecode;
BoolVarArgs c(x.size()-1);
for (int i=0; i<x.size()-1; i++)
c[i]=channel(home,x[1+i]);
if (r == 1) {
switch (Base::rand(3)) {
case 0:
element(home, c, x[0], 1);
break;
case 1:
{
BoolVar one(home,1,1);
rel(home, element(c,x[0]) == one);
}
break;
case 2:
rel(home, element(c,x[0]));
break;
default: GECODE_NEVER;
}
} else {
element(home, c, x[0], r);
}
}
};
class MatrixIntIntVarXY : public Test {
protected:
Gecode::IntArgs tm;
public:
MatrixIntIntVarXY(void)
: Test("Element::Matrix::Int::IntVar::XY",3,0,5,false),
tm({0,1,2,3,4,5}) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
using namespace Gecode;
if ((x[0] > 2) || (x[1] > 1))
return false;
Matrix<IntArgs> m(tm,3,2);
return m(x[0],x[1]) == x[2];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
using namespace Gecode;
Matrix<IntArgs> m(tm,3,2);
element(home, m, x[0], x[1], x[2]);
}
};
class MatrixIntIntVarXX : public Test {
protected:
Gecode::IntArgs tm;
public:
MatrixIntIntVarXX(void)
: Test("Element::Matrix::Int::IntVar::XX",2,0,3,false),
tm({0,1,2,3}) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[0], result: x[1]
using namespace Gecode;
if (x[0] > 1)
return false;
Matrix<IntArgs> m(tm,2,2);
return m(x[0],x[0]) == x[1];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[0], result: x[1]
using namespace Gecode;
Matrix<IntArgs> m(tm,2,2);
element(home, m, x[0], x[0], x[1]);
}
};
class MatrixIntBoolVarXY : public Test {
protected:
Gecode::IntArgs tm;
public:
MatrixIntBoolVarXY(void)
: Test("Element::Matrix::Int::BoolVar::XY",3,0,3,false),
tm({0,1,1,0}) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
using namespace Gecode;
if ((x[0] > 1) || (x[1] > 1))
return false;
Matrix<IntArgs> m(tm,2,2);
return m(x[0],x[1]) == x[2];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
using namespace Gecode;
Matrix<IntArgs> m(tm,2,2);
element(home, m, x[0], x[1], channel(home,x[2]));
}
};
class MatrixIntBoolVarXX : public Test {
protected:
Gecode::IntArgs tm;
public:
MatrixIntBoolVarXX(void)
: Test("Element::Matrix::Int::BoolVar::XX",2,0,3,false),
tm({0,1,1,0}) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[0], result: x[1]
using namespace Gecode;
if (x[0] > 1)
return false;
Matrix<IntArgs> m(tm,2,2);
return m(x[0],x[0]) == x[1];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[0], result: x[1]
using namespace Gecode;
Matrix<IntArgs> m(tm,2,2);
element(home, m, x[0], x[0], channel(home,x[1]));
}
};
class MatrixIntVarIntVarXY : public Test {
public:
MatrixIntVarIntVarXY(void)
: Test("Element::Matrix::IntVar::IntVar::XY",3+4,0,3,false) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
// remaining: matrix
using namespace Gecode;
if ((x[0] > 1) || (x[1] > 1))
return false;
IntArgs tm(4);
tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
Matrix<IntArgs> m(tm,2,2);
return m(x[0],x[1]) == x[2];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
using namespace Gecode;
IntVarArgs tm(4);
tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
Matrix<IntVarArgs> m(tm,2,2);
element(home, m, x[0], x[1], x[2]);
}
};
class MatrixIntVarIntVarXX : public Test {
public:
MatrixIntVarIntVarXX(void)
: Test("Element::Matrix::IntVar::IntVar::XX",2+4,0,3,false) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[0], result: x[1]
// remaining: matrix
using namespace Gecode;
if (x[0] > 1)
return false;
IntArgs tm(4);
tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
Matrix<IntArgs> m(tm,2,2);
return m(x[0],x[0]) == x[1];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[1], result: x[1]
using namespace Gecode;
IntVarArgs tm(4);
tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
Matrix<IntVarArgs> m(tm,2,2);
element(home, m, x[0], x[0], x[1]);
}
};
class MatrixBoolVarBoolVarXY : public Test {
public:
MatrixBoolVarBoolVarXY(void)
: Test("Element::Matrix::BoolVar::BoolVar::XY",3+4,0,1,false) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
// remaining: matrix
using namespace Gecode;
IntArgs tm(4);
tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
Matrix<IntArgs> m(tm,2,2);
return m(x[0],x[1]) == x[2];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[1], result: x[2]
using namespace Gecode;
BoolVarArgs tm(4);
tm[0]=channel(home,x[3]); tm[1]=channel(home,x[4]);
tm[2]=channel(home,x[5]); tm[3]=channel(home,x[6]);
Matrix<BoolVarArgs> m(tm,2,2);
element(home, m, x[0], x[1], channel(home,x[2]));
}
};
class MatrixBoolVarBoolVarXX : public Test {
public:
MatrixBoolVarBoolVarXX(void)
: Test("Element::Matrix::BoolVar::BoolVar::XX",2+4,0,1,false) {}
virtual bool solution(const Assignment& x) const {
// x-coordinate: x[0], y-coordinate: x[0], result: x[1]
// remaining: matrix
using namespace Gecode;
IntArgs tm(4);
tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
Matrix<IntArgs> m(tm,2,2);
return m(x[0],x[0]) == x[1];
}
virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
// x-coordinate: x[0], y-coordinate: x[1], result: x[1]
using namespace Gecode;
BoolVarArgs tm(4);
tm[0]=channel(home,x[2]); tm[1]=channel(home,x[3]);
tm[2]=channel(home,x[4]); tm[3]=channel(home,x[5]);
Matrix<BoolVarArgs> m(tm,2,2);
element(home, m, x[0], x[0], channel(home,x[1]));
}
};
class Create {
public:
void optimized(int idx, int val) {
Gecode::IntArgs c(idx);
for (int i=0; i<idx; i++)
c[i]=std::max(val-i,0);
(void) new IntIntVar(Test::str(idx)+"::"+Test::str(val)+"::val",c,
val-8,val-1);
if (idx != val)
(void) new IntIntVar(Test::str(idx)+"::"+Test::str(val)+"::idx",c,
idx-8,idx-1);
}
Create(void) {
using namespace Gecode;
IntArgs ic1({-1,1,-3,3,-4});
IntArgs ic2({-1,1,-1,1,-1,1,0,0});
IntArgs ic3({-1});
IntArgs ic4({0,-1,2,-2,4,-3,6});
IntArgs ic5({0,0,1,2,3,4});
IntArgs bc1({0,1,1,0,1});
IntArgs bc2({1,1,0,1,0,1,0,0});
IntArgs bc3({1});
(void) new IntIntVar("A",ic1,-8,8);
(void) new IntIntVar("B",ic2,-8,8);
(void) new IntIntVar("C",ic3,-8,8);
(void) new IntIntVar("D",ic4,-8,8);
// Test optimizations
{
int ov[] = {
SCHAR_MAX-1,SCHAR_MAX,
SHRT_MAX-1,SHRT_MAX,
0
};
for (int i=0; ov[i] != 0; i++)
for (int j=0; ov[j] != 0; j++)
optimized(ov[i],ov[j]);
}
for (int i=-4; i<=4; i++) {
(void) new IntIntInt("A",ic1,i);
(void) new IntIntInt("B",ic2,i);
(void) new IntIntInt("C",ic3,i);
(void) new IntIntInt("D",ic4,i);
}
(void) new IntIntShared("A",ic1);
(void) new IntIntShared("B",ic2);
(void) new IntIntShared("C",ic3);
(void) new IntIntShared("D",ic4);
(void) new IntIntShared("E",ic5,1);
(void) new IntBoolVar("A",bc1);
(void) new IntBoolVar("B",bc2);
(void) new IntBoolVar("C",bc3);
for (int i=0; i<=1; i++) {
(void) new IntBoolInt("A",bc1,i);
(void) new IntBoolInt("B",bc2,i);
(void) new IntBoolInt("C",bc3,i);
}
(void) new VarIntVar(IPL_BND);
(void) new VarIntVar(IPL_DOM);
for (int i=-4; i<=4; i++) {
(void) new VarIntInt(IPL_BND,i);
(void) new VarIntInt(IPL_DOM,i);
}
(void) new VarIntShared(IPL_BND);
(void) new VarIntShared(IPL_DOM);
(void) new VarBoolVar();
(void) new VarBoolInt(0);
(void) new VarBoolInt(1);
// Matrix tests
(void) new MatrixIntIntVarXY();
(void) new MatrixIntIntVarXX();
(void) new MatrixIntBoolVarXY();
(void) new MatrixIntBoolVarXX();
(void) new MatrixIntVarIntVarXY();
(void) new MatrixIntVarIntVarXX();
(void) new MatrixBoolVarBoolVarXY();
(void) new MatrixBoolVarBoolVarXX();
}
};
Create c;
}
}}
// STATISTICS: test-int
Gecode::BoolVarArgs
Passing Boolean variables.
Definition int.hh:712
Gecode::BoolVar
Boolean integer variables.
Definition int.hh:512
Gecode::IntArgs
Passing integer arguments.
Definition int.hh:628
Gecode::IntVarArgs
Passing integer variables.
Definition int.hh:656
Gecode::IntVarArray
Integer variable array.
Definition int.hh:763
Gecode::Matrix
Matrix-interface for arrays.
Definition minimodel.hh:2161
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::VarArray::size
int size(void) const
Return size of array (number of elements).
Definition array.hpp:926
Test::Base::rand
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition test.hh:134
Test::Int::Assignment
Base class for assignments
Definition int.hh:59
Test::Int::Assignment::size
int size(void) const
Return number of variables.
Definition int.hpp:46
Test::Int::Element::Create
Help class to create and register tests.
Definition element.cpp:516
Test::Int::Element::Create::optimized
void optimized(int idx, int val)
Test size-dependent optimizations
Definition element.cpp:519
Test::Int::Element::Create::Create
Create(void)
Perform creation and registration.
Definition element.cpp:530
Test::Int::Element::IntBoolInt
Test for element with integer array and integer and Boolean variable
Definition element.cpp:132
Test::Int::Element::IntBoolInt::r
int r
Integer result.
Definition element.cpp:137
Test::Int::Element::IntBoolInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:148
Test::Int::Element::IntBoolInt::c
Gecode::IntArgs c
Array of integers.
Definition element.cpp:135
Test::Int::Element::IntBoolInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:144
Test::Int::Element::IntBoolInt::IntBoolInt
IntBoolInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Definition element.cpp:140
Test::Int::Element::IntBoolVar
Test for element with integer array and integer and Boolean variable
Definition element.cpp:113
Test::Int::Element::IntBoolVar::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:126
Test::Int::Element::IntBoolVar::c
Gecode::IntArgs c
Array of integers.
Definition element.cpp:116
Test::Int::Element::IntBoolVar::IntBoolVar
IntBoolVar(const std::string &s, const Gecode::IntArgs &c0)
Create and register test.
Definition element.cpp:119
Test::Int::Element::IntBoolVar::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:122
Test::Int::Element::IntIntInt
Test for element with integer array and integer variables
Definition element.cpp:71
Test::Int::Element::IntIntInt::IntIntInt
IntIntInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Definition element.cpp:79
Test::Int::Element::IntIntInt::c
Gecode::IntArgs c
Array of integers.
Definition element.cpp:74
Test::Int::Element::IntIntInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:83
Test::Int::Element::IntIntInt::r
int r
Integer result.
Definition element.cpp:76
Test::Int::Element::IntIntInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:87
Test::Int::Element::IntIntShared
Test for element with integer array and single shared integer variable
Definition element.cpp:93
Test::Int::Element::IntIntShared::c
Gecode::IntArgs c
Array of integers.
Definition element.cpp:96
Test::Int::Element::IntIntShared::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:107
Test::Int::Element::IntIntShared::IntIntShared
IntIntShared(const std::string &s, const Gecode::IntArgs &c0, int minDomain=-4)
Create and register test.
Definition element.cpp:99
Test::Int::Element::IntIntShared::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:103
Test::Int::Element::IntIntVar
Test for element with integer array and integer variables
Definition element.cpp:50
Test::Int::Element::IntIntVar::c
Gecode::IntArgs c
Array of integers.
Definition element.cpp:53
Test::Int::Element::IntIntVar::IntIntVar
IntIntVar(const std::string &s, const Gecode::IntArgs &c0, int min, int max)
Create and register test.
Definition element.cpp:56
Test::Int::Element::IntIntVar::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:61
Test::Int::Element::IntIntVar::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:65
Test::Int::Element::MatrixBoolVarBoolVarXX
Test for matrix element with Boolean variable array and Boolean variable
Definition element.cpp:485
Test::Int::Element::MatrixBoolVarBoolVarXX::MatrixBoolVarBoolVarXX
MatrixBoolVarBoolVarXX(void)
Create and register test.
Definition element.cpp:488
Test::Int::Element::MatrixBoolVarBoolVarXX::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:491
Test::Int::Element::MatrixBoolVarBoolVarXX::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:501
Test::Int::Element::MatrixBoolVarBoolVarXY
Test for matrix element with Boolean variable array and Boolean variable
Definition element.cpp:457
Test::Int::Element::MatrixBoolVarBoolVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:473
Test::Int::Element::MatrixBoolVarBoolVarXY::MatrixBoolVarBoolVarXY
MatrixBoolVarBoolVarXY(void)
Create and register test.
Definition element.cpp:460
Test::Int::Element::MatrixBoolVarBoolVarXY::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:463
Test::Int::Element::MatrixIntBoolVarXX
Test for matrix element with integer array and Boolean variable
Definition element.cpp:371
Test::Int::Element::MatrixIntBoolVarXX::MatrixIntBoolVarXX
MatrixIntBoolVarXX(void)
Create and register test.
Definition element.cpp:377
Test::Int::Element::MatrixIntBoolVarXX::tm
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:374
Test::Int::Element::MatrixIntBoolVarXX::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:381
Test::Int::Element::MatrixIntBoolVarXX::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:390
Test::Int::Element::MatrixIntBoolVarXY
Test for matrix element with integer array and Boolean variable
Definition element.cpp:343
Test::Int::Element::MatrixIntBoolVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:362
Test::Int::Element::MatrixIntBoolVarXY::MatrixIntBoolVarXY
MatrixIntBoolVarXY(void)
Create and register test.
Definition element.cpp:349
Test::Int::Element::MatrixIntBoolVarXY::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:353
Test::Int::Element::MatrixIntBoolVarXY::tm
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:346
Test::Int::Element::MatrixIntIntVarXX
Test for matrix element with integer array and integer variable
Definition element.cpp:315
Test::Int::Element::MatrixIntIntVarXX::tm
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:318
Test::Int::Element::MatrixIntIntVarXX::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:325
Test::Int::Element::MatrixIntIntVarXX::MatrixIntIntVarXX
MatrixIntIntVarXX(void)
Create and register test.
Definition element.cpp:321
Test::Int::Element::MatrixIntIntVarXX::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:334
Test::Int::Element::MatrixIntIntVarXY
Test for matrix element with integer array and integer variable
Definition element.cpp:287
Test::Int::Element::MatrixIntIntVarXY::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:297
Test::Int::Element::MatrixIntIntVarXY::MatrixIntIntVarXY
MatrixIntIntVarXY(void)
Create and register test.
Definition element.cpp:293
Test::Int::Element::MatrixIntIntVarXY::tm
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:290
Test::Int::Element::MatrixIntIntVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:306
Test::Int::Element::MatrixIntVarIntVarXX
Test for matrix element with integer variable array and integer variable
Definition element.cpp:428
Test::Int::Element::MatrixIntVarIntVarXX::MatrixIntVarIntVarXX
MatrixIntVarIntVarXX(void)
Create and register test.
Definition element.cpp:431
Test::Int::Element::MatrixIntVarIntVarXX::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:434
Test::Int::Element::MatrixIntVarIntVarXX::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:446
Test::Int::Element::MatrixIntVarIntVarXY
Test for matrix element with integer variable array and integer variable
Definition element.cpp:399
Test::Int::Element::MatrixIntVarIntVarXY::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:417
Test::Int::Element::MatrixIntVarIntVarXY::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:405
Test::Int::Element::MatrixIntVarIntVarXY::MatrixIntVarIntVarXY
MatrixIntVarIntVarXY(void)
Create and register test.
Definition element.cpp:402
Test::Int::Element::VarBoolInt
Test for element with Boolean variable array and integer variable
Definition element.cpp:242
Test::Int::Element::VarBoolInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:251
Test::Int::Element::VarBoolInt::VarBoolInt
VarBoolInt(int r0)
Create and register test.
Definition element.cpp:248
Test::Int::Element::VarBoolInt::r
int r
Integer result.
Definition element.cpp:245
Test::Int::Element::VarBoolInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:258
Test::Int::Element::VarBoolVar
Test for element with Boolean variable array and integer variable
Definition element.cpp:219
Test::Int::Element::VarBoolVar::VarBoolVar
VarBoolVar(void)
Create and register test.
Definition element.cpp:222
Test::Int::Element::VarBoolVar::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:232
Test::Int::Element::VarBoolVar::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:224
Test::Int::Element::VarIntInt
Test for element with variable array and integer variables
Definition element.cpp:173
Test::Int::Element::VarIntInt::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:185
Test::Int::Element::VarIntInt::VarIntInt
VarIntInt(Gecode::IntPropLevel ipl, int r0)
Create and register test.
Definition element.cpp:179
Test::Int::Element::VarIntInt::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:189
Test::Int::Element::VarIntInt::r
int r
Integer result.
Definition element.cpp:176
Test::Int::Element::VarIntShared
Test for element with variable array and shared integer variable
Definition element.cpp:198
Test::Int::Element::VarIntShared::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:206
Test::Int::Element::VarIntShared::VarIntShared
VarIntShared(Gecode::IntPropLevel ipl)
Create and register test.
Definition element.cpp:201
Test::Int::Element::VarIntShared::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:210
Test::Int::Element::VarIntVar
Test for element with variable array and integer variables
Definition element.cpp:154
Test::Int::Element::VarIntVar::post
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:164
Test::Int::Element::VarIntVar::solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:160
Test::Int::Element::VarIntVar::VarIntVar
VarIntVar(Gecode::IntPropLevel ipl)
Create and register test.
Definition element.cpp:157
Test::Int::Test::ipl
Gecode::IntPropLevel ipl
Propagation level.
Definition int.hh:234
Test::Int::Test::str
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Definition int.hpp:209
Test::Int::Test::contest
ConTestLevel contest
Whether to test for certain consistency.
Definition int.hh:236
Gecode::rel
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
Gecode::IntPropLevel
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
Gecode::IPL_DOM
@ IPL_DOM
Domain propagation Options: basic versus advanced propagation.
Definition int.hh:979
Gecode::IPL_BND
@ IPL_BND
Bounds propagation.
Definition int.hh:978
minimodel.hh
Gecode
Gecode toplevel namespace
Gecode::channel
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition channel.cpp:41
Gecode::element
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Definition element.cpp:39
Test::Int::Element
Tests for element constraints
Definition element.cpp:42
Test::Int::Element::c
Create c
Definition element.cpp:610
Test::Int
Testing finite domain integers.
Definition int.cpp:40
Test::Int::CTL_NONE
@ CTL_NONE
No consistency-test.
Definition int.hh:140
Test
General test support.
Definition afc.cpp:39
GECODE_NEVER
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56
int.hh