Generated on Thu Jan 16 2025 00:00:00 for Gecode by doxygen 1.14.0
rel.cpp
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Christian Schulte <schulte@gecode.org>
5 *
6 * Copyright:
7 * Christian Schulte, 2005
8 *
9 * This file is part of Gecode, the generic constraint
10 * development environment:
11 * http://www.gecode.org
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining
14 * a copy of this software and associated documentation files (the
15 * "Software"), to deal in the Software without restriction, including
16 * without limitation the rights to use, copy, modify, merge, publish,
17 * distribute, sublicense, and/or sell copies of the Software, and to
18 * permit persons to whom the Software is furnished to do so, subject to
19 * the following conditions:
20 *
21 * The above copyright notice and this permission notice shall be
22 * included in all copies or substantial portions of the Software.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 *
32 */
33
34#include "test/int.hh"
35
36#include <gecode/minimodel.hh>
37
38namespace Test { namespace Int {
39
41 namespace Rel {
42
48
49 class IntVarXY : public Test {
50 protected:
53 public:
56 : Test("Rel::Int::Var::XY::"+str(irt0)+"::"+str(ipl)+"::"+str(n),
57 n+1,-3,3,n==1,ipl),
58 irt(irt0) {}
59
60 virtual bool solution(const Assignment& x) const {
61 if (x.size() == 2) {
62 return cmp(x[0],irt,x[1]);
63 } else {
64 return cmp(x[0],irt,x[2]) && cmp(x[1],irt,x[2]);
65 }
66 }
67
68 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
69 using namespace Gecode;
70 if (x.size() == 2) {
71 rel(home, x[0], irt, x[1], ipl);
72 } else {
73 IntVarArgs y(2);
74 y[0]=x[0]; y[1]=x[1];
75 rel(home, y, irt, x[2], ipl);
76 }
77 }
78
81 assert(x.size() == 2);
82 Gecode::rel(home, x[0], irt, x[1], r, ipl);
83 }
84 };
85
87 class IntVarXX : public Test {
88 protected:
91 public:
94 : Test("Rel::Int::Var::XX::"+str(irt0)+"::"+str(ipl),
95 1,-3,3,true,ipl),
96 irt(irt0) {
97 contest = ((irt != Gecode::IRT_LE) &&
98 (irt != Gecode::IRT_GR) &&
101 }
102
103 virtual bool solution(const Assignment& x) const {
104 return cmp(x[0],irt,x[0]);
105 }
106
107 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
108 Gecode::rel(home, x[0], irt, x[0], ipl);
109 }
110
113 Gecode::rel(home, x[0], irt, x[0], r, ipl);
114 }
115 };
116
118 class BoolVarXY : public Test {
119 protected:
122 public:
125 : Test("Rel::Bool::Var::XY::"+str(irt0)+"::"+str(n),n+1,0,1,
126 n==1),
127 irt(irt0) {}
128
129 virtual bool solution(const Assignment& x) const {
130 if (x.size() == 2) {
131 return cmp(x[0],irt,x[1]);
132 } else {
133 return cmp(x[0],irt,x[2]) && cmp(x[1],irt,x[2]);
134 }
135 }
136
137 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
138 using namespace Gecode;
139 if (x.size() == 2) {
140 rel(home, channel(home,x[0]), irt, channel(home,x[1]));
141 } else {
142 BoolVarArgs y(2);
143 y[0]=channel(home,x[0]); y[1]=channel(home,x[1]);
144 rel(home, y, irt, channel(home,x[2]));
145 }
146 }
147
150 assert(x.size() == 2);
151 using namespace Gecode;
152 rel(home,
153 channel(home,x[0]), irt, channel(home,x[1]),
154 r);
155 }
156 };
157
159 class BoolVarXX : public Test {
160 protected:
163 public:
166 : Test("Rel::Bool::Var::XX::"+str(irt0),1,0,1),
167 irt(irt0) {
168 contest = ((irt != Gecode::IRT_LE) &&
169 (irt != Gecode::IRT_GR) &&
170 (irt != Gecode::IRT_NQ))
172 }
173
174 virtual bool solution(const Assignment& x) const {
175 return cmp(x[0],irt,x[0]);
176 }
177
178 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
179 Gecode::BoolVar b = Gecode::channel(home,x[0]);
180 Gecode::rel(home, b, irt, b);
181 }
182 };
183
185 class IntInt : public Test {
186 protected:
190 int c;
191 public:
193 IntInt(Gecode::IntRelType irt0, int n, int c0)
194 : Test("Rel::Int::Int::"+str(irt0)+"::"+str(n)+"::"+str(c0),
195 n,-3,3,n==1),
196 irt(irt0), c(c0) {}
197
198 virtual bool solution(const Assignment& x) const {
199 if (x.size() == 1)
200 return cmp(x[0],irt,c);
201 else
202 return cmp(x[0],irt,c) && cmp(x[1],irt,c);
203 }
204
205 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
206 using namespace Gecode;
207 if (x.size() == 1)
208 rel(home, x[0], irt, c);
209 else
210 rel(home, x, irt, c);
211 }
212
215 assert(x.size() == 1);
216 Gecode::rel(home, x[0], irt, c, r);
217 }
218 };
219
221 class BoolInt : public Test {
222 protected:
226 int c;
227 public:
229 BoolInt(Gecode::IntRelType irt0, int n, int c0)
230 : Test("Rel::Bool::Int::"+str(irt0)+"::"+str(n)+"::"+str(c0),n,0,1,
231 n==1),
232 irt(irt0), c(c0) {}
233
234 virtual bool solution(const Assignment& x) const {
235 if (x.size() == 1)
236 return cmp(x[0],irt,c);
237 else
238 return cmp(x[0],irt,c) && cmp(x[1],irt,c);
239 }
240
241 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
242 using namespace Gecode;
243 if (x.size() == 1) {
244 rel(home, channel(home,x[0]), irt, c);
245 } else {
246 BoolVarArgs y(2);
247 y[0]=channel(home,x[0]); y[1]=channel(home,x[1]);
248 rel(home, y, irt, c);
249 }
250 }
251
254 assert(x.size() == 1);
255 using namespace Gecode;
256 rel(home, channel(home,x[0]), irt, c, r);
257 }
258 };
259
261 class IntSeq : public Test {
262 protected:
265 public:
268 : Test("Rel::Int::Seq::"+str(n)+"::"+str(irt0)+"::"+str(ipl),
269 n,-3,3,false,ipl),
270 irt(irt0) {}
271
272 virtual bool solution(const Assignment& x) const {
273 if (irt == Gecode::IRT_NQ) {
274 if (x.size() < 2)
275 return false;
276 for (int i=0; i<x.size()-1; i++)
277 if (x[i] != x[i+1])
278 return true;
279 return false;
280 } else {
281 for (int i=0; i<x.size()-1; i++)
282 if (!cmp(x[i],irt,x[i+1]))
283 return false;
284 return true;
285 }
286 }
287
288 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
289 Gecode::rel(home, x, irt, ipl);
290 }
291 };
292
294 class IntSharedSeq : public Test {
295 protected:
298 public:
301 : Test("Rel::Int::Seq::Shared::"+str(n)+"::"+str(irt0)+"::"+str(ipl),
302 n,-3,3,false,ipl),
303 irt(irt0) {}
304
305 virtual bool solution(const Assignment& x) const {
306 if (irt == Gecode::IRT_NQ) {
307 if (x.size() < 2)
308 return false;
309 for (int i=0; i<x.size()-1; i++)
310 if (x[i] != x[i+1])
311 return true;
312 return false;
313 } else {
314 int n = x.size();
315 for (int i=0; i<2*n-1; i++)
316 if (!cmp(x[i % n],irt,x[(i+1) % n]))
317 return false;
318 return true;
319 }
320 }
321
322 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
323 using namespace Gecode;
324 int n = x.size();
325 IntVarArgs y(2*n);
326 for (int i=n; i--; )
327 y[i] = y[n+i] = x[i];
328 rel(home, y, irt, ipl);
329 }
330 };
331
333 class BoolSeq : public Test {
334 protected:
337 public:
340 : Test("Rel::Bool::Seq::"+str(n)+"::"+str(irt0),n,0,1),
341 irt(irt0) {}
342
343 virtual bool solution(const Assignment& x) const {
344 if (irt == Gecode::IRT_NQ) {
345 if (x.size() < 2)
346 return false;
347 for (int i=0; i<x.size()-1; i++)
348 if (x[i] != x[i+1])
349 return true;
350 return false;
351 } else {
352 for (int i=0; i<x.size()-1; i++)
353 if (!cmp(x[i],irt,x[i+1]))
354 return false;
355 return true;
356 }
357 }
358
359 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
360 using namespace Gecode;
361 BoolVarArgs b(x.size());
362 for (int i=x.size(); i--; )
363 b[i]=channel(home,x[i]);
364 rel(home, b, irt);
365 }
366 };
367
369 class BoolSharedSeq : public Test {
370 protected:
373 public:
376 : Test("Rel::Bool::Seq::Shared::"+str(n)+"::"+str(irt0),n,0,1),
377 irt(irt0) {}
378
379 virtual bool solution(const Assignment& x) const {
380 if (irt == Gecode::IRT_NQ) {
381 if (x.size() < 2)
382 return false;
383 for (int i=0; i<x.size()-1; i++)
384 if (x[i] != x[i+1])
385 return true;
386 return false;
387 } else {
388 int n = x.size();
389 for (int i=0; i<2*n-1; i++)
390 if (!cmp(x[i % n],irt,x[(i+1) % n]))
391 return false;
392 return true;
393 }
394 }
395
396 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
397 using namespace Gecode;
398 int n = x.size();
399 BoolVarArgs b(2*n);
400 for (int i=n; i--; )
401 b[i]=b[n+i]=channel(home,x[i]);
402 rel(home, b, irt);
403 }
404 };
405
407 class IntArrayVar : public Test {
408 protected:
411 public:
414 : Test("Rel::Int::Array::Var::"+str(irt0),6,-2,2), irt(irt0) {}
415
416 virtual bool solution(const Assignment& x) const {
417 int n=x.size() >> 1;
418 for (int i=0; i<n; i++)
419 if (x[i] != x[n+i])
420 return cmp(x[i],irt,x[n+i]);
421 return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
422 (irt == Gecode::IRT_EQ));
424 return false;
425 }
426
427 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
428 using namespace Gecode;
429 int n=x.size() >> 1;
430 IntVarArgs y(n); IntVarArgs z(n);
431 for (int i=0; i<n; i++) {
432 y[i]=x[i]; z[i]=x[n+i];
433 }
434 rel(home, y, irt, z);
435 }
436 };
437
439 class IntArrayInt : public Test {
440 protected:
443 public:
446 : Test("Rel::Int::Array::Int::"+str(irt0),3,-2,2), irt(irt0) {}
447
448 virtual bool solution(const Assignment& x) const {
449 Gecode::IntArgs y({0,0,0});
450 int n=x.size();
451 for (int i=0; i<n; i++)
452 if (x[i] != y[i])
453 return cmp(x[i],irt,y[i]);
454 return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
455 (irt == Gecode::IRT_EQ));
457 return false;
458 }
459
460 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
461 using namespace Gecode;
462 IntArgs y({0,0,0});
463 rel(home, x, irt, y);
464 }
465 };
466
468 class IntArrayDiff : public Test {
469 protected:
473 static const int n = 4;
475 int n_fst;
476 public:
479 : Test("Rel::Int::Array::"+str(irt0)+"::"+str(m)+"::"+str(n-m),
480 n,-2,2),
481 irt(irt0), n_fst(m) {
482 assert(n_fst <= n);
483 }
484
485 virtual bool solution(const Assignment& x) const {
486 int n_snd = n - n_fst;
487 for (int i=0; i<std::min(n_fst,n_snd); i++)
488 if (x[i] != x[n_fst+i])
489 return cmp(x[i],irt,x[n_fst+i]);
490 return cmp(n_fst,irt,n_snd);
491 }
492
493 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
494 using namespace Gecode;
495 int n_snd = n - n_fst;
496 IntVarArgs y(n_fst); IntVarArgs z(n_snd);
497 for (int i=0; i<n_fst; i++) {
498 y[i]=x[i];
499 }
500 for (int i=0; i<n_snd; i++) {
501 z[i]=x[n_fst + i];
502 }
503 rel(home, y, irt, z);
504 }
505 };
506
508 class BoolArrayVar : public Test {
509 protected:
512 public:
515 : Test("Rel::Bool::Array::Var::"+str(irt0),10,0,1), irt(irt0) {}
516
517 virtual bool solution(const Assignment& x) const {
518 int n=x.size() >> 1;
519 for (int i=0; i<n; i++)
520 if (x[i] != x[n+i])
521 return cmp(x[i],irt,x[n+i]);
522 return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
523 (irt == Gecode::IRT_EQ));
525 return false;
526 }
527
528 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
529 using namespace Gecode;
530 int n=x.size() >> 1;
531 BoolVarArgs y(n); BoolVarArgs z(n);
532 for (int i=0; i<n; i++) {
533 y[i]=channel(home,x[i]); z[i]=channel(home,x[n+i]);
534 }
535 rel(home, y, irt, z);
536 }
537 };
538
540 class BoolArrayInt : public Test {
541 protected:
544 public:
547 : Test("Rel::Bool::Array::Int::"+str(irt0),5,0,1), irt(irt0) {}
548
549 virtual bool solution(const Assignment& x) const {
550 Gecode::IntArgs y({0,0,1,0,0});
551 for (int i=0; i<5; i++)
552 if (x[i] != y[i])
553 return cmp(x[i],irt,y[i]);
554 return ((irt == Gecode::IRT_LQ) || (irt == Gecode::IRT_GQ) ||
555 (irt == Gecode::IRT_EQ));
557 return false;
558 }
559
560 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
561 using namespace Gecode;
562 Gecode::IntArgs z({0,0,1,0,0});
563 int n=x.size();
564 BoolVarArgs y(n);
565 for (int i=0; i<n; i++)
566 y[i]=channel(home,x[i]);
567 rel(home, y, irt, z);
568 }
569 };
570
572 class Create {
573 public:
575 Create(void) {
576 using namespace Gecode;
577 for (IntRelTypes irts; irts(); ++irts) {
578 for (IntPropLevels ipls; ipls(); ++ipls) {
579 (void) new IntVarXY(irts.irt(),1,ipls.ipl());
580 (void) new IntVarXY(irts.irt(),2,ipls.ipl());
581 (void) new IntVarXX(irts.irt(),ipls.ipl());
582 (void) new IntSeq(1,irts.irt(),ipls.ipl());
583 (void) new IntSeq(2,irts.irt(),ipls.ipl());
584 (void) new IntSeq(3,irts.irt(),ipls.ipl());
585 (void) new IntSeq(5,irts.irt(),ipls.ipl());
586 (void) new IntSharedSeq(1,irts.irt(),ipls.ipl());
587 (void) new IntSharedSeq(2,irts.irt(),ipls.ipl());
588 (void) new IntSharedSeq(3,irts.irt(),ipls.ipl());
589 (void) new IntSharedSeq(4,irts.irt(),ipls.ipl());
590 }
591 (void) new BoolVarXY(irts.irt(),1);
592 (void) new BoolVarXY(irts.irt(),2);
593 (void) new BoolVarXX(irts.irt());
594 (void) new BoolSeq(1,irts.irt());
595 (void) new BoolSeq(2,irts.irt());
596 (void) new BoolSeq(3,irts.irt());
597 (void) new BoolSeq(10,irts.irt());
598 (void) new BoolSharedSeq(1,irts.irt());
599 (void) new BoolSharedSeq(2,irts.irt());
600 (void) new BoolSharedSeq(3,irts.irt());
601 (void) new BoolSharedSeq(4,irts.irt());
602 (void) new BoolSharedSeq(8,irts.irt());
603 for (int c=-4; c<=4; c++) {
604 (void) new IntInt(irts.irt(),1,c);
605 (void) new IntInt(irts.irt(),2,c);
606 }
607 for (int c=0; c<=1; c++) {
608 (void) new BoolInt(irts.irt(),1,c);
609 (void) new BoolInt(irts.irt(),2,c);
610 }
611 (void) new IntArrayVar(irts.irt());
612 (void) new IntArrayInt(irts.irt());
613 for (int n_fst=0; n_fst<=4; n_fst++)
614 (void) new IntArrayDiff(irts.irt(),n_fst);
615 (void) new BoolArrayVar(irts.irt());
616 (void) new BoolArrayInt(irts.irt());
617 }
618 }
619 };
620
623
624 }
625}}
626
627// STATISTICS: test-int
Passing Boolean variables.
Definition int.hh:721
Boolean integer variables.
Definition int.hh:515
Passing integer arguments.
Definition int.hh:634
Passing integer variables.
Definition int.hh:662
Integer variable array.
Definition int.hh:772
Reification specification.
Definition int.hh:891
Computation spaces.
Definition core.hpp:1744
Base class for assignments
Definition int.hh:59
Iterator for simple integer propagation levels.
Definition int.hh:332
Iterator for integer relation types.
Definition int.hh:368
Test for relation between arrays of Boolean variables and integers
Definition rel.cpp:540
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:560
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:543
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:549
BoolArrayInt(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:546
Test for relation between arrays of Boolean variables
Definition rel.cpp:508
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:528
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:517
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:511
BoolArrayVar(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:514
Test for simple relation involving Boolean variable and integer constant
Definition rel.cpp:221
int c
Integer constant.
Definition rel.cpp:226
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:234
BoolInt(Gecode::IntRelType irt0, int n, int c0)
Create and register test.
Definition rel.cpp:229
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:252
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:224
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:241
Test for sequence of relations between Boolean variables
Definition rel.cpp:333
BoolSeq(int n, Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:339
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:336
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:359
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:343
Test for sequence of relations between shared Boolean variables
Definition rel.cpp:369
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:372
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:379
BoolSharedSeq(int n, Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:375
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:396
Test for simple relation involving shared Boolean variables
Definition rel.cpp:159
BoolVarXX(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:165
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:174
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:162
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:178
Test for simple relation involving Boolean variables
Definition rel.cpp:118
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:121
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:137
BoolVarXY(Gecode::IntRelType irt0, int n)
Create and register test.
Definition rel.cpp:124
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:129
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:148
Help class to create and register tests.
Definition rel.cpp:572
Create(void)
Perform creation and registration.
Definition rel.cpp:575
Test for relation between differently sized arrays of integer variables
Definition rel.cpp:468
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:485
static const int n
How many variables in total.
Definition rel.cpp:473
IntArrayDiff(Gecode::IntRelType irt0, int m)
Create and register test.
Definition rel.cpp:478
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:493
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:471
int n_fst
How big is the first array.
Definition rel.cpp:475
Test for relation between same sized arrays of integer variables and integers
Definition rel.cpp:439
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:442
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:448
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:460
IntArrayInt(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:445
Test for relation between same sized arrays of integer variables
Definition rel.cpp:407
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:410
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:427
IntArrayVar(Gecode::IntRelType irt0)
Create and register test.
Definition rel.cpp:413
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:416
Test for simple relation involving integer variable and integer constant
Definition rel.cpp:185
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:188
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:213
int c
Integer constant.
Definition rel.cpp:190
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:205
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:198
IntInt(Gecode::IntRelType irt0, int n, int c0)
Create and register test.
Definition rel.cpp:193
Test for sequence of relations between integer variables
Definition rel.cpp:261
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:272
IntSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:267
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:264
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:288
Test for sequence of relations between shared integer variables
Definition rel.cpp:294
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:322
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:297
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:305
IntSharedSeq(int n, Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:300
Test for simple relation involving shared integer variables
Definition rel.cpp:87
IntVarXX(Gecode::IntRelType irt0, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:93
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:107
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:90
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:111
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:103
Test for simple relation involving integer variables
Definition rel.cpp:49
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition rel.cpp:68
Gecode::IntRelType irt
Integer relation type to propagate.
Definition rel.cpp:52
IntVarXY(Gecode::IntRelType irt0, int n, Gecode::IntPropLevel ipl)
Create and register test.
Definition rel.cpp:55
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition rel.cpp:60
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x, Gecode::Reify r)
Post reified constraint on x for r.
Definition rel.cpp:79
Gecode::IntPropLevel ipl
Propagation level.
Definition int.hh:234
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Definition int.hpp:209
static bool cmp(T x, Gecode::IntRelType r, T y)
Compare x and y with respect to r.
Definition int.hpp:285
ConTestLevel contest
Whether to test for certain consistency.
Definition int.hh:236
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVar x1)
Post propagator for .
Definition rel.cpp:68
IntRelType
Relation types for integers.
Definition int.hh:940
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:989
@ IRT_EQ
Equality ( )
Definition int.hh:941
@ IRT_NQ
Disequality ( )
Definition int.hh:942
@ IRT_GQ
Greater or equal ( )
Definition int.hh:945
@ IRT_LE
Less ( )
Definition int.hh:944
@ IRT_GR
Greater ( )
Definition int.hh:946
@ IRT_LQ
Less or equal ( )
Definition int.hh:943
Gecode toplevel namespace
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition channel.cpp:41
Post propagator for SetVar SetOpType SetVar SetRelType SetVar z
Definition set.hh:773
Post propagator for SetVar SetOpType SetVar y
Definition set.hh:773
Post propagator for SetVar x
Definition set.hh:773
Tests for relation constraints
Definition rel.cpp:41
Create c
Definition rel.cpp:621
Testing finite domain integers.
Definition int.cpp:40
@ CTL_NONE
No consistency-test.
Definition int.hh:140
@ CTL_DOMAIN
Test for domain-consistency.
Definition int.hh:141
General test support.
Definition afc.cpp:39
Region r
Definition region.cpp:65
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56