40 namespace Test {
namespace Int {
55 :
Test(
"GCC::Int::All::MinMax::"+
str(ipl),4,-1,3,false,ipl) {}
61 for (
int i=x.
size();
i--; )
76 for (
int i=0;
i<5;
i++) {
77 values[
i] =
i-1; cards[
i] = fixed;
89 :
Test(
"GCC::Int::All::MinMaxDef::"+
str(ipl),4,0,3,false,ipl) {}
95 for (
int i=x.
size();
i--; )
109 for (
int i=0;
i<4;
i++) {
122 :
Test(
"GCC::Int::All::Max::"+
str(ipl), 4, 1,2, false, ipl) {}
128 for (
int i=x.
size();
i--; )
130 if (n[0] != 2 || n[1] != 2)
148 :
Test(
std::string(
"GCC::Int::Some::")+
149 (hole ?
"::Hole" :
"::Full")+
str(ipl),4,1,4,false,ipl) {}
155 for (
int i=x.
size();
i--; )
157 if ((n[0] < 2) || (n[1] < 2) || (n[2] > 0) || (n[3] > 0))
173 cards[0]=fixed; cards[1]=fixed;
182 static const int n = 4;
186 :
Test(
"GCC::Var::All::"+
str(ipl),7,0,2,false,ipl) {}
191 for (
int i=0;
i<
n;
i++)
192 if ((x[
i] < 0) || (x[
i] > 2))
194 int*
card =
new int[m];
195 for (
int i=0;
i<m;
i++) {
197 if ((x[n+
i] < 0) || (x[n+
i] > 2)) {
202 for (
int i=0;
i<
n;
i++)
204 for (
int i=0;
i<m;
i++)
205 if (card[
i] != x[n+
i]) {
219 for (
int i=0;
i<
n;
i++)
221 for (
int i=0;
i<m;
i++)
233 static const int randomArity = 7;
238 :
Test(
"GCC::Var::Some::"+s+
"::"+
str(ipl),
239 n0+(max-min)+1,min,max,false,ipl)
243 if (
arity>randomArity)
250 int*
card =
new int[m];
251 for (
int i=0;
i<m;
i++) {
253 if ((x[n+
i] < 0) || (x[n+
i] > n)) {
258 for (
int i=0;
i<
n;
i++)
260 for (
int i=0;
i<m;
i++)
261 if (card[
i] != x[n+
i]) {
270 if (
arity > randomArity)
281 for (
int i=0;
i<
n;
i++)
283 for (
int i=0;
i<m;
i++)
303 (void)
new VarAll(ipls.ipl());
304 (void)
new VarSome(
"Small",2,-1,3,ipls.ipl());
305 (void)
new VarSome(
"Large",3,-1,4,ipls.ipl());
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
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.
IntAllMinMaxDef(Gecode::IntPropLevel ipl)
Create and register test.
int size(void) const
Return size of array (number of elements)
const FloatNum max
Largest allowed float value.
void count(Home home, const IntVarArgs &x, int n, IntRelType irt, int m, IntPropLevel)
Post propagator for .
VarSome(std::string s, int n0, int min, int max, Gecode::IntPropLevel ipl)
Create and register test.
int size(void) const
Return number of variables.
int n
Number of non-cardinality variables.
Test for variable cardinality for all cardinality values
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode::IntSet dom
Domain of variables.
IntAllMinMax(Gecode::IntPropLevel ipl)
Create and register test.
const unsigned int card
Maximum cardinality of an integer set.
ConTestLevel contest
Whether to test for certain consistency.
int min(int i) const
Return minimum of range at position i.
Generate random selection of assignments.
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.
VarAll(Gecode::IntPropLevel ipl)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual Assignment * assignment(void) const
Create and register initial assignment.
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.
IntAllMax(Gecode::IntPropLevel ipl)
Create and register test.
IntSome(Gecode::IntPropLevel ipl)
Create and register test.
Test for variable cardinality for some cardinality values
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntPropLevel ipl
Propagation level.
Passing integer variables.
Passing integer arguments.
virtual bool solution(const Assignment &x) const
Test whether x is solution
IntPropLevel
Propagation levels for integer propagators.
Post propagator for SetVar SetOpType SetVar y
Node * x
Pointer to corresponding Boolean expression node.
bool testsearch
Whether to perform search test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &xy)
Post constraint on xy.
Base class for assignments
virtual bool solution(const Assignment &x) const
Test whether x is solution
void values(Home home, const IntVarArgs &x, IntSet y, IntPropLevel ipl=IPL_DEF)
Post constraint .
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
virtual bool solution(const Assignment &x) const
Test whether x is solution
Generate all assignments.
Iterator for simple integer propagation levels.
void count(Home home, const IntVarArgs &x, const IntSet &c, const IntArgs &v, IntPropLevel ipl)
Posts a global count (cardinality) constraint.
virtual bool solution(const Assignment &x) const
Test whether x is solution