Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
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$ by $Author$
17  * $Revision$
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 ViewArray<View0>& va, const View1& y) {
52  return va.shared(y);
53  }
54 
55  template<>
56  forceinline bool
57  viewarrayshared<Set::SingletonView,Set::SetView>
59  return false;
60  }
61 
62  template<>
63  forceinline bool
64  viewarrayshared<Set::ComplementView<Set::SingletonView>,Set::SetView>
66  const Set::SetView&) {
67  return false;
68  }
69 
70  template<>
71  forceinline bool
72  viewarrayshared<Set::ComplementView<Set::SingletonView>,
74  (const ViewArray<Set::ComplementView<Set::SingletonView> >&,
76  return false;
77  }
78 
79 
80 namespace Set { namespace RelOp {
81 
82  /*
83  * Detect sharing between 3 variables
84  *
85  */
86  template<class View0, class View1, class View2>
87  forceinline bool
88  shared(View0 v0, View1 v1, View2 v2) {
89  return shared(v0,v1) || shared(v0,v2) || shared(v1,v2);
90  }
91 
92  template<class View0, class View1, class View2>
94  bool& retmodified, View0& x0, View1& x1, View2& x2) {
95  bool modified = false;
96  do {
97  retmodified |= modified;
98  modified = false;
99 
100  {
101  LubRanges<View0> x0ub(x0);
102  LubRanges<View1> x1ub(x1);
104  u1(x0ub,x1ub);
105  unsigned int s1 = Iter::Ranges::size(u1);
106 
107  if (x0.cardMin() + x1.cardMin() > s1) {
108  GECODE_ME_CHECK_MODIFIED(modified,
109  x2.cardMin(home, x0.cardMin()+x1.cardMin()-s1));
110  }
111 
112  // unsigned int res = std::max(x0.cardMin()+
113  // (x1.cardMin()<s1 ?
114  // 0 : x1.cardMin()-s1),
115  // std::max(x0.cardMin(),
116  // x1.cardMin()));
117  // GECODE_ME_CHECK_MODIFIED(modified, x2.cardMin(home,res));
118  }
119 
120  {
121  GlbRanges<View0> x0lb(x0);
122  GlbRanges<View1> x1lb(x1);
124  u1(x0lb,x1lb);
125  unsigned int s1 = Iter::Ranges::size(u1);
126  GECODE_ME_CHECK_MODIFIED(modified,
127  x2.cardMax(home,
128  x0.cardMax()+x1.cardMax()-s1));
129  }
130 
131  if (x2.cardMax() < x1.cardMin())
132  GECODE_ME_CHECK_MODIFIED(modified,
133  x0.cardMax(home,
134  Set::Limits::card+x2.cardMax()-x1.cardMin()));
135 
136  if (x2.cardMax() < x0.cardMin())
137  GECODE_ME_CHECK_MODIFIED(modified,
138  x1.cardMax(home,
139  Set::Limits::card+x2.cardMax()-x0.cardMin()));
140 
141  GECODE_ME_CHECK_MODIFIED(modified,
142  x0.cardMin(home,x2.cardMin()));
143  GECODE_ME_CHECK_MODIFIED(modified,
144  x1.cardMin(home,x2.cardMin()));
145  } while(modified);
146  return ES_FIX;
147  }
148  template<class View0, class View1, class View2>
150  bool& retmodified, View0& x0, View1& x1, View2& x2) {
151  bool modified = false;
152  do {
153  retmodified |= modified;
154  modified = false;
155 
156  {
157  LubRanges<View0> x0ub(x0);
158  LubRanges<View1> x1ub(x1);
160  unsigned int s1 = Iter::Ranges::size(i1);
161  unsigned int res = std::max(x0.cardMin()+
162  (x1.cardMin()<s1 ?
163  0 : x1.cardMin()-s1),
164  std::max(x0.cardMin(),
165  x1.cardMin()));
166  GECODE_ME_CHECK_MODIFIED(modified, x2.cardMin(home,res));
167  }
168 
169  {
170  LubRanges<View0> x0ub(x0);
171  LubRanges<View1> x1ub(x1);
173  unsigned int s1 = Iter::Ranges::size(u1);
174  GECODE_ME_CHECK_MODIFIED(modified,
175  x2.cardMax(home,
176  std::min(x0.cardMax()+x1.cardMax(),s1)));
177  }
178 
179  if (x2.cardMin() > x1.cardMax())
180  GECODE_ME_CHECK_MODIFIED(modified,
181  x0.cardMin(home,x2.cardMin() - x1.cardMax()));
182 
183  if (x2.cardMin() > x0.cardMax())
184  GECODE_ME_CHECK_MODIFIED(modified,
185  x1.cardMin(home,x2.cardMin() - x0.cardMax()));
186 
187  GECODE_ME_CHECK_MODIFIED(modified,
188  x0.cardMax(home,x2.cardMax()));
189  GECODE_ME_CHECK_MODIFIED(modified,
190  x1.cardMax(home,x2.cardMax()));
191  } while(modified);
192  return ES_FIX;
193  }
194 
195  template<class View0, class View1>
196  ExecStatus
197  unionNCard(Space& home, bool& modified, ViewArray<View0>& x,
198  View1& y, GLBndSet& unionOfDets) {
199  int xsize = x.size();
200  // Max(Xi.cardMin) <= y.card <= Sum(Xi.cardMax)
201  // Xi.card <=y.cardMax
202  unsigned int cardMaxSum=unionOfDets.size();
203  bool maxValid = true;
204  for (int i=xsize; i--; ) {
205  cardMaxSum+=x[i].cardMax();
206  if (cardMaxSum < x[i].cardMax()) { maxValid = false; } //overflow
207  GECODE_ME_CHECK_MODIFIED(modified, y.cardMin(home,x[i].cardMin()) );
208  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMax(home,y.cardMax()) );
209  }
210  if (maxValid) {
211  GECODE_ME_CHECK_MODIFIED(modified, y.cardMax(home,cardMaxSum));
212  }
213  //y.cardMin - Sum(Xj.cardMax) <= Xi.card
214 
215  if (x.size() == 0)
216  return ES_NOFIX;
217 
218  Region r;
219  //TODO: overflow management is a waste now.
220  {
221  unsigned int* rightSum = r.alloc<unsigned int>(xsize);
222  rightSum[xsize-1]=0;
223 
224  for (int i=x.size()-1;i--;) {
225  rightSum[i] = rightSum[i+1] + x[i+1].cardMax();
226  if (rightSum[i] < rightSum[i+1]) {
227  //overflow, fill the rest of the array.
228  for (int j=i; j>0;j--) {
229  rightSum[j]=Limits::card;
230  }
231  break;
232  }
233  }
234 
235  //Size of union of determied vars missing from x sneaked in here:
236  unsigned int leftAcc=unionOfDets.size();
237 
238  for (int i=0; i<xsize;i++) {
239  unsigned int jsum = leftAcc+rightSum[i];
240  //If jsum did not overflow and is less than y.cardMin:
241  if (jsum >= leftAcc && jsum < y.cardMin()) {
242  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMin(home,y.cardMin()-jsum));
243  }
244  leftAcc += x[i].cardMax();
245  if (leftAcc < x[i].cardMax()) {leftAcc = Limits::card;}
246  }
247  }
248 
249  //y.cardMin - |U(Xj.ub)| <= Xi.card
250 
251  {
252  GLBndSet* rightUnion =
253  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
254  new (&rightUnion[xsize-1]) GLBndSet(home);
255  for (int i=xsize-1;i--;) {
256  BndSetRanges prev(rightUnion[i+1]);
257  LubRanges<View0> prevX(x[i+1]);
259  iter(prev,prevX);
260  new (&rightUnion[i]) GLBndSet(home);
261  rightUnion[i].includeI(home, iter);
262  }
263 
264  //union of determied vars missing from x sneaked in here:
265  GLBndSet leftAcc;
266  leftAcc.update(home,unionOfDets);
267  for (int i=0; i<xsize; i++) {
268  BndSetRanges left(leftAcc);
269  BndSetRanges right(rightUnion[i]);
271  BndSetRanges> iter(left, right);
272  unsigned int unionSize = Iter::Ranges::size(iter);
273  if (y.cardMin() > unionSize) {
274  GECODE_ME_CHECK_MODIFIED(modified,
275  x[i].cardMin(home, y.cardMin() - unionSize) );
276  }
277  LubRanges<View0> xiub(x[i]);
278  leftAcc.includeI(home, xiub);
279  }
280 
281  for (int i=xsize; i--;)
282  rightUnion[i].dispose(home);
283  leftAcc.dispose(home);
284  }
285 
286  //no need for this: |y.lb - U(Xj.cardMax)| <= S.card
287 
288  return ES_NOFIX;
289 
290  }
291 
292  /*
293  * Xi UB is subset of YUB
294  * Subscribes to Y UB
295  */
296  template<class View0, class View1>
297  ExecStatus
299  bool& modified, ViewArray<View0>& x, View1& y,
300  GLBndSet &) {
301  int xsize = x.size();
302  for (int i=xsize; i--; ) {
303  LubRanges<View1> yub(y);
304  GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home, yub));
305  }
306  return ES_FIX;
307  }
308 
309  // cardinality rules for PartitionN constraint
310  template<class View0, class View1>
311  ExecStatus
313  bool& modified, ViewArray<View0>& x, View1& y,
314  GLBndSet& unionOfDets) {
315  unsigned int cardMinSum=unionOfDets.size();
316  unsigned int cardMaxSum=unionOfDets.size();
317  int xsize = x.size();
318  for (int i=xsize; i--; ) {
319  cardMinSum+=x[i].cardMin();
320  if (cardMinSum < x[i].cardMin()) {
321  //sum of mins overflows: fail the space.
323  }
324  }
325  GECODE_ME_CHECK_MODIFIED(modified, y.cardMin(home,cardMinSum));
326  for (int i=xsize; i--; ) {
327  cardMaxSum+=x[i].cardMax();
328  if (cardMaxSum < x[i].cardMax()) {
329  //sum of maxes overflows: no useful information to tell.
330  goto overflow;
331  }
332  }
333  GECODE_ME_CHECK_MODIFIED(modified, y.cardMax(home,cardMaxSum));
334 
335  if (x.size() == 0)
336  return ES_NOFIX;
337 
338  overflow:
339 
340  //Cardinality of each x[i] limited by cardinality of y minus all x[j]s:
341 
342  {
343  Region r;
344  unsigned int* rightMinSum = r.alloc<unsigned int>(xsize);
345  unsigned int* rightMaxSum = r.alloc<unsigned int>(xsize);
346  rightMinSum[xsize-1]=0;
347  rightMaxSum[xsize-1]=0;
348 
349  for (int i=x.size()-1;i--;) {
350  rightMaxSum[i] = rightMaxSum[i+1] + x[i+1].cardMax();
351  if (rightMaxSum[i] < rightMaxSum[i+1]) {
352  //overflow, fill the rest of the array.
353  for (int j=i; j>0;j--) {
354  rightMaxSum[j]=Limits::card;
355  }
356  break;
357  }
358  }
359  for (int i=x.size()-1;i--;) {
360  rightMinSum[i] = rightMinSum[i+1] + x[i+1].cardMin();
361  if (rightMinSum[i] < rightMinSum[i+1]) {
362  //overflow, fail the space
364  }
365  }
366  unsigned int leftMinAcc=unionOfDets.size();
367  unsigned int leftMaxAcc=unionOfDets.size();
368 
369  for (int i=0; i<xsize;i++) {
370  unsigned int maxSum = leftMaxAcc+rightMaxSum[i];
371  unsigned int minSum = leftMinAcc+rightMinSum[i];
372  //If maxSum did not overflow and is less than y.cardMin:
373  if (maxSum >= leftMaxAcc && maxSum < y.cardMin()) {
374  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMin(home,y.cardMin()-maxSum));
375  }
376 
377  //Overflow, fail.
378  if (minSum < leftMinAcc || y.cardMax() < minSum) {
380  }
381  else {
382  GECODE_ME_CHECK_MODIFIED(modified, x[i].cardMax(home,y.cardMax()-minSum));
383  }
384 
385  leftMaxAcc += x[i].cardMax();
386  if (leftMaxAcc < x[i].cardMax())
387  leftMaxAcc = Limits::card;
388  leftMinAcc += x[i].cardMin();
389  if (leftMinAcc < x[i].cardMin())
391  }
392  }
393 
394  return ES_NOFIX;
395  }
396 
397  // Xi LB includes YLB minus union Xj UB
398  // Xi UB is subset of YUB minus union of Xj LBs
399  template<class View0, class View1>
400  ExecStatus
402  bool& modified, ViewArray<View0>& x, View1& y) {
403  int xsize = x.size();
404  Region r;
405  GLBndSet* afterUB =
406  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
407  GLBndSet* afterLB =
408  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
409 
410  {
411  GLBndSet sofarAfterUB;
412  GLBndSet sofarAfterLB;
413  for (int i=xsize; i--;) {
414  new (&afterUB[i]) GLBndSet(home);
415  new (&afterLB[i]) GLBndSet(home);
416  afterUB[i].update(home,sofarAfterUB);
417  afterLB[i].update(home,sofarAfterLB);
418  LubRanges<View0> xiub(x[i]);
419  GlbRanges<View0> xilb(x[i]);
420  sofarAfterUB.includeI(home,xiub);
421  sofarAfterLB.includeI(home,xilb);
422  }
423  sofarAfterUB.dispose(home);
424  sofarAfterLB.dispose(home);
425  }
426 
427  {
428  GLBndSet sofarBeforeUB;
429  GLBndSet sofarBeforeLB;
430  for (int i=0; i<xsize; i++) {
431  LubRanges<View1> yub(y);
432  BndSetRanges slb(sofarBeforeLB);
433  BndSetRanges afterlb(afterLB[i]);
435  BndSetRanges> xjlb(slb, afterlb);
437  Iter::Ranges::Union<BndSetRanges,
438  BndSetRanges> > diff1(yub, xjlb);
439  GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home,diff1));
440 
441  GlbRanges<View1> ylb(y);
442  BndSetRanges sub(sofarBeforeUB);
443  BndSetRanges afterub(afterUB[i]);
444  Iter::Ranges::Union<BndSetRanges,
445  BndSetRanges> xjub(sub, afterub);
447  Iter::Ranges::Union<BndSetRanges,
448  BndSetRanges> > diff2(ylb, xjub);
449  GECODE_ME_CHECK_MODIFIED(modified, x[i].includeI(home,diff2));
450 
451  LubRanges<View0> xiub(x[i]);
452  GlbRanges<View0> xilb(x[i]);
453  sofarBeforeUB.includeI(home,xiub);
454  sofarBeforeLB.includeI(home,xilb);
455  }
456  sofarBeforeLB.dispose(home);
457  sofarBeforeUB.dispose(home);
458  }
459 
460  for (int i=xsize;i--;) {
461  afterUB[i].dispose(home);
462  afterLB[i].dispose(home);
463  }
464 
465  return ES_NOFIX;
466  }
467 
468  // Xi UB is subset of YUB minus union of Xj LBs
469  template<class View0, class View1>
470  ExecStatus
472  bool& modified, ViewArray<View0>& x, View1& y,
473  GLBndSet& unionOfDets) {
474  int xsize = x.size();
475  Region r;
476  GLBndSet* afterLB =
477  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
478 
479  {
480  GLBndSet sofarAfterLB;
481  for (int i=xsize; i--;) {
482  new (&afterLB[i]) GLBndSet(home);
483  afterLB[i].update(home,sofarAfterLB);
484  GlbRanges<View0> xilb(x[i]);
485  sofarAfterLB.includeI(home,xilb);
486  }
487  sofarAfterLB.dispose(home);
488  }
489 
490  {
491  GLBndSet sofarBeforeLB;
492  sofarBeforeLB.update(home,unionOfDets);
493  for (int i=0; i<xsize; i++) {
494  LubRanges<View1> yub(y);
495  BndSetRanges slb(sofarBeforeLB);
496  BndSetRanges afterlb(afterLB[i]);
498  BndSetRanges> xjlb(slb, afterlb);
500  Iter::Ranges::Union<BndSetRanges,
501  BndSetRanges> > diff1(yub, xjlb);
502  GECODE_ME_CHECK_MODIFIED(modified, x[i].intersectI(home,diff1));
503 
504  GlbRanges<View0> xilb(x[i]);
505  sofarBeforeLB.includeI(home,xilb);
506  }
507  sofarBeforeLB.dispose(home);
508  }
509  for (int i=xsize; i--;)
510  afterLB[i].dispose(home);
511  return ES_NOFIX;
512  }
513 
514  // Xi LB includes YLB minus union Xj UB
515  template<class View0, class View1>
516  ExecStatus
518  bool& modified, ViewArray<View0>& x, View1& y,
519  GLBndSet& unionOfDets) {
520  int xsize = x.size();
521  Region r;
522  GLBndSet* afterUB =
523  static_cast<GLBndSet*>(r.ralloc(sizeof(GLBndSet)*xsize));
524 
525  {
526  GLBndSet sofarAfterUB;
527  for (int i=xsize; i--;) {
528  new (&afterUB[i]) GLBndSet(home);
529  afterUB[i].update(home,sofarAfterUB);
530  LubRanges<View0> xiub(x[i]);
531  sofarAfterUB.includeI(home,xiub);
532  }
533  sofarAfterUB.dispose(home);
534  }
535 
536  {
537  //The union of previously determined x[j]-s is added to the mix here:
538  GLBndSet sofarBeforeUB;
539  sofarBeforeUB.update(home,unionOfDets);
540  for (int i=0; i<xsize; i++) {
541  GlbRanges<View1> ylb(y);
542  BndSetRanges sub(sofarBeforeUB);
543  BndSetRanges afterub(afterUB[i]);
545  BndSetRanges> xjub(sub, afterub);
547  Iter::Ranges::Union<BndSetRanges,
548  BndSetRanges> > diff2(ylb, xjub);
549  GECODE_ME_CHECK_MODIFIED(modified, x[i].includeI(home,diff2));
550 
551  LubRanges<View0> xiub(x[i]);
552  sofarBeforeUB.includeI(home,xiub);
553  }
554  sofarBeforeUB.dispose(home);
555  }
556  for (int i=xsize;i--;)
557  afterUB[i].dispose(home);
558  return ES_NOFIX;
559  }
560 
561  // Y LB contains union of X LBs
562  template<class View0, class View1>
563  ExecStatus
565  bool& modified, ViewArray<View0>& x, View1& y,
566  GLBndSet& unionOfDets) {
567  assert(unionOfDets.isConsistent());
568  int xsize = x.size();
569  Region reg;
570  GlbRanges<View0>* xLBs = reg.alloc<GlbRanges<View0> >(xsize);
571  int nonEmptyCounter=0;
572  for (int i = xsize; i--; ) {
573  GlbRanges<View0> r(x[i]);
574  if (r()) {
575  xLBs[nonEmptyCounter] = r;
576  nonEmptyCounter++;
577  }
578  }
579  if (nonEmptyCounter !=0) {
580  Iter::Ranges::NaryUnion xLBUnion(reg,xLBs,nonEmptyCounter);
581  BndSetRanges dets(unionOfDets);
582  xLBUnion |= dets;
583  GECODE_ME_CHECK_MODIFIED(modified, y.includeI(home,xLBUnion));
584  }
585  return ES_FIX;
586  }
587 
588  // Y UB is subset of union of X UBs
589  template<class View0, class View1>
590  ExecStatus
592  bool& modified, ViewArray<View0>& x, View1& y,
593  GLBndSet& unionOfDets) {
594  int xsize = x.size();
595  Region reg;
596  LubRanges<View0>* xUBs = reg.alloc<LubRanges<View0> >(xsize);
597  int nonEmptyCounter=0;
598  for (int i = xsize; i--; ) {
599  LubRanges<View0> r(x[i]);
600  if (r()) {
601  xUBs[nonEmptyCounter] = r;
602  nonEmptyCounter++;
603  }
604  }
605  if (nonEmptyCounter != 0) {
606  Iter::Ranges::NaryUnion xUBUnion(reg,xUBs,nonEmptyCounter);
607  BndSetRanges dets(unionOfDets);
608  xUBUnion |= dets;
609  GECODE_ME_CHECK_MODIFIED(modified, y.intersectI(home,xUBUnion));
610  }
611  return ES_FIX;
612  }
613 
614 }}}
615 
616 #endif
617 
618 // STATISTICS: set-prop
ExecStatus partitionNXiUB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:471
ExecStatus partitionNYLB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:564
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
Definition: var-type.hpp:138
const FloatNum max
Largest allowed float value.
Definition: float.hh:848
ExecStatus unionNXiUB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &)
Definition: common.hpp:298
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Definition: region.hpp:384
ExecStatus partitionNXiLB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:517
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:93
ExecStatus unionNCard(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:197
Handle to region.
Definition: region.hpp:57
#define forceinline
Definition: config.hpp:182
Propagation has computed fixpoint.
Definition: core.hpp:469
const unsigned int card
Maximum cardinality of an integer set.
Definition: set.hh:105
Computation spaces.
Definition: core.hpp:1668
#define GECODE_ME_CHECK_MODIFIED(modified, me)
Check whether me is failed or modified, and forward failure.
Definition: macros.hpp:68
Range iterator for the least upper bound.
Definition: var-imp.hpp:321
const FloatNum min
Smallest allowed float value.
Definition: float.hh:850
Gecode::IntArgs i(4, 1, 2, 3, 4)
unsigned int size(void) const
Return size.
Definition: integerset.hpp:97
bool overflow(Term *t, int n, FloatVal c)
Definition: post.cpp:68
Range iterator for computing intersection (binary)
Range iterator for union of iterators.
ExecStatus partitionNXi(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y)
Definition: common.hpp:401
unsigned int size(I &i)
Size of all ranges of range iterator i.
Range iterator for integer sets.
Definition: var-imp.hpp:189
bool viewarrayshared(const ViewArray< View0 > &va, const View1 &y)
Definition: common.hpp:51
bool isConsistent(void) const
Check whether internal invariants hold.
Definition: integerset.cpp:293
ExecStatus partitionNYUB(Space &home, bool &modified, ViewArray< View0 > &x, View1 &y, GLBndSet &unionOfDets)
Definition: common.hpp:591
bool shared(void) const
Test whether array contains shared views.
Definition: array.hpp:1506
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:56
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:88
Range iterator for computing union (binary)
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:769
Set view for set variables
Definition: view.hpp:60
Gecode::IntArgs v1(4, Gecode::Int::Limits::min+4, 0, 1, Gecode::Int::Limits::max)
Post propagator for SetVar SetOpType SetVar y
Definition: set.hh:769
ExecStatus
Definition: core.hpp:464
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:312
Post propagator for SetVar x
Definition: set.hh:769
Propagation has not computed fixpoint.
Definition: core.hpp:467
Complement set view.
Definition: view.hpp:756
Gecode toplevel namespace
Range iterator for computing set difference.
Definition: ranges-diff.hpp:47
int size(void) const
Return size of array (number of elements)
Definition: array.hpp:1203
ExecStatus unionCard(Space &home, bool &retmodified, View0 &x0, View1 &x1, View2 &x2)
Definition: common.hpp:149
void * ralloc(size_t s)
Allocate memory from region.
Definition: region.hpp:359
Gecode::IntArgs v2(4, Gecode::Int::Limits::min, 0, 1, Gecode::Int::Limits::max-4)