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::"+
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());
bool one(const Gecode::IntArgs &a)
Check whether a has only one coefficients.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
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.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
int size(void) const
Return size of array (number of elements)
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
const FloatNum max
Largest allowed float value.
static bool cmp(T x, Gecode::IntRelType r, T y)
Compare x and y with respect to r.
Gecode::IntRelType irt
Integer relation type to propagate.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
int c
Righthand-side constant.
virtual bool solution(const Assignment &x) const
Test whether x is solution
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)
Post constraint on x.
Gecode::IntRelType irt
Integer relation type to propagate.
BoolVar(const std::string &s, int min, int max, const Gecode::IntArgs &a0, Gecode::IntRelType irt0)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode::IntArgs a
Coefficients.
BoolInt(const std::string &s, const Gecode::IntArgs &a0, Gecode::IntRelType irt0, int c0)
Create and register test.
Help class to create and register tests.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
IntRelType
Relation types for integers.
Simple propagation levels.
Gecode::IntArgs a
Coefficients.
Iterator for integer relation types.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Test linear relation over Boolean variables equal to constant
Reification specification.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Gecode::IntPropLevel ipl
Propagation level.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Passing integer variables.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Passing integer arguments.
Passing Boolean variables.
Gecode::IntArgs a
Coefficients.
bool testfix
Whether to perform fixpoint test.
virtual bool ignore(const Assignment &x) const
Test whether x is to be ignored
Gecode::IntRelType irt
Integer relation type to propagate.
IntPropLevel
Propagation levels for integer propagators.
Post propagator for SetVar SetOpType SetVar y
Test linear relation over integer variables
Node * x
Pointer to corresponding Boolean expression node.
Test linear relation over integer variables
Gecode::IntRelType irt
Integer relation type to propagate.
virtual bool solution(const Assignment &x) const
Test whether x is solution
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Base class for assignments
virtual bool solution(const Assignment &x) const
Test whether x is solution
Domain propagation Preferences: prefer speed or memory.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode toplevel namespace
Create(void)
Perform creation and registration.
Test linear relation over Boolean variables equal to integer variable
Gecode::IntArgs a
Coefficients.
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.