48 namespace Gecode {
namespace Set {
namespace Int {
71 return new (home)
MinElement(home,share,*
this);
94 assert(x0.cardMin()>=1);
98 unsigned int size = 0;
102 int* ub = r.
alloc<
int>(size*2);
106 ub[2*i+1] = ubr.max();
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);
112 maxN =
static_cast<int>(ub[2*i+1]-x0cm);
168 if ((x0.cardMax() == 0) ||
169 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
170 ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
174 if (x1.assigned() && x1.val()==x0.lubMin()) {
180 if (x0.glbMin() == x0.lubMin()) {
187 if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMin()) {
188 unsigned int oldGlbSize = x0.glbSize();
201 if (!ur() || ur.
min()>x1.val()) {
229 int* _ur = r.
alloc<
int>(num_ranges*2);
233 _ur[2*
i ] = ur.min();
234 _ur[2*i+1] = ur.max();
238 unsigned int n = x0.cardMin();
240 for (
int i=num_ranges; i--; ) {
242 unsigned int num_values =
static_cast<unsigned int>(_ur[2*i+1]-_ur[2*
i]+1);
244 if (num_values >= n) {
246 nth_largest =
static_cast<int>(_ur[2*i+1]-n+1);
253 if (x1.min() > nth_largest)
259 template<
class View, ReifyMode rm>
268 template<
class View, ReifyMode rm>
276 template<
class View, ReifyMode rm>
284 template<
class View, ReifyMode rm>
290 template<
class View, ReifyMode rm>
308 if ((x0.cardMax() == 0) ||
309 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
310 ((x0.glbSize() > 0) && (x0.glbMin() < x1.min())))
317 if (x0.glbMin() == x0.lubMin()) {
320 if (x1.val() == x0.glbMin()) {
330 else if ((x0.glbMin() < x1.min()) ||
331 (x0.glbMin() > x1.max()) ||
420 return new (home)
MaxElement(home,share,*
this);
429 assert(x0.cardMin()>=1);
478 if ((x0.cardMax() == 0) ||
479 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
480 ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
484 if (x1.assigned() && x1.val()==x0.lubMax()) {
490 if (x0.glbMax() == x0.lubMax()) {
497 if (x1.assigned() && x0.glbSize() > 0 && x1.val()==x0.glbMax()) {
498 unsigned int oldGlbSize = x0.glbSize();
503 while (ur.
max() < x1.val()) {
509 if (ur.
width() == 1) {
532 unsigned int n = x0.cardMin();
535 if (ur.width() >=
n) {
537 nth_smallest =
static_cast<int>(ur.min() + n - 1);
544 if (x1.max() < nth_smallest)
550 template<
class View, ReifyMode rm>
559 template<
class View, ReifyMode rm>
567 template<
class View, ReifyMode rm>
576 template<
class View, ReifyMode rm>
582 template<
class View, ReifyMode rm>
600 if ((x0.cardMax() == 0) ||
601 ((x1.max() < x0.lubMin()) || (x1.min() > x0.lubMax())) ||
602 ((x0.glbSize() > 0) && (x0.glbMax() > x1.max())))
609 if (x0.glbMax() == x0.lubMax()) {
612 if (x1.val() == x0.glbMax()) {
622 else if ((x0.glbMax() < x1.min()) ||
623 (x0.glbMax() > x1.max()) ||
647 unsigned int n = x0.cardMin();
653 nth_smallest =
static_cast<int>(ur.min() + n - 1);
660 if (x1.max() < nth_smallest) {
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the minimal element of s.
Inverse implication for reification.
Range iterator for the unknown set.
const int min
Smallest allowed integer in integer set.
ExecStatus ES_SUBSUMED(Propagator &p)
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Propagator for not maximum element
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
int max(void) const
Return largest value of range.
ReMinElement(Space &home, bool share, ReMinElement &p)
Constructor for cloning p.
Reified mixed binary propagator.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
Propagation has computed fixpoint.
const int max
Largest allowed integer in integer set.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the minimal element of s.
Base-class for both propagators and branchers.
Propagator for reified minimum element
int min(void) const
Return smallest value of range.
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
int n
Number of negative literals for node type.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for not minimum element
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.
Range iterator for computing intersection (binary)
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
unsigned int size(I &i)
Size of all ranges of range iterator i.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
MaxElement(Space &home, bool share, MaxElement &p)
Constructor for cloning p.
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is the largest element of s.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
ReMaxElement(Space &home, bool share, ReMaxElement &p)
Constructor for cloning p.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
NotMaxElement(Space &home, bool share, NotMaxElement &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Propagator for maximum element
Integer view for integer variables.
Reified propagator for maximum element
MinElement(Space &home, bool share, MinElement &p)
Constructor for cloning p.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
NotMinElement(Space &home, bool share, NotMinElement &p)
Constructor for cloning p.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
Gecode toplevel namespace
Implication for reification.
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.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
int ModEventDelta
Modification event deltas.
Home class for posting propagators
static ExecStatus post(Home home, View s, Gecode::Int::IntView x)
Post propagator for x is not the largest element of s.
Propagator for minimum element
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
Boolean view for Boolean variables.