38namespace Test {
namespace Int {
45 for (
int i=
a.
size(); i--; )
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++)
164 :
Test(
"Linear::Bool::Int::"+
165 str(irt0)+
"::"+s+
"::"+
str(a0.size())+
"::"+
str(c0),
166 a0.size(),0,1,true,
Gecode::IPL_DEF),
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);
283 (void)
new IntInt(
"11",d1,a1,IRT_EQ,0,IPL_DOM);
284 (void)
new IntVar(
"11",d1,a1,IRT_EQ,IPL_DOM);
285 (void)
new IntInt(
"21",d2,a1,IRT_EQ,0,IPL_DOM);
286 (void)
new IntVar(
"21",d2,a1,IRT_EQ,IPL_DOM);
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());
320 (void)
new IntInt(
"12",d1,a2,IRT_EQ,0,IPL_DOM);
321 (void)
new IntInt(
"13",d1,a3,IRT_EQ,0,IPL_DOM);
322 (void)
new IntInt(
"14",d1,a4,IRT_EQ,0,IPL_DOM);
323 (void)
new IntInt(
"15",d1,a5,IRT_EQ,0,IPL_DOM);
324 (void)
new IntInt(
"22",d2,a2,IRT_EQ,0,IPL_DOM);
325 (void)
new IntInt(
"23",d2,a3,IRT_EQ,0,IPL_DOM);
326 (void)
new IntInt(
"24",d2,a4,IRT_EQ,0,IPL_DOM);
327 (void)
new IntInt(
"25",d2,a5,IRT_EQ,0,IPL_DOM);
329 (void)
new IntVar(
"12",d1,a2,IRT_EQ,IPL_DOM);
330 (void)
new IntVar(
"13",d1,a3,IRT_EQ,IPL_DOM);
331 (void)
new IntVar(
"14",d1,a4,IRT_EQ,IPL_DOM);
332 (void)
new IntVar(
"15",d1,a5,IRT_EQ,IPL_DOM);
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());
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Node * x
Pointer to corresponding Boolean expression node.
int size(void) const
Return size of array (number of elements)
Passing Boolean variables.
Passing integer arguments.
Passing integer variables.
Reification specification.
Base class for assignments
Iterator for integer relation types.
Test linear relation over Boolean variables equal to constant
Gecode::IntArgs a
Coefficients.
virtual bool solution(const Assignment &x) const
Test whether x is solution
int c
Righthand-side constant.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
BoolInt(const std::string &s, const Gecode::IntArgs &a0, Gecode::IntRelType irt0, int c0)
Create and register test.
Gecode::IntRelType irt
Integer relation type to propagate.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Test linear relation over Boolean variables equal to integer variable
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 bool ignore(const Assignment &x) const
Test whether x is to be ignored
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.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Gecode::IntArgs a
Coefficients.
Help class to create and register tests.
Create(void)
Perform creation and registration.
Test linear relation over integer variables
Gecode::IntRelType irt
Integer relation type to propagate.
Gecode::IntArgs a
Coefficients.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
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
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.
Test linear relation over integer variables
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
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.
Gecode::IntArgs a
Coefficients.
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.
Gecode::IntRelType irt
Integer relation type to propagate.
bool testfix
Whether to perform fixpoint test.
Gecode::IntPropLevel ipl
Propagation level.
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
static bool cmp(T x, Gecode::IntRelType r, T y)
Compare x and y with respect to r.
void linear(Home home, const FloatVarArgs &x, FloatRelType frt, FloatVal c)
Post propagator for .
IntRelType
Relation types for integers.
IntPropLevel
Propagation levels for integer propagators.
@ IPL_DEF
Simple propagation levels.
@ IPL_BND
Bounds propagation.
Gecode toplevel namespace
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
bool one(const Gecode::IntArgs &a)
Check whether a has only one coefficients.