Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
set.cpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Guido Tack <tack@gecode.org>
5  * Christian Schulte <schulte@gecode.org>
6  * Mikael Lagerkvist <lagerkvist@gecode.org>
7  *
8  * Copyright:
9  * Guido Tack, 2005
10  * Christian Schulte, 2005
11  * Mikael Lagerkvist, 2005
12  *
13  * Last modified:
14  * $Date$ by $Author$
15  * $Revision$
16  *
17  * This file is part of Gecode, the generic constraint
18  * development environment:
19  * http://www.gecode.org
20  *
21  * Permission is hereby granted, free of charge, to any person obtaining
22  * a copy of this software and associated documentation files (the
23  * "Software"), to deal in the Software without restriction, including
24  * without limitation the rights to use, copy, modify, merge, publish,
25  * distribute, sublicense, and/or sell copies of the Software, and to
26  * permit persons to whom the Software is furnished to do so, subject to
27  * the following conditions:
28  *
29  * The above copyright notice and this permission notice shall be
30  * included in all copies or substantial portions of the Software.
31  *
32  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
36  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
37  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
38  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39  *
40  */
41 
42 #include "test/set.hh"
43 
44 #include <algorithm>
45 
46 namespace Test { namespace Set {
47 
48  CountableSet::CountableSet(const Gecode::IntSet& d0) : d(d0), cur(0) {
49  Gecode::IntSetRanges isr(d);
50  lubmax =
51  static_cast<unsigned int>(pow(static_cast<double>(2.0),
52  static_cast<int>(Gecode::Iter::Ranges::size(isr))));
53  }
54 
56  cur++;
57  }
58 
60  d = d0;
61  cur = 0;
62  Gecode::IntSetRanges isr(d);
63  lubmax =
64  static_cast<unsigned int>(pow(static_cast<double>(2.0),
65  static_cast<int>(Gecode::Iter::Ranges::size(isr))));
66  }
67 
68  int CountableSet::val(void) const {
69  return cur;
70  }
71 
72  SetAssignment::SetAssignment(int n0, const Gecode::IntSet& d0, int _withInt)
73  : n(n0), dsv(new CountableSet[n]), ir(_withInt, d0), done(false), lub(d0),
74  withInt(_withInt) {
75  for (int i=n; i--; )
76  dsv[i].init(lub);
77  }
78 
79  void
81  int i = n-1;
82  while (true) {
83  ++dsv[i];
84  if (dsv[i]())
85  return;
86  dsv[i].init(lub);
87  --i;
88  if (i<0) {
89  if (withInt==0) {
90  done = true;
91  return;
92  }
93  ++ir;
94  if (ir()) {
95  i = n-1;
96  for (int j=n; j--; )
97  dsv[j].init(lub);
98  } else {
99  done = true;
100  return;
101  }
102  }
103  }
104  }
105 
106 }}
107 
108 std::ostream&
109 operator<<(std::ostream& os, const Test::Set::SetAssignment& a) {
110  int n = a.size();
111  os << "{";
112  for (int i=0; i<n; i++) {
114  Gecode::IntSet icsv(csv);
115  os << icsv << ((i!=n-1) ? "," : "}");
116  }
117  if (a.withInt > 0)
118  os << a.ints();
119  return os;
120 }
121 
122 namespace Test { namespace Set {
123 
125  SetTest* t, bool log)
126  : d(d0), y(*this, i, d),
127  withInt(i), r(Gecode::BoolVar(*this, 0, 1),Gecode::RM_EQV),
128  reified(false), test(t) {
129  using namespace Gecode;
131  x = SetVarArray(*this, n, Gecode::IntSet::empty, u);
132  SetVarArgs _x(*this, n, Gecode::IntSet::empty, d);
133  if (x.size() == 1)
134  dom(*this,x[0],_x[0]);
135  else
136  dom(*this,x,_x);
137  if (opt.log && log) {
138  olog << ind(2) << "Initial: x[]=" << x;
139  olog << " y[]=" << y;
140  olog << std::endl;
141  }
142  }
143 
145  SetTest* t, Gecode::ReifyMode rm, bool log)
146  : d(d0), x(*this, n, Gecode::IntSet::empty, d), y(*this, i, d),
147  withInt(i), r(Gecode::BoolVar(*this, 0, 1),rm),
148  reified(true), test(t) {
149  if (opt.log && log) {
150  olog << ind(2) << "Initial: x[]=" << x;
151  olog << " y[]=" << y;
152  olog << " b=" << r.var();
153  olog << std::endl;
154  }
155  }
156 
158  : Gecode::Space(s), d(s.d), withInt(s.withInt),
159  reified(s.reified), test(s.test) {
160  x.update(*this, s.x);
161  y.update(*this, s.y);
163  Gecode::BoolVar sr(s.r.var());
164  b.update(*this, sr);
165  r.var(b); r.mode(s.r.mode());
166  }
167 
170  return new SetTestSpace(*this);
171  }
172 
173  void
175  if (reified){
176  test->post(*this,x,y,r);
177  if (opt.log)
178  olog << ind(3) << "Posting reified propagator" << std::endl;
179  } else {
180  test->post(*this,x,y);
181  if (opt.log)
182  olog << ind(3) << "Posting propagator" << std::endl;
183  }
184  }
185 
186  bool
188  if (opt.log) {
189  olog << ind(3) << "Fixpoint: x[]=" << x
190  << " y[]=" << y << std::endl;
191  bool f=(status() == Gecode::SS_FAILED);
192  olog << ind(3) << " --> x[]=" << x
193  << " y[]=" << y << std::endl;
194  return f;
195  } else {
196  return status() == Gecode::SS_FAILED;
197  }
198  }
199 
200  bool
202  return b ? (propagators() == 0) : true;
203  }
204 
205  void
207  if (opt.log) {
208  olog << ind(4) << "x[" << i << "] ";
209  switch (srt) {
210  case Gecode::SRT_EQ: olog << "="; break;
211  case Gecode::SRT_LQ: olog << "<="; break;
212  case Gecode::SRT_LE: olog << "<"; break;
213  case Gecode::SRT_GQ: olog << ">="; break;
214  case Gecode::SRT_GR: olog << ">"; break;
215  case Gecode::SRT_NQ: olog << "!="; break;
216  case Gecode::SRT_SUB: olog << "sub"; break;
217  case Gecode::SRT_SUP: olog << "sup"; break;
218  case Gecode::SRT_DISJ: olog << "||"; break;
219  case Gecode::SRT_CMPL: olog << "^-1 = "; break;
220  }
221  olog << is << std::endl;
222  }
223  Gecode::dom(*this, x[i], srt, is);
224  }
225 
226  void
227  SetTestSpace::cardinality(int i, int cmin, int cmax) {
228  if (opt.log) {
229  olog << ind(4) << cmin << " <= #(x[" << i << "]) <= " << cmax
230  << std::endl;
231  }
232  Gecode::cardinality(*this, x[i], cmin, cmax);
233  }
234 
235  void
237  if (opt.log) {
238  olog << ind(4) << "y[" << i << "] ";
239  switch (irt) {
240  case Gecode::IRT_EQ: olog << "="; break;
241  case Gecode::IRT_NQ: olog << "!="; break;
242  case Gecode::IRT_LQ: olog << "<="; break;
243  case Gecode::IRT_LE: olog << "<"; break;
244  case Gecode::IRT_GQ: olog << ">="; break;
245  case Gecode::IRT_GR: olog << ">"; break;
246  }
247  olog << " " << n << std::endl;
248  }
249  Gecode::rel(*this, y[i], irt, n);
250  }
251 
252  void
253  SetTestSpace::rel(bool sol) {
254  int n = sol ? 1 : 0;
255  assert(reified);
256  if (opt.log)
257  olog << ind(4) << "b = " << n << std::endl;
258  Gecode::rel(*this, r.var(), Gecode::IRT_EQ, n);
259  }
260 
261  void
263  for (int i=a.size(); i--; ) {
264  CountableSetRanges csv(a.lub, a[i]);
265  Gecode::IntSet ai(csv);
266  rel(i, Gecode::SRT_EQ, ai);
267  if (Base::fixpoint() && failed())
268  return;
269  }
270  for (int i=withInt; i--; ) {
271  rel(i, Gecode::IRT_EQ, a.ints()[i]);
272  if (Base::fixpoint() && failed())
273  return;
274  }
275  }
276 
277  bool
279  for (int i=x.size(); i--; )
280  if (!x[i].assigned())
281  return false;
282  for (int i=y.size(); i--; )
283  if (!y[i].assigned())
284  return false;
285  return true;
286  }
287 
288  void
290  using namespace Gecode;
291  SetVarUnknownRanges ur(x[i]);
292  CountableSetRanges air(a.lub, a[i]);
294  CountableSetRanges> diff(ur, air);
296  <Gecode::SetVarUnknownRanges, CountableSetRanges> > diffV(diff);
297  for (int j=0; j<v; j++, ++diffV) {}
298  rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diffV.val(), diffV.val()));
299  }
300 
301  void
303  SetTestSpace& c) {
304  using namespace Gecode;
305  SetVarUnknownRanges ur(x[i]);
306  CountableSetRanges air(a.lub, a[i]);
308  CountableSetRanges> diff(ur, air);
310  <Gecode::SetVarUnknownRanges, CountableSetRanges> > diffV(diff);
311  for (int j=0; j<v; j++, ++diffV) {}
312  rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diffV.val(), diffV.val()));
313  c.rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diffV.val(), diffV.val()));
314  }
315 
316  void
318  using namespace Gecode;
319  SetVarUnknownRanges ur(x[i]);
320  CountableSetRanges air(a.lub, a[i]);
322  CountableSetRanges> inter(ur, air);
324  <Gecode::SetVarUnknownRanges, CountableSetRanges> > interV(inter);
325  for (int j=0; j<v; j++, ++interV) {}
326  rel(i, Gecode::SRT_SUP, Gecode::IntSet(interV.val(), interV.val()));
327  }
328 
329  void
331  SetTestSpace& c) {
332  using namespace Gecode;
333  SetVarUnknownRanges ur(x[i]);
334  CountableSetRanges air(a.lub, a[i]);
336  CountableSetRanges> inter(ur, air);
338  <Gecode::SetVarUnknownRanges, CountableSetRanges> > interV(inter);
339  for (int j=0; j<v; j++, ++interV) {}
340  rel(i, Gecode::SRT_SUP, Gecode::IntSet(interV.val(), interV.val()));
341  c.rel(i, Gecode::SRT_SUP, Gecode::IntSet(interV.val(), interV.val()));
342  }
343 
344  bool
346  if (failed())
347  return true;
348  SetTestSpace* c = static_cast<SetTestSpace*>(clone());
349  if (opt.log)
350  olog << ind(3) << "Testing fixpoint on copy" << std::endl;
351  c->post();
352  if (c->failed()) {
353  delete c; return false;
354  }
355 
356  for (int i=x.size(); i--; )
357  if (x[i].glbSize() != c->x[i].glbSize() ||
358  x[i].lubSize() != c->x[i].lubSize() ||
359  x[i].cardMin() != c->x[i].cardMin() ||
360  x[i].cardMax() != c->x[i].cardMax()) {
361  delete c;
362  return false;
363  }
364  for (int i=y.size(); i--; )
365  if (y[i].size() != c->y[i].size()) {
366  delete c; return false;
367  }
368  if (reified && (r.var().size() != c->r.var().size())) {
369  delete c; return false;
370  }
371  if (opt.log)
372  olog << ind(3) << "Finished testing fixpoint on copy" << std::endl;
373  delete c;
374  return true;
375  }
376 
377  bool
379  if (opt.log)
380  olog << ind(3) << "Testing whether enabled space is the same"
381  << std::endl;
382  bool f = failed();
383  bool cf = c.failed();
384  if (f != cf)
385  return false;
386  if (f)
387  return true;
388 
389  for (int i=x.size(); i--; )
390  if (x[i].glbSize() != c.x[i].glbSize() ||
391  x[i].lubSize() != c.x[i].lubSize() ||
392  x[i].cardMin() != c.x[i].cardMin() ||
393  x[i].cardMax() != c.x[i].cardMax())
394  return false;
395 
396  for (int i=y.size(); i--; )
397  if (y[i].size() != c.y[i].size())
398  return false;
399 
400  if (reified && (r.var().size() != c.r.var().size()))
401  return false;
402  if (opt.log)
403  olog << ind(3) << "Finished testing whether enabled space is the same"
404  << std::endl;
405  return true;
406  }
407 
408  bool
410  using namespace Gecode;
411  bool setsAssigned = true;
412  for (int j=x.size(); j--; )
413  if (!x[j].assigned()) {
414  setsAssigned = false;
415  break;
416  }
417  bool intsAssigned = true;
418  for (int j=y.size(); j--; )
419  if (!y[j].assigned()) {
420  intsAssigned = false;
421  break;
422  }
423 
424  // Select variable to be pruned
425  int i;
426  if (intsAssigned) {
427  i = Base::rand(x.size());
428  } else if (setsAssigned) {
429  i = Base::rand(y.size());
430  } else {
431  i = Base::rand(x.size()+y.size());
432  }
433 
434  if (setsAssigned || i>=x.size()) {
435  if (i>=x.size())
436  i = i-x.size();
437  while (y[i].assigned()) {
438  i = (i+1) % y.size();
439  }
440  // Prune int var
441 
442  // Select mode for pruning
443  switch (Base::rand(3)) {
444  case 0:
445  if (a.ints()[i] < y[i].max()) {
446  int v=a.ints()[i]+1+
447  Base::rand(static_cast<unsigned int>(y[i].max()-a.ints()[i]));
448  assert((v > a.ints()[i]) && (v <= y[i].max()));
449  rel(i, Gecode::IRT_LE, v);
450  }
451  break;
452  case 1:
453  if (a.ints()[i] > y[i].min()) {
454  int v=y[i].min()+
455  Base::rand(static_cast<unsigned int>(a.ints()[i]-y[i].min()));
456  assert((v < a.ints()[i]) && (v >= y[i].min()));
457  rel(i, Gecode::IRT_GR, v);
458  }
459  break;
460  default:
461  int v;
463  unsigned int skip = Base::rand(y[i].size()-1);
464  while (true) {
465  if (it.width() > skip) {
466  v = it.min() + skip;
467  if (v == a.ints()[i]) {
468  if (it.width() == 1) {
469  ++it; v = it.min();
470  } else if (v < it.max()) {
471  ++v;
472  } else {
473  --v;
474  }
475  }
476  break;
477  }
478  skip -= it.width();
479  ++it;
480  }
481  rel(i, Gecode::IRT_NQ, v);
482  }
483  return (!Base::fixpoint() || fixprob());
484  }
485  while (x[i].assigned()) {
486  i = (i+1) % x.size();
487  }
489  CountableSetRanges air1(a.lub, a[i]);
491  CountableSetRanges> diff(ur1, air1);
492  Gecode::SetVarUnknownRanges ur2(x[i]);
493  CountableSetRanges air2(a.lub, a[i]);
494  Gecode::Iter::Ranges::Inter<Gecode::SetVarUnknownRanges,
495  CountableSetRanges> inter(ur2, air2);
496 
497  CountableSetRanges aisizer(a.lub, a[i]);
498  unsigned int aisize = Gecode::Iter::Ranges::size(aisizer);
499 
500  // Select mode for pruning
501  switch (Base::rand(5)) {
502  case 0:
503  if (inter()) {
505  addToGlb(v, i, a);
506  }
507  break;
508  case 1:
509  if (diff()) {
511  removeFromLub(v, i, a);
512  }
513  break;
514  case 2:
515  if (x[i].cardMin() < aisize) {
516  unsigned int newc = x[i].cardMin() + 1 +
517  Base::rand(aisize - x[i].cardMin());
518  assert( newc > x[i].cardMin() );
519  assert( newc <= aisize );
521  }
522  break;
523  case 3:
524  if (x[i].cardMax() > aisize) {
525  unsigned int newc = x[i].cardMax() - 1 -
526  Base::rand(x[i].cardMax() - aisize);
527  assert( newc < x[i].cardMax() );
528  assert( newc >= aisize );
529  cardinality(i, 0, newc);
530  }
531  break;
532  default:
533  if (inter()) {
535  addToGlb(v, i, a);
536  } else {
538  removeFromLub(v, i, a);
539  }
540  }
541  return (!Base::fixpoint() || fixprob());
542  }
543 
544  bool
546  c.disable();
547  using namespace Gecode;
548  bool setsAssigned = true;
549  for (int j=x.size(); j--; )
550  if (!x[j].assigned()) {
551  setsAssigned = false;
552  break;
553  }
554  bool intsAssigned = true;
555  for (int j=y.size(); j--; )
556  if (!y[j].assigned()) {
557  intsAssigned = false;
558  break;
559  }
560 
561  // Select variable to be pruned
562  int i;
563  if (intsAssigned) {
564  i = Base::rand(x.size());
565  } else if (setsAssigned) {
566  i = Base::rand(y.size());
567  } else {
568  i = Base::rand(x.size()+y.size());
569  }
570 
571  if (setsAssigned || i>=x.size()) {
572  if (i>=x.size())
573  i = i-x.size();
574  while (y[i].assigned()) {
575  i = (i+1) % y.size();
576  }
577  // Prune int var
578 
579  // Select mode for pruning
580  switch (Base::rand(3)) {
581  case 0:
582  if (a.ints()[i] < y[i].max()) {
583  int v=a.ints()[i]+1+
584  Base::rand(static_cast<unsigned int>(y[i].max()-a.ints()[i]));
585  assert((v > a.ints()[i]) && (v <= y[i].max()));
586  rel(i, Gecode::IRT_LE, v);
587  c.rel(i, Gecode::IRT_LE, v);
588  }
589  break;
590  case 1:
591  if (a.ints()[i] > y[i].min()) {
592  int v=y[i].min()+
593  Base::rand(static_cast<unsigned int>(a.ints()[i]-y[i].min()));
594  assert((v < a.ints()[i]) && (v >= y[i].min()));
595  rel(i, Gecode::IRT_GR, v);
596  c.rel(i, Gecode::IRT_GR, v);
597  }
598  break;
599  default:
600  int v;
602  unsigned int skip = Base::rand(y[i].size()-1);
603  while (true) {
604  if (it.width() > skip) {
605  v = it.min() + skip;
606  if (v == a.ints()[i]) {
607  if (it.width() == 1) {
608  ++it; v = it.min();
609  } else if (v < it.max()) {
610  ++v;
611  } else {
612  --v;
613  }
614  }
615  break;
616  }
617  skip -= it.width();
618  ++it;
619  }
620  rel(i, Gecode::IRT_NQ, v);
621  c.rel(i, Gecode::IRT_NQ, v);
622  }
623  c.enable();
624  return same(c);
625  }
626  while (x[i].assigned()) {
627  i = (i+1) % x.size();
628  }
630  CountableSetRanges air1(a.lub, a[i]);
632  CountableSetRanges> diff(ur1, air1);
633  Gecode::SetVarUnknownRanges ur2(x[i]);
634  CountableSetRanges air2(a.lub, a[i]);
635  Gecode::Iter::Ranges::Inter<Gecode::SetVarUnknownRanges,
636  CountableSetRanges> inter(ur2, air2);
637 
638  CountableSetRanges aisizer(a.lub, a[i]);
639  unsigned int aisize = Gecode::Iter::Ranges::size(aisizer);
640 
641  // Select mode for pruning
642  switch (Base::rand(5)) {
643  case 0:
644  if (inter()) {
646  addToGlb(v, i, a, c);
647  }
648  break;
649  case 1:
650  if (diff()) {
652  removeFromLub(v, i, a, c);
653  }
654  break;
655  case 2:
656  if (x[i].cardMin() < aisize) {
657  unsigned int newc = x[i].cardMin() + 1 +
658  Base::rand(aisize - x[i].cardMin());
659  assert( newc > x[i].cardMin() );
660  assert( newc <= aisize );
663  }
664  break;
665  case 3:
666  if (x[i].cardMax() > aisize) {
667  unsigned int newc = x[i].cardMax() - 1 -
668  Base::rand(x[i].cardMax() - aisize);
669  assert( newc < x[i].cardMax() );
670  assert( newc >= aisize );
671  cardinality(i, 0, newc);
672  c.cardinality(i, 0, newc);
673  }
674  break;
675  default:
676  if (inter()) {
678  addToGlb(v, i, a, c);
679  } else {
681  removeFromLub(v, i, a, c);
682  }
683  }
684  c.enable();
685  return same(c);
686  }
687 
688  unsigned int
690  return Gecode::PropagatorGroup::all.size(*this);
691  }
692 
693  void
696  }
697 
698  void
701  (void) status();
702  }
703 
704 
706 #define CHECK_TEST(T,M) \
707 if (opt.log) \
708  olog << ind(3) << "Check: " << (M) << std::endl; \
709 if (!(T)) { \
710  problem = (M); delete s; goto failed; \
711 }
712 
714 #define START_TEST(T) \
715  if (opt.log) { \
716  olog.str(""); \
717  olog << ind(2) << "Testing: " << (T) << std::endl; \
718  } \
719  test = (T);
720 
721  bool
722  SetTest::run(void) {
723  using namespace Gecode;
724  const char* test = "NONE";
725  const char* problem = "NONE";
726 
727  SetAssignment* ap = new SetAssignment(arity,lub,withInt);
728  SetAssignment& a = *ap;
729  while (a()) {
730  bool is_sol = solution(a);
731  if (opt.log)
732  olog << ind(1) << "Assignment: " << a
733  << (is_sol ? " (solution)" : " (no solution)")
734  << std::endl;
735  START_TEST("Assignment (after posting)");
736  {
737  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
738  SetTestSpace* sc = NULL;
739  s->post();
740  switch (Base::rand(2)) {
741  case 0:
742  if (opt.log)
743  olog << ind(3) << "No copy" << std::endl;
744  sc = s;
745  s = NULL;
746  break;
747  case 1:
748  if (opt.log)
749  olog << ind(3) << "Copy" << std::endl;
750  if (s->status() != Gecode::SS_FAILED) {
751  sc = static_cast<SetTestSpace*>(s->clone());
752  } else {
753  sc = s; s = NULL;
754  }
755  break;
756  default: assert(false);
757  }
758  sc->assign(a);
759  if (is_sol) {
760  CHECK_TEST(!sc->failed(), "Failed on solution");
761  CHECK_TEST(sc->subsumed(testsubsumed), "No subsumption");
762  } else {
763  CHECK_TEST(sc->failed(), "Solved on non-solution");
764  }
765  delete s; delete sc;
766  }
767  START_TEST("Assignment (after posting, disable)");
768  {
769  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
770  s->post();
771  s->disable();
772  s->assign(a);
773  s->enable();
774  if (is_sol) {
775  CHECK_TEST(!s->failed(), "Failed on solution");
776  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
777  } else {
778  CHECK_TEST(s->failed(), "Solved on non-solution");
779  }
780  delete s;
781  }
782  START_TEST("Assignment (before posting)");
783  {
784  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
785  s->assign(a);
786  s->post();
787  if (is_sol) {
788  CHECK_TEST(!s->failed(), "Failed on solution");
789  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
790  } else {
791  CHECK_TEST(s->failed(), "Solved on non-solution");
792  }
793  delete s;
794  }
795  START_TEST("Prune");
796  {
797  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
798  s->post();
799  while (!s->failed() && !s->assigned())
800  if (!s->prune(a)) {
801  problem = "No fixpoint";
802  delete s;
803  goto failed;
804  }
805  s->assign(a);
806  if (is_sol) {
807  CHECK_TEST(!s->failed(), "Failed on solution");
808  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
809  } else {
810  CHECK_TEST(s->failed(), "Solved on non-solution");
811  }
812  delete s;
813  }
814  if (disabled) {
815  START_TEST("Prune (disable)");
816  {
817  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
818  SetTestSpace* c = new SetTestSpace(arity,lub,withInt,this);
819  s->post(); c->post();
820  while (!s->failed() && !s->assigned())
821  if (!s->disabled(a,*c)) {
822  problem = "Different result after re-enable";
823  delete s; delete c;
824  goto failed;
825  }
826  s->assign(a); c->assign(a);
827  if (s->failed() != c->failed()) {
828  problem = "Different failure after re-enable";
829  delete s; delete c;
830  goto failed;
831  }
832  delete s; delete c;
833  }
834  }
835  if (reified) {
836  START_TEST("Assignment reified (rewrite after post, <=>)");
837  {
838  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
839  s->post();
840  s->rel(is_sol);
841  s->assign(a);
842  CHECK_TEST(!s->failed(), "Failed");
843  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
844  delete s;
845  }
846  START_TEST("Assignment reified (rewrite after post, =>)");
847  {
848  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
849  s->post();
850  s->rel(is_sol);
851  s->assign(a);
852  CHECK_TEST(!s->failed(), "Failed");
853  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
854  delete s;
855  }
856  START_TEST("Assignment reified (rewrite after post, <=)");
857  {
858  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
859  s->post();
860  s->rel(is_sol);
861  s->assign(a);
862  CHECK_TEST(!s->failed(), "Failed");
863  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
864  delete s;
865  }
866  {
867  START_TEST("Assignment reified (rewrite failure, <=>)");
868  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
869  s->post();
870  s->rel(!is_sol);
871  s->assign(a);
872  CHECK_TEST(s->failed(), "Not failed");
873  delete s;
874  }
875  {
876  START_TEST("Assignment reified (rewrite failure, =>)");
877  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
878  s->post();
879  s->rel(!is_sol);
880  s->assign(a);
881  if (is_sol) {
882  CHECK_TEST(!s->failed(), "Failed");
883  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
884  } else {
885  CHECK_TEST(s->failed(), "Not failed");
886  }
887  delete s;
888  }
889  {
890  START_TEST("Assignment reified (rewrite failure, <=)");
891  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
892  s->post();
893  s->rel(!is_sol);
894  s->assign(a);
895  if (is_sol) {
896  CHECK_TEST(s->failed(), "Not failed");
897  } else {
898  CHECK_TEST(!s->failed(), "Failed");
899  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
900  }
901  delete s;
902  }
903  START_TEST("Assignment reified (immediate rewrite, <=>)");
904  {
905  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
906  s->rel(is_sol);
907  s->post();
908  s->assign(a);
909  CHECK_TEST(!s->failed(), "Failed");
910  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
911  delete s;
912  }
913  START_TEST("Assignment reified (immediate rewrite, =>)");
914  {
915  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
916  s->rel(is_sol);
917  s->post();
918  s->assign(a);
919  CHECK_TEST(!s->failed(), "Failed");
920  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
921  delete s;
922  }
923  START_TEST("Assignment reified (immediate rewrite, <=)");
924  {
925  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
926  s->rel(is_sol);
927  s->post();
928  s->assign(a);
929  CHECK_TEST(!s->failed(), "Failed");
930  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
931  delete s;
932  }
933  START_TEST("Assignment reified (immediate failure, <=>)");
934  {
935  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
936  s->rel(!is_sol);
937  s->post();
938  s->assign(a);
939  CHECK_TEST(s->failed(), "Not failed");
940  delete s;
941  }
942  START_TEST("Assignment reified (immediate failure, =>)");
943  {
944  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
945  s->rel(!is_sol);
946  s->post();
947  s->assign(a);
948  if (is_sol) {
949  CHECK_TEST(!s->failed(), "Failed");
950  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
951  } else {
952  CHECK_TEST(s->failed(), "Not failed");
953  }
954  delete s;
955  }
956  START_TEST("Assignment reified (immediate failure, <=)");
957  {
958  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
959  s->rel(!is_sol);
960  s->post();
961  s->assign(a);
962  if (is_sol) {
963  CHECK_TEST(s->failed(), "Not failed");
964  } else {
965  CHECK_TEST(!s->failed(), "Failed");
966  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
967  }
968  delete s;
969  }
970  START_TEST("Assignment reified (before posting, <=>)");
971  {
972  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
973  s->assign(a);
974  s->post();
975  CHECK_TEST(!s->failed(), "Failed");
976  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
977  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
978  if (is_sol) {
979  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
980  } else {
981  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
982  }
983  delete s;
984  }
985  START_TEST("Assignment reified (before posting, =>)");
986  {
987  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
988  s->assign(a);
989  s->post();
990  CHECK_TEST(!s->failed(), "Failed");
991  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
992  if (is_sol) {
993  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
994  } else {
995  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
996  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
997  }
998  delete s;
999  }
1000  START_TEST("Assignment reified (before posting, <=)");
1001  {
1002  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1003  s->assign(a);
1004  s->post();
1005  CHECK_TEST(!s->failed(), "Failed");
1006  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1007  if (is_sol) {
1008  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1009  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1010  } else {
1011  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1012  }
1013  delete s;
1014  }
1015  START_TEST("Assignment reified (after posting, <=>)");
1016  {
1017  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
1018  s->post();
1019  s->assign(a);
1020  CHECK_TEST(!s->failed(), "Failed");
1021  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1022  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1023  if (is_sol) {
1024  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1025  } else {
1026  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1027  }
1028  delete s;
1029  }
1030  START_TEST("Assignment reified (after posting, =>)");
1031  {
1032  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
1033  s->post();
1034  s->assign(a);
1035  CHECK_TEST(!s->failed(), "Failed");
1036  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1037  if (is_sol) {
1038  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1039  } else {
1040  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1041  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1042  }
1043  delete s;
1044  }
1045  START_TEST("Assignment reified (after posting, <=)");
1046  {
1047  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1048  s->post();
1049  s->assign(a);
1050  CHECK_TEST(!s->failed(), "Failed");
1051  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1052  if (is_sol) {
1053  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1054  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1055  } else {
1056  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1057  }
1058  delete s;
1059  }
1060  START_TEST("Assignment reified (after posting, <=>, disable)");
1061  {
1062  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
1063  s->post();
1064  s->disable();
1065  s->assign(a);
1066  s->enable();
1067  CHECK_TEST(!s->failed(), "Failed");
1068  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1069  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1070  if (is_sol) {
1071  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1072  } else {
1073  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1074  }
1075  delete s;
1076  }
1077  START_TEST("Assignment reified (after posting, =>, disable)");
1078  {
1079  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
1080  s->post();
1081  s->disable();
1082  s->assign(a);
1083  s->enable();
1084  CHECK_TEST(!s->failed(), "Failed");
1085  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1086  if (is_sol) {
1087  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1088  } else {
1089  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1090  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1091  }
1092  delete s;
1093  }
1094  START_TEST("Assignment reified (after posting, <=, disable)");
1095  {
1096  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1097  s->post();
1098  s->disable();
1099  s->assign(a);
1100  s->enable();
1101  CHECK_TEST(!s->failed(), "Failed");
1102  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1103  if (is_sol) {
1104  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1105  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1106  } else {
1107  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1108  }
1109  delete s;
1110  }
1111  START_TEST("Prune reified, <=>");
1112  {
1113  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
1114  s->post();
1115  while (!s->failed() &&
1116  (!s->assigned() || !s->r.var().assigned()))
1117  if (!s->prune(a)) {
1118  problem = "No fixpoint";
1119  delete s;
1120  goto failed;
1121  }
1122  CHECK_TEST(!s->failed(), "Failed");
1123  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1124  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1125  if (is_sol) {
1126  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1127  } else {
1128  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1129  }
1130  delete s;
1131  }
1132  START_TEST("Prune reified, =>");
1133  {
1134  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
1135  s->post();
1136  while (!s->failed() &&
1137  (!s->assigned() || (!is_sol && !s->r.var().assigned()))) {
1138  if (!s->prune(a)) {
1139  problem = "No fixpoint";
1140  delete s;
1141  goto failed;
1142  }
1143  }
1144  CHECK_TEST(!s->failed(), "Failed");
1145  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1146  if (is_sol) {
1147  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1148  } else {
1149  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1150  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1151  }
1152  delete s;
1153  }
1154  START_TEST("Prune reified, <=");
1155  {
1156  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1157  s->post();
1158  while (!s->failed() &&
1159  (!s->assigned() || (is_sol && !s->r.var().assigned())))
1160  if (!s->prune(a)) {
1161  problem = "No fixpoint";
1162  delete s;
1163  goto failed;
1164  }
1165  CHECK_TEST(!s->failed(), "Failed");
1166  CHECK_TEST(s->subsumed(testsubsumed), "No subsumption");
1167  if (is_sol) {
1168  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1169  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1170  } else {
1171  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1172  }
1173  delete s;
1174  }
1175  }
1176  ++a;
1177  }
1178  delete ap;
1179  return true;
1180  failed:
1181  if (opt.log)
1182  olog << "FAILURE" << std::endl
1183  << ind(1) << "Test: " << test << std::endl
1184  << ind(1) << "Problem: " << problem << std::endl;
1185  if (a() && opt.log)
1186  olog << ind(1) << "Assignment: " << a << std::endl;
1187  delete ap;
1188 
1189  return false;
1190  }
1191 
1192  const Gecode::SetRelType SetRelTypes::srts[] =
1195 
1196  const Gecode::SetOpType SetOpTypes::sots[] =
1199 
1200 }}
1201 
1202 #undef START_TEST
1203 #undef CHECK_TEST
1204 
1205 // STATISTICS: test-set
void removeFromLub(int v, int i, const SetAssignment &a)
Remove value v from the upper bound of x[i].
Definition: set.cpp:289
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
void operator++(void)
Move to next subset.
Definition: set.cpp:55
void cardinality(int i, int cmin, int cmax)
Perform cardinality tell operation on x[i].
Definition: set.cpp:227
NodeType t
Type of node.
Definition: bool-expr.cpp:234
void disable(void)
Disable propagators in space and compute fixpoint (make all idle)
Definition: set.cpp:699
SetRelType
Common relation types for sets.
Definition: set.hh:645
Inverse implication for reification.
Definition: int.hh:848
Simple class for describing identation.
Definition: test.hh:70
Gecode::Reify r
Reification information.
Definition: set.hh:197
const int min
Smallest allowed integer in integer set.
Definition: set.hh:103
Range iterator for integer sets.
Definition: int.hh:272
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:973
const FloatNum max
Largest allowed float value.
Definition: float.hh:848
ReifyMode mode(void) const
Return reification mode.
Definition: reify.hpp:60
virtual Gecode::Space * copy(void)
Copy space during cloning.
Definition: set.cpp:169
void update(Space &home, VarArray< Var > &a)
Update array to be a clone of array a.
Definition: array.hpp:1060
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition: test.hh:138
Gecode::SetVarArray x
Set variables to be tested.
Definition: set.hh:191
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: bool.hpp:85
void enable(void)
Enable propagators in space.
Definition: set.cpp:694
void disable(Space &home)
Disable all propagators in a group.
Definition: core.cpp:944
static PropagatorGroup all
Group of all propagators.
Definition: core.hpp:779
bool assigned(void) const
Test whether view is assigned.
Definition: var.hpp:123
void assign(const SetAssignment &a)
Assign all variables to values in a.
Definition: set.cpp:262
Less or equal ( )
Definition: int.hh:907
void pow(Home home, FloatVar x0, int n, FloatVar x1)
Post propagator for for $n 0$.
Definition: arithmetic.cpp:113
CountableSet(void)
Default constructor.
Definition: set.hh:134
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Definition: dom.cpp:44
bool same(SetTestSpace &c)
Check whether propagation is the same as in c.
Definition: set.cpp:378
int val(void) const
Return current subset.
Definition: set.cpp:68
SetOpType
Common operations for sets.
Definition: set.hh:662
Greater ( )
Definition: int.hh:910
Superset ( )
Definition: set.hh:649
Complement.
Definition: set.hh:651
const unsigned int card
Maximum cardinality of an integer set.
Definition: set.hh:105
SetAssignment(int n, const Gecode::IntSet &d, int i=0)
Initialize with n set variables, initial bound d and i int variables.
Definition: set.cpp:72
const int max
Largest allowed integer in integer set.
Definition: set.hh:101
Computation spaces.
Definition: core.hpp:1668
Greater or equal ( )
Definition: int.hh:909
Difference.
Definition: set.hh:666
unsigned int size(Space &home) const
Return number of propagators in a group.
Definition: core.cpp:920
Iterator for the unknown ranges of a set variable.
Definition: set.hh:338
Gecode::IntSet d(v, 7)
bool reified
Whether the test is for a reified propagator.
Definition: set.hh:199
void rel(int i, Gecode::SetRelType srt, const Gecode::IntSet &is)
Perform set tell operation on x[i].
Definition: set.cpp:206
const FloatNum min
Smallest allowed float value.
Definition: float.hh:850
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
Equality ( )
Definition: int.hh:905
Options opt
The options.
Definition: test.cpp:101
IntRelType
Relation types for integers.
Definition: int.hh:904
Range iterator for computing intersection (binary)
Space * clone(CloneStatistics &stat=unused_clone) const
Clone space.
Definition: core.hpp:3144
Less or equal ( )
Definition: set.hh:652
ChannelShared csv(Gecode::IPL_VAL)
static bool fixpoint(void)
Throw a coin whether to compute a fixpoint.
Definition: test.hpp:70
void post(void)
Post propagator.
Definition: set.cpp:174
bool failed(void)
Compute a fixpoint and check for failure.
Definition: set.cpp:187
Value iterator from range iterator.
unsigned int size(I &i)
Size of all ranges of range iterator i.
int min(void) const
Return smallest value of range.
struct Gecode::Space::@58::@60 c
Data available only during copying.
Subset ( )
Definition: set.hh:648
void update(Space &home, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
Definition: var.hpp:128
virtual bool run(void)
Perform test.
Definition: set.cpp:722
bool log
Whether to log the tests.
Definition: test.hh:95
Gecode::IntSet lub
The common superset for all domains.
Definition: set.hh:158
Intersection
Definition: set.hh:665
union Gecode::@585::NNF::@62 u
Union depending on nodetype t.
Less ( )
Definition: int.hh:908
Integer sets.
Definition: int.hh:174
const Test::Int::Assignment & ints(void) const
Return assignment for integer variables.
Definition: set.hh:175
Less ( )
Definition: set.hh:653
#define START_TEST(T)
Start new test.
Definition: set.cpp:714
bool assigned(void) const
Test whether all variables are assigned.
Definition: set.cpp:278
static const IntSet empty
Empty set.
Definition: int.hh:263
Gecode::IntSet d
Initial domain.
Definition: set.hh:189
SetTestSpace(int n, Gecode::IntSet &d0, int i, SetTest *t, bool log=true)
Create test space without reification.
Definition: set.cpp:124
Boolean integer variables.
Definition: int.hh:492
LinIntExpr cardinality(const SetExpr &e)
Cardinality of set expression.
Definition: set-expr.cpp:818
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
Definition: set-expr.cpp:699
const int v[7]
Definition: distinct.cpp:263
bool prune(const SetAssignment &a)
Perform random pruning.
Definition: set.cpp:409
General test support.
Definition: afc.cpp:43
Union.
Definition: set.hh:663
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
unsigned int propagators(void)
Return the number of propagators.
Definition: set.cpp:689
Passing set variables.
Definition: set.hh:492
Greater or equal ( )
Definition: set.hh:654
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:769
int withInt
How many integer variables to iterate.
Definition: set.hh:160
void addToGlb(int v, int i, const SetAssignment &a)
Remove value v from the lower bound of x[i].
Definition: set.cpp:317
bool disabled(const SetAssignment &a, SetTestSpace &c)
Prune values also in a space c with disabled propagators, but not those in assignment a...
Definition: set.cpp:545
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
virtual void post(Gecode::Space &home, Gecode::SetVarArray &x, Gecode::IntVarArray &y)=0
Post propagator.
Disjoint union.
Definition: set.hh:664
Base class for tests with set constraints
Definition: set.hh:277
Generate all set assignments.
Definition: set.hh:146
Region r
Definition: region.cpp:69
void operator++(void)
Move to next assignment.
Definition: set.cpp:80
bool fixprob(void)
Perform fixpoint computation.
Definition: set.cpp:345
void enable(Space &home, bool s=true)
Enable all propagators in a group.
Definition: core.cpp:953
std::ostringstream olog
Stream used for logging.
Definition: test.cpp:57
void rel(Home home, FloatVar x0, FloatRelType frt, FloatVal n)
Propagates .
Definition: rel.cpp:47
std::ostream & operator<<(std::ostream &os, const Test::Set::SetAssignment &a)
Definition: set.cpp:109
Gecode::IntVarArray y
Int variables to be tested.
Definition: set.hh:193
bool subsumed(bool b)
Check for subsumption if b is true.
Definition: set.cpp:201
BoolVar var(void) const
Return Boolean control variable.
Definition: reify.hpp:52
Range iterator producing subsets of an IntSet.
Definition: set.hh:102
Greater ( )
Definition: set.hh:655
Equality ( )
Definition: set.hh:646
Disjoint ( )
Definition: set.hh:650
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Definition: core.cpp:229
int withInt
How many integer variables are used by the test.
Definition: set.hh:195
int max(void) const
Return largest value of range.
Set variable array
Definition: set.hh:572
Disequality ( )
Definition: set.hh:647
Gecode toplevel namespace
Implication for reification.
Definition: int.hh:841
int size(void) const
Return arity.
Definition: set.hh:177
Range iterator for computing set difference.
Definition: ranges-diff.hpp:47
Disequality ( )
Definition: int.hh:906
#define CHECK_TEST(T, M)
Check the test result and handle failed test.
Definition: set.cpp:706
SetTest * test
The test currently run.
Definition: set.hh:201
Space is failed
Definition: core.hpp:1608
Space for executing set tests.
Definition: set.hh:186
Iterate all subsets of a given set.
Definition: set.hh:122
ReifyMode
Mode for reification.
Definition: int.hh:827
void init(const Gecode::IntSet &s)
Initialize with set s.
Definition: set.cpp:59
Equivalence for reification (default)
Definition: int.hh:834
int val(void) const
Return assigned value.
Definition: bool.hpp:61