44 namespace Test {
namespace Int {
59 :
Test(
"GCC::Int::All::MinMax::"+
str(icl),4,-1,3,false,icl) {}
65 for (
int i=x.
size();
i--; )
80 for (
int i=0;
i<5;
i++) {
81 values[
i] =
i-1; cards[
i] = fixed;
93 :
Test(
"GCC::Int::All::MinMaxDef::"+
str(icl),4,0,3,false,icl) {}
99 for (
int i=x.
size();
i--; )
113 for (
int i=0;
i<4;
i++) {
126 :
Test(
"GCC::Int::All::Max::"+
str(icl), 4, 1,2, false, icl) {}
132 for (
int i=x.
size();
i--; )
134 if (n[0] != 2 || n[1] != 2)
152 :
Test(
std::string(
"GCC::Int::Some::")+
153 (hole ?
"::Hole" :
"::Full")+
str(icl),4,1,4,false,icl) {}
159 for (
int i=x.
size();
i--; )
161 if ((n[0] < 2) || (n[1] < 2) || (n[2] > 0) || (n[3] > 0))
177 cards[0]=fixed; cards[1]=fixed;
186 static const int n = 4;
190 :
Test(
"GCC::Var::All::"+
str(icl),7,0,2,false,icl) {}
195 for (
int i=0;
i<
n;
i++)
196 if ((x[
i] < 0) || (x[
i] > 2))
198 int*
card =
new int[m];
199 for (
int i=0;
i<m;
i++) {
201 if ((x[n+
i] < 0) || (x[n+
i] > 2)) {
206 for (
int i=0;
i<
n;
i++)
208 for (
int i=0;
i<m;
i++)
209 if (card[
i] != x[n+
i]) {
223 for (
int i=0;
i<
n;
i++)
225 for (
int i=0;
i<m;
i++)
237 static const int randomArity = 7;
242 :
Test(
"GCC::Var::Some::"+s+
"::"+
str(icl),
243 n0+(max-min)+1,min,max,false,icl)
247 if (
arity>randomArity)
254 int*
card =
new int[m];
255 for (
int i=0;
i<m;
i++) {
257 if ((x[n+
i] < 0) || (x[n+
i] > n)) {
262 for (
int i=0;
i<
n;
i++)
264 for (
int i=0;
i<m;
i++)
265 if (card[
i] != x[n+
i]) {
274 if (
arity > randomArity)
285 for (
int i=0;
i<
n;
i++)
287 for (
int i=0;
i<m;
i++)
307 (void)
new VarAll(icls.icl());
308 (void)
new VarSome(
"Small",2,-1,3,icls.icl());
309 (void)
new VarSome(
"Large",3,-1,4,icls.icl());
IntConLevel
Consistency levels for integer propagators.
Help class to create and register tests.
Test for integer cardinality with max cardinality for all variables
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
const FloatNum max
Largest allowed float value.
IntSome(Gecode::IntConLevel icl)
Create and register test.
virtual Assignment * assignment(void) const
Create and register initial assignment.
VarAll(Gecode::IntConLevel icl)
Create and register test.
int n
Number of non-cardinality variables.
Test for variable cardinality for all cardinality values
IntAllMinMaxDef(Gecode::IntConLevel icl)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode::IntSet dom
Domain of variables.
Iterator for integer consistency levels.
const unsigned int card
Maximum cardinality of an integer set.
ConTestLevel contest
Whether to test for certain consistency.
Generate random selection of assignments.
void count(Home home, const IntVarArgs &x, const IntSet &c, const IntArgs &v, IntConLevel icl)
Posts a global count (cardinality) constraint.
static std::string str(Gecode::ExtensionalPropKind epk)
Map extensional propagation kind to string.
virtual bool solution(const Assignment &x) const
Test whether x is solution
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xy)
Post constraint on xy.
int n
Number of negative literals for node type.
VarSome(std::string s, int n0, int min, int max, Gecode::IntConLevel icl)
Create and register test.
Gecode::IntConLevel icl
Consistency level.
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
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
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test for variable cardinality for some cardinality values
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Passing integer variables.
Passing integer arguments.
void values(Home home, const IntVarArgs &x, IntSet y, IntConLevel icl=ICL_DEF)
Post constraint .
Node * x
Pointer to corresponding Boolean expression node.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntConLevel)
Post propagator for .
bool testsearch
Whether to perform search test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xy)
Post constraint on xy.
Base class for assignments
IntAllMinMax(Gecode::IntConLevel icl)
Create and register test.
Test for integer cardinality with min and max for all variables
Gecode toplevel namespace
Create(void)
Perform creation and registration.
int arity
Number of variables.
Test for integer cardinality with min and max for all variables
Test for integer cardinality for some variables
int size(void) const
Return size of array (number of elements)
virtual bool solution(const Assignment &x) const
Test whether x is solution
int size(void) const
Return number of variables.
IntAllMax(Gecode::IntConLevel icl)
Create and register test.
Generate all assignments.
int min(int i) const
Return minimum of range at position i.