38 namespace Test {
namespace Int {
45 for (
int i=a.
size();
i--; )
70 :
Test(
"Linear::Int::Int::"+
74 a(a0), irt(irt0), c(c0) {
82 return cmp(e, irt, static_cast<double>(c));
113 :
Test(
"Linear::Int::Var::"+
124 return cmp(e, irt, static_cast<double>(x[a.
size()]));
164 :
Test(
"Linear::Bool::Int::"+
167 a(a0), irt(irt0), c(c0) {
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};
293 for (
int i=1;
i<=5;
i++) {
299 (void)
new IntInt(
"12",d1,a2,irts.irt(),0);
300 (void)
new IntInt(
"13",d1,a3,irts.irt(),0);
301 (void)
new IntInt(
"14",d1,a4,irts.irt(),0);
302 (void)
new IntInt(
"15",d1,a5,irts.irt(),0);
303 (void)
new IntInt(
"22",d2,a2,irts.irt(),0);
304 (void)
new IntInt(
"23",d2,a3,irts.irt(),0);
305 (void)
new IntInt(
"24",d2,a4,irts.irt(),0);
306 (void)
new IntInt(
"25",d2,a5,irts.irt(),0);
307 (void)
new IntInt(
"32",d3,a2,irts.irt(),1500000000);
309 (void)
new IntVar(
"12",d1,a2,irts.irt());
310 (void)
new IntVar(
"13",d1,a3,irts.irt());
311 (void)
new IntVar(
"14",d1,a4,irts.irt());
312 (void)
new IntVar(
"15",d1,a5,irts.irt());
313 (void)
new IntVar(
"22",d2,a2,irts.irt());
314 (void)
new IntVar(
"23",d2,a3,irts.irt());
315 (void)
new IntVar(
"24",d2,a4,irts.irt());
316 (void)
new IntVar(
"25",d2,a5,irts.irt());
336 const int av1[10] = {
337 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
339 const int av2[10] = {
340 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1
343 for (
int i=1;
i<=10;
i += 3) {
346 for (
int c=0;
c<=6;
c++)
348 (void)
new BoolInt(
"1",a1,irts.irt(),
c);
349 (void)
new BoolInt(
"2",a2,irts.irt(),-
c);
358 for (
int c=0;
c<=16;
c++) {
359 (void)
new BoolInt(
"3",a3,irts.irt(),
c);
360 (void)
new BoolInt(
"4",a4,irts.irt(),-
c);
361 (void)
new BoolInt(
"5",a5,irts.irt(),
c);
362 (void)
new BoolInt(
"6",a5,irts.irt(),-
c);
366 for (
int i=1;
i<=5;
i += 2) {
381 (void)
new BoolVar(
"6",0,10,a6,irts.irt());
382 (void)
new BoolVar(
"7",-10,0,a7,irts.irt());
383 (void)
new BoolVar(
"8",-3,3,a8,irts.irt());
384 (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 .
int size(void) const
Return size of array (number of elements)
const FloatNum max
Largest allowed float value.
int size(void) const
Return number of variables.
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.
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.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
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 Options: basic versus advanced propagation.
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.