Generated on Tue Feb 11 2025 17:33:26 for Gecode by doxygen 1.12.0
element.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#include <climits>
38
39namespace Test { namespace Int {
40
42 namespace Element {
43
50 class IntIntVar : public Test {
51 protected:
54 public:
56 IntIntVar(const std::string& s, const Gecode::IntArgs& c0,
57 int min, int max)
58 : Test("Element::Int::Int::Var::"+s,2,min,max),
59 c(c0) {}
61 virtual bool solution(const Assignment& x) const {
62 return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[1];
63 }
65 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
66 Gecode::element(home, c, x[0], x[1]);
67 }
68 };
69
71 class IntIntInt : public Test {
72 protected:
76 int r;
77 public:
79 IntIntInt(const std::string& s, const Gecode::IntArgs& c0, int r0)
80 : Test("Element::Int::Int::Int::"+s+"::"+str(r0),1,-4,8),
81 c(c0), r(r0) {}
83 virtual bool solution(const Assignment& x) const {
84 return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==r;
85 }
87 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
88 Gecode::element(home, c, x[0], r);
89 }
90 };
91
93 class IntIntShared : public Test {
94 protected:
97 public:
99 IntIntShared(const std::string& s, const Gecode::IntArgs& c0,
100 int minDomain=-4)
101 : Test("Element::Int::Int::Shared::"+s,1,minDomain,8), c(c0) {}
103 virtual bool solution(const Assignment& x) const {
104 return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[0];
105 }
107 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
108 Gecode::element(home, c, x[0], x[0]);
109 }
110 };
111
113 class IntBoolVar : public Test {
114 protected:
117 public:
119 IntBoolVar(const std::string& s, const Gecode::IntArgs& c0)
120 : Test("Element::Int::Bool::Var::"+s,2,-4,8), c(c0) {}
122 virtual bool solution(const Assignment& x) const {
123 return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[1];
124 }
126 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
127 Gecode::element(home, c, x[0], Gecode::channel(home,x[1]));
128 }
129 };
130
132 class IntBoolInt : public Test {
133 protected:
137 int r;
138 public:
140 IntBoolInt(const std::string& s, const Gecode::IntArgs& c0, int r0)
141 : Test("Element::Int::Bool::Int::"+s+"::"+str(r0),1,-4,8),
142 c(c0), r(r0) {}
144 virtual bool solution(const Assignment& x) const {
145 return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==r;
146 }
148 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
149 Gecode::element(home, c, x[0], r);
150 }
151 };
152
154 class VarIntVar : public Test {
155 public:
158 : Test("Element::Var::Int::Var::"+str(ipl),6,-1,3,false,ipl) {}
160 virtual bool solution(const Assignment& x) const {
161 return (x[0]>= 0) && (x[0]<x.size()-2) && x[2+x[0]]==x[1];
162 }
164 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
165 Gecode::IntVarArgs c(x.size()-2);
166 for (int i=0; i<x.size()-2; i++)
167 c[i]=x[2+i];
168 Gecode::element(home, c, x[0], x[1], ipl);
169 }
170 };
171
173 class VarIntInt : public Test {
174 protected:
176 int r;
177 public:
180 : Test("Element::Var::Int::Int::"+str(ipl)+"::"+str(r0),
181 5,-1,3,false,ipl), r(r0) {
183 }
185 virtual bool solution(const Assignment& x) const {
186 return (x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==r;
187 }
189 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
190 Gecode::IntVarArgs c(x.size()-1);
191 for (int i=0; i<x.size()-1; i++)
192 c[i]=x[1+i];
193 Gecode::element(home, c, x[0], r, ipl);
194 }
195 };
196
198 class VarIntShared : public Test {
199 public:
202 : Test("Element::Var::Int::Shared::"+str(ipl),5,-1,3,false,ipl) {
204 }
206 virtual bool solution(const Assignment& x) const {
207 return (x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==x[0];
208 }
210 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
211 Gecode::IntVarArgs c(x.size()-1);
212 for (int i=0; i<x.size()-1; i++)
213 c[i]=x[1+i];
214 Gecode::element(home, c, x[0], x[0], ipl);
215 }
216 };
217
219 class VarBoolVar : public Test {
220 public:
222 VarBoolVar(void) : Test("Element::Var::Bool::Var",6,-1,3,false) {}
224 virtual bool solution(const Assignment& x) const {
225 for (int i=0; i<x.size()-2; i++)
226 if ((x[2+i] < 0) || (x[2+i]>1))
227 return false;
228 return ((x[0]>= 0) && (x[0]<x.size()-2) && x[2+x[0]]==x[1]
229 && (x[1]>=0) && (x[1]<=1));
230 }
232 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
233 using namespace Gecode;
234 BoolVarArgs c(x.size()-2);
235 for (int i=0; i<x.size()-2; i++)
236 c[i]=channel(home,x[2+i]);
237 element(home, c, x[0], channel(home,x[1]));
238 }
239 };
240
242 class VarBoolInt : public Test {
243 protected:
245 int r;
246 public:
249 : Test("Element::Var::Bool::Int::"+str(r0),5,-1,3,false), r(r0) {}
251 virtual bool solution(const Assignment& x) const {
252 for (int i=0; i<x.size()-1; i++)
253 if ((x[1+i] < 0) || (x[1+i]>1))
254 return false;
255 return ((x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==r);
256 }
258 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
259 using namespace Gecode;
260 BoolVarArgs c(x.size()-1);
261 for (int i=0; i<x.size()-1; i++)
262 c[i]=channel(home,x[1+i]);
263 if (r == 1) {
264 switch (Base::rand(3)) {
265 case 0:
266 element(home, c, x[0], 1);
267 break;
268 case 1:
269 {
270 BoolVar one(home,1,1);
271 rel(home, element(c,x[0]) == one);
272 }
273 break;
274 case 2:
275 rel(home, element(c,x[0]));
276 break;
277 default: GECODE_NEVER;
278 }
279 } else {
280 element(home, c, x[0], r);
281 }
282 }
283 };
284
285
287 class MatrixIntIntVarXY : public Test {
288 protected:
291 public:
294 : Test("Element::Matrix::Int::IntVar::XY",3,0,5,false),
295 tm({0,1,2,3,4,5}) {}
297 virtual bool solution(const Assignment& x) const {
298 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
299 using namespace Gecode;
300 if ((x[0] > 2) || (x[1] > 1))
301 return false;
302 Matrix<IntArgs> m(tm,3,2);
303 return m(x[0],x[1]) == x[2];
304 }
306 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
307 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
308 using namespace Gecode;
309 Matrix<IntArgs> m(tm,3,2);
310 element(home, m, x[0], x[1], x[2]);
311 }
312 };
313
315 class MatrixIntIntVarXX : public Test {
316 protected:
319 public:
322 : Test("Element::Matrix::Int::IntVar::XX",2,0,3,false),
323 tm({0,1,2,3}) {}
325 virtual bool solution(const Assignment& x) const {
326 // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
327 using namespace Gecode;
328 if (x[0] > 1)
329 return false;
330 Matrix<IntArgs> m(tm,2,2);
331 return m(x[0],x[0]) == x[1];
332 }
334 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
335 // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
336 using namespace Gecode;
337 Matrix<IntArgs> m(tm,2,2);
338 element(home, m, x[0], x[0], x[1]);
339 }
340 };
341
343 class MatrixIntBoolVarXY : public Test {
344 protected:
347 public:
350 : Test("Element::Matrix::Int::BoolVar::XY",3,0,3,false),
351 tm({0,1,1,0}) {}
353 virtual bool solution(const Assignment& x) const {
354 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
355 using namespace Gecode;
356 if ((x[0] > 1) || (x[1] > 1))
357 return false;
358 Matrix<IntArgs> m(tm,2,2);
359 return m(x[0],x[1]) == x[2];
360 }
362 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
363 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
364 using namespace Gecode;
365 Matrix<IntArgs> m(tm,2,2);
366 element(home, m, x[0], x[1], channel(home,x[2]));
367 }
368 };
369
371 class MatrixIntBoolVarXX : public Test {
372 protected:
375 public:
378 : Test("Element::Matrix::Int::BoolVar::XX",2,0,3,false),
379 tm({0,1,1,0}) {}
381 virtual bool solution(const Assignment& x) const {
382 // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
383 using namespace Gecode;
384 if (x[0] > 1)
385 return false;
386 Matrix<IntArgs> m(tm,2,2);
387 return m(x[0],x[0]) == x[1];
388 }
390 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
391 // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
392 using namespace Gecode;
393 Matrix<IntArgs> m(tm,2,2);
394 element(home, m, x[0], x[0], channel(home,x[1]));
395 }
396 };
397
399 class MatrixIntVarIntVarXY : public Test {
400 public:
403 : Test("Element::Matrix::IntVar::IntVar::XY",3+4,0,3,false) {}
405 virtual bool solution(const Assignment& x) const {
406 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
407 // remaining: matrix
408 using namespace Gecode;
409 if ((x[0] > 1) || (x[1] > 1))
410 return false;
411 IntArgs tm(4);
412 tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
413 Matrix<IntArgs> m(tm,2,2);
414 return m(x[0],x[1]) == x[2];
415 }
417 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
418 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
419 using namespace Gecode;
420 IntVarArgs tm(4);
421 tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
422 Matrix<IntVarArgs> m(tm,2,2);
423 element(home, m, x[0], x[1], x[2]);
424 }
425 };
426
428 class MatrixIntVarIntVarXX : public Test {
429 public:
432 : Test("Element::Matrix::IntVar::IntVar::XX",2+4,0,3,false) {}
434 virtual bool solution(const Assignment& x) const {
435 // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
436 // remaining: matrix
437 using namespace Gecode;
438 if (x[0] > 1)
439 return false;
440 IntArgs tm(4);
441 tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
442 Matrix<IntArgs> m(tm,2,2);
443 return m(x[0],x[0]) == x[1];
444 }
446 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
447 // x-coordinate: x[0], y-coordinate: x[1], result: x[1]
448 using namespace Gecode;
449 IntVarArgs tm(4);
450 tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
451 Matrix<IntVarArgs> m(tm,2,2);
452 element(home, m, x[0], x[0], x[1]);
453 }
454 };
455
458 public:
461 : Test("Element::Matrix::BoolVar::BoolVar::XY",3+4,0,1,false) {}
463 virtual bool solution(const Assignment& x) const {
464 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
465 // remaining: matrix
466 using namespace Gecode;
467 IntArgs tm(4);
468 tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
469 Matrix<IntArgs> m(tm,2,2);
470 return m(x[0],x[1]) == x[2];
471 }
473 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
474 // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
475 using namespace Gecode;
476 BoolVarArgs tm(4);
477 tm[0]=channel(home,x[3]); tm[1]=channel(home,x[4]);
478 tm[2]=channel(home,x[5]); tm[3]=channel(home,x[6]);
479 Matrix<BoolVarArgs> m(tm,2,2);
480 element(home, m, x[0], x[1], channel(home,x[2]));
481 }
482 };
483
486 public:
489 : Test("Element::Matrix::BoolVar::BoolVar::XX",2+4,0,1,false) {}
491 virtual bool solution(const Assignment& x) const {
492 // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
493 // remaining: matrix
494 using namespace Gecode;
495 IntArgs tm(4);
496 tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
497 Matrix<IntArgs> m(tm,2,2);
498 return m(x[0],x[0]) == x[1];
499 }
501 virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
502 // x-coordinate: x[0], y-coordinate: x[1], result: x[1]
503 using namespace Gecode;
504 BoolVarArgs tm(4);
505 tm[0]=channel(home,x[2]); tm[1]=channel(home,x[3]);
506 tm[2]=channel(home,x[4]); tm[3]=channel(home,x[5]);
507 Matrix<BoolVarArgs> m(tm,2,2);
508 element(home, m, x[0], x[0], channel(home,x[1]));
509 }
510 };
511
512
513
514
516 class Create {
517 public:
519 void optimized(int idx, int val) {
520 Gecode::IntArgs c(idx);
521 for (int i=0; i<idx; i++)
522 c[i]=std::max(val-i,0);
523 (void) new IntIntVar(Test::str(idx)+"::"+Test::str(val)+"::val",c,
524 val-8,val-1);
525 if (idx != val)
526 (void) new IntIntVar(Test::str(idx)+"::"+Test::str(val)+"::idx",c,
527 idx-8,idx-1);
528 }
530 Create(void) {
531 using namespace Gecode;
532 IntArgs ic1({-1,1,-3,3,-4});
533 IntArgs ic2({-1,1,-1,1,-1,1,0,0});
534 IntArgs ic3({-1});
535 IntArgs ic4({0,-1,2,-2,4,-3,6});
536 IntArgs ic5({0,0,1,2,3,4});
537
538 IntArgs bc1({0,1,1,0,1});
539 IntArgs bc2({1,1,0,1,0,1,0,0});
540 IntArgs bc3({1});
541
542 (void) new IntIntVar("A",ic1,-8,8);
543 (void) new IntIntVar("B",ic2,-8,8);
544 (void) new IntIntVar("C",ic3,-8,8);
545 (void) new IntIntVar("D",ic4,-8,8);
546
547 // Test optimizations
548 {
549 int ov[] = {
550 SCHAR_MAX-1,SCHAR_MAX,
551 SHRT_MAX-1,SHRT_MAX,
552 0
553 };
554 for (int i=0; ov[i] != 0; i++)
555 for (int j=0; ov[j] != 0; j++)
556 optimized(ov[i],ov[j]);
557 }
558
559 for (int i=-4; i<=4; i++) {
560 (void) new IntIntInt("A",ic1,i);
561 (void) new IntIntInt("B",ic2,i);
562 (void) new IntIntInt("C",ic3,i);
563 (void) new IntIntInt("D",ic4,i);
564 }
565
566 (void) new IntIntShared("A",ic1);
567 (void) new IntIntShared("B",ic2);
568 (void) new IntIntShared("C",ic3);
569 (void) new IntIntShared("D",ic4);
570 (void) new IntIntShared("E",ic5,1);
571
572 (void) new IntBoolVar("A",bc1);
573 (void) new IntBoolVar("B",bc2);
574 (void) new IntBoolVar("C",bc3);
575
576 for (int i=0; i<=1; i++) {
577 (void) new IntBoolInt("A",bc1,i);
578 (void) new IntBoolInt("B",bc2,i);
579 (void) new IntBoolInt("C",bc3,i);
580 }
581
582 (void) new VarIntVar(IPL_BND);
583 (void) new VarIntVar(IPL_DOM);
584
585 for (int i=-4; i<=4; i++) {
586 (void) new VarIntInt(IPL_BND,i);
587 (void) new VarIntInt(IPL_DOM,i);
588 }
589
590 (void) new VarIntShared(IPL_BND);
591 (void) new VarIntShared(IPL_DOM);
592
593 (void) new VarBoolVar();
594 (void) new VarBoolInt(0);
595 (void) new VarBoolInt(1);
596
597 // Matrix tests
598 (void) new MatrixIntIntVarXY();
599 (void) new MatrixIntIntVarXX();
600 (void) new MatrixIntBoolVarXY();
601 (void) new MatrixIntBoolVarXX();
602
603 (void) new MatrixIntVarIntVarXY();
604 (void) new MatrixIntVarIntVarXX();
605 (void) new MatrixBoolVarBoolVarXY();
606 (void) new MatrixBoolVarBoolVarXX();
607 }
608 };
609
612
613 }
614}}
615
616// STATISTICS: test-int
Node * x
Pointer to corresponding Boolean expression node.
int size(void) const
Return size of array (number of elements)
Definition array.hpp:1607
Passing Boolean variables.
Definition int.hh:712
Boolean integer variables.
Definition int.hh:512
Passing integer arguments.
Definition int.hh:628
Passing integer variables.
Definition int.hh:656
Integer variable array.
Definition int.hh:763
Matrix-interface for arrays.
Computation spaces.
Definition core.hpp:1742
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition test.hh:134
Base class for assignments
Definition int.hh:59
Help class to create and register tests.
Definition element.cpp:516
void optimized(int idx, int val)
Test size-dependent optimizations
Definition element.cpp:519
Create(void)
Perform creation and registration.
Definition element.cpp:530
Test for element with integer array and integer and Boolean variable
Definition element.cpp:132
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:148
Gecode::IntArgs c
Array of integers.
Definition element.cpp:135
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:144
IntBoolInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Definition element.cpp:140
Test for element with integer array and integer and Boolean variable
Definition element.cpp:113
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:126
Gecode::IntArgs c
Array of integers.
Definition element.cpp:116
IntBoolVar(const std::string &s, const Gecode::IntArgs &c0)
Create and register test.
Definition element.cpp:119
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:122
Test for element with integer array and integer variables
Definition element.cpp:71
IntIntInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Definition element.cpp:79
Gecode::IntArgs c
Array of integers.
Definition element.cpp:74
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:83
int r
Integer result.
Definition element.cpp:76
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:87
Test for element with integer array and single shared integer variable
Definition element.cpp:93
Gecode::IntArgs c
Array of integers.
Definition element.cpp:96
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:107
IntIntShared(const std::string &s, const Gecode::IntArgs &c0, int minDomain=-4)
Create and register test.
Definition element.cpp:99
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:103
Test for element with integer array and integer variables
Definition element.cpp:50
Gecode::IntArgs c
Array of integers.
Definition element.cpp:53
IntIntVar(const std::string &s, const Gecode::IntArgs &c0, int min, int max)
Create and register test.
Definition element.cpp:56
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:61
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:65
Test for matrix element with Boolean variable array and Boolean variable
Definition element.cpp:485
MatrixBoolVarBoolVarXX(void)
Create and register test.
Definition element.cpp:488
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:491
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:501
Test for matrix element with Boolean variable array and Boolean variable
Definition element.cpp:457
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:473
MatrixBoolVarBoolVarXY(void)
Create and register test.
Definition element.cpp:460
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:463
Test for matrix element with integer array and Boolean variable
Definition element.cpp:371
MatrixIntBoolVarXX(void)
Create and register test.
Definition element.cpp:377
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:374
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:381
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:390
Test for matrix element with integer array and Boolean variable
Definition element.cpp:343
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:362
MatrixIntBoolVarXY(void)
Create and register test.
Definition element.cpp:349
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:353
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:346
Test for matrix element with integer array and integer variable
Definition element.cpp:315
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:318
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:325
MatrixIntIntVarXX(void)
Create and register test.
Definition element.cpp:321
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:334
Test for matrix element with integer array and integer variable
Definition element.cpp:287
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:297
MatrixIntIntVarXY(void)
Create and register test.
Definition element.cpp:293
Gecode::IntArgs tm
Array for test matrix.
Definition element.cpp:290
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:306
Test for matrix element with integer variable array and integer variable
Definition element.cpp:428
MatrixIntVarIntVarXX(void)
Create and register test.
Definition element.cpp:431
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:434
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:446
Test for matrix element with integer variable array and integer variable
Definition element.cpp:399
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:417
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:405
MatrixIntVarIntVarXY(void)
Create and register test.
Definition element.cpp:402
Test for element with Boolean variable array and integer variable
Definition element.cpp:242
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:251
VarBoolInt(int r0)
Create and register test.
Definition element.cpp:248
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:258
Test for element with Boolean variable array and integer variable
Definition element.cpp:219
VarBoolVar(void)
Create and register test.
Definition element.cpp:222
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:232
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:224
Test for element with variable array and integer variables
Definition element.cpp:173
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:185
VarIntInt(Gecode::IntPropLevel ipl, int r0)
Create and register test.
Definition element.cpp:179
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:189
Test for element with variable array and shared integer variable
Definition element.cpp:198
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:206
VarIntShared(Gecode::IntPropLevel ipl)
Create and register test.
Definition element.cpp:201
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:210
Test for element with variable array and integer variables
Definition element.cpp:154
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition element.cpp:164
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition element.cpp:160
VarIntVar(Gecode::IntPropLevel ipl)
Create and register test.
Definition element.cpp:157
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
ConTestLevel contest
Whether to test for certain consistency.
Definition int.hh:236
IntPropLevel
Propagation levels for integer propagators.
Definition int.hh:974
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
void element(Home home, IntSharedArray n, IntVar x0, IntVar x1, IntPropLevel ipl=IPL_DEF)
Post domain consistent propagator for .
Definition element.cpp:39
@ CTL_NONE
No consistency-test.
Definition int.hh:140
General test support.
Definition afc.cpp:39
#define GECODE_NEVER
Assert that this command is never executed.
Definition macros.hpp:56