Generated on Thu Apr 5 2018 19:44:19 for Gecode by doxygen 1.8.13
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$ by $Author$
16  * $Revision$
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, p) {}
67 
68  template<class View>
69  Actor*
71  return new (home) MinElement(home,*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;
102  int* ub = r.alloc<int>(size*2);
103  {
104  int i=0;
105  for (LubRanges<View> ubr(x0); ubr(); ++ubr, ++i) {
106  ub[2*i] = ubr.min();
107  ub[2*i+1] = ubr.max();
108  }
109  }
110  unsigned int x0cm = x0.cardMin()-1;
111  for (unsigned int i=size; i--;) {
112  unsigned int width = static_cast<unsigned int>(ub[2*i+1]-ub[2*i]+1);
113  if (width > x0cm) {
114  maxN = static_cast<int>(ub[2*i+1]-x0cm);
115  break;
116  }
117  x0cm -= width;
118  }
119  GECODE_ME_CHECK(x1.lq(home,maxN));
120  }
121 
122  GECODE_ME_CHECK( x0.exclude(home,
123  Limits::min, x1.min()-1) );
124 
125  if (x1.assigned()) {
126  GECODE_ME_CHECK(x0.include(home,x1.val()));
127  GECODE_ME_CHECK(x0.exclude(home,
128  Limits::min, x1.val()-1));
129  return home.ES_SUBSUMED(*this);
130  }
131 
132  return ES_FIX;
133  }
134 
135 
136  template<class View>
141  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> (home, y0, y1) {}
142 
143  template<class View>
146  (void) new (home) NotMinElement(home,x0,x1);
147  return ES_OK;
148  }
149 
150  template<class View>
154  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> (home, p) {}
155 
156  template<class View>
157  Actor*
159  return new (home) NotMinElement(home,*this);
160  }
161 
162  template<class View>
163  ExecStatus
165  // cheap tests for entailment:
166  // if x0 is empty, then entailed
167  // if max(x1) < min(x0.lub) or min(x1) > max(x0.lub), then entailed
168  // if min(x0.glb) < min(x1), then entailed
169  if ((x0.cardMax() == 0) ||
170  ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
171  ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
172  return home.ES_SUBSUMED(*this);
173  // if x1 is determined and = x0.lub.min: remove it from x0,
174  // then entailed
175  if (x1.assigned() && x1.val()==x0.lubMin()) {
176  GECODE_ME_CHECK(x0.exclude(home,x1.val()));
177  return home.ES_SUBSUMED(*this);
178  }
179  // if min(x0) is decided: remove min(x0) from the domain of x1
180  // then entailed
181  if (x0.glbMin() == x0.lubMin()) {
182  GECODE_ME_CHECK(x1.nq(home,x0.glbMin()));
183  return home.ES_SUBSUMED(*this);
184  }
185  // if x1 is determined and = x0.glb.min, then we need at least
186  // one more element; if there is only one below, then we must
187  // take it.
188  if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMin()) {
189  unsigned int oldGlbSize = x0.glbSize();
190  // if there is only 1 unknown below x1, then we must take it
192  assert(ur());
193  // the iterator is not empty: otherwise x0 would be determined
194  // and min(x0) would have been decided and the preceding if
195  // would have caught it. Also, the first range is not above
196  // x1 otherwise the very first if would have caught it.
197  // so let's check if the very first range of unknowns is of
198  // size 1 and there is no second one or it starts above x1.
199  if (ur.width()==1) {
200  int i=ur.min();
201  ++ur;
202  if (!ur() || ur.min()>x1.val()) {
203  GECODE_ME_CHECK(x0.include(home,i));
204  return home.ES_SUBSUMED(*this);
205  }
206  }
207  GECODE_ME_CHECK(x0.cardMin(home, oldGlbSize+1));
208  }
209  // if dom(x1) and lub(x0) are disjoint, then entailed;
210  {
211  LubRanges<View> ub(x0);
215  if (!ir()) return home.ES_SUBSUMED(*this);
216  }
217  // x0 is fated to eventually contain at least x0.cardMin elements.
218  // therefore min(x0) <= x0.cardMin-th largest element of x0.lub
219  // if x1 > than that, then entailed.
220  {
221  // to find the x0.cardMin-th largest element of x0.lub, we need
222  // some sort of reverse range iterator. we will need to fake one
223  // by storing the ranges of the forward iterator in an array.
224  // first we need to know how large the array needs to be. so, let's
225  // count the ranges:
226  int num_ranges = 0;
227  for (LubRanges<View> ur(x0); ur(); ++ur, ++num_ranges) {}
228  // create an array for storing min and max of each range
229  Region r;
230  int* _ur = r.alloc<int>(num_ranges*2);
231  // now, we fill the array:
232  int i = 0;
233  for (LubRanges<View> ur(x0); ur(); ++ur, ++i) {
234  _ur[2*i ] = ur.min();
235  _ur[2*i+1] = ur.max();
236  }
237  // now we search from the top the range that contains the
238  // nth largest value.
239  unsigned int n = x0.cardMin();
240  int nth_largest = BndSet::MAX_OF_EMPTY;
241  for (int i=num_ranges; i--; ) {
242  // number of values in range
243  unsigned int num_values = static_cast<unsigned int>(_ur[2*i+1]-_ur[2*i]+1);
244  // does the range contain the value?
245  if (num_values >= n) {
246  // record it and exit the loop
247  nth_largest = static_cast<int>(_ur[2*i+1]-n+1);
248  break;
249  }
250  // otherwise, we skipped num_values
251  n -= num_values;
252  }
253  // if x1.min > nth_largest, then entailed
254  if (x1.min() > nth_largest)
255  return home.ES_SUBSUMED(*this);
256  }
257  return ES_FIX;
258  }
259 
260  template<class View, ReifyMode rm>
266  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
267  Gecode::Int::BoolView> (home, y0, y1, b2) {}
268 
269  template<class View, ReifyMode rm>
273  (void) new (home) ReMinElement(home,x0,x1,b2);
274  return ES_OK;
275  }
276 
277  template<class View, ReifyMode rm>
281  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
282  Gecode::Int::BoolView> (home, p) {}
283 
284  template<class View, ReifyMode rm>
285  Actor*
287  return new (home) ReMinElement(home,*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, 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*
420  return new (home) MaxElement(home,*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>
455  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM> (home, p) {}
456 
457  template<class View>
458  ExecStatus
460  (void) new (home) NotMaxElement(home,x0,x1);
461  return ES_OK;
462  }
463 
464  template<class View>
465  Actor*
467  return new (home) NotMaxElement(home,*this);
468  }
469 
470  template<class View>
471  ExecStatus
473  // cheap tests for entailment:
474  // if x0 is empty, then entailed
475  // if max(x1) < min(x0.lub) or min(x1) > max(x0.lub), then entailed
476  // if max(x0.glb) > max(x1), then entailed
477  if ((x0.cardMax() == 0) ||
478  ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
479  ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
480  return home.ES_SUBSUMED(*this);
481  // if x1 is determined and = max(x0.lub): remove it from x0,
482  // then entailed
483  if (x1.assigned() && x1.val()==x0.lubMax()) {
484  GECODE_ME_CHECK(x0.exclude(home,x1.val()));
485  return home.ES_SUBSUMED(*this);
486  }
487  // if max(x0) is decided: remove max(x0) from the domain of x1
488  // then entailed
489  if (x0.glbMax() == x0.lubMax()) {
490  GECODE_ME_CHECK(x1.nq(home,x0.glbMax()));
491  return home.ES_SUBSUMED(*this);
492  }
493  // if x1 is determined and = max(x0.glb), then we need at least
494  // one more element; if there is only one above, then we must
495  // take it.
496  if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMax()) {
497  unsigned int oldGlbSize = x0.glbSize();
498  // if there is only 1 unknown above x1, then we must take it
500  // there is at least one unknown above x1 otherwise it would
501  // have been caught by the if for x1=max(x0.lub)
502  while (ur.max() < x1.val()) {
503  assert(ur());
504  ++ur;
505  };
506  // if the first range above x1 contains just 1 element,
507  // and is the last range, then take that element
508  if (ur.width() == 1) {
509  int i = ur.min();
510  ++ur;
511  if (!ur()) {
512  // last range
513  GECODE_ME_CHECK(x0.include(home,i));
514  return home.ES_SUBSUMED(*this);
515  }
516  }
517  GECODE_ME_CHECK(x0.cardMin(home, oldGlbSize+1));
518  }
519  // if dom(x1) and lub(x0) are disjoint, then entailed
520  {
521  LubRanges<View> ub(x0);
525  if (!ir()) return home.ES_SUBSUMED(*this);
526  }
527  // x0 is fated to eventually contain at least x0.cardMin elements.
528  // therefore max(x0) >= x0.cardMin-th smallest element of x0.lub.
529  // if x1 < than that, then entailed.
530  {
531  unsigned int n = x0.cardMin();
532  int nth_smallest = BndSet::MIN_OF_EMPTY;
533  for (LubRanges<View> ur(x0); ur(); ++ur) {
534  if (ur.width() >= n) {
535  // record it and exit the loop
536  nth_smallest = static_cast<int>(ur.min() + n - 1);
537  break;
538  }
539  // otherwise, we skipped ur.width() values
540  n -= ur.width();
541  }
542  // if x1.max < nth_smallest, then entailed
543  if (x1.max() < nth_smallest)
544  return home.ES_SUBSUMED(*this);
545  }
546  return ES_FIX;
547  }
548 
549  template<class View, ReifyMode rm>
555  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
556  Gecode::Int::BoolView> (home, y0, y1, b2) {}
557 
558  template<class View, ReifyMode rm>
562  Gecode::Int::IntView,Gecode::Int::PC_INT_DOM,
563  Gecode::Int::BoolView> (home, p) {}
564 
565  template<class View, ReifyMode rm>
566  ExecStatus
570  (void) new (home) ReMaxElement(home,x0,x1,b2);
571  return ES_OK;
572  }
573 
574  template<class View, ReifyMode rm>
575  Actor*
577  return new (home) ReMaxElement(home,*this);
578  }
579 
580  template<class View, ReifyMode rm>
581  ExecStatus
583  // check if b is determined
584  if (b.one()) {
585  if (rm == RM_PMI)
586  return home.ES_SUBSUMED(*this);
587  GECODE_REWRITE(*this, (MaxElement<View>::post(home(*this),x0,x1)));
588  }
589  if (b.zero()) {
590  if (rm == RM_IMP)
591  return home.ES_SUBSUMED(*this);
592  GECODE_REWRITE(*this, (NotMaxElement<View>::post(home(*this),x0,x1)));
593  }
594  // cheap tests for => b=0
595  // if x0 is empty, then b=0 and entailed
596  // if max(x1) < min(x0.lub) or min(x1) > max(x0.lub), then b=0 and entailed
597  // if max(x0.glb) > max(x1), then b=0 and entailed
598  if ((x0.cardMax() == 0) ||
599  ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
600  ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
601  {
602  if (rm != RM_PMI)
603  GECODE_ME_CHECK(b.zero(home));
604  return home.ES_SUBSUMED(*this);
605  }
606  // if max(x0) is decided
607  if (x0.glbMax() == x0.lubMax()) {
608  // if x1 is det: check if = max(x0), assign b, entailed
609  if (x1.assigned()) {
610  if (x1.val() == x0.glbMax()) {
611  if (rm != RM_IMP)
612  GECODE_ME_CHECK(b.one(home));
613  } else {
614  if (rm != RM_PMI)
615  GECODE_ME_CHECK(b.zero(home));
616  }
617  return home.ES_SUBSUMED(*this);
618  }
619  // if max(x0) not in dom(x1): b=0, entailed
620  else if ((x0.glbMax() < x1.min()) ||
621  (x0.glbMax() > x1.max()) ||
622  !x1.in(x0.glbMax()))
623  {
624  if (rm != RM_PMI)
625  GECODE_ME_CHECK(b.zero(home));
626  return home.ES_SUBSUMED(*this);
627  }
628  }
629  // if dom(x1) and lub(x0) are disjoint, then b=0, entailed
630  {
631  LubRanges<View> ub(x0);
635  if (!ir()) {
636  if (rm != RM_PMI)
637  GECODE_ME_CHECK(b.zero(home));
638  return home.ES_SUBSUMED(*this);
639  }
640  }
641  // x0 is fated to eventually contain at least x0.cardMin elements.
642  // therefore max(x0) >= x0.cardMin-th smallest element of x0.lub.
643  // if x1 < than that, then b=0, entailed.
644  {
645  unsigned int n = x0.cardMin();
646  int nth_smallest = BndSet::MIN_OF_EMPTY;
647  for (LubRanges<View> ur(x0); ur(); ++ur) {
648  if (ur.width() >= n)
649  {
650  // record it and exit the loop
651  nth_smallest = static_cast<int>(ur.min() + n - 1);
652  break;
653  }
654  // otherwise, we skipped ur.width() values
655  n -= ur.width();
656  }
657  // if x1.max < nth_smallest, then entailed
658  if (x1.max() < nth_smallest) {
659  if (rm != RM_PMI)
660  GECODE_ME_CHECK(b.zero(home));
661  return home.ES_SUBSUMED(*this);
662  }
663  }
664  return ES_FIX;
665  }
666 
667 }}}
668 
669 // STATISTICS: set-prop
ModEvent inter_r(Space &home, I &i, bool depends=true)
Intersect domain with ranges described by i.
Definition: int.hpp:180
ModEvent nq(Space &home, int n)
Restrict domain values to be different from n.
Definition: int.hpp:151
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: minmax.hpp:70
int val(void) const
Return assigned value (only if assigned)
Definition: int.hpp:70
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
Definition: macros.hpp:120
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
bool zero(void) const
Test whether view is assigned to be zero.
Definition: bool.hpp:214
MinElement(Space &home, MinElement &p)
Constructor for cloning p.
Definition: minmax.hpp:65
Inverse implication for reification.
Definition: int.hh:848
Range iterator for the unknown set.
Definition: var-imp.hpp:406
const int min
Smallest allowed integer in integer set.
Definition: set.hh:103
ExecStatus ES_SUBSUMED(Propagator &p)
Definition: core.hpp:3433
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:384
bool one(void) const
Test whether view is assigned to be one.
Definition: bool.hpp:218
Reified mixed binary propagator.
Definition: propagator.hpp:128
int max(void) const
Return largest value of range.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: minmax.hpp:158
Handle to region.
Definition: region.hpp:57
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
Definition: var-imp.hpp:116
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: minmax.hpp:419
#define forceinline
Definition: config.hpp:182
Propagation has computed fixpoint.
Definition: core.hpp:469
const int max
Largest allowed integer in integer set.
Definition: set.hh:101
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:145
Computation spaces.
Definition: core.hpp:1668
MaxElement(Space &home, MaxElement &p)
Constructor for cloning p.
Definition: minmax.hpp:404
Base-class for both propagators and branchers.
Definition: core.hpp:620
Propagator for reified minimum element
Definition: int.hh:115
Gecode::IntSet d(v, 7)
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: minmax.hpp:286
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
Definition: var-imp.hpp:114
bool in(int n) const
Test whether n is contained in domain.
Definition: int.hpp:101
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:292
NotMaxElement(Space &home, NotMaxElement &p)
Constructor for cloning p.
Definition: minmax.hpp:453
int p
Number of positive literals for node type.
Definition: bool-expr.cpp:236
Gecode::IntArgs i(4, 1, 2, 3, 4)
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:582
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:271
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
Definition: int.hpp:115
Range iterator for computing intersection (binary)
NotMinElement(Space &home, NotMinElement &p)
Constructor for cloning p.
Definition: minmax.hpp:152
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
Definition: var-type.hpp:91
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Definition: var-type.hpp:100
int min(void) const
Return minimum of domain.
Definition: int.hpp:58
size_t size
The size of the propagator (used during subsumption)
Definition: core.hpp:1029
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
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Definition: macros.hpp:56
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:164
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Definition: var-type.hpp:248
Post propagator for SetVar SetOpType SetVar SetRelType r
Definition: set.hh:769
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
bool assigned(void) const
Test whether view is assigned.
Definition: view.hpp:478
Mixed binary propagator.
Definition: pattern.hpp:208
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: minmax.hpp:576
ExecStatus
Definition: core.hpp:464
Reified propagator for maximum element
Definition: int.hh:202
ReMinElement(Space &home, ReMinElement &p)
Constructor for cloning p.
Definition: minmax.hpp:279
ReMaxElement(Space &home, ReMaxElement &p)
Constructor for cloning p.
Definition: minmax.hpp:560
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
Definition: int.hpp:133
Execution is okay.
Definition: core.hpp:468
Gecode toplevel namespace
int max(void) const
Return maximum of domain.
Definition: int.hpp:62
Implication for reification.
Definition: int.hh:841
int min(void) const
Return smallest value of range.
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:567
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:472
int ModEventDelta
Modification event deltas.
Definition: core.hpp:91
Home class for posting propagators
Definition: core.hpp:846
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:459
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition: minmax.hpp:466
Propagator for minimum element
Definition: int.hh:59
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition: minmax.hpp:425
Boolean view for Boolean variables.
Definition: view.hpp:1329