Generated on Tue Jan 28 2020 00:00:00 for Gecode by doxygen 1.8.17
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  * Last modified:
10  * $Date: 2016-04-19 17:19:45 +0200 (Tue, 19 Apr 2016) $ by $Author: schulte $
11  * $Revision: 14967 $
12  *
13  * This file is part of Gecode, the generic constraint
14  * development environment:
15  * http://www.gecode.org
16  *
17  * Permission is hereby granted, free of charge, to any person obtaining
18  * a copy of this software and associated documentation files (the
19  * "Software"), to deal in the Software without restriction, including
20  * without limitation the rights to use, copy, modify, merge, publish,
21  * distribute, sublicense, and/or sell copies of the Software, and to
22  * permit persons to whom the Software is furnished to do so, subject to
23  * the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be
26  * included in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35  *
36  */
37 
38 #include "test/int.hh"
39 
40 #include <gecode/minimodel.hh>
41 #include <climits>
42 
43 namespace Test { namespace Int {
44 
46  namespace Element {
47 
53  class IntIntVar : public Test {
55  protected:
58  public:
60  IntIntVar(const std::string& s, const Gecode::IntArgs& c0,
61  int min, int max)
62  : Test("Element::Int::Int::Var::"+s,2,min,max),
63  c(c0) {}
65  virtual bool solution(const Assignment& x) const {
66  return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[1];
67  }
69  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
70  Gecode::element(home, c, x[0], x[1]);
71  }
72  };
73 
75  class IntIntInt : public Test {
76  protected:
80  int r;
81  public:
83  IntIntInt(const std::string& s, const Gecode::IntArgs& c0, int r0)
84  : Test("Element::Int::Int::Int::"+s+"::"+str(r0),1,-4,8),
85  c(c0), r(r0) {}
87  virtual bool solution(const Assignment& x) const {
88  return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==r;
89  }
91  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
92  Gecode::element(home, c, x[0], r);
93  }
94  };
95 
97  class IntIntShared : public Test {
98  protected:
101  public:
103  IntIntShared(const std::string& s, const Gecode::IntArgs& c0,
104  int minDomain=-4)
105  : Test("Element::Int::Int::Shared::"+s,1,minDomain,8), c(c0) {}
107  virtual bool solution(const Assignment& x) const {
108  return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[0];
109  }
111  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
112  Gecode::element(home, c, x[0], x[0]);
113  }
114  };
115 
117  class IntBoolVar : public Test {
118  protected:
121  public:
123  IntBoolVar(const std::string& s, const Gecode::IntArgs& c0)
124  : Test("Element::Int::Bool::Var::"+s,2,-4,8), c(c0) {}
126  virtual bool solution(const Assignment& x) const {
127  return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==x[1];
128  }
130  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
131  Gecode::element(home, c, x[0], Gecode::channel(home,x[1]));
132  }
133  };
134 
136  class IntBoolInt : public Test {
137  protected:
141  int r;
142  public:
144  IntBoolInt(const std::string& s, const Gecode::IntArgs& c0, int r0)
145  : Test("Element::Int::Bool::Int::"+s+"::"+str(r0),1,-4,8),
146  c(c0), r(r0) {}
148  virtual bool solution(const Assignment& x) const {
149  return (x[0]>= 0) && (x[0]<c.size()) && c[x[0]]==r;
150  }
152  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
153  Gecode::element(home, c, x[0], r);
154  }
155  };
156 
158  class VarIntVar : public Test {
159  public:
162  : Test("Element::Var::Int::Var::"+str(ipl),6,-1,3,false,ipl) {}
164  virtual bool solution(const Assignment& x) const {
165  return (x[0]>= 0) && (x[0]<x.size()-2) && x[2+x[0]]==x[1];
166  }
168  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
169  Gecode::IntVarArgs c(x.size()-2);
170  for (int i=0; i<x.size()-2; i++)
171  c[i]=x[2+i];
172  Gecode::element(home, c, x[0], x[1], ipl);
173  }
174  };
175 
177  class VarIntInt : public Test {
178  protected:
180  int r;
181  public:
184  : Test("Element::Var::Int::Int::"+str(ipl)+"::"+str(r0),
185  5,-1,3,false,ipl), r(r0) {
186  contest = CTL_NONE;
187  }
189  virtual bool solution(const Assignment& x) const {
190  return (x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==r;
191  }
193  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
194  Gecode::IntVarArgs c(x.size()-1);
195  for (int i=0; i<x.size()-1; i++)
196  c[i]=x[1+i];
197  Gecode::element(home, c, x[0], r, ipl);
198  }
199  };
200 
202  class VarIntShared : public Test {
203  public:
206  : Test("Element::Var::Int::Shared::"+str(ipl),5,-1,3,false,ipl) {
207  contest = CTL_NONE;
208  }
210  virtual bool solution(const Assignment& x) const {
211  return (x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==x[0];
212  }
214  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
215  Gecode::IntVarArgs c(x.size()-1);
216  for (int i=0; i<x.size()-1; i++)
217  c[i]=x[1+i];
218  Gecode::element(home, c, x[0], x[0], ipl);
219  }
220  };
221 
223  class VarBoolVar : public Test {
224  public:
226  VarBoolVar(void) : Test("Element::Var::Bool::Var",6,-1,3,false) {}
228  virtual bool solution(const Assignment& x) const {
229  for (int i=0; i<x.size()-2; i++)
230  if ((x[2+i] < 0) || (x[2+i]>1))
231  return false;
232  return ((x[0]>= 0) && (x[0]<x.size()-2) && x[2+x[0]]==x[1]
233  && (x[1]>=0) && (x[1]<=1));
234  }
236  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
237  using namespace Gecode;
238  BoolVarArgs c(x.size()-2);
239  for (int i=0; i<x.size()-2; i++)
240  c[i]=channel(home,x[2+i]);
241  element(home, c, x[0], channel(home,x[1]));
242  }
243  };
244 
246  class VarBoolInt : public Test {
247  protected:
249  int r;
250  public:
252  VarBoolInt(int r0)
253  : Test("Element::Var::Bool::Int::"+str(r0),5,-1,3,false), r(r0) {}
255  virtual bool solution(const Assignment& x) const {
256  for (int i=0; i<x.size()-1; i++)
257  if ((x[1+i] < 0) || (x[1+i]>1))
258  return false;
259  return ((x[0]>= 0) && (x[0]<x.size()-1) && x[1+x[0]]==r);
260  }
262  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
263  using namespace Gecode;
264  BoolVarArgs c(x.size()-1);
265  for (int i=0; i<x.size()-1; i++)
266  c[i]=channel(home,x[1+i]);
267  if (r == 1) {
268  switch (Base::rand(3)) {
269  case 0:
270  element(home, c, x[0], 1);
271  break;
272  case 1:
273  {
274  BoolVar one(home,1,1);
275  rel(home, element(c,x[0]) == one);
276  }
277  break;
278  case 2:
279  rel(home, element(c,x[0]));
280  break;
281  default: GECODE_NEVER;
282  }
283  } else {
284  element(home, c, x[0], r);
285  }
286  }
287  };
288 
289 
291  class MatrixIntIntVarXY : public Test {
292  protected:
295  public:
298  : Test("Element::Matrix::Int::IntVar::XY",3,0,5,false),
299  tm(6, 0,1,2,3,4,5) {}
301  virtual bool solution(const Assignment& x) const {
302  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
303  using namespace Gecode;
304  if ((x[0] > 2) || (x[1] > 1))
305  return false;
306  Matrix<IntArgs> m(tm,3,2);
307  return m(x[0],x[1]) == x[2];
308  }
310  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
311  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
312  using namespace Gecode;
313  Matrix<IntArgs> m(tm,3,2);
314  element(home, m, x[0], x[1], x[2]);
315  }
316  };
317 
319  class MatrixIntIntVarXX : public Test {
320  protected:
323  public:
326  : Test("Element::Matrix::Int::IntVar::XX",2,0,3,false),
327  tm(4, 0,1,2,3) {}
329  virtual bool solution(const Assignment& x) const {
330  // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
331  using namespace Gecode;
332  if (x[0] > 1)
333  return false;
334  Matrix<IntArgs> m(tm,2,2);
335  return m(x[0],x[0]) == x[1];
336  }
338  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
339  // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
340  using namespace Gecode;
341  Matrix<IntArgs> m(tm,2,2);
342  element(home, m, x[0], x[0], x[1]);
343  }
344  };
345 
347  class MatrixIntBoolVarXY : public Test {
348  protected:
351  public:
354  : Test("Element::Matrix::Int::BoolVar::XY",3,0,3,false),
355  tm(4, 0,1,1,0) {}
357  virtual bool solution(const Assignment& x) const {
358  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
359  using namespace Gecode;
360  if ((x[0] > 1) || (x[1] > 1))
361  return false;
362  Matrix<IntArgs> m(tm,2,2);
363  return m(x[0],x[1]) == x[2];
364  }
366  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
367  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
368  using namespace Gecode;
369  Matrix<IntArgs> m(tm,2,2);
370  element(home, m, x[0], x[1], channel(home,x[2]));
371  }
372  };
373 
375  class MatrixIntBoolVarXX : public Test {
376  protected:
379  public:
382  : Test("Element::Matrix::Int::BoolVar::XX",2,0,3,false),
383  tm(4, 0,1,1,0) {}
385  virtual bool solution(const Assignment& x) const {
386  // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
387  using namespace Gecode;
388  if (x[0] > 1)
389  return false;
390  Matrix<IntArgs> m(tm,2,2);
391  return m(x[0],x[0]) == x[1];
392  }
394  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
395  // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
396  using namespace Gecode;
397  Matrix<IntArgs> m(tm,2,2);
398  element(home, m, x[0], x[0], channel(home,x[1]));
399  }
400  };
401 
403  class MatrixIntVarIntVarXY : public Test {
404  public:
407  : Test("Element::Matrix::IntVar::IntVar::XY",3+4,0,3,false) {}
409  virtual bool solution(const Assignment& x) const {
410  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
411  // remaining: matrix
412  using namespace Gecode;
413  if ((x[0] > 1) || (x[1] > 1))
414  return false;
415  IntArgs tm(4);
416  tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
417  Matrix<IntArgs> m(tm,2,2);
418  return m(x[0],x[1]) == x[2];
419  }
421  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
422  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
423  using namespace Gecode;
424  IntVarArgs tm(4);
425  tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
426  Matrix<IntVarArgs> m(tm,2,2);
427  element(home, m, x[0], x[1], x[2]);
428  }
429  };
430 
432  class MatrixIntVarIntVarXX : public Test {
433  public:
436  : Test("Element::Matrix::IntVar::IntVar::XX",2+4,0,3,false) {}
438  virtual bool solution(const Assignment& x) const {
439  // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
440  // remaining: matrix
441  using namespace Gecode;
442  if (x[0] > 1)
443  return false;
444  IntArgs tm(4);
445  tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
446  Matrix<IntArgs> m(tm,2,2);
447  return m(x[0],x[0]) == x[1];
448  }
450  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
451  // x-coordinate: x[0], y-coordinate: x[1], result: x[1]
452  using namespace Gecode;
453  IntVarArgs tm(4);
454  tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
455  Matrix<IntVarArgs> m(tm,2,2);
456  element(home, m, x[0], x[0], x[1]);
457  }
458  };
459 
461  class MatrixBoolVarBoolVarXY : public Test {
462  public:
465  : Test("Element::Matrix::BoolVar::BoolVar::XY",3+4,0,1,false) {}
467  virtual bool solution(const Assignment& x) const {
468  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
469  // remaining: matrix
470  using namespace Gecode;
471  IntArgs tm(4);
472  tm[0]=x[3]; tm[1]=x[4]; tm[2]=x[5]; tm[3]=x[6];
473  Matrix<IntArgs> m(tm,2,2);
474  return m(x[0],x[1]) == x[2];
475  }
477  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
478  // x-coordinate: x[0], y-coordinate: x[1], result: x[2]
479  using namespace Gecode;
480  BoolVarArgs tm(4);
481  tm[0]=channel(home,x[3]); tm[1]=channel(home,x[4]);
482  tm[2]=channel(home,x[5]); tm[3]=channel(home,x[6]);
483  Matrix<BoolVarArgs> m(tm,2,2);
484  element(home, m, x[0], x[1], channel(home,x[2]));
485  }
486  };
487 
489  class MatrixBoolVarBoolVarXX : public Test {
490  public:
493  : Test("Element::Matrix::BoolVar::BoolVar::XX",2+4,0,1,false) {}
495  virtual bool solution(const Assignment& x) const {
496  // x-coordinate: x[0], y-coordinate: x[0], result: x[1]
497  // remaining: matrix
498  using namespace Gecode;
499  IntArgs tm(4);
500  tm[0]=x[2]; tm[1]=x[3]; tm[2]=x[4]; tm[3]=x[5];
501  Matrix<IntArgs> m(tm,2,2);
502  return m(x[0],x[0]) == x[1];
503  }
505  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
506  // x-coordinate: x[0], y-coordinate: x[1], result: x[1]
507  using namespace Gecode;
508  BoolVarArgs tm(4);
509  tm[0]=channel(home,x[2]); tm[1]=channel(home,x[3]);
510  tm[2]=channel(home,x[4]); tm[3]=channel(home,x[5]);
511  Matrix<BoolVarArgs> m(tm,2,2);
512  element(home, m, x[0], x[0], channel(home,x[1]));
513  }
514  };
515 
516 
517 
518 
520  class Create {
521  public:
523  void optimized(int idx, int val) {
524  Gecode::IntArgs c(idx);
525  for (int i=0; i<idx; i++)
526  c[i]=std::max(val-i,0);
527  (void) new IntIntVar(Test::str(idx)+"::"+Test::str(val)+"::val",c,
528  val-8,val-1);
529  if (idx != val)
530  (void) new IntIntVar(Test::str(idx)+"::"+Test::str(val)+"::idx",c,
531  idx-8,idx-1);
532  }
534  Create(void) {
535  using namespace Gecode;
536  IntArgs ic1(5, -1,1,-3,3,-4);
537  IntArgs ic2(8, -1,1,-1,1,-1,1,0,0);
538  IntArgs ic3(1, -1);
539  IntArgs ic4(7, 0,-1,2,-2,4,-3,6);
540  IntArgs ic5(6, 0,0,1,2,3,4);
541 
542  IntArgs bc1(5, 0,1,1,0,1);
543  IntArgs bc2(8, 1,1,0,1,0,1,0,0);
544  IntArgs bc3(1, 1);
545 
546  (void) new IntIntVar("A",ic1,-8,8);
547  (void) new IntIntVar("B",ic2,-8,8);
548  (void) new IntIntVar("C",ic3,-8,8);
549  (void) new IntIntVar("D",ic4,-8,8);
550 
551  // Test optimizations
552  {
553  int ov[] = {
554  SCHAR_MAX-1,SCHAR_MAX,
555  SHRT_MAX-1,SHRT_MAX,
556  0
557  };
558  for (int i=0; ov[i] != 0; i++)
559  for (int j=0; ov[j] != 0; j++)
560  optimized(ov[i],ov[j]);
561  }
562 
563  for (int i=-4; i<=4; i++) {
564  (void) new IntIntInt("A",ic1,i);
565  (void) new IntIntInt("B",ic2,i);
566  (void) new IntIntInt("C",ic3,i);
567  (void) new IntIntInt("D",ic4,i);
568  }
569 
570  (void) new IntIntShared("A",ic1);
571  (void) new IntIntShared("B",ic2);
572  (void) new IntIntShared("C",ic3);
573  (void) new IntIntShared("D",ic4);
574  (void) new IntIntShared("E",ic5,1);
575 
576  (void) new IntBoolVar("A",bc1);
577  (void) new IntBoolVar("B",bc2);
578  (void) new IntBoolVar("C",bc3);
579 
580  for (int i=0; i<=1; i++) {
581  (void) new IntBoolInt("A",bc1,i);
582  (void) new IntBoolInt("B",bc2,i);
583  (void) new IntBoolInt("C",bc3,i);
584  }
585 
586  (void) new VarIntVar(IPL_BND);
587  (void) new VarIntVar(IPL_DOM);
588 
589  for (int i=-4; i<=4; i++) {
590  (void) new VarIntInt(IPL_BND,i);
591  (void) new VarIntInt(IPL_DOM,i);
592  }
593 
594  (void) new VarIntShared(IPL_BND);
595  (void) new VarIntShared(IPL_DOM);
596 
597  (void) new VarBoolVar();
598  (void) new VarBoolInt(0);
599  (void) new VarBoolInt(1);
600 
601  // Matrix tests
602  (void) new MatrixIntIntVarXY();
603  (void) new MatrixIntIntVarXX();
604  (void) new MatrixIntBoolVarXY();
605  (void) new MatrixIntBoolVarXX();
606 
607  (void) new MatrixIntVarIntVarXY();
608  (void) new MatrixIntVarIntVarXX();
609  (void) new MatrixBoolVarBoolVarXY();
610  (void) new MatrixBoolVarBoolVarXX();
611  }
612  };
613 
616 
617  }
618 }}
619 
620 // STATISTICS: test-int
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:193
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:130
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:111
Region r
Definition: region.cpp:82
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:450
ConTestLevel contest
Whether to test for certain consistency.
Definition: int.hh:240
MatrixIntVarIntVarXX(void)
Create and register test.
Definition: element.cpp:435
int r
Integer result.
Definition: element.cpp:249
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:87
Gecode::IntArgs c
Array of integers.
Definition: element.cpp:100
Test for element with integer array and integer and Boolean variable
Definition: element.cpp:136
Gecode::IntPropLevel ipl
Propagation level.
Definition: int.hh:238
Test for matrix element with integer array and Boolean variable
Definition: element.cpp:347
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:338
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:357
void optimized(int idx, int val)
Test size-dependent optimizations
Definition: element.cpp:523
Passing integer variables.
Definition: int.hh:639
void element(Home home, IntSharedArray c, IntVar x0, IntVar x1, IntPropLevel)
Post domain consistent propagator for .
Definition: element.cpp:43
VarBoolInt(int r0)
Create and register test.
Definition: element.cpp:252
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:505
@ CTL_NONE
No consistency-test.
Definition: int.hh:144
Gecode::IntArgs i(4, 1, 2, 3, 4)
Test for matrix element with Boolean variable array and Boolean variable
Definition: element.cpp:461
Test for element with variable array and shared integer variable
Definition: element.cpp:202
Test for matrix element with integer array and integer variable
Definition: element.cpp:319
Create c
Definition: element.cpp:614
const FloatNum min
Smallest allowed float value.
Definition: float.hh:850
Help class to create and register tests.
Definition: element.cpp:520
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:467
IntPropLevel
Propagation levels for integer propagators.
Definition: int.hh:955
Computation spaces.
Definition: core.hpp:1748
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:210
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:228
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:214
Test for element with integer array and integer variables
Definition: element.cpp:54
Integer variable array.
Definition: int.hh:744
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition: test.hh:138
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:168
MatrixBoolVarBoolVarXX(void)
Create and register test.
Definition: element.cpp:492
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:477
Test for element with variable array and integer variables
Definition: element.cpp:177
Test for element with integer array and single shared integer variable
Definition: element.cpp:97
Gecode::IntArgs tm
Array for test matrix.
Definition: element.cpp:322
VarIntInt(Gecode::IntPropLevel ipl, int r0)
Create and register test.
Definition: element.cpp:183
Gecode toplevel namespace
MatrixIntIntVarXY(void)
Create and register test.
Definition: element.cpp:297
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:107
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
Test for element with Boolean variable array and integer variable
Definition: element.cpp:223
Test for element with integer array and integer and Boolean variable
Definition: element.cpp:117
Test for matrix element with integer variable array and integer variable
Definition: element.cpp:432
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:438
Passing Boolean variables.
Definition: int.hh:693
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:164
IntBoolVar(const std::string &s, const Gecode::IntArgs &c0)
Create and register test.
Definition: element.cpp:123
int r
Integer result.
Definition: element.cpp:141
Gecode::IntArgs c
Array of integers.
Definition: element.cpp:57
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:310
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:394
Boolean integer variables.
Definition: int.hh:494
Gecode::IntArgs c
Array of integers.
Definition: element.cpp:120
@ IPL_DOM
Domain propagation Preferences: prefer speed or memory.
Definition: int.hh:960
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:495
IntBoolInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Definition: element.cpp:144
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Definition: linear.cpp:50
Test for matrix element with Boolean variable array and Boolean variable
Definition: element.cpp:489
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:409
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:366
int r
Integer result.
Definition: element.cpp:80
IntIntInt(const std::string &s, const Gecode::IntArgs &c0, int r0)
Create and register test.
Definition: element.cpp:83
@ IPL_BND
Bounds propagation.
Definition: int.hh:959
#define GECODE_NEVER
Assert that this command is never executed.
Definition: macros.hpp:60
Gecode::IntArgs tm
Array for test matrix.
Definition: element.cpp:294
MatrixIntVarIntVarXY(void)
Create and register test.
Definition: element.cpp:406
IntIntVar(const std::string &s, const Gecode::IntArgs &c0, int min, int max)
Create and register test.
Definition: element.cpp:60
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:65
Matrix-interface for arrays.
Definition: minimodel.hh:1923
MatrixIntBoolVarXY(void)
Create and register test.
Definition: element.cpp:353
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:236
Gecode::IntArgs c
Array of integers.
Definition: element.cpp:78
VarIntShared(Gecode::IntPropLevel ipl)
Create and register test.
Definition: element.cpp:205
Base class for assignments
Definition: int.hh:63
void element(Home home, const SetVarArgs &a, IntVar x, int w, IntVar y, int h, SetVar z)
Definition: element.cpp:242
VarBoolVar(void)
Create and register test.
Definition: element.cpp:226
MatrixIntIntVarXX(void)
Create and register test.
Definition: element.cpp:325
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:47
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:69
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:148
Gecode::IntArgs tm
Array for test matrix.
Definition: element.cpp:350
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:189
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition: channel.cpp:45
IntIntShared(const std::string &s, const Gecode::IntArgs &c0, int minDomain=-4)
Create and register test.
Definition: element.cpp:103
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:91
Test for element with integer array and integer variables
Definition: element.cpp:75
Gecode::IntArgs c
Array of integers.
Definition: element.cpp:139
Test for matrix element with integer variable array and integer variable
Definition: element.cpp:403
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:421
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:385
General test support.
Definition: afc.cpp:43
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:152
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:255
Test for element with variable array and integer variables
Definition: element.cpp:158
int r
Integer result.
Definition: element.cpp:180
Test for matrix element with integer array and integer variable
Definition: element.cpp:291
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: element.cpp:262
VarIntVar(Gecode::IntPropLevel ipl)
Create and register test.
Definition: element.cpp:161
Test for matrix element with integer array and Boolean variable
Definition: element.cpp:375
Passing integer arguments.
Definition: int.hh:610
MatrixIntBoolVarXX(void)
Create and register test.
Definition: element.cpp:381
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:329
Gecode::IntArgs tm
Array for test matrix.
Definition: element.cpp:378
Test for element with Boolean variable array and integer variable
Definition: element.cpp:246
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:126
Create(void)
Perform creation and registration.
Definition: element.cpp:534
const FloatNum max
Largest allowed float value.
Definition: float.hh:848
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: element.cpp:301
MatrixBoolVarBoolVarXY(void)
Create and register test.
Definition: element.cpp:464
static std::string str(Gecode::IntPropLevel ipl)
Map integer propagation level to string.
Definition: int.hpp:212