Go to the documentation of this file.
42 namespace Test {
namespace Int {
49 for (
int i=
a.size();
i--; )
60 class IntInt :
public Test {
74 :
Test(
"Linear::Int::Int::"+
78 a(a0),
irt(irt0),
c(c0) {
84 for (
int i=0;
i<
x.size();
i++)
86 return cmp(e,
irt,
static_cast<double>(
c));
117 :
Test(
"Linear::Int::Var::"+
126 for (
int i=0;
i<
a.size();
i++)
128 return cmp(e,
irt,
static_cast<double>(
x[
a.size()]));
168 :
Test(
"Linear::Bool::Int::"+
171 a(a0),
irt(irt0),
c(c0) {
177 for (
int i=0;
i<
x.size();
i++)
179 return cmp(e,
irt,
static_cast<double>(
c));
184 for (
int i=
x.size();
i--; )
195 for (
int i=
x.size();
i--; )
216 :
Test(
"Linear::Bool::Var::"+
str(irt0)+
"::"+s,a0.
size()+1,
224 for (
int i=0;
i<
n;
i++)
225 if ((
x[
i] < 0) || (
x[
i] > 1))
228 for (
int i=0;
i<
n;
i++)
230 return cmp(e,
irt,
static_cast<double>(
x[
n]));
234 for (
int i=
x.size()-1;
i--; )
235 if ((
x[
i] < 0) || (
x[
i] > 1))
272 const int dv2[] = {-4,-1,0,1,4};
275 const int dv3[] = {0,1500000000};
281 (void)
new IntInt(
"11",
d1,a1,irts.irt(),0);
282 (void)
new IntVar(
"11",
d1,a1,irts.irt());
283 (void)
new IntInt(
"21",
d2,a1,irts.irt(),0);
284 (void)
new IntVar(
"21",
d2,a1,irts.irt());
285 (void)
new IntInt(
"31",
d3,a1,irts.irt(),150000000);
292 const int av2[5] = {1,1,1,1,1};
293 const int av3[5] = {1,-1,-1,1,-1};
294 const int av4[5] = {2,3,5,7,11};
295 const int av5[5] = {-2,3,-5,7,-11};
297 for (
int i=1;
i<=5;
i++) {
303 (void)
new IntInt(
"12",
d1,a2,irts.irt(),0);
304 (void)
new IntInt(
"13",
d1,a3,irts.irt(),0);
305 (void)
new IntInt(
"14",
d1,a4,irts.irt(),0);
306 (void)
new IntInt(
"15",
d1,a5,irts.irt(),0);
307 (void)
new IntInt(
"22",
d2,a2,irts.irt(),0);
308 (void)
new IntInt(
"23",
d2,a3,irts.irt(),0);
309 (void)
new IntInt(
"24",
d2,a4,irts.irt(),0);
310 (void)
new IntInt(
"25",
d2,a5,irts.irt(),0);
311 (void)
new IntInt(
"32",
d3,a2,irts.irt(),1500000000);
313 (void)
new IntVar(
"12",
d1,a2,irts.irt());
314 (void)
new IntVar(
"13",
d1,a3,irts.irt());
315 (void)
new IntVar(
"14",
d1,a4,irts.irt());
316 (void)
new IntVar(
"15",
d1,a5,irts.irt());
317 (void)
new IntVar(
"22",
d2,a2,irts.irt());
318 (void)
new IntVar(
"23",
d2,a3,irts.irt());
319 (void)
new IntVar(
"24",
d2,a4,irts.irt());
320 (void)
new IntVar(
"25",
d2,a5,irts.irt());
340 const int av1[10] = {
341 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
343 const int av2[10] = {
344 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
347 for (
int i=1;
i<=10;
i += 3) {
350 for (
int c=0;
c<=6;
c++)
352 (void)
new BoolInt(
"1",a1,irts.irt(),
c);
353 (void)
new BoolInt(
"2",a2,irts.irt(),-
c);
362 for (
int c=0;
c<=16;
c++) {
363 (void)
new BoolInt(
"3",a3,irts.irt(),
c);
364 (void)
new BoolInt(
"4",a4,irts.irt(),-
c);
365 (void)
new BoolInt(
"5",a5,irts.irt(),
c);
366 (void)
new BoolInt(
"6",a5,irts.irt(),-
c);
370 for (
int i=1;
i<=5;
i += 2) {
385 (void)
new BoolVar(
"6",0,10,a6,irts.irt());
386 (void)
new BoolVar(
"7",-10,0,a7,irts.irt());
387 (void)
new BoolVar(
"8",-3,3,a8,irts.irt());
388 (void)
new BoolVar(
"9",-3,3,a9,irts.irt());
Gecode::IntRelType irt
Integer relation type to propagate.
IntRelType
Relation types for integers.
Iterator for integer relation types.
Post propagator for SetVar SetOpType SetVar y
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Gecode::IntPropLevel ipl
Propagation level.
Test linear relation over integer variables
BoolVar(const std::string &s, int min, int max, const Gecode::IntArgs &a0, Gecode::IntRelType irt0)
Create and register test.
Passing integer variables.
Gecode::IntRelType irt
Integer relation type to propagate.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Gecode::IntRelType irt
Integer relation type to propagate.
Gecode::IntArgs i(4, 1, 2, 3, 4)
const FloatNum min
Smallest allowed float value.
Test linear relation over Boolean variables equal to integer variable
IntPropLevel
Propagation levels for integer propagators.
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
static bool cmp(T x, Gecode::IntRelType r, T y)
Compare x and y with respect to r.
Gecode::IntArgs a
Coefficients.
Gecode toplevel namespace
bool testfix
Whether to perform fixpoint test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Help class to create and register tests.
Gecode::IntArgs a
Coefficients.
Node * x
Pointer to corresponding Boolean expression node.
Reification specification.
Passing Boolean variables.
IntVar(const std::string &s, const Gecode::IntSet &d, const Gecode::IntArgs &a0, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl=Gecode::IPL_BND)
Create and register test.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode::IntArgs a
Coefficients.
@ IPL_DOM
Domain propagation Preferences: prefer speed or memory.
IntInt(const std::string &s, const Gecode::IntSet &d, const Gecode::IntArgs &a0, Gecode::IntRelType irt0, int c0, Gecode::IntPropLevel ipl=Gecode::IPL_BND)
Create and register test.
Gecode::IntRelType irt
Integer relation type to propagate.
@ IPL_BND
Bounds propagation.
Test linear relation over integer variables
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Base class for assignments
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
int c
Righthand-side constant.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
@ IPL_DEF
Simple propagation levels.
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
virtual bool ignore(const Assignment &x) const
Test whether x is to be ignored
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Gecode::IntArgs a
Coefficients.
BoolInt(const std::string &s, const Gecode::IntArgs &a0, Gecode::IntRelType irt0, int c0)
Create and register test.
int n
Number of negative literals for node type.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Passing integer arguments.
Test linear relation over Boolean variables equal to constant
const FloatNum max
Largest allowed float value.
bool one(const Gecode::IntArgs &a)
Check whether a has only one coefficients.
Create(void)
Perform creation and registration.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.