Go to the documentation of this file.
38 namespace Test {
namespace Int {
45 for (
int i=
a.size();
i--; )
56 class IntInt :
public Test {
70 :
Test(
"Linear::Int::Int::"+
74 a(a0),
irt(irt0),
c(c0) {
80 for (
int i=0;
i<
x.size();
i++)
82 return cmp(e,
irt,
static_cast<double>(
c));
113 :
Test(
"Linear::Int::Var::"+
122 for (
int i=0;
i<
a.size();
i++)
124 return cmp(e,
irt,
static_cast<double>(
x[
a.size()]));
164 :
Test(
"Linear::Bool::Int::"+
167 a(a0),
irt(irt0),
c(c0) {
173 for (
int i=0;
i<
x.size();
i++)
175 return cmp(e,
irt,
static_cast<double>(
c));
180 for (
int i=
x.size();
i--; )
191 for (
int i=
x.size();
i--; )
212 :
Test(
"Linear::Bool::Var::"+
str(irt0)+
"::"+s,a0.
size()+1,
220 for (
int i=0;
i<
n;
i++)
221 if ((
x[
i] < 0) || (
x[
i] > 1))
224 for (
int i=0;
i<
n;
i++)
226 return cmp(e,
irt,
static_cast<double>(
x[
n]));
230 for (
int i=
x.size()-1;
i--; )
231 if ((
x[
i] < 0) || (
x[
i] > 1))
268 const int dv2[] = {-4,-1,0,1,4};
271 const int dv3[] = {0,1500000000};
277 (void)
new IntInt(
"11",
d1,a1,irts.irt(),0);
278 (void)
new IntVar(
"11",
d1,a1,irts.irt());
279 (void)
new IntInt(
"21",
d2,a1,irts.irt(),0);
280 (void)
new IntVar(
"21",
d2,a1,irts.irt());
281 (void)
new IntInt(
"31",
d3,a1,irts.irt(),150000000);
288 const int av2[5] = {1,1,1,1,1};
289 const int av3[5] = {1,-1,-1,1,-1};
290 const int av4[5] = {2,3,5,7,11};
291 const int av5[5] = {-2,3,-5,7,-11};
294 for (
int i=1;
i<=5;
i++) {
300 (void)
new IntInt(
"12",
d1,a2,irts.irt(),0);
301 (void)
new IntInt(
"13",
d1,a3,irts.irt(),0);
302 (void)
new IntInt(
"14",
d1,a4,irts.irt(),0);
303 (void)
new IntInt(
"15",
d1,a5,irts.irt(),0);
304 (void)
new IntInt(
"22",
d2,a2,irts.irt(),0);
305 (void)
new IntInt(
"23",
d2,a3,irts.irt(),0);
306 (void)
new IntInt(
"24",
d2,a4,irts.irt(),0);
307 (void)
new IntInt(
"25",
d2,a5,irts.irt(),0);
308 (void)
new IntInt(
"32",
d3,a2,irts.irt(),1500000000);
310 (void)
new IntVar(
"12",
d1,a2,irts.irt());
311 (void)
new IntVar(
"13",
d1,a3,irts.irt());
312 (void)
new IntVar(
"14",
d1,a4,irts.irt());
313 (void)
new IntVar(
"15",
d1,a5,irts.irt());
314 (void)
new IntVar(
"22",
d2,a2,irts.irt());
315 (void)
new IntVar(
"23",
d2,a3,irts.irt());
316 (void)
new IntVar(
"24",
d2,a4,irts.irt());
317 (void)
new IntVar(
"25",
d2,a5,irts.irt());
337 const int av1[10] = {
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
340 const int av2[10] = {
341 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
344 for (
int i=1;
i<=10;
i += 3) {
347 for (
int c=0;
c<=6;
c++)
349 (void)
new BoolInt(
"1",a1,irts.irt(),
c);
350 (void)
new BoolInt(
"2",a2,irts.irt(),-
c);
359 for (
int c=0;
c<=16;
c++) {
360 (void)
new BoolInt(
"3",a3,irts.irt(),
c);
361 (void)
new BoolInt(
"4",a4,irts.irt(),-
c);
362 (void)
new BoolInt(
"5",a5,irts.irt(),
c);
363 (void)
new BoolInt(
"6",a5,irts.irt(),-
c);
367 for (
int i=1;
i<=5;
i += 2) {
382 (void)
new BoolVar(
"6",0,10,a6,irts.irt());
383 (void)
new BoolVar(
"7",-10,0,a7,irts.irt());
384 (void)
new BoolVar(
"8",-3,3,a8,irts.irt());
385 (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.
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.
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 Options: basic versus advanced propagation.
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
struct Gecode::@602::NNF::@65::@67 a
For atomic nodes.
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.
Gecode::IntArgs i({1, 2, 3, 4})
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.