Generated on Sat Feb 7 2015 02:01:30 for Gecode by doxygen 1.8.9.1
minmax.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  * Gabor Szokoli <szokoli@gecode.org>
7  * Denys Duchier <denys.duchier@univ-orleans.fr>
8  *
9  * Copyright:
10  * Guido Tack, 2004
11  * Christian Schulte, 2004
12  * Gabor Szokoli, 2004
13  *
14  * Last modified:
15  * $Date: 2012-10-19 05:58:26 +0200 (Fri, 19 Oct 2012) $ by $Author: tack $
16  * $Revision: 13156 $
17  *
18  * This file is part of Gecode, the generic constraint
19  * development environment:
20  * http://www.gecode.org
21  *
22  * Permission is hereby granted, free of charge, to any person obtaining
23  * a copy of this software and associated documentation files (the
24  * "Software"), to deal in the Software without restriction, including
25  * without limitation the rights to use, copy, modify, merge, publish,
26  * distribute, sublicense, and/or sell copies of the Software, and to
27  * permit persons to whom the Software is furnished to do so, subject to
28  * the following conditions:
29  *
30  * The above copyright notice and this permission notice shall be
31  * included in all copies or substantial portions of the Software.
32  *
33  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
37  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
38  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
39  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40  *
41  */
42 
43 
44 
45 #include <gecode/set.hh>
46 #include <gecode/int.hh>
47 
48 namespace Gecode { namespace Set { namespace Int {
49 
50  template<class View>
53  : MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> (home, y0, y1) {}
54 
55  template<class View>
58  GECODE_ME_CHECK(x0.cardMin(home,1));
59  (void) new (home) MinElement(home,x0,x1);
60  return ES_OK;
61  }
62 
63  template<class View>
66  : MixBinaryPropagator<View,PC_SET_ANY,Gecode::Int::IntView,Gecode::Int::PC_INT_BND> (home, share, p) {}
67 
68  template<class View>
69  Actor*
70  MinElement<View>::copy(Space& home, bool share) {
71  return new (home) MinElement(home,share,*this);
72  }
73 
74  template<class View>
77  //x1 is an element of x0.ub
78  //x1 =< smallest element of x0.lb
79  //x1 =< x0.cardinialityMin-est largest element of x0.ub
80  //(these 2 take care of determined x0)
81  //No element in x0 is smaller than x1
82  //if x1 is determined, it is part of the ub.
83 
84  //Consequently:
85  //The domain of x1 is a subset of x0.ub up to the first element in x0.lb.
86  //x0 lacks everything smaller than smallest possible x1.
87 
88  {
89  LubRanges<View> ub(x0);
90  GECODE_ME_CHECK(x1.inter_r(home,ub,false));
91  }
92  GECODE_ME_CHECK(x1.lq(home,x0.glbMin()));
93  //if cardMin>lbSize?
94  assert(x0.cardMin()>=1);
95 
96  {
98  unsigned int size = 0;
99  int maxN = BndSet::MAX_OF_EMPTY;
100  for (LubRanges<View> ubr(x0); ubr(); ++ubr, ++size) {}
101  Region r(home);
102  int* ub = r.alloc<int>(size*2);
103  int i=0;
104  for (LubRanges<View> ubr(x0); ubr(); ++ubr, ++i) {
105  ub[2*i] = ubr.min();
106  ub[2*i+1] = ubr.max();
107  }
108  unsigned int x0cm = x0.cardMin()-1;
109  for (unsigned int i=size; i--;) {
110  unsigned int width = static_cast<unsigned int>(ub[2*i+1]-ub[2*i]+1);
111  if (width > x0cm) {
112  maxN = static_cast<int>(ub[2*i+1]-x0cm);
113  break;
114  }
115  x0cm -= width;
116  }
117  GECODE_ME_CHECK(x1.lq(home,maxN));
118  }
119 
120  GECODE_ME_CHECK( x0.exclude(home,
121  Limits::min, x1.min()-1) );
122 
123  if (x1.assigned()) {
124  GECODE_ME_CHECK(x0.include(home,x1.val()));
125  GECODE_ME_CHECK(x0.exclude(home,
126  Limits::min, x1.val()-1));
127  return home.ES_SUBSUMED(*this);
128  }
129 
130  return ES_FIX;
131  }
132 
133 
134  template<class View>
139  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> (home, y0, y1) {}
140 
141  template<class View>
144  (void) new (home) NotMinElement(home,x0,x1);
145  return ES_OK;
146  }
147 
148  template<class View>
151  NotMinElement& p)
153  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> (home, share, p) {}
154 
155  template<class View>
156  Actor*
157  NotMinElement<View>::copy(Space& home, bool share) {
158  return new (home) NotMinElement(home,share,*this);
159  }
160 
161  template<class View>
162  ExecStatus
164  // cheap tests for entailment:
165  // if x0 is empty, then entailed
166  // if max(x1) < min(x0.lub) or min(x1) > max(x0.lub), then entailed
167  // if min(x0.glb) < min(x1), then entailed
168  if ((x0.cardMax() == 0) ||
169  ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
170  ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
171  return home.ES_SUBSUMED(*this);
172  // if x1 is determined and = x0.lub.min: remove it from x0,
173  // then entailed
174  if (x1.assigned() && x1.val()==x0.lubMin()) {
175  GECODE_ME_CHECK(x0.exclude(home,x1.val()));
176  return home.ES_SUBSUMED(*this);
177  }
178  // if min(x0) is decided: remove min(x0) from the domain of x1
179  // then entailed
180  if (x0.glbMin() == x0.lubMin()) {
181  GECODE_ME_CHECK(x1.nq(home,x0.glbMin()));
182  return home.ES_SUBSUMED(*this);
183  }
184  // if x1 is determined and = x0.glb.min, then we need at least
185  // one more element; if there is only one below, then we must
186  // take it.
187  if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMin()) {
188  unsigned int oldGlbSize = x0.glbSize();
189  // if there is only 1 unknown below x1, then we must take it
190  UnknownRanges<View> ur(x0);
191  assert(ur());
192  // the iterator is not empty: otherwise x0 would be determined
193  // and min(x0) would have been decided and the preceding if
194  // would have caught it. Also, the first range is not above
195  // x1 otherwise the very first if would have caught it.
196  // so let's check if the very first range of unknowns is of
197  // size 1 and there is no second one or it starts above x1.
198  if (ur.width()==1) {
199  int i=ur.min();
200  ++ur;
201  if (!ur() || ur.min()>x1.val()) {
202  GECODE_ME_CHECK(x0.include(home,i));
203  return home.ES_SUBSUMED(*this);
204  }
205  }
206  GECODE_ME_CHECK(x0.cardMin(home, oldGlbSize+1));
207  }
208  // if dom(x1) and lub(x0) are disjoint, then entailed;
209  {
210  LubRanges<View> ub(x0);
214  if (!ir()) return home.ES_SUBSUMED(*this);
215  }
216  // x0 is fated to eventually contain at least x0.cardMin elements.
217  // therefore min(x0) <= x0.cardMin-th largest element of x0.lub
218  // if x1 > than that, then entailed.
219  {
220  // to find the x0.cardMin-th largest element of x0.lub, we need
221  // some sort of reverse range iterator. we will need to fake one
222  // by storing the ranges of the forward iterator in an array.
223  // first we need to know how large the array needs to be. so, let's
224  // count the ranges:
225  int num_ranges = 0;
226  for (LubRanges<View> ur(x0); ur(); ++ur, ++num_ranges) {}
227  // create an array for storing min and max of each range
228  Region r(home);
229  int* _ur = r.alloc<int>(num_ranges*2);
230  // now, we fill the array:
231  int i = 0;
232  for (LubRanges<View> ur(x0); ur(); ++ur, ++i) {
233  _ur[2*i ] = ur.min();
234  _ur[2*i+1] = ur.max();
235  }
236  // now we search from the top the range that contains the
237  // nth largest value.
238  unsigned int n = x0.cardMin();
239  int nth_largest = BndSet::MAX_OF_EMPTY;
240  for (int i=num_ranges; i--; ) {
241  // number of values in range
242  unsigned int num_values = static_cast<unsigned int>(_ur[2*i+1]-_ur[2*i]+1);
243  // does the range contain the value?
244  if (num_values >= n) {
245  // record it and exit the loop
246  nth_largest = static_cast<int>(_ur[2*i+1]-n+1);
247  break;
248  }
249  // otherwise, we skipped num_values
250  n -= num_values;
251  }
252  // if x1.min > nth_largest, then entailed
253  if (x1.min() > nth_largest)
254  return home.ES_SUBSUMED(*this);
255  }
256  return ES_FIX;
257  }
258 
259  template<class View, ReifyMode rm>
265  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
266  Gecode::Int::BoolView> (home, y0, y1, b2) {}
267 
268  template<class View, ReifyMode rm>
272  (void) new (home) ReMinElement(home,x0,x1,b2);
273  return ES_OK;
274  }
275 
276  template<class View, ReifyMode rm>
279  ReMinElement& p)
281  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
282  Gecode::Int::BoolView> (home, share, p) {}
283 
284  template<class View, ReifyMode rm>
285  Actor*
286  ReMinElement<View,rm>::copy(Space& home, bool share) {
287  return new (home) ReMinElement(home,share,*this);
288  }
289 
290  template<class View, ReifyMode rm>
291  ExecStatus
293  // check if b is determined
294  if (b.one()) {
295  if (rm == RM_PMI)
296  return home.ES_SUBSUMED(*this);
297  GECODE_REWRITE(*this, (MinElement<View>::post(home(*this),x0,x1)));
298  }
299  if (b.zero()) {
300  if (rm == RM_IMP)
301  return home.ES_SUBSUMED(*this);
302  GECODE_REWRITE(*this, (NotMinElement<View>::post(home(*this),x0,x1)));
303  }
304  // cheap tests for => b=0
305  // if x0 is empty, then b=0 and entailed
306  // if max(x1) < min(x0.lub) or min(x1) > max(x0.lub), then b=0 and entailed
307  // if min(x0.glb) < min(x1), then b=0 and entailed
308  if ((x0.cardMax() == 0) ||
309  ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
310  ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
311  {
312  if (rm != RM_PMI)
313  GECODE_ME_CHECK(b.zero(home));
314  return home.ES_SUBSUMED(*this);
315  }
316  // if min(x0) is decided
317  if (x0.glbMin() == x0.lubMin()) {
318  // if x1 is det: check if = min(x0), assign b, entailed
319  if (x1.assigned()) {
320  if (x1.val() == x0.glbMin()) {
321  if (rm != RM_IMP)
322  GECODE_ME_CHECK(b.one(home));
323  } else {
324  if (rm != RM_PMI)
325  GECODE_ME_CHECK(b.zero(home));
326  }
327  return home.ES_SUBSUMED(*this);
328  }
329  // if min(x0) not in dom(x1): b=0, entailed
330  else if ((x0.glbMin() < x1.min()) ||
331  (x0.glbMin() > x1.max()) ||
332  !x1.in(x0.glbMin()))
333  {
334  if (rm != RM_PMI)
335  GECODE_ME_CHECK(b.zero(home));
336  return home.ES_SUBSUMED(*this);
337  }
338  }
339  // // if dom(x1) and lub(x0) are disjoint, then b=0, entailed;
340  // {
341  // LubRanges<View> ub(x0);
342  // Gecode::Int::ViewRanges<Gecode::Int::IntView> d(x1);
343  // Gecode::Iter::Ranges::Inter<LubRanges<View>,
344  // Gecode::Int::ViewRanges<Gecode::Int::IntView> > ir(ub,d);
345  // if (!ir()) {
346  // GECODE_ME_CHECK(b.zero(home));
347  // return home.ES_SUBSUMED(*this);
348  // }
349  // }
350  // // x0 is fated to eventually contain at least x0.cardMin elements.
351  // // therefore min(x0) <= x0.cardMin-th largest element of x0.lub
352  // // if x1 > than that, then b=0 and entailed.
353  // {
354  // // to find the x0.cardMin-th largest element of x0.lub, we need
355  // // some sort of reverse range iterator. we will need to fake one
356  // // by storing the ranges of the forward iterator in an array.
357  // // first we need to know how large the array needs to be. so, let's
358  // // count the ranges:
359  // int num_ranges = 0;
360  // for (LubRanges<View> ur(x0); ur(); ++ur, ++num_ranges) {}
361  // // create an array for storing min and max of each range
362  // Region re(home);
363  // int* _ur = re.alloc<int>(num_ranges*2);
364  // // now, we fill the array:
365  // int i = 0;
366  // for (LubRanges<View> ur(x0); ur(); ++ur, ++i) {
367  // _ur[2*i ] = ur.min();
368  // _ur[2*i+1] = ur.max();
369  // }
370  // // now we search from the top the range that contains the
371  // // nth largest value.
372  // int n = x0.cardMin();
373  // int nth_largest = BndSet::MAX_OF_EMPTY;
374  // for (int i=num_ranges; i--; ) {
375  // // number of values in range
376  // int num_values = _ur[2*i+1]-_ur[2*i]+1;
377  // // does the range contain the value?
378  // if (num_values >= n)
379  // {
380  // // record it and exit the loop
381  // nth_largest = _ur[2*i+1]-n+1;
382  // break;
383  // }
384  // // otherwise, we skipped num_values
385  // n -= num_values;
386  // }
387  // // if x1.min > nth_largest, then entailed
388  // if (x1.min() > nth_largest) {
389  // GECODE_ME_CHECK(b.zero(home));
390  // return home.ES_SUBSUMED(*this);
391  // }
392  // }
393  return ES_FIX;
394  }
395 
396  template<class View>
400  Gecode::Int::IntView,Gecode::Int::PC_INT_BND> (home, y0, y1) {}
401 
402  template<class View>
406  Gecode::Int::IntView,Gecode::Int::PC_INT_BND> (home, share, p) {}
407 
408  template<class View>
409  ExecStatus
412  GECODE_ME_CHECK(x0.cardMin(home,1));
413  (void) new (home) MaxElement(home,x0,x1);
414  return ES_OK;
415  }
416 
417  template<class View>
418  Actor*
419  MaxElement<View>::copy(Space& home, bool share) {
420  return new (home) MaxElement(home,share,*this);
421  }
422 
423  template<class View>
424  ExecStatus
426  LubRanges<View> ub(x0);
427  GECODE_ME_CHECK(x1.inter_r(home,ub,false));
428  GECODE_ME_CHECK(x1.gq(home,x0.glbMax()));
429  assert(x0.cardMin()>=1);
430  GECODE_ME_CHECK(x1.gq(home,x0.lubMinN(x0.cardMin()-1)));
431  GECODE_ME_CHECK(x0.exclude(home,
432  x1.max()+1,Limits::max) );
433 
434  if (x1.assigned()) {
435  GECODE_ME_CHECK(x0.include(home,x1.val()));
436  GECODE_ME_CHECK( x0.exclude(home,
437  x1.val()+1,Limits::max) );
438  return home.ES_SUBSUMED(*this);
439  }
440 
441  return ES_FIX;
442  }
443 
444  template<class View>
449  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> (home, y0, y1) {}
450 
451  template<class View>
454  NotMaxElement& p)
456  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> (home, share, p) {}
457 
458  template<class View>
459  ExecStatus
461  (void) new (home) NotMaxElement(home,x0,x1);
462  return ES_OK;
463  }
464 
465  template<class View>
466  Actor*
467  NotMaxElement<View>::copy(Space& home, bool share) {
468  return new (home) NotMaxElement(home,share,*this);
469  }
470 
471  template<class View>
472  ExecStatus
474  // cheap tests for entailment:
475  // if x0 is empty, then entailed
476  // if max(x1) < min(x0.lub) or min(x1) > max(x0.lub), then entailed
477  // if max(x0.glb) > max(x1), then entailed
478  if ((x0.cardMax() == 0) ||
479  ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
480  ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
481  return home.ES_SUBSUMED(*this);
482  // if x1 is determined and = max(x0.lub): remove it from x0,
483  // then entailed
484  if (x1.assigned() && x1.val()==x0.lubMax()) {
485  GECODE_ME_CHECK(x0.exclude(home,x1.val()));
486  return home.ES_SUBSUMED(*this);
487  }
488  // if max(x0) is decided: remove max(x0) from the domain of x1
489  // then entailed
490  if (x0.glbMax() == x0.lubMax()) {
491  GECODE_ME_CHECK(x1.nq(home,x0.glbMax()));
492  return home.ES_SUBSUMED(*this);
493  }
494  // if x1 is determined and = max(x0.glb), then we need at least
495  // one more element; if there is only one above, then we must
496  // take it.
497  if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMax()) {
498  unsigned int oldGlbSize = x0.glbSize();
499  // if there is only 1 unknown above x1, then we must take it
500  UnknownRanges<View> ur(x0);
501  // there is at least one unknown above x1 otherwise it would
502  // have been caught by the if for x1=max(x0.lub)
503  while (ur.max() < x1.val()) {
504  assert(ur());
505  ++ur;
506  };
507  // if the first range above x1 contains just 1 element,
508  // and is the last range, then take that element
509  if (ur.width() == 1) {
510  int i = ur.min();
511  ++ur;
512  if (!ur()) {
513  // last range
514  GECODE_ME_CHECK(x0.include(home,i));
515  return home.ES_SUBSUMED(*this);
516  }
517  }
518  GECODE_ME_CHECK(x0.cardMin(home, oldGlbSize+1));
519  }
520  // if dom(x1) and lub(x0) are disjoint, then entailed
521  {
522  LubRanges<View> ub(x0);
526  if (!ir()) return home.ES_SUBSUMED(*this);
527  }
528  // x0 is fated to eventually contain at least x0.cardMin elements.
529  // therefore max(x0) >= x0.cardMin-th smallest element of x0.lub.
530  // if x1 < than that, then entailed.
531  {
532  unsigned int n = x0.cardMin();
533  int nth_smallest = BndSet::MIN_OF_EMPTY;
534  for (LubRanges<View> ur(x0); ur(); ++ur) {
535  if (ur.width() >= n) {
536  // record it and exit the loop
537  nth_smallest = static_cast<int>(ur.min() + n - 1);
538  break;
539  }
540  // otherwise, we skipped ur.width() values
541  n -= ur.width();
542  }
543  // if x1.max < nth_smallest, then entailed
544  if (x1.max() < nth_smallest)
545  return home.ES_SUBSUMED(*this);
546  }
547  return ES_FIX;
548  }
549 
550  template<class View, ReifyMode rm>
556  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
557  Gecode::Int::BoolView> (home, y0, y1, b2) {}
558 
559  template<class View, ReifyMode rm>
562  ReMaxElement& p)
564  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
565  Gecode::Int::BoolView> (home, share, p) {}
566 
567  template<class View, ReifyMode rm>
568  ExecStatus
572  (void) new (home) ReMaxElement(home,x0,x1,b2);
573  return ES_OK;
574  }
575 
576  template<class View, ReifyMode rm>
577  Actor*
578  ReMaxElement<View,rm>::copy(Space& home, bool share) {
579  return new (home) ReMaxElement(home,share,*this);
580  }
581 
582  template<class View, ReifyMode rm>
583  ExecStatus
585  // check if b is determined
586  if (b.one()) {
587  if (rm == RM_PMI)
588  return home.ES_SUBSUMED(*this);
589  GECODE_REWRITE(*this, (MaxElement<View>::post(home(*this),x0,x1)));
590  }
591  if (b.zero()) {
592  if (rm == RM_IMP)
593  return home.ES_SUBSUMED(*this);
594  GECODE_REWRITE(*this, (NotMaxElement<View>::post(home(*this),x0,x1)));
595  }
596  // cheap tests for => b=0
597  // if x0 is empty, then b=0 and entailed
598  // if max(x1) < min(x0.lub) or min(x1) > max(x0.lub), then b=0 and entailed
599  // if max(x0.glb) > max(x1), then b=0 and entailed
600  if ((x0.cardMax() == 0) ||
601  ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
602  ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
603  {
604  if (rm != RM_PMI)
605  GECODE_ME_CHECK(b.zero(home));
606  return home.ES_SUBSUMED(*this);
607  }
608  // if max(x0) is decided
609  if (x0.glbMax() == x0.lubMax()) {
610  // if x1 is det: check if = max(x0), assign b, entailed
611  if (x1.assigned()) {
612  if (x1.val() == x0.glbMax()) {
613  if (rm != RM_IMP)
614  GECODE_ME_CHECK(b.one(home));
615  } else {
616  if (rm != RM_PMI)
617  GECODE_ME_CHECK(b.zero(home));
618  }
619  return home.ES_SUBSUMED(*this);
620  }
621  // if max(x0) not in dom(x1): b=0, entailed
622  else if ((x0.glbMax() < x1.min()) ||
623  (x0.glbMax() > x1.max()) ||
624  !x1.in(x0.glbMax()))
625  {
626  if (rm != RM_PMI)
627  GECODE_ME_CHECK(b.zero(home));
628  return home.ES_SUBSUMED(*this);
629  }
630  }
631  // if dom(x1) and lub(x0) are disjoint, then b=0, entailed
632  {
633  LubRanges<View> ub(x0);
637  if (!ir()) {
638  if (rm != RM_PMI)
639  GECODE_ME_CHECK(b.zero(home));
640  return home.ES_SUBSUMED(*this);
641  }
642  }
643  // x0 is fated to eventually contain at least x0.cardMin elements.
644  // therefore max(x0) >= x0.cardMin-th smallest element of x0.lub.
645  // if x1 < than that, then b=0, entailed.
646  {
647  unsigned int n = x0.cardMin();
648  int nth_smallest = BndSet::MIN_OF_EMPTY;
649  for (LubRanges<View> ur(x0); ur(); ++ur) {
650  if (ur.width() >= n)
651  {
652  // record it and exit the loop
653  nth_smallest = static_cast<int>(ur.min() + n - 1);
654  break;
655  }
656  // otherwise, we skipped ur.width() values
657  n -= ur.width();
658  }
659  // if x1.max < nth_smallest, then entailed
660  if (x1.max() < nth_smallest) {
661  if (rm != RM_PMI)
662  GECODE_ME_CHECK(b.zero(home));
663  return home.ES_SUBSUMED(*this);
664  }
665  }
666  return ES_FIX;
667  }
668 
669 }}}
670 
671 // STATISTICS: set-prop
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
Definition: macros.hpp:109
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the minimal element of s.
Definition: minmax.hpp:57
Inverse implication for reification.
Definition: int.hh:847
Range iterator for the unknown set.
Definition: var-imp.hpp:406
const int min
Smallest allowed integer in integer set.
Definition: set.hh:101
ExecStatus ES_SUBSUMED(Propagator &p)
Definition: core.hpp:2973
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: minmax.hpp:419
Propagator for not maximum element
Definition: int.hh:174
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Definition: region.hpp:326
int max(void) const
Return largest value of range.
ReMinElement(Space &home, bool share, ReMinElement &p)
Constructor for cloning p.
Definition: minmax.hpp:278
Reified mixed binary propagator.
Definition: propagator.hpp:124
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
Handle to region.
Definition: region.hpp:61
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
Definition: var-imp.hpp:116
Propagation has computed fixpoint.
Definition: core.hpp:528
const int max
Largest allowed integer in integer set.
Definition: set.hh:99
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the minimal element of s.
Definition: minmax.hpp:143
Computation spaces.
Definition: core.hpp:1362
Base-class for both propagators and branchers.
Definition: core.hpp:666
Propagator for reified minimum element
Definition: int.hh:115
int min(void) const
Return smallest value of range.
Gecode::IntSet d(v, 7)
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
Definition: var-imp.hpp:114
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:292
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: minmax.hpp:467
int n
Number of negative literals for node type.
Definition: bool-expr.cpp:238
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:584
Propagator for not minimum element
Definition: int.hh:87
static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b)
Post reified propagator for b iff x is the minimal element of s.
Definition: minmax.hpp:270
Range iterator for computing intersection (binary)
NNF * r
Right subtree.
Definition: bool-expr.cpp:246
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:91
unsigned int size(I &i)
Size of all ranges of range iterator i.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition: var-type.hpp:100
MaxElement(Space &home, bool share, MaxElement &p)
Constructor for cloning p.
Definition: minmax.hpp:404
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the largest element of s.
Definition: minmax.hpp:410
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: minmax.hpp:286
ReMaxElement(Space &home, bool share, ReMaxElement &p)
Constructor for cloning p.
Definition: minmax.hpp:561
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:45
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:163
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition: var-type.hpp:248
NotMaxElement(Space &home, bool share, NotMaxElement &p)
Constructor for cloning p.
Definition: minmax.hpp:453
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:76
Propagator for maximum element
Definition: int.hh:147
Integer view for integer variables.
Definition: view.hpp:129
Mixed binary propagator.
Definition: propagator.hpp:203
ExecStatus
Definition: core.hpp:523
Reified propagator for maximum element
Definition: int.hh:202
#define forceinline
Definition: config.hpp:132
MinElement(Space &home, bool share, MinElement &p)
Constructor for cloning p.
Definition: minmax.hpp:65
Execution is okay.
Definition: core.hpp:527
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: minmax.hpp:157
NotMinElement(Space &home, bool share, NotMinElement &p)
Constructor for cloning p.
Definition: minmax.hpp:150
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
Implication for reification.
Definition: int.hh:840
static ExecStatus post(Home home, View s, Gecode::Int::IntView x, Gecode::Int::BoolView b)
Post reified propagator for b iff x is the largest element of s.
Definition: minmax.hpp:569
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: minmax.hpp:70
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:473
int ModEventDelta
Modification event deltas.
Definition: core.hpp:173
Home class for posting propagators
Definition: core.hpp:717
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the largest element of s.
Definition: minmax.hpp:460
Propagator for minimum element
Definition: int.hh:59
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:425
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Definition: minmax.hpp:578
Boolean view for Boolean variables.
Definition: view.hpp:1315