Generated on Thu Mar 16 2017 03:24:24 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: 2016-10-25 12:52:26 +0200 (Tue, 25 Oct 2016) $ by $Author: schulte $
15  * $Revision: 15233 $
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(share,s), d(s.d), withInt(s.withInt),
159  reified(s.reified), test(s.test) {
160  x.update(*this, share, s.x);
161  y.update(*this, share, s.y);
163  Gecode::BoolVar sr(s.r.var());
164  b.update(*this, share, sr);
165  r.var(b); r.mode(s.r.mode());
166  }
167 
169  SetTestSpace::copy(bool share) {
170  return new SetTestSpace(share,*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  void
202  if (opt.log) {
203  olog << ind(4) << "x[" << i << "] ";
204  switch (srt) {
205  case Gecode::SRT_EQ: olog << "="; break;
206  case Gecode::SRT_LQ: olog << "<="; break;
207  case Gecode::SRT_LE: olog << "<"; break;
208  case Gecode::SRT_GQ: olog << ">="; break;
209  case Gecode::SRT_GR: olog << ">"; break;
210  case Gecode::SRT_NQ: olog << "!="; break;
211  case Gecode::SRT_SUB: olog << "sub"; break;
212  case Gecode::SRT_SUP: olog << "sup"; break;
213  case Gecode::SRT_DISJ: olog << "||"; break;
214  case Gecode::SRT_CMPL: olog << "^-1 = "; break;
215  }
216  olog << is << std::endl;
217  }
218  Gecode::dom(*this, x[i], srt, is);
219  }
220 
221  void
222  SetTestSpace::cardinality(int i, int cmin, int cmax) {
223  if (opt.log) {
224  olog << ind(4) << cmin << " <= #(x[" << i << "]) <= " << cmax
225  << std::endl;
226  }
227  Gecode::cardinality(*this, x[i], cmin, cmax);
228  }
229 
230  void
232  if (opt.log) {
233  olog << ind(4) << "y[" << i << "] ";
234  switch (irt) {
235  case Gecode::IRT_EQ: olog << "="; break;
236  case Gecode::IRT_NQ: olog << "!="; break;
237  case Gecode::IRT_LQ: olog << "<="; break;
238  case Gecode::IRT_LE: olog << "<"; break;
239  case Gecode::IRT_GQ: olog << ">="; break;
240  case Gecode::IRT_GR: olog << ">"; break;
241  }
242  olog << " " << n << std::endl;
243  }
244  Gecode::rel(*this, y[i], irt, n);
245  }
246 
247  void
248  SetTestSpace::rel(bool sol) {
249  int n = sol ? 1 : 0;
250  assert(reified);
251  if (opt.log)
252  olog << ind(4) << "b = " << n << std::endl;
253  Gecode::rel(*this, r.var(), Gecode::IRT_EQ, n);
254  }
255 
256  void
258  for (int i=a.size(); i--; ) {
259  CountableSetRanges csv(a.lub, a[i]);
260  Gecode::IntSet ai(csv);
261  rel(i, Gecode::SRT_EQ, ai);
262  if (Base::fixpoint() && failed())
263  return;
264  }
265  for (int i=withInt; i--; ) {
266  rel(i, Gecode::IRT_EQ, a.ints()[i]);
267  if (Base::fixpoint() && failed())
268  return;
269  }
270  }
271 
272  bool
274  for (int i=x.size(); i--; )
275  if (!x[i].assigned())
276  return false;
277  for (int i=y.size(); i--; )
278  if (!y[i].assigned())
279  return false;
280  return true;
281  }
282 
283  void
285  using namespace Gecode;
286  SetVarUnknownRanges ur(x[i]);
287  CountableSetRanges air(a.lub, a[i]);
289  CountableSetRanges> diff(ur, air);
291  <Gecode::SetVarUnknownRanges, CountableSetRanges> > diffV(diff);
292  for (int j=0; j<v; j++, ++diffV) {}
293  rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diffV.val(), diffV.val()));
294  }
295 
296  void
298  SetTestSpace& c) {
299  using namespace Gecode;
300  SetVarUnknownRanges ur(x[i]);
301  CountableSetRanges air(a.lub, a[i]);
303  CountableSetRanges> diff(ur, air);
305  <Gecode::SetVarUnknownRanges, CountableSetRanges> > diffV(diff);
306  for (int j=0; j<v; j++, ++diffV) {}
307  rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diffV.val(), diffV.val()));
308  c.rel(i, Gecode::SRT_DISJ, Gecode::IntSet(diffV.val(), diffV.val()));
309  }
310 
311  void
313  using namespace Gecode;
314  SetVarUnknownRanges ur(x[i]);
315  CountableSetRanges air(a.lub, a[i]);
317  CountableSetRanges> inter(ur, air);
319  <Gecode::SetVarUnknownRanges, CountableSetRanges> > interV(inter);
320  for (int j=0; j<v; j++, ++interV) {}
321  rel(i, Gecode::SRT_SUP, Gecode::IntSet(interV.val(), interV.val()));
322  }
323 
324  void
326  SetTestSpace& c) {
327  using namespace Gecode;
328  SetVarUnknownRanges ur(x[i]);
329  CountableSetRanges air(a.lub, a[i]);
331  CountableSetRanges> inter(ur, air);
333  <Gecode::SetVarUnknownRanges, CountableSetRanges> > interV(inter);
334  for (int j=0; j<v; j++, ++interV) {}
335  rel(i, Gecode::SRT_SUP, Gecode::IntSet(interV.val(), interV.val()));
336  c.rel(i, Gecode::SRT_SUP, Gecode::IntSet(interV.val(), interV.val()));
337  }
338 
339  bool
341  if (failed())
342  return true;
343  SetTestSpace* c = static_cast<SetTestSpace*>(clone());
344  if (opt.log)
345  olog << ind(3) << "Testing fixpoint on copy" << std::endl;
346  c->post();
347  if (c->failed()) {
348  delete c; return false;
349  }
350 
351  for (int i=x.size(); i--; )
352  if (x[i].glbSize() != c->x[i].glbSize() ||
353  x[i].lubSize() != c->x[i].lubSize() ||
354  x[i].cardMin() != c->x[i].cardMin() ||
355  x[i].cardMax() != c->x[i].cardMax()) {
356  delete c;
357  return false;
358  }
359  for (int i=y.size(); i--; )
360  if (y[i].size() != c->y[i].size()) {
361  delete c; return false;
362  }
363  if (reified && (r.var().size() != c->r.var().size())) {
364  delete c; return false;
365  }
366  if (opt.log)
367  olog << ind(3) << "Finished testing fixpoint on copy" << std::endl;
368  delete c;
369  return true;
370  }
371 
372  bool
374  if (opt.log)
375  olog << ind(3) << "Testing whether enabled space is the same"
376  << std::endl;
377  bool f = failed();
378  bool cf = c.failed();
379  if (f != cf)
380  return false;
381  if (f)
382  return true;
383 
384  for (int i=x.size(); i--; )
385  if (x[i].glbSize() != c.x[i].glbSize() ||
386  x[i].lubSize() != c.x[i].lubSize() ||
387  x[i].cardMin() != c.x[i].cardMin() ||
388  x[i].cardMax() != c.x[i].cardMax())
389  return false;
390 
391  for (int i=y.size(); i--; )
392  if (y[i].size() != c.y[i].size())
393  return false;
394 
395  if (reified && (r.var().size() != c.r.var().size()))
396  return false;
397  if (opt.log)
398  olog << ind(3) << "Finished testing whether enabled space is the same"
399  << std::endl;
400  return true;
401  }
402 
403  bool
405  using namespace Gecode;
406  bool setsAssigned = true;
407  for (int j=x.size(); j--; )
408  if (!x[j].assigned()) {
409  setsAssigned = false;
410  break;
411  }
412  bool intsAssigned = true;
413  for (int j=y.size(); j--; )
414  if (!y[j].assigned()) {
415  intsAssigned = false;
416  break;
417  }
418 
419  // Select variable to be pruned
420  int i;
421  if (intsAssigned) {
422  i = Base::rand(x.size());
423  } else if (setsAssigned) {
424  i = Base::rand(y.size());
425  } else {
426  i = Base::rand(x.size()+y.size());
427  }
428 
429  if (setsAssigned || i>=x.size()) {
430  if (i>=x.size())
431  i = i-x.size();
432  while (y[i].assigned()) {
433  i = (i+1) % y.size();
434  }
435  // Prune int var
436 
437  // Select mode for pruning
438  switch (Base::rand(3)) {
439  case 0:
440  if (a.ints()[i] < y[i].max()) {
441  int v=a.ints()[i]+1+
442  Base::rand(static_cast<unsigned int>(y[i].max()-a.ints()[i]));
443  assert((v > a.ints()[i]) && (v <= y[i].max()));
444  rel(i, Gecode::IRT_LE, v);
445  }
446  break;
447  case 1:
448  if (a.ints()[i] > y[i].min()) {
449  int v=y[i].min()+
450  Base::rand(static_cast<unsigned int>(a.ints()[i]-y[i].min()));
451  assert((v < a.ints()[i]) && (v >= y[i].min()));
452  rel(i, Gecode::IRT_GR, v);
453  }
454  break;
455  default:
456  int v;
458  unsigned int skip = Base::rand(y[i].size()-1);
459  while (true) {
460  if (it.width() > skip) {
461  v = it.min() + skip;
462  if (v == a.ints()[i]) {
463  if (it.width() == 1) {
464  ++it; v = it.min();
465  } else if (v < it.max()) {
466  ++v;
467  } else {
468  --v;
469  }
470  }
471  break;
472  }
473  skip -= it.width();
474  ++it;
475  }
476  rel(i, Gecode::IRT_NQ, v);
477  }
478  return (!Base::fixpoint() || fixprob());
479  }
480  while (x[i].assigned()) {
481  i = (i+1) % x.size();
482  }
484  CountableSetRanges air1(a.lub, a[i]);
486  CountableSetRanges> diff(ur1, air1);
487  Gecode::SetVarUnknownRanges ur2(x[i]);
488  CountableSetRanges air2(a.lub, a[i]);
489  Gecode::Iter::Ranges::Inter<Gecode::SetVarUnknownRanges,
490  CountableSetRanges> inter(ur2, air2);
491 
492  CountableSetRanges aisizer(a.lub, a[i]);
493  unsigned int aisize = Gecode::Iter::Ranges::size(aisizer);
494 
495  // Select mode for pruning
496  switch (Base::rand(5)) {
497  case 0:
498  if (inter()) {
500  addToGlb(v, i, a);
501  }
502  break;
503  case 1:
504  if (diff()) {
506  removeFromLub(v, i, a);
507  }
508  break;
509  case 2:
510  if (x[i].cardMin() < aisize) {
511  unsigned int newc = x[i].cardMin() + 1 +
512  Base::rand(aisize - x[i].cardMin());
513  assert( newc > x[i].cardMin() );
514  assert( newc <= aisize );
516  }
517  break;
518  case 3:
519  if (x[i].cardMax() > aisize) {
520  unsigned int newc = x[i].cardMax() - 1 -
521  Base::rand(x[i].cardMax() - aisize);
522  assert( newc < x[i].cardMax() );
523  assert( newc >= aisize );
524  cardinality(i, 0, newc);
525  }
526  break;
527  default:
528  if (inter()) {
530  addToGlb(v, i, a);
531  } else {
533  removeFromLub(v, i, a);
534  }
535  }
536  return (!Base::fixpoint() || fixprob());
537  }
538 
539  bool
541  c.disable();
542  using namespace Gecode;
543  bool setsAssigned = true;
544  for (int j=x.size(); j--; )
545  if (!x[j].assigned()) {
546  setsAssigned = false;
547  break;
548  }
549  bool intsAssigned = true;
550  for (int j=y.size(); j--; )
551  if (!y[j].assigned()) {
552  intsAssigned = false;
553  break;
554  }
555 
556  // Select variable to be pruned
557  int i;
558  if (intsAssigned) {
559  i = Base::rand(x.size());
560  } else if (setsAssigned) {
561  i = Base::rand(y.size());
562  } else {
563  i = Base::rand(x.size()+y.size());
564  }
565 
566  if (setsAssigned || i>=x.size()) {
567  if (i>=x.size())
568  i = i-x.size();
569  while (y[i].assigned()) {
570  i = (i+1) % y.size();
571  }
572  // Prune int var
573 
574  // Select mode for pruning
575  switch (Base::rand(3)) {
576  case 0:
577  if (a.ints()[i] < y[i].max()) {
578  int v=a.ints()[i]+1+
579  Base::rand(static_cast<unsigned int>(y[i].max()-a.ints()[i]));
580  assert((v > a.ints()[i]) && (v <= y[i].max()));
581  rel(i, Gecode::IRT_LE, v);
582  c.rel(i, Gecode::IRT_LE, v);
583  }
584  break;
585  case 1:
586  if (a.ints()[i] > y[i].min()) {
587  int v=y[i].min()+
588  Base::rand(static_cast<unsigned int>(a.ints()[i]-y[i].min()));
589  assert((v < a.ints()[i]) && (v >= y[i].min()));
590  rel(i, Gecode::IRT_GR, v);
591  c.rel(i, Gecode::IRT_GR, v);
592  }
593  break;
594  default:
595  int v;
597  unsigned int skip = Base::rand(y[i].size()-1);
598  while (true) {
599  if (it.width() > skip) {
600  v = it.min() + skip;
601  if (v == a.ints()[i]) {
602  if (it.width() == 1) {
603  ++it; v = it.min();
604  } else if (v < it.max()) {
605  ++v;
606  } else {
607  --v;
608  }
609  }
610  break;
611  }
612  skip -= it.width();
613  ++it;
614  }
615  rel(i, Gecode::IRT_NQ, v);
616  c.rel(i, Gecode::IRT_NQ, v);
617  }
618  c.enable();
619  return same(c);
620  }
621  while (x[i].assigned()) {
622  i = (i+1) % x.size();
623  }
625  CountableSetRanges air1(a.lub, a[i]);
627  CountableSetRanges> diff(ur1, air1);
628  Gecode::SetVarUnknownRanges ur2(x[i]);
629  CountableSetRanges air2(a.lub, a[i]);
630  Gecode::Iter::Ranges::Inter<Gecode::SetVarUnknownRanges,
631  CountableSetRanges> inter(ur2, air2);
632 
633  CountableSetRanges aisizer(a.lub, a[i]);
634  unsigned int aisize = Gecode::Iter::Ranges::size(aisizer);
635 
636  // Select mode for pruning
637  switch (Base::rand(5)) {
638  case 0:
639  if (inter()) {
641  addToGlb(v, i, a, c);
642  }
643  break;
644  case 1:
645  if (diff()) {
647  removeFromLub(v, i, a, c);
648  }
649  break;
650  case 2:
651  if (x[i].cardMin() < aisize) {
652  unsigned int newc = x[i].cardMin() + 1 +
653  Base::rand(aisize - x[i].cardMin());
654  assert( newc > x[i].cardMin() );
655  assert( newc <= aisize );
658  }
659  break;
660  case 3:
661  if (x[i].cardMax() > aisize) {
662  unsigned int newc = x[i].cardMax() - 1 -
663  Base::rand(x[i].cardMax() - aisize);
664  assert( newc < x[i].cardMax() );
665  assert( newc >= aisize );
666  cardinality(i, 0, newc);
667  c.cardinality(i, 0, newc);
668  }
669  break;
670  default:
671  if (inter()) {
673  addToGlb(v, i, a, c);
674  } else {
676  removeFromLub(v, i, a, c);
677  }
678  }
679  c.enable();
680  return same(c);
681  }
682 
683  unsigned int
685  return Gecode::PropagatorGroup::all.size(*this);
686  }
687 
688  void
691  }
692 
693  void
696  (void) status();
697  }
698 
699 
701 #define CHECK_TEST(T,M) \
702 if (opt.log) \
703  olog << ind(3) << "Check: " << (M) << std::endl; \
704 if (!(T)) { \
705  problem = (M); delete s; goto failed; \
706 }
707 
709 #define START_TEST(T) \
710  if (opt.log) { \
711  olog.str(""); \
712  olog << ind(2) << "Testing: " << (T) << std::endl; \
713  } \
714  test = (T);
715 
716  bool
717  SetTest::run(void) {
718  using namespace Gecode;
719  const char* test = "NONE";
720  const char* problem = "NONE";
721 
722  SetAssignment* ap = new SetAssignment(arity,lub,withInt);
723  SetAssignment& a = *ap;
724  while (a()) {
725  bool is_sol = solution(a);
726  if (opt.log)
727  olog << ind(1) << "Assignment: " << a
728  << (is_sol ? " (solution)" : " (no solution)")
729  << std::endl;
730  START_TEST("Assignment (after posting)");
731  {
732  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
733  SetTestSpace* sc = NULL;
734  s->post();
735  switch (Base::rand(3)) {
736  case 0:
737  if (opt.log)
738  olog << ind(3) << "No copy" << std::endl;
739  sc = s;
740  s = NULL;
741  break;
742  case 1:
743  if (opt.log)
744  olog << ind(3) << "Unshared copy" << std::endl;
745  if (s->status() != Gecode::SS_FAILED) {
746  sc = static_cast<SetTestSpace*>(s->clone(true));
747  } else {
748  sc = s; s = NULL;
749  }
750  break;
751  case 2:
752  if (opt.log)
753  olog << ind(3) << "Unshared copy" << std::endl;
754  if (s->status() != Gecode::SS_FAILED) {
755  sc = static_cast<SetTestSpace*>(s->clone(false));
756  } else {
757  sc = s; s = NULL;
758  }
759  break;
760  default: assert(false);
761  }
762  sc->assign(a);
763  if (is_sol) {
764  CHECK_TEST(!sc->failed(), "Failed on solution");
765  CHECK_TEST(sc->propagators()==0, "No subsumption");
766  } else {
767  CHECK_TEST(sc->failed(), "Solved on non-solution");
768  }
769  delete s; delete sc;
770  }
771  START_TEST("Assignment (after posting, disable)");
772  {
773  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
774  s->post();
775  s->disable();
776  s->assign(a);
777  s->enable();
778  if (is_sol) {
779  CHECK_TEST(!s->failed(), "Failed on solution");
780  CHECK_TEST(s->propagators()==0, "No subsumption");
781  } else {
782  CHECK_TEST(s->failed(), "Solved on non-solution");
783  }
784  delete s;
785  }
786  START_TEST("Assignment (before posting)");
787  {
788  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
789  s->assign(a);
790  s->post();
791  if (is_sol) {
792  CHECK_TEST(!s->failed(), "Failed on solution");
793  CHECK_TEST(s->propagators()==0, "No subsumption");
794  } else {
795  CHECK_TEST(s->failed(), "Solved on non-solution");
796  }
797  delete s;
798  }
799  START_TEST("Prune");
800  {
801  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
802  s->post();
803  while (!s->failed() && !s->assigned())
804  if (!s->prune(a)) {
805  problem = "No fixpoint";
806  delete s;
807  goto failed;
808  }
809  s->assign(a);
810  if (is_sol) {
811  CHECK_TEST(!s->failed(), "Failed on solution");
812  CHECK_TEST(s->propagators()==0, "No subsumption");
813  } else {
814  CHECK_TEST(s->failed(), "Solved on non-solution");
815  }
816  delete s;
817  }
818  if (disabled) {
819  START_TEST("Prune (disable)");
820  {
821  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this);
822  SetTestSpace* c = new SetTestSpace(arity,lub,withInt,this);
823  s->post(); c->post();
824  while (!s->failed() && !s->assigned())
825  if (!s->disabled(a,*c)) {
826  problem = "Different result after re-enable";
827  delete s; delete c;
828  goto failed;
829  }
830  s->assign(a); c->assign(a);
831  if (s->failed() != c->failed()) {
832  problem = "Different failure after re-enable";
833  delete s; delete c;
834  goto failed;
835  }
836  delete s; delete c;
837  }
838  }
839  if (reified) {
840  START_TEST("Assignment reified (rewrite after post, <=>)");
841  {
842  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
843  s->post();
844  s->rel(is_sol);
845  s->assign(a);
846  CHECK_TEST(!s->failed(), "Failed");
847  CHECK_TEST(s->propagators()==0, "No subsumption");
848  delete s;
849  }
850  START_TEST("Assignment reified (rewrite after post, =>)");
851  {
852  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
853  s->post();
854  s->rel(is_sol);
855  s->assign(a);
856  CHECK_TEST(!s->failed(), "Failed");
857  CHECK_TEST(s->propagators()==0, "No subsumption");
858  delete s;
859  }
860  START_TEST("Assignment reified (rewrite after post, <=)");
861  {
862  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
863  s->post();
864  s->rel(is_sol);
865  s->assign(a);
866  CHECK_TEST(!s->failed(), "Failed");
867  CHECK_TEST(s->propagators()==0, "No subsumption");
868  delete s;
869  }
870  {
871  START_TEST("Assignment reified (rewrite failure, <=>)");
872  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
873  s->post();
874  s->rel(!is_sol);
875  s->assign(a);
876  CHECK_TEST(s->failed(), "Not failed");
877  delete s;
878  }
879  {
880  START_TEST("Assignment reified (rewrite failure, =>)");
881  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
882  s->post();
883  s->rel(!is_sol);
884  s->assign(a);
885  if (is_sol) {
886  CHECK_TEST(!s->failed(), "Failed");
887  CHECK_TEST(s->propagators()==0, "No subsumption");
888  } else {
889  CHECK_TEST(s->failed(), "Not failed");
890  }
891  delete s;
892  }
893  {
894  START_TEST("Assignment reified (rewrite failure, <=)");
895  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
896  s->post();
897  s->rel(!is_sol);
898  s->assign(a);
899  if (is_sol) {
900  CHECK_TEST(s->failed(), "Not failed");
901  } else {
902  CHECK_TEST(!s->failed(), "Failed");
903  CHECK_TEST(s->propagators()==0, "No subsumption");
904  }
905  delete s;
906  }
907  START_TEST("Assignment reified (immediate rewrite, <=>)");
908  {
909  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
910  s->rel(is_sol);
911  s->post();
912  s->assign(a);
913  CHECK_TEST(!s->failed(), "Failed");
914  CHECK_TEST(s->propagators()==0, "No subsumption");
915  delete s;
916  }
917  START_TEST("Assignment reified (immediate rewrite, =>)");
918  {
919  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
920  s->rel(is_sol);
921  s->post();
922  s->assign(a);
923  CHECK_TEST(!s->failed(), "Failed");
924  CHECK_TEST(s->propagators()==0, "No subsumption");
925  delete s;
926  }
927  START_TEST("Assignment reified (immediate rewrite, <=)");
928  {
929  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
930  s->rel(is_sol);
931  s->post();
932  s->assign(a);
933  CHECK_TEST(!s->failed(), "Failed");
934  CHECK_TEST(s->propagators()==0, "No subsumption");
935  delete s;
936  }
937  START_TEST("Assignment reified (immediate failure, <=>)");
938  {
939  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
940  s->rel(!is_sol);
941  s->post();
942  s->assign(a);
943  CHECK_TEST(s->failed(), "Not failed");
944  delete s;
945  }
946  START_TEST("Assignment reified (immediate failure, =>)");
947  {
948  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
949  s->rel(!is_sol);
950  s->post();
951  s->assign(a);
952  if (is_sol) {
953  CHECK_TEST(!s->failed(), "Failed");
954  CHECK_TEST(s->propagators()==0, "No subsumption");
955  } else {
956  CHECK_TEST(s->failed(), "Not failed");
957  }
958  delete s;
959  }
960  START_TEST("Assignment reified (immediate failure, <=)");
961  {
962  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
963  s->rel(!is_sol);
964  s->post();
965  s->assign(a);
966  if (is_sol) {
967  CHECK_TEST(s->failed(), "Not failed");
968  } else {
969  CHECK_TEST(!s->failed(), "Failed");
970  CHECK_TEST(s->propagators()==0, "No subsumption");
971  }
972  delete s;
973  }
974  START_TEST("Assignment reified (before posting, <=>)");
975  {
976  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
977  s->assign(a);
978  s->post();
979  CHECK_TEST(!s->failed(), "Failed");
980  CHECK_TEST(s->propagators()==0, "No subsumption");
981  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
982  if (is_sol) {
983  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
984  } else {
985  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
986  }
987  delete s;
988  }
989  START_TEST("Assignment reified (before posting, =>)");
990  {
991  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
992  s->assign(a);
993  s->post();
994  CHECK_TEST(!s->failed(), "Failed");
995  CHECK_TEST(s->propagators()==0, "No subsumption");
996  if (is_sol) {
997  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
998  } else {
999  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1000  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1001  }
1002  delete s;
1003  }
1004  START_TEST("Assignment reified (before posting, <=)");
1005  {
1006  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1007  s->assign(a);
1008  s->post();
1009  CHECK_TEST(!s->failed(), "Failed");
1010  CHECK_TEST(s->propagators()==0, "No subsumption");
1011  if (is_sol) {
1012  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1013  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1014  } else {
1015  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1016  }
1017  delete s;
1018  }
1019  START_TEST("Assignment reified (after posting, <=>)");
1020  {
1021  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
1022  s->post();
1023  s->assign(a);
1024  CHECK_TEST(!s->failed(), "Failed");
1025  CHECK_TEST(s->propagators()==0, "No subsumption");
1026  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1027  if (is_sol) {
1028  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1029  } else {
1030  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1031  }
1032  delete s;
1033  }
1034  START_TEST("Assignment reified (after posting, =>)");
1035  {
1036  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
1037  s->post();
1038  s->assign(a);
1039  CHECK_TEST(!s->failed(), "Failed");
1040  CHECK_TEST(s->propagators()==0, "No subsumption");
1041  if (is_sol) {
1042  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1043  } else {
1044  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1045  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1046  }
1047  delete s;
1048  }
1049  START_TEST("Assignment reified (after posting, <=)");
1050  {
1051  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1052  s->post();
1053  s->assign(a);
1054  CHECK_TEST(!s->failed(), "Failed");
1055  CHECK_TEST(s->propagators()==0, "No subsumption");
1056  if (is_sol) {
1057  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1058  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1059  } else {
1060  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1061  }
1062  delete s;
1063  }
1064  START_TEST("Assignment reified (after posting, <=>, disable)");
1065  {
1066  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
1067  s->post();
1068  s->disable();
1069  s->assign(a);
1070  s->enable();
1071  CHECK_TEST(!s->failed(), "Failed");
1072  CHECK_TEST(s->propagators()==0, "No subsumption");
1073  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1074  if (is_sol) {
1075  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1076  } else {
1077  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1078  }
1079  delete s;
1080  }
1081  START_TEST("Assignment reified (after posting, =>, disable)");
1082  {
1083  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
1084  s->post();
1085  s->disable();
1086  s->assign(a);
1087  s->enable();
1088  CHECK_TEST(!s->failed(), "Failed");
1089  CHECK_TEST(s->propagators()==0, "No subsumption");
1090  if (is_sol) {
1091  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1092  } else {
1093  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1094  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1095  }
1096  delete s;
1097  }
1098  START_TEST("Assignment reified (after posting, <=, disable)");
1099  {
1100  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1101  s->post();
1102  s->disable();
1103  s->assign(a);
1104  s->enable();
1105  CHECK_TEST(!s->failed(), "Failed");
1106  CHECK_TEST(s->propagators()==0, "No subsumption");
1107  if (is_sol) {
1108  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1109  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1110  } else {
1111  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1112  }
1113  delete s;
1114  }
1115  START_TEST("Prune reified, <=>");
1116  {
1117  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_EQV);
1118  s->post();
1119  while (!s->failed() &&
1120  (!s->assigned() || !s->r.var().assigned()))
1121  if (!s->prune(a)) {
1122  problem = "No fixpoint";
1123  delete s;
1124  goto failed;
1125  }
1126  CHECK_TEST(!s->failed(), "Failed");
1127  CHECK_TEST(s->propagators()==0, "No subsumption");
1128  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1129  if (is_sol) {
1130  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1131  } else {
1132  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1133  }
1134  delete s;
1135  }
1136  START_TEST("Prune reified, =>");
1137  {
1138  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_IMP);
1139  s->post();
1140  while (!s->failed() &&
1141  (!s->assigned() || (!is_sol && !s->r.var().assigned())))
1142  if (!s->prune(a)) {
1143  problem = "No fixpoint";
1144  delete s;
1145  goto failed;
1146  }
1147  CHECK_TEST(!s->failed(), "Failed");
1148  CHECK_TEST(s->propagators()==0, "No subsumption");
1149  if (is_sol) {
1150  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1151  } else {
1152  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1153  CHECK_TEST(s->r.var().val()==0, "One on non-solution");
1154  }
1155  delete s;
1156  }
1157  START_TEST("Prune reified, <=");
1158  {
1159  SetTestSpace* s = new SetTestSpace(arity,lub,withInt,this,RM_PMI);
1160  s->post();
1161  while (!s->failed() &&
1162  (!s->assigned() || (is_sol && !s->r.var().assigned())))
1163  if (!s->prune(a)) {
1164  problem = "No fixpoint";
1165  delete s;
1166  goto failed;
1167  }
1168  CHECK_TEST(!s->failed(), "Failed");
1169  CHECK_TEST(s->propagators()==0, "No subsumption");
1170  if (is_sol) {
1171  CHECK_TEST(s->r.var().assigned(), "Control variable unassigned");
1172  CHECK_TEST(s->r.var().val()==1, "Zero on solution");
1173  } else {
1174  CHECK_TEST(!s->r.var().assigned(), "Control variable assigned");
1175  }
1176  delete s;
1177  }
1178  }
1179  ++a;
1180  }
1181  delete ap;
1182  return true;
1183  failed:
1184  if (opt.log)
1185  olog << "FAILURE" << std::endl
1186  << ind(1) << "Test: " << test << std::endl
1187  << ind(1) << "Problem: " << problem << std::endl;
1188  if (a() && opt.log)
1189  olog << ind(1) << "Assignment: " << a << std::endl;
1190  delete ap;
1191 
1192  return false;
1193  }
1194 
1195  const Gecode::SetRelType SetRelTypes::srts[] =
1198 
1199  const Gecode::SetOpType SetOpTypes::sots[] =
1202 
1203 }}
1204 
1205 #undef START_TEST
1206 #undef CHECK_TEST
1207 
1208 // 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:284
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:222
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:694
SetRelType
Common relation types for sets.
Definition: set.hh:643
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:209
const int min
Smallest allowed integer in integer set.
Definition: set.hh:101
Range iterator for integer sets.
Definition: int.hh:272
void log(Home home, FloatVar x0, FloatVar x1)
Post propagator for .
Definition: arithmetic.cpp:151
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:985
const FloatNum max
Largest allowed float value.
Definition: float.hh:846
ReifyMode mode(void) const
Return reification mode.
Definition: reify.hpp:60
void update(Space &home, bool share, VarImpVar< VarImp > &y)
Update this variable to be a clone of variable y.
Definition: var.hpp:128
static Gecode::Support::RandomGenerator rand
Random number generator.
Definition: test.hh:138
Gecode::SetVarArray x
Set variables to be tested.
Definition: set.hh:203
unsigned int size(void) const
Return size (cardinality) of domain.
Definition: bool.hpp:85
void enable(void)
Enable propagators in space.
Definition: set.cpp:689
void disable(Space &home)
Disable all propagators in a group.
Definition: core.cpp:786
static PropagatorGroup all
Group of all propagators.
Definition: core.hpp:838
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:257
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:117
CountableSet(void)
Default constructor.
Definition: set.hh:146
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:373
int val(void) const
Return current subset.
Definition: set.cpp:68
Space * clone(bool share_data=true, bool share_info=true, CloneStatistics &stat=unused_clone) const
Clone space.
Definition: core.hpp:3258
SetOpType
Common operations for sets.
Definition: set.hh:660
Greater ( )
Definition: int.hh:910
Superset ( )
Definition: set.hh:647
Complement.
Definition: set.hh:649
const unsigned int card
Maximum cardinality of an integer set.
Definition: set.hh:103
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:99
Computation spaces.
Definition: core.hpp:1672
Greater or equal ( )
Definition: int.hh:909
Difference.
Definition: set.hh:664
unsigned int size(Space &home) const
Return number of propagators in a group.
Definition: core.cpp:762
Iterator for the unknown ranges of a set variable.
Definition: set.hh:336
Gecode::IntSet d(v, 7)
bool reified
Whether the test is for a reified propagator.
Definition: set.hh:211
void update(Space &, bool share, VarArray< Var > &a)
Update array to be a clone of array a.
Definition: array.hpp:1072
void rel(int i, Gecode::SetRelType srt, const Gecode::IntSet &is)
Perform set tell operation on x[i].
Definition: set.cpp:201
struct Gecode::@554::NNF::@60::@62 a
For atomic nodes.
const FloatNum min
Smallest allowed float value.
Definition: float.hh:848
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
union Gecode::@554::NNF::@60 u
Union depending on nodetype t.
IntRelType
Relation types for integers.
Definition: int.hh:904
Range iterator for computing intersection (binary)
Less or equal ( )
Definition: set.hh:650
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.
Subset ( )
Definition: set.hh:646
virtual bool run(void)
Perform test.
Definition: set.cpp:717
bool log
Whether to log the tests.
Definition: test.hh:95
Gecode::IntSet lub
The common superset for all domains.
Definition: set.hh:170
Intersection
Definition: set.hh:663
Less ( )
Definition: int.hh:908
Integer sets.
Definition: int.hh:172
const Test::Int::Assignment & ints(void) const
Return assignment for integer variables.
Definition: set.hh:187
Less ( )
Definition: set.hh:651
#define START_TEST(T)
Start new test.
Definition: set.cpp:709
bool assigned(void) const
Test whether all variables are assigned.
Definition: set.cpp:273
static const IntSet empty
Empty set.
Definition: int.hh:263
Gecode::IntSet d
Initial domain.
Definition: set.hh:201
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:404
General test support.
Definition: afc.cpp:43
Union.
Definition: set.hh:661
unsigned int propagators(void)
Return the number of propagators.
Definition: set.cpp:684
Passing set variables.
Definition: set.hh:490
Greater or equal ( )
Definition: set.hh:652
int withInt
How many integer variables to iterate.
Definition: set.hh:172
void addToGlb(int v, int i, const SetAssignment &a)
Remove value v from the lower bound of x[i].
Definition: set.cpp:312
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:540
virtual void post(Gecode::Space &home, Gecode::SetVarArray &x, Gecode::IntVarArray &y)=0
Post propagator.
Disjoint union.
Definition: set.hh:662
struct Gecode::Space::@55::@57 c
Data available only during copying.
Base class for tests with set constraints
Definition: set.hh:287
Generate all set assignments.
Definition: set.hh:158
Region r
Definition: region.cpp:82
void operator++(void)
Move to next assignment.
Definition: set.cpp:80
bool fixprob(void)
Perform fixpoint computation.
Definition: set.cpp:340
void enable(Space &home, bool s=true)
Enable all propagators in a group.
Definition: core.cpp:795
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:205
BoolVar var(void) const
Return Boolean control variable.
Definition: reify.hpp:52
Range iterator producing subsets of an IntSet.
Definition: set.hh:114
Greater ( )
Definition: set.hh:653
Equality ( )
Definition: set.hh:644
Disjoint ( )
Definition: set.hh:648
SpaceStatus status(StatusStatistics &stat=unused_status)
Query space status.
Definition: core.cpp:234
int withInt
How many integer variables are used by the test.
Definition: set.hh:207
int max(void) const
Return largest value of range.
Set variable array
Definition: set.hh:570
Disequality ( )
Definition: set.hh:645
Gecode toplevel namespace
Implication for reification.
Definition: int.hh:841
int size(void) const
Return arity.
Definition: set.hh:189
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:701
SetTest * test
The test currently run.
Definition: set.hh:213
Space is failed
Definition: core.hpp:1611
Space for executing set tests.
Definition: set.hh:198
struct Gecode::@554::NNF::@60::@61 b
For binary nodes (and, or, eqv)
Iterate all subsets of a given set.
Definition: set.hh:134
ReifyMode
Mode for reification.
Definition: int.hh:827
virtual Gecode::Space * copy(bool share)
Copy space during cloning.
Definition: set.cpp:169
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