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