Generated on Sat Feb 7 2015 02:01:30 for Gecode by doxygen 1.8.9.1
common.hpp
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  *
7  * Contributing authors:
8  * Gabor Szokoli <szokoli@gecode.org>
9  *
10  * Copyright:
11  * Guido Tack, 2004
12  * Christian Schulte, 2004
13  * Gabor Szokoli, 2004
14  *
15  * Last modified:
16  * $Date: 2012-09-07 17:31:22 +0200 (Fri, 07 Sep 2012) $ by $Author: schulte $
17  * $Revision: 13068 $
18  *
19  * This file is part of Gecode, the generic constraint
20  * development environment:
21  * http://www.gecode.org
22  *
23  * Permission is hereby granted, free of charge, to any person obtaining
24  * a copy of this software and associated documentation files (the
25  * "Software"), to deal in the Software without restriction, including
26  * without limitation the rights to use, copy, modify, merge, publish,
27  * distribute, sublicense, and/or sell copies of the Software, and to
28  * permit persons to whom the Software is furnished to do so, subject to
29  * the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be
32  * included in all copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
36  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
38  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
39  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
40  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41  *
42  */
43 
44 #ifndef __GECODE_SET_RELOP_COMM_ICC__
45 #define __GECODE_SET_RELOP_COMM_ICC__
46 
47 namespace Gecode {
48 
49  template<class View0, class View1>
50  forceinline bool
51  viewarrayshared(const Space& home,
52  const ViewArray<View0>& va, const View1& y) {
53  return va.shared(home,y);
54  }
55 
56  template<>
57  forceinline bool
58  viewarrayshared<Set::SingletonView,Set::SetView>
60  return false;
61  }
62 
63  template<>
64  forceinline bool
65  viewarrayshared<Set::ComplementView<Set::SingletonView>,Set::SetView>
66  (const Space&, const ViewArray<Set::ComplementView<Set::SingletonView> >&,
67  const Set::SetView&) {
68  return false;
69  }
70 
71  template<>
72  forceinline bool
73  viewarrayshared<Set::ComplementView<Set::SingletonView>,
74  Set::ComplementView<Set::SetView> >
75  (const Space&, const ViewArray<Set::ComplementView<Set::SingletonView> >&,
76  const Set::ComplementView<Set::SetView>&) {
77  return false;
78  }
79 
80 
81 namespace Set { namespace RelOp {
82 
83  /*
84  * Detect sharing between 3 variables
85  *
86  */
87  template<class View0, class View1, class View2>
88  forceinline bool
89  shared(View0 v0, View1 v1, View2 v2) {
90  return shared(v0,v1) || shared(v0,v2) || shared(v1,v2);
91  }
92 
93  template<class View0, class View1, class View2>
94  ExecStatus interCard(Space& home,
95  bool& retmodified, View0& x0, View1& x1, View2& x2) {
96  bool modified = false;
97  do {
98  retmodified |= modified;
99  modified = false;
100 
101  {
102  LubRanges<View0> x0ub(x0);
103  LubRanges<View1> x1ub(x1);
105  u1(x0ub,x1ub);
106  unsigned int s1 = Iter::Ranges::size(u1);
107 
108  if (x0.cardMin() + x1.cardMin() > s1) {
109  GECODE_ME_CHECK_MODIFIED(modified,
110  x2.cardMin(home, x0.cardMin()+x1.cardMin()-s1));
111  }
112 
113  // unsigned int res = std::max(x0.cardMin()+
114  // (x1.cardMin()<s1 ?
115  // 0 : x1.cardMin()-s1),
116  // std::max(x0.cardMin(),
117  // x1.cardMin()));
118  // GECODE_ME_CHECK_MODIFIED(modified, x2.cardMin(home,res));
119  }
120 
121  {
122  GlbRanges<View0> x0lb(x0);
123  GlbRanges<View1> x1lb(x1);
125  u1(x0lb,x1lb);
126  unsigned int s1 = Iter::Ranges::size(u1);
127  GECODE_ME_CHECK_MODIFIED(modified,
128  x2.cardMax(home,
129  x0.cardMax()+x1.cardMax()-s1));
130  }
131 
132  if (x2.cardMax() < x1.cardMin())
133  GECODE_ME_CHECK_MODIFIED(modified,
134  x0.cardMax(home,
135  Set::Limits::card+x2.cardMax()-x1.cardMin()));
136 
137  if (x2.cardMax() < x0.cardMin())
138  GECODE_ME_CHECK_MODIFIED(modified,
139  x1.cardMax(home,
140  Set::Limits::card+x2.cardMax()-x0.cardMin()));
141 
142  GECODE_ME_CHECK_MODIFIED(modified,
143  x0.cardMin(home,x2.cardMin()));
144  GECODE_ME_CHECK_MODIFIED(modified,
145  x1.cardMin(home,x2.cardMin()));
146  } while(modified);
147  return ES_FIX;
148  }
149  template<class View0, class View1, class View2>
150  ExecStatus unionCard(Space& home,
151  bool& retmodified, View0& x0, View1& x1, View2& x2) {
152  bool modified = false;
153  do {
154  retmodified |= modified;
155  modified = false;
156 
157  {
158  LubRanges<View0> x0ub(x0);
159  LubRanges<View1> x1ub(x1);
161  unsigned int s1 = Iter::Ranges::size(i1);
162  unsigned int res = std::max(x0.cardMin()+
163  (x1.cardMin()<s1 ?
164  0 : x1.cardMin()-s1),
165  std::max(x0.cardMin(),
166  x1.cardMin()));
167  GECODE_ME_CHECK_MODIFIED(modified, x2.cardMin(home,res));
168  }
169 
170  {
171  LubRanges<View0> x0ub(x0);
172  LubRanges<View1> x1ub(x1);
174  unsigned int s1 = Iter::Ranges::size(u1);
175  GECODE_ME_CHECK_MODIFIED(modified,
176  x2.cardMax(home,
177  std::min(x0.cardMax()+x1.cardMax(),s1)));
178  }
179 
180  if (x2.cardMin() > x1.cardMax())
181  GECODE_ME_CHECK_MODIFIED(modified,
182  x0.cardMin(home,x2.cardMin() - x1.cardMax()));
183 
184  if (x2.cardMin() > x0.cardMax())
185  GECODE_ME_CHECK_MODIFIED(modified,
186  x1.cardMin(home,x2.cardMin() - x0.cardMax()));
187 
188  GECODE_ME_CHECK_MODIFIED(modified,
189  x0.cardMax(home,x2.cardMax()));
190  GECODE_ME_CHECK_MODIFIED(modified,
191  x1.cardMax(home,x2.cardMax()));
192  } while(modified);
193  return ES_FIX;
194  }
195 
196  template<class View0, class View1>
197  ExecStatus
198  unionNCard(Space& home, bool& modified, ViewArray<View0>& x,
199  View1& y, GLBndSet& unionOfDets) {
200  int xsize = x.size();
201  // Max(Xi.cardMin) <= y.card <= Sum(Xi.cardMax)
202  // Xi.card <=y.cardMax
203  unsigned int cardMaxSum=unionOfDets.size();
204  bool maxValid = true;
205  for (int i=xsize; i--; ){
206  cardMaxSum+=x[i].cardMax();
207  if (cardMaxSum < x[i].cardMax()) { maxValid = false; } //overflow
208  GECODE_ME_CHECK_MODIFIED(modified, y.cardMin(home,x[i].cardMin()) );
209  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMax(home,y.cardMax()) );
210  }
211  if (maxValid) {
212  GECODE_ME_CHECK_MODIFIED(modified, y.cardMax(home,cardMaxSum));
213  }
214  //y.cardMin - Sum(Xj.cardMax) <= Xi.card
215 
216  if (x.size() == 0)
217  return ES_NOFIX;
218 
219  Region r(home);
220  //TODO: overflow management is a waste now.
221  {
222  unsigned int* rightSum = r.alloc<unsigned int>(xsize);
223  rightSum[xsize-1]=0;
224 
225  for (int i=x.size()-1;i--;) {
226  rightSum[i] = rightSum[i+1] + x[i+1].cardMax();
227  if (rightSum[i] < rightSum[i+1]) {
228  //overflow, fill the rest of the array.
229  for (int j=i; j>0;j--) {
230  rightSum[j]=Limits::card;
231  }
232  break;
233  }
234  }
235 
236  //Size of union of determied vars missing from x sneaked in here:
237  unsigned int leftAcc=unionOfDets.size();
238 
239  for (int i=0; i<xsize;i++) {
240  unsigned int jsum = leftAcc+rightSum[i];
241  //If jsum did not overflow and is less than y.cardMin:
242  if (jsum >= leftAcc && jsum < y.cardMin()) {
243  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMin(home,y.cardMin()-jsum));
244  }
245  leftAcc += x[i].cardMax();
246  if (leftAcc < x[i].cardMax()) {leftAcc = Limits::card;}
247  }
248  }
249 
250  //y.cardMin - |U(Xj.ub)| <= Xi.card
251 
252  {
253  GLBndSet* rightUnion =
254  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
255  new (&rightUnion[xsize-1]) GLBndSet(home);
256  for (int i=xsize-1;i--;){
257  BndSetRanges prev(rightUnion[i+1]);
258  LubRanges<View0> prevX(x[i+1]);
260  iter(prev,prevX);
261  new (&rightUnion[i]) GLBndSet(home);
262  rightUnion[i].includeI(home, iter);
263  }
264 
265  //union of determied vars missing from x sneaked in here:
266  GLBndSet leftAcc;
267  leftAcc.update(home,unionOfDets);
268  for (int i=0; i<xsize; i++) {
269  BndSetRanges left(leftAcc);
270  BndSetRanges right(rightUnion[i]);
272  BndSetRanges> iter(left, right);
273  unsigned int unionSize = Iter::Ranges::size(iter);
274  if (y.cardMin() > unionSize) {
275  GECODE_ME_CHECK_MODIFIED(modified,
276  x[i].cardMin(home, y.cardMin() - unionSize) );
277  }
278  LubRanges<View0> xiub(x[i]);
279  leftAcc.includeI(home, xiub);
280  }
281 
282  for (int i=xsize; i--;)
283  rightUnion[i].dispose(home);
284  leftAcc.dispose(home);
285  }
286 
287  //no need for this: |y.lb - U(Xj.cardMax)| <= S.card
288 
289  return ES_NOFIX;
290 
291  }
292 
293  /*
294  * Xi UB is subset of YUB
295  * Subscribes to Y UB
296  */
297  template<class View0, class View1>
298  ExecStatus
299  unionNXiUB(Space& home,
300  bool& modified, ViewArray<View0>& x, View1& y,
301  GLBndSet &) {
302  int xsize = x.size();
303  for (int i=xsize; i--; ) {
304  LubRanges<View1> yub(y);
305  GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home, yub));
306  }
307  return ES_FIX;
308  }
309 
310  // cardinality rules for PartitionN constraint
311  template<class View0, class View1>
312  ExecStatus
313  partitionNCard(Space& home,
314  bool& modified, ViewArray<View0>& x, View1& y,
315  GLBndSet& unionOfDets) {
316  unsigned int cardMinSum=unionOfDets.size();
317  unsigned int cardMaxSum=unionOfDets.size();
318  int xsize = x.size();
319  for (int i=xsize; i--; ) {
320  cardMinSum+=x[i].cardMin();
321  if (cardMinSum < x[i].cardMin()) {
322  //sum of mins overflows: fail the space.
324  }
325  }
326  GECODE_ME_CHECK_MODIFIED(modified, y.cardMin(home,cardMinSum));
327  for (int i=xsize; i--; ) {
328  cardMaxSum+=x[i].cardMax();
329  if (cardMaxSum < x[i].cardMax()) {
330  //sum of maxes overflows: no useful information to tell.
331  goto overflow;
332  }
333  }
334  GECODE_ME_CHECK_MODIFIED(modified, y.cardMax(home,cardMaxSum));
335 
336  if (x.size() == 0)
337  return ES_NOFIX;
338 
339  overflow:
340 
341  //Cardinality of each x[i] limited by cardinality of y minus all x[j]s:
342 
343  {
344  Region r(home);
345  unsigned int* rightMinSum = r.alloc<unsigned int>(xsize);
346  unsigned int* rightMaxSum = r.alloc<unsigned int>(xsize);
347  rightMinSum[xsize-1]=0;
348  rightMaxSum[xsize-1]=0;
349 
350  for (int i=x.size()-1;i--;) {
351  rightMaxSum[i] = rightMaxSum[i+1] + x[i+1].cardMax();
352  if (rightMaxSum[i] < rightMaxSum[i+1]) {
353  //overflow, fill the rest of the array.
354  for (int j=i; j>0;j--) {
355  rightMaxSum[j]=Limits::card;
356  }
357  break;
358  }
359  }
360  for (int i=x.size()-1;i--;) {
361  rightMinSum[i] = rightMinSum[i+1] + x[i+1].cardMin();
362  if (rightMinSum[i] < rightMinSum[i+1]) {
363  //overflow, fail the space
365  }
366  }
367  unsigned int leftMinAcc=unionOfDets.size();
368  unsigned int leftMaxAcc=unionOfDets.size();
369 
370  for (int i=0; i<xsize;i++) {
371  unsigned int maxSum = leftMaxAcc+rightMaxSum[i];
372  unsigned int minSum = leftMinAcc+rightMinSum[i];
373  //If maxSum did not overflow and is less than y.cardMin:
374  if (maxSum >= leftMaxAcc && maxSum < y.cardMin()) {
375  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMin(home,y.cardMin()-maxSum));
376  }
377 
378  //Overflow, fail.
379  if (minSum < leftMinAcc || y.cardMax() < minSum) {
381  }
382  else {
383  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMax(home,y.cardMax()-minSum));
384  }
385 
386  leftMaxAcc += x[i].cardMax();
387  if (leftMaxAcc < x[i].cardMax())
388  leftMaxAcc = Limits::card;
389  leftMinAcc += x[i].cardMin();
390  if (leftMinAcc < x[i].cardMin())
392  }
393  }
394 
395  return ES_NOFIX;
396  }
397 
398  // Xi LB includes YLB minus union Xj UB
399  // Xi UB is subset of YUB minus union of Xj LBs
400  template<class View0, class View1>
401  ExecStatus
402  partitionNXi(Space& home,
403  bool& modified, ViewArray<View0>& x, View1& y) {
404  int xsize = x.size();
405  Region r(home);
406  GLBndSet* afterUB =
407  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
408  GLBndSet* afterLB =
409  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
410 
411  {
412  GLBndSet sofarAfterUB;
413  GLBndSet sofarAfterLB;
414  for (int i=xsize; i--;) {
415  new (&afterUB[i]) GLBndSet(home);
416  new (&afterLB[i]) GLBndSet(home);
417  afterUB[i].update(home,sofarAfterUB);
418  afterLB[i].update(home,sofarAfterLB);
419  LubRanges<View0> xiub(x[i]);
420  GlbRanges<View0> xilb(x[i]);
421  sofarAfterUB.includeI(home,xiub);
422  sofarAfterLB.includeI(home,xilb);
423  }
424  sofarAfterUB.dispose(home);
425  sofarAfterLB.dispose(home);
426  }
427 
428  {
429  GLBndSet sofarBeforeUB;
430  GLBndSet sofarBeforeLB;
431  for (int i=0; i<xsize; i++) {
432  LubRanges<View1> yub(y);
433  BndSetRanges slb(sofarBeforeLB);
434  BndSetRanges afterlb(afterLB[i]);
436  BndSetRanges> xjlb(slb, afterlb);
438  Iter::Ranges::Union<BndSetRanges,
439  BndSetRanges> > diff1(yub, xjlb);
440  GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home,diff1));
441 
442  GlbRanges<View1> ylb(y);
443  BndSetRanges sub(sofarBeforeUB);
444  BndSetRanges afterub(afterUB[i]);
445  Iter::Ranges::Union<BndSetRanges,
446  BndSetRanges> xjub(sub, afterub);
448  Iter::Ranges::Union<BndSetRanges,
449  BndSetRanges> > diff2(ylb, xjub);
450  GECODE_ME_CHECK_MODIFIED(modified, x[i].includeI(home,diff2));
451 
452  LubRanges<View0> xiub(x[i]);
453  GlbRanges<View0> xilb(x[i]);
454  sofarBeforeUB.includeI(home,xiub);
455  sofarBeforeLB.includeI(home,xilb);
456  }
457  sofarBeforeLB.dispose(home);
458  sofarBeforeUB.dispose(home);
459  }
460 
461  for (int i=xsize;i--;) {
462  afterUB[i].dispose(home);
463  afterLB[i].dispose(home);
464  }
465 
466  return ES_NOFIX;
467  }
468 
469  // Xi UB is subset of YUB minus union of Xj LBs
470  template<class View0, class View1>
471  ExecStatus
472  partitionNXiUB(Space& home,
473  bool& modified, ViewArray<View0>& x, View1& y,
474  GLBndSet& unionOfDets) {
475  int xsize = x.size();
476  Region r(home);
477  GLBndSet* afterLB =
478  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
479 
480  {
481  GLBndSet sofarAfterLB;
482  for (int i=xsize; i--;) {
483  new (&afterLB[i]) GLBndSet(home);
484  afterLB[i].update(home,sofarAfterLB);
485  GlbRanges<View0> xilb(x[i]);
486  sofarAfterLB.includeI(home,xilb);
487  }
488  sofarAfterLB.dispose(home);
489  }
490 
491  {
492  GLBndSet sofarBeforeLB;
493  sofarBeforeLB.update(home,unionOfDets);
494  for (int i=0; i<xsize; i++) {
495  LubRanges<View1> yub(y);
496  BndSetRanges slb(sofarBeforeLB);
497  BndSetRanges afterlb(afterLB[i]);
499  BndSetRanges> xjlb(slb, afterlb);
501  Iter::Ranges::Union<BndSetRanges,
502  BndSetRanges> > diff1(yub, xjlb);
503  GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home,diff1));
504 
505  GlbRanges<View0> xilb(x[i]);
506  sofarBeforeLB.includeI(home,xilb);
507  }
508  sofarBeforeLB.dispose(home);
509  }
510  for (int i=xsize; i--;)
511  afterLB[i].dispose(home);
512  return ES_NOFIX;
513  }
514 
515  // Xi LB includes YLB minus union Xj UB
516  template<class View0, class View1>
517  ExecStatus
518  partitionNXiLB(Space& home,
519  bool& modified, ViewArray<View0>& x, View1& y,
520  GLBndSet& unionOfDets) {
521  int xsize = x.size();
522  Region r(home);
523  GLBndSet* afterUB =
524  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
525 
526  {
527  GLBndSet sofarAfterUB;
528  for (int i=xsize; i--;) {
529  new (&afterUB[i]) GLBndSet(home);
530  afterUB[i].update(home,sofarAfterUB);
531  LubRanges<View0> xiub(x[i]);
532  sofarAfterUB.includeI(home,xiub);
533  }
534  sofarAfterUB.dispose(home);
535  }
536 
537  {
538  //The union of previously determined x[j]-s is added to the mix here:
539  GLBndSet sofarBeforeUB;
540  sofarBeforeUB.update(home,unionOfDets);
541  for (int i=0; i<xsize; i++) {
542  GlbRanges<View1> ylb(y);
543  BndSetRanges sub(sofarBeforeUB);
544  BndSetRanges afterub(afterUB[i]);
546  BndSetRanges> xjub(sub, afterub);
548  Iter::Ranges::Union<BndSetRanges,
549  BndSetRanges> > diff2(ylb, xjub);
550  GECODE_ME_CHECK_MODIFIED(modified, x[i].includeI(home,diff2));
551 
552  LubRanges<View0> xiub(x[i]);
553  sofarBeforeUB.includeI(home,xiub);
554  }
555  sofarBeforeUB.dispose(home);
556  }
557  for (int i=xsize;i--;)
558  afterUB[i].dispose(home);
559  return ES_NOFIX;
560  }
561 
562  // Y LB contains union of X LBs
563  template<class View0, class View1>
564  ExecStatus
565  partitionNYLB(Space& home,
566  bool& modified, ViewArray<View0>& x, View1& y,
567  GLBndSet& unionOfDets) {
568  assert(unionOfDets.isConsistent());
569  int xsize = x.size();
570  Region r(home);
571  GlbRanges<View0>* xLBs = r.alloc<GlbRanges<View0> >(xsize);
572  int nonEmptyCounter=0;
573  for (int i = xsize; i--; ) {
574  GlbRanges<View0> r(x[i]);
575  if (r()) {
576  xLBs[nonEmptyCounter] = r;
577  nonEmptyCounter++;
578  }
579  }
580  if (nonEmptyCounter !=0) {
581  Iter::Ranges::NaryUnion xLBUnion(r,xLBs,nonEmptyCounter);
582  BndSetRanges dets(unionOfDets);
583  xLBUnion |= dets;
584  GECODE_ME_CHECK_MODIFIED(modified, y.includeI(home,xLBUnion));
585  }
586  return ES_FIX;
587  }
588 
589  // Y UB is subset of union of X UBs
590  template<class View0, class View1>
591  ExecStatus
592  partitionNYUB(Space& home,
593  bool& modified, ViewArray<View0>& x, View1& y,
594  GLBndSet& unionOfDets) {
595  int xsize = x.size();
596  Region r(home);
597  LubRanges<View0>* xUBs = r.alloc<LubRanges<View0> >(xsize);
598  int nonEmptyCounter=0;
599  for (int i = xsize; i--; ) {
600  LubRanges<View0> r(x[i]);
601  if (r()) {
602  xUBs[nonEmptyCounter] = r;
603  nonEmptyCounter++;
604  }
605  }
606  if (nonEmptyCounter != 0) {
607  Iter::Ranges::NaryUnion xUBUnion(r,xUBs,nonEmptyCounter);
608  BndSetRanges dets(unionOfDets);
609  xUBUnion |= dets;
610  GECODE_ME_CHECK_MODIFIED(modified, y.intersectI(home,xUBUnion));
611  }
612  return ES_FIX;
613  }
614 
615 }}}
616 
617 #endif
618 
619 // STATISTICS: set-prop
ExecStatus partitionNXiUB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:472
ExecStatus partitionNYLB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:565
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
Definition: var-type.hpp:138
bool isConsistent(void) const
Check whether internal invariants hold.
Definition: integerset.cpp:293
const FloatNum max
Largest allowed float value.
Definition: float.hh:831
ExecStatus unionNXiUB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &)
Definition: common.hpp:299
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Definition: region.hpp:326
ExecStatus partitionNXiLB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:518
Range iterator for the greatest lower bound.
Definition: var-imp.hpp:363
ExecStatus interCard(Space &home, bool &retmodified, View0 &x0, View1 &x1, View2 &x2)
Definition: common.hpp:94
ExecStatus unionNCard(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:198
Handle to region.
Definition: region.hpp:61
Propagation has computed fixpoint.
Definition: core.hpp:528
const unsigned int card
Maximum cardinality of an integer set.
Definition: set.hh:103
Computation spaces.
Definition: core.hpp:1362
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
Definition: macros.hpp:57
Range iterator for the least upper bound.
Definition: var-imp.hpp:321
unsigned int size(void) const
Return size.
Definition: integerset.hpp:97
const FloatNum min
Smallest allowed float value.
Definition: float.hh:833
Gecode::IntArgs i(4, 1, 2, 3, 4)
Range iterator for computing intersection (binary)
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
bool shared(const Space &home) const
Test whether array contains shared views.
Definition: array.hpp:1511
Range iterator for union of iterators.
ExecStatus partitionNXi(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y)
Definition: common.hpp:402
unsigned int size(I &i)
Size of all ranges of range iterator i.
Range iterator for integer sets.
Definition: var-imp.hpp:189
ExecStatus partitionNYUB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:592
void update(Space &home, BndSet &x)
Update this set to be a clone of set x.
Definition: integerset.hpp:144
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:45
bool includeI(Space &home, I &i)
Include the set represented by i in this set.
Definition: integerset.hpp:300
void dispose(Space &home)
Free memory used by this set.
Definition: integerset.hpp:64
bool shared(View0 v0, View1 v1, View2 v2)
Definition: common.hpp:89
Range iterator for computing union (binary)
Set view for set variables
Definition: view.hpp:60
Node * x
Pointer to corresponding Boolean expression node.
Definition: bool-expr.cpp:253
ExecStatus
Definition: core.hpp:523
#define forceinline
Definition: config.hpp:132
Growing sets of integers.
Definition: var-imp.hpp:209
ExecStatus partitionNCard(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:313
Propagation has not computed fixpoint.
Definition: core.hpp:526
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1215
Gecode toplevel namespace
Range iterator for computing set difference.
Definition: ranges-diff.hpp:47
ExecStatus unionCard(Space &home, bool &retmodified, View0 &x0, View1 &x1, View2 &x2)
Definition: common.hpp:150
void * ralloc(size_t s)
Allocate memory from region.
Definition: region.hpp:302
bool viewarrayshared(const Space &home, const ViewArray< View0 > &va, const View1 &y)
Definition: common.hpp:51