Generated on Sat Feb 7 2015 02:01:22 for Gecode by doxygen 1.8.9.1
extensional.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Mikael Lagerkvist <lagerkvist@gecode.org>
5  * Christian Schulte <schulte@gecode.org>
6  *
7  * Copyright:
8  * Mikael Lagerkvist, 2007
9  * Christian Schulte, 2005
10  *
11  * Last modified:
12  * $Date: 2010-04-08 12:35:31 +0200 (Thu, 08 Apr 2010) $ by $Author: schulte $
13  * $Revision: 10684 $
14  *
15  * This file is part of Gecode, the generic constraint
16  * development environment:
17  * http://www.gecode.org
18  *
19  * Permission is hereby granted, free of charge, to any person obtaining
20  * a copy of this software and associated documentation files (the
21  * "Software"), to deal in the Software without restriction, including
22  * without limitation the rights to use, copy, modify, merge, publish,
23  * distribute, sublicense, and/or sell copies of the Software, and to
24  * permit persons to whom the Software is furnished to do so, subject to
25  * the following conditions:
26  *
27  * The above copyright notice and this permission notice shall be
28  * included in all copies or substantial portions of the Software.
29  *
30  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
32  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
33  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
34  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
35  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
36  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37  *
38  */
39 
40 #include "test/int.hh"
41 
42 #include <gecode/minimodel.hh>
43 #include <climits>
44 
45 namespace Test { namespace Int {
46 
48  namespace Extensional {
49 
55  class RegSimpleA : public Test {
57  public:
59  RegSimpleA(void) : Test("Extensional::Reg::Simple::A",4,2,2) {}
61  virtual bool solution(const Assignment& x) const {
62  return (((x[0] == 0) || (x[0] == 2)) &&
63  ((x[1] == -1) || (x[1] == 1)) &&
64  ((x[2] == 0) || (x[2] == 1)) &&
65  ((x[3] == 0) || (x[3] == 1)));
66  }
68  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
69  using namespace Gecode;
70  extensional(home, x,
71  (REG(0) | REG(2)) +
72  (REG(-1) | REG(1)) +
73  (REG(7) | REG(0) | REG(1)) +
74  (REG(0) | REG(1)));
75  }
76  };
77 
79  class RegSimpleB : public Test {
80  public:
82  RegSimpleB(void) : Test("Extensional::Reg::Simple::B",4,2,2) {}
84  virtual bool solution(const Assignment& x) const {
85  return (x[0]<x[1]) && (x[1]<x[2]) && (x[2]<x[3]);
86  }
88  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
89  using namespace Gecode;
90  extensional(home, x,
91  (REG(-2) + REG(-1) + REG(0) + REG(1)) |
92  (REG(-2) + REG(-1) + REG(0) + REG(2)) |
93  (REG(-2) + REG(-1) + REG(1) + REG(2)) |
94  (REG(-2) + REG(0) + REG(1) + REG(2)) |
95  (REG(-1) + REG(0) + REG(1) + REG(2)));
96  }
97  };
98 
100  class RegSimpleC : public Test {
101  public:
103  RegSimpleC(void) : Test("Extensional::Reg::Simple::C",6,0,1) {}
105  virtual bool solution(const Assignment& x) const {
106  int pos = 0;
107  int s = x.size();
108 
109  while (pos < s && x[pos] == 0) ++pos;
110  if (pos + 4 > s) return false;
111 
112  for (int i = 0; i < 2; ++i, ++pos)
113  if (x[pos] != 1) return false;
114  if (pos + 2 > s) return false;
115 
116  for (int i = 0; i < 1; ++i, ++pos)
117  if (x[pos] != 0) return false;
118  while (pos < s && x[pos] == 0) ++pos;
119  if (pos + 1 > s) return false;
120 
121  for (int i = 0; i < 1; ++i, ++pos)
122  if (x[pos] != 1) return false;
123  while (pos < s) if (x[pos++] != 0) return false;
124  return true;
125 
126  }
128  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
129  using namespace Gecode;
130  extensional(home, x,
131  *REG(0) + REG(1)(2,2) + +REG(0) + REG(1)(1,1) + *REG(0));
132  }
133  };
134 
136  class RegDistinct : public Test {
137  public:
139  RegDistinct(void) : Test("Extensional::Reg::Distinct",4,-1,4) {}
141  virtual bool solution(const Assignment& x) const {
142  for (int i=0; i<x.size(); i++) {
143  if ((x[i] < 0) || (x[i] > 3))
144  return false;
145  for (int j=i+1; j<x.size(); j++)
146  if (x[i]==x[j])
147  return false;
148  }
149  return true;
150  }
152  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
153  using namespace Gecode;
154  extensional(home, x,
155  (REG(0)+REG(1)+REG(2)+REG(3)) |
156  (REG(0)+REG(1)+REG(3)+REG(2)) |
157  (REG(0)+REG(2)+REG(1)+REG(3)) |
158  (REG(0)+REG(2)+REG(3)+REG(1)) |
159  (REG(0)+REG(3)+REG(1)+REG(2)) |
160  (REG(0)+REG(3)+REG(2)+REG(1)) |
161  (REG(1)+REG(0)+REG(2)+REG(3)) |
162  (REG(1)+REG(0)+REG(3)+REG(2)) |
163  (REG(1)+REG(2)+REG(0)+REG(3)) |
164  (REG(1)+REG(2)+REG(3)+REG(0)) |
165  (REG(1)+REG(3)+REG(0)+REG(2)) |
166  (REG(1)+REG(3)+REG(2)+REG(0)) |
167  (REG(2)+REG(0)+REG(1)+REG(3)) |
168  (REG(2)+REG(0)+REG(3)+REG(1)) |
169  (REG(2)+REG(1)+REG(0)+REG(3)) |
170  (REG(2)+REG(1)+REG(3)+REG(0)) |
171  (REG(2)+REG(3)+REG(0)+REG(1)) |
172  (REG(2)+REG(3)+REG(1)+REG(0)) |
173  (REG(3)+REG(0)+REG(1)+REG(2)) |
174  (REG(3)+REG(0)+REG(2)+REG(1)) |
175  (REG(3)+REG(1)+REG(0)+REG(2)) |
176  (REG(3)+REG(1)+REG(2)+REG(0)) |
177  (REG(3)+REG(2)+REG(0)+REG(1)) |
178  (REG(3)+REG(2)+REG(1)+REG(0)));
179  }
180  };
181 
183  class RegRoland : public Test {
184  public:
187  : Test("Extensional::Reg::Roland::"+str(n),n,0,1) {}
189  virtual bool solution(const Assignment& x) const {
190  int n = x.size();
191  return
192  ((n > 1) && (x[n-2] == 0)) ||
193  ((n > 0) && (x[n-1] == 0));
194  }
196  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
197  using namespace Gecode;
198  REG r0(0), r1(1);
199  REG r01 = r0 | r1;
200  extensional(home, x, *r01 + r0 + r01(0,1));
201  }
202  };
203 
205  class RegSharedA : public Test {
206  public:
208  RegSharedA(void) : Test("Extensional::Reg::Shared::A",4,2,2) {}
210  virtual bool solution(const Assignment& x) const {
211  return (((x[0] == 0) || (x[0] == 2)) &&
212  ((x[1] == -1) || (x[1] == 1)) &&
213  ((x[2] == 0) || (x[2] == 1)) &&
214  ((x[3] == 0) || (x[3] == 1)));
215  }
217  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
218  using namespace Gecode;
219  IntVarArgs y(8);
220  for (int i=0; i<4; i++)
221  y[i]=y[i+4]=x[i];
222  unshare(home,y);
223  extensional(home, y,
224  ((REG(0) | REG(2)) +
225  (REG(-1) | REG(1)) +
226  (REG(7) | REG(0) | REG(1)) +
227  (REG(0) | REG(1)))(2,2));
228  }
229  };
230 
232  class RegSharedB : public Test {
233  public:
235  RegSharedB(void) : Test("Extensional::Reg::Shared::B",4,2,2) {}
237  virtual bool solution(const Assignment& x) const {
238  return (((x[0] == 0) || (x[0] == 2)) &&
239  ((x[1] == -1) || (x[1] == 1)) &&
240  ((x[2] == 0) || (x[2] == 1)) &&
241  ((x[3] == 0) || (x[3] == 1)));
242  }
244  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
245  using namespace Gecode;
246  IntVarArgs y(12);
247  for (int i=0; i<4; i++)
248  y[i]=y[i+4]=y[i+8]=x[i];
249  unshare(home,y);
250  extensional(home, y,
251  ((REG(0) | REG(2)) +
252  (REG(-1) | REG(1)) +
253  (REG(7) | REG(0) | REG(1)) +
254  (REG(0) | REG(1)))(3,3));
255  }
256  };
257 
259  class RegSharedC : public Test {
260  public:
262  RegSharedC(void) : Test("Extensional::Reg::Shared::C",4,0,1) {}
264  virtual bool solution(const Assignment& x) const {
265  return (x[1]==1) && (x[2]==0) && (x[3]==1);
266  }
268  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
269  using namespace Gecode;
270  Gecode::BoolVarArgs y(8);
271  for (int i=0; i<4; i++)
272  y[i]=y[i+4]=channel(home,x[i]);
273  unshare(home,y);
274  extensional(home,y,
275  ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(2,2));
276  }
277  };
278 
280  class RegSharedD : public Test {
281  public:
283  RegSharedD(void) : Test("Extensional::Reg::Shared::D",4,0,1) {}
285  virtual bool solution(const Assignment& x) const {
286  return (x[1]==1) && (x[2]==0) && (x[3]==1);
287  }
289  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
290  using namespace Gecode;
291  Gecode::BoolVarArgs y(12);
292  for (int i=0; i<4; i++)
293  y[i]=y[i+4]=y[i+8]=channel(home,x[i]);
294  unshare(home, y);
295  extensional(home, y,
296  ((REG(0) | REG(1)) + REG(1) + REG(0) + REG(1))(3,3));
297  }
298  };
299 
301  class RegEmptyDFA : public Test {
302  public:
304  RegEmptyDFA(void) : Test("Extensional::Reg::Empty::DFA",1,0,0) {
305  testsearch = false;
306  }
308  virtual bool solution(const Assignment& x) const {
309  (void)x;
310  return false;
311  }
313  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
314  Gecode::DFA d;
315  Gecode::extensional(home, x, d);
316  }
317  };
318 
320  class RegEmptyREG : public Test {
321  public:
323  RegEmptyREG(void) : Test("Extensional::Reg::Empty::REG",1,0,0) {
324  testsearch = false;
325  }
327  virtual bool solution(const Assignment& x) const {
328  (void)x;
329  return false;
330  }
332  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
333  Gecode::REG r;
334  Gecode::extensional(home, x, r);
335  }
336  };
337 
339  class RegOpt : public Test {
340  protected:
342  int n;
343  public:
345  RegOpt(int n0)
346  : Test("Extensional::Reg::Opt::"+str(n0),1,0,15), n(n0) {}
348  virtual bool solution(const Assignment& x) const {
349  return (x[0] < n) && ((x[0] & 1) == 0);
350  }
352  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
353  using namespace Gecode;
354  DFA::Transition* t = new DFA::Transition[n+1];
355  DFA::Transition* ti = t;
356  int* f = new int[n+1];
357  int* fi = f;
358  for (int i=0; i<n; i++) {
359  ti->i_state = 0;
360  ti->symbol = i;
361  ti->o_state = i+1;
362  ti++;
363  if ((i & 1) == 0) {
364  *fi = i+1; fi++;
365  }
366  }
367  ti->i_state = -1;
368  *fi = -1;
369  DFA d(0, t, f, false);
370  delete [] t;
371  delete [] f;
372  extensional(home, x, d);
373  }
374 
375  };
376 
378  class TupleSetA : public Test {
379  protected:
382  public:
385  : Test("Extensional::TupleSet::A::"+str(epk0),
386  4,1,5,false,Gecode::ICL_DOM), epk(epk0) {}
388  virtual bool solution(const Assignment& x) const {
389  return ((x[0] == 1 && x[1] == 3 && x[2] == 2 && x[3] == 3) ||
390  (x[0] == 2 && x[1] == 1 && x[2] == 2 && x[3] == 4) ||
391  (x[0] == 2 && x[1] == 2 && x[2] == 1 && x[3] == 4) ||
392  (x[0] == 3 && x[1] == 3 && x[2] == 3 && x[3] == 2) ||
393  (x[0] == 4 && x[1] == 3 && x[2] == 4 && x[3] == 1)
394  );
395  }
397  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
398  using namespace Gecode;
399  TupleSet t;
400  IntArgs t1(4, 2, 1, 2, 4);
401  IntArgs t2(4, 2, 2, 1, 4);
402  IntArgs t3(4, 4, 3, 4, 1);
403  IntArgs t4(4, 1, 3, 2, 3);
404  IntArgs t5(4, 3, 3, 3, 2);
405  t.add(t1);
406  t.add(t1);
407  t.add(t2);
408  t.add(t2);
409  t.add(t3);
410  t.add(t3);
411  t.add(t4);
412  t.add(t4);
413  t.add(t5);
414  t.add(t5);
415  t.add(t5);
416  t.add(t5);
417  t.add(t5);
418  t.add(t5);
419  t.add(t5);
420  t.add(t5);
421  t.finalize();
422 
423  extensional(home, x, t, epk, ICL_DEF);
424  }
425  };
426 
428  class TupleSetB : public Test {
429  mutable Gecode::TupleSet t;
430  protected:
433  public:
436  : Test("Extensional::TupleSet::B::"+str(epk0),
437  4,1,5,false,Gecode::ICL_DOM), epk(epk0) {
438  using namespace Gecode;
439  IntArgs t1 (4, 2, 1, 2, 4);
440  IntArgs t2 (4, 2, 2, 1, 4);
441  IntArgs t3 (4, 4, 3, 4, 1);
442  IntArgs t4 (4, 1, 3, 2, 3);
443  IntArgs t5 (4, 3, 3, 3, 2);
444  IntArgs t6 (4, 5, 1, 4, 4);
445  IntArgs t7 (4, 2, 5, 1, 5);
446  IntArgs t8 (4, 4, 3, 5, 1);
447  IntArgs t9 (4, 1, 5, 2, 5);
448  IntArgs t10(4, 5, 3, 3, 2);
449  t.add(t1);
450  t.add(t2);
451  t.add(t3);
452  t.add(t4);
453  t.add(t5);
454  t.add(t6);
455  t.add(t7);
456  t.add(t8);
457  t.add(t9);
458  t.add(t10);
459  t.finalize();
460  }
462  virtual bool solution(const Assignment& x) const {
463  using namespace Gecode;
464  for (int i = 0; i < t.tuples(); ++i) {
465  TupleSet::Tuple l = t[i];
466  bool same = true;
467  for (int j = 0; j < t.arity() && same; ++j)
468  if (l[j] != x[j]) same = false;
469  if (same) return true;
470  }
471  return false;
472  }
474  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
475  using namespace Gecode;
476  extensional(home, x, t, epk, ICL_DEF);
477  }
478  };
479 
480 
481 
483  class TupleSetBool : public Test {
484  mutable Gecode::TupleSet t;
485  protected:
488  public:
491  : Test("Extensional::TupleSet::Bool::"+str(epk0),
492  5,0,1,false,Gecode::ICL_DOM), epk(epk0) {
493  using namespace Gecode;
494 
495  CpltAssignment ass(5, IntSet(0, 1));
496  while (ass()) {
497  if (Base::rand(100) <= prob*100) {
498  IntArgs tuple(5);
499  for (int i = 5; i--; ) tuple[i] = ass[i];
500  t.add(tuple);
501  }
502  ++ass;
503  }
504  t.finalize();
505  }
507  virtual bool solution(const Assignment& x) const {
508  using namespace Gecode;
509  for (int i = 0; i < t.tuples(); ++i) {
510  TupleSet::Tuple l = t[i];
511  bool same = true;
512  for (int j = 0; j < t.arity() && same; ++j)
513  if (l[j] != x[j]) same = false;
514  if (same) return true;
515  }
516  return false;
517  }
519  virtual void post(Gecode::Space& home, Gecode::IntVarArray& x) {
520  using namespace Gecode;
521  BoolVarArgs y(x.size());
522  for (int i = x.size(); i--; ) y[i] = channel(home, x[i]);
523  extensional(home, y, t, epk, ICL_DEF);
524  }
525  };
526 
527 
531 
533 
534  RegRoland rr1(1);
535  RegRoland rr2(2);
536  RegRoland rr3(3);
537  RegRoland rr4(4);
538 
543 
546 
547  RegOpt ro0(CHAR_MAX-1);
548  RegOpt ro1(CHAR_MAX);
549  RegOpt ro2(static_cast<int>(UCHAR_MAX-1));
550  RegOpt ro3(static_cast<int>(UCHAR_MAX));
551  RegOpt ro4(SHRT_MAX-1);
552  RegOpt ro5(SHRT_MAX);
553  RegOpt ro6(static_cast<int>(USHRT_MAX-1));
554  RegOpt ro7(static_cast<int>(USHRT_MAX));
555 
558 
561 
565 
566  }
567 }}
568 
569 
570 // STATISTICS: test-int
571 
RegRoland(int n)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test with simple regular expression and shared variables (uses unsharing)
virtual bool solution(const Assignment &x) const
Test whether x is solution
int symbol
symbol
Definition: int.hh:1890
NodeType t
Type of node.
Definition: bool-expr.cpp:234
TupleSetBool tsbools(Gecode::EPK_SPEED, 0.3)
virtual bool solution(const Assignment &x) const
Test whether x is solution
void finalize(void)
Finalize tuple set.
Definition: tuple-set.hpp:111
NNF * l
Left subtree.
Definition: bool-expr.cpp:244
RegEmptyREG(void)
Create and register test.
void channel(Home home, FloatVar x0, IntVar x1)
Post propagator for channeling a float and an integer variable .
Definition: arithmetic.cpp:218
Test for optimizations
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: extensional.cpp:68
Test with regular expression for distinct constraint
virtual bool solution(const Assignment &x) const
Test whether x is solution
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition: test.hh:138
Regular expressions over integer values.
Definition: minimodel.hh:1401
RegOpt ro3(static_cast< int >(UCHAR_MAX))
int arity(void) const
Arity of tuple set.
Definition: tuple-set.hpp:134
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
RegDistinct(void)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
bool pos(const View &x)
Test whether x is postive.
Definition: mult.hpp:45
Test with simple regular expression
Definition: extensional.cpp:79
int * Tuple
Type of a tuple.
Definition: int.hh:2028
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Integer variable array.
Definition: int.hh:741
Test with simple regular expression and shared variables (uses unsharing)
TupleSetB tsbs(Gecode::EPK_SPEED)
Test with simple regular expression
virtual bool solution(const Assignment &x) const
Test whether x is solution
Computation spaces.
Definition: core.hpp:1362
int tuples(void) const
Number of tuples.
Definition: tuple-set.hpp:141
int i_state
input state
Definition: int.hh:1889
RegOpt ro1(CHAR_MAX)
RegOpt ro0(CHAR_MAX-1)
Gecode::IntSet d(v, 7)
static std::string str(Gecode::ExtensionalPropKind epk)
Map extensional propagation kind to string.
Definition: int.hpp:212
Deterministic finite automaton (DFA)
Definition: int.hh:1881
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Prefer speed over memory consumption.
Definition: int.hh:1984
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
RegOpt ro5(SHRT_MAX)
Specification of a DFA transition.
Definition: int.hh:1887
virtual bool solution(const Assignment &x) const
Test whether x is solution
void extensional(Home home, const BoolVarArgs &x, const TupleSet &t, ExtensionalPropKind epk, IntConLevel)
Post propagator for .
RegSharedB(void)
Create and register test.
RegOpt ro7(static_cast< int >(USHRT_MAX))
TupleSetA tsas(Gecode::EPK_SPEED)
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
RegEmptyDFA(void)
Create and register test.
TupleSetB(Gecode::ExtensionalPropKind epk0)
Create and register test.
TupleSetBool tsboolm(Gecode::EPK_MEMORY, 0.3)
virtual bool solution(const Assignment &x) const
Test whether x is solution
Integer sets.
Definition: int.hh:171
int o_state
output state Default constructor
Definition: int.hh:1891
ExtensionalPropKind
Extensional propagation kind.
Definition: int.hh:1982
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Definition: extensional.cpp:88
virtual bool solution(const Assignment &x) const
Test whether x is solution
Passing integer variables.
Definition: int.hh:636
ExecStatus unshare(Home home, VarArgArray< Var > &x, IntConLevel icl)
Replace unassigned shared variables by fresh, yet equal variables.
Definition: unshare.cpp:106
Passing integer arguments.
Definition: int.hh:607
Passing Boolean variables.
Definition: int.hh:690
TupleSetB tsbm(Gecode::EPK_MEMORY)
Class represeting a set of tuples.
Definition: int.hh:2022
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
void extensional(Home home, const IntVarArgs &x, DFA dfa, IntConLevel)
Post domain consistent propagator for extensional constraint described by a DFA.
Definition: extensional.cpp:45
RegSharedD(void)
Create and register test.
General test support.
Definition: afc.cpp:43
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
bool testsearch
Whether to perform search test.
Definition: int.hh:230
Gecode::ExtensionalPropKind epk
Extensional propagation kind.
Base class for assignments
Definition: int.hh:63
virtual bool solution(const Assignment &x) const
Test whether x is solution
bool same(const Item &i, const Item &j)
Whether two items are the same.
Definition: propagate.hpp:76
Test with simple regular expression and shared variables (uses unsharing)
TupleSetA tsam(Gecode::EPK_MEMORY)
The default consistency for a constraint.
Definition: int.hh:941
TupleSetA(Gecode::ExtensionalPropKind epk0)
Create and register test.
Gecode::ExtensionalPropKind epk
Extensional propagation kind.
RegOpt(int n0)
Create and register test.
Gecode::ExtensionalPropKind epk
Extensional propagation kind.
Test with simple regular expression from Roland Yap
int n
DFA size characteristic.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Prefer little memory over speed.
Definition: int.hh:1985
RegSimpleC(void)
Create and register test.
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
Gecode toplevel namespace
virtual bool solution(const Assignment &x) const
Test whether x is solution
TupleSetBool(Gecode::ExtensionalPropKind epk0, double prob)
Create and register test.
RegOpt ro4(SHRT_MAX-1)
Test for empty regular expression
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
virtual bool solution(const Assignment &x) const
Test whether x is solution
void add(const IntArgs &tuple)
Add tuple to tuple set.
Definition: tuple-set.hpp:98
RegOpt ro6(static_cast< int >(USHRT_MAX-1))
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: extensional.cpp:61
RegOpt ro2(static_cast< int >(UCHAR_MAX-1))
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:985
RegSharedA(void)
Create and register test.
Test with bool tuple set
virtual void post(Gecode::Space &home, Gecode::IntVarArray &x)
Post constraint on x.
int size(void) const
Return number of variables.
Definition: int.hpp:50
RegSharedC(void)
Create and register test.
virtual bool solution(const Assignment &x) const
Test whether x is solution
Definition: extensional.cpp:84
Domain propagation or consistency.
Definition: int.hh:940
virtual bool solution(const Assignment &x) const
Test whether x is solution
Test with simple regular expression and shared variables (uses unsharing)
Generate all assignments.
Definition: int.hh:83
RegSimpleA(void)
Create and register test.
Definition: extensional.cpp:59
RegSimpleB(void)
Create and register test.
Definition: extensional.cpp:82
Test with simple regular expression
Definition: extensional.cpp:56