51 assert(lub.card()==lub.size());
58 lub(home,ubMin,ubMax), glb(home,lbMin,lbMax) {
59 glb.card(std::max(
cardMin, glb.size() ));
60 lub.card(std::min(
cardMax, lub.size() ));
65 const IntSet& theGlb,
int ubMin,
int ubMax,
68 lub(home,ubMin,ubMax), glb(home,theGlb) {
69 glb.card(std::max(
cardMin, glb.size() ));
70 lub.card(std::min(
cardMax, lub.size() ));
75 int lbMin,
int lbMax,
const IntSet& theLub,
78 lub(home,theLub), glb(home,lbMin,lbMax) {
79 glb.card(std::max(
cardMin, glb.size() ));
80 lub.card(std::min(
cardMax, lub.size() ));
88 glb.card(std::max(
cardMin, glb.size() ));
89 lub.card(std::min(
cardMax, lub.size() ));
95 return glb.size() == lub.size();
167 return cardMin_full(home);
177 return cardMax_full(home);
189 int oldMin = lub.min();
190 int oldMax = lub.max();
191 if (lub.intersect(home, i, j)) {
194 d._lubMin = lub.
max()+1;
196 }
else if (j == oldMax) {
198 d._lubMax = lub.
min()-1;
200 return processLubChange(home, d);
224 SetDelta d(1, 0, lub.min(), lub.max());
225 lub.excludeAll(home);
228 int mi=iterator.min();
229 int ma=iterator.max();
232 return intersectI_full(home, mi, ma, iterator);
239 SetVarImp::intersectI_full(
Space& home,
int mi,
int ma, I& iterator) {
262 glb.become(home, lub);
281 if (glb.include(home, i, j, d))
282 return processGlbChange(home, d);
302 int mi=iterator.min();
303 int ma=iterator.max();
306 return includeI_full(home, mi, ma, iterator);
313 SetVarImp::includeI_full(
Space& home,
int mi,
int ma, I& iterator) {
336 lub.become(home, glb);
355 if (lub.exclude(home, i, j, d))
356 return processLubChange(home, d);
375 int mi=iterator.min();
376 int ma=iterator.max();
379 return excludeI_full(home, mi, ma, iterator);
386 SetVarImp::excludeI_full(
Space& home,
int mi,
int ma, I& iterator) {
409 glb.become(home, lub);
Generic domain change information to be supplied to advisors.
int min(int i) const
Return minimum of range at position i.
int max(int i) const
Return maximum of range at position i.
Range iterator for computing set difference.
Range iterator for computing intersection (binary)
Range iterator for appending a singleton with a range iterator
Range iterator for singleton range.
Range iterator for integer sets.
BndSetRanges(void)
Default constructor.
void init(const BndSet &s)
Initialize with BndSet s.
unsigned int size(void) const
Return size.
void become(Space &home, const BndSet &s)
Make this set equal to s.
unsigned int card(void) const
Return cardinality.
bool includeI(Space &home, I &i)
Include the set represented by i in this set.
void init(const SetVarImp *)
Initialize with ranges for variable implementation x.
GlbRanges(void)
Default constructor.
void init(const T &x)
Initialize with greatest lower bound ranges for set variable x.
GlbRanges(void)
Default constructor.
bool intersectI(Space &home, I &i)
Exclude all elements not in the set represented by i from this set.
bool excludeI(Space &home, I &i)
Exclude all elements in the set represented by i from this set.
void init(const SetVarImp *)
Initialize with ranges for variable implementation x.
LubRanges(void)
Default constructor.
LubRanges(void)
Default constructor.
void init(const T &x)
Initialize with least upper bound ranges for set variable x.
Finite set delta information for advisors.
SetVarImpBase(Gecode::Space &home, SetVarImpBase &x)
Constructor for cloning x.
Gecode::ModEvent notify(Gecode::Space &home, Gecode::ModEvent me, Gecode::Delta &d)
Notify that variable implementation has been modified with modification event me and delta informatio...
Finite integer set variable implementation.
bool knownIn(int n) const
Test whether n is contained in greatest lower bound.
int glbMin(void) const
Return minimum of the greatest lower bound.
ModEvent intersect(Space &home, int n)
Exclude everything but n from the least upper bound.
int lubMinN(unsigned int n) const
Return n -th smallest element in the least upper bound.
static bool lubAny(const Delta &d)
Test whether arbitrary values got pruned from lub.
unsigned int cardMax(void) const
Return current cardinality maximum.
SetVarImp * copy(Space &home)
Return copy of this variable.
unsigned int lubSize(void) const
Return the size of the least upper bound.
int lubMin(void) const
Return minimum of the least upper bound.
bool assigned(void) const
Test whether variable is assigned.
int lubMax(void) const
Return maximum of the least upper bound.
int glbMax(void) const
Return maximum of the greatest lower bound.
ModEvent excludeI(Space &home, I &i)
Exclude set described by i from the least upper bound.
static bool glbAny(const Delta &d)
Test whether arbitrary values got pruned from glb.
bool knownOut(int) const
Test whether n is not contained in least upper bound.
ModEvent includeI(Space &home, I &i)
Include set described by i in the greatest lower bound.
unsigned int glbSize(void) const
Return the size of the greatest lower bound.
ModEvent intersectI(Space &home, I &i)
Exclude everything but set described by i from the least upper bound.
ModEvent exclude(Space &home, int n)
Exclude n from the least upper bound.
ModEvent include(Space &home, int n)
Include n in the greatest lower bound.
unsigned int cardMin(void) const
Return current cardinality minimum.
SetVarImp(Space &home, SetVarImp &x)
Constructor for cloning x.
ModEvent fail(Space &home)
VarImp * forward(void) const
static ModEvent me(const ModEventDelta &med)
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
const unsigned int card
Maximum cardinality of an integer set.
const Gecode::ModEvent ME_SET_CLUB
Domain operation has changed the least upper bound and the cardinality.
const Gecode::ModEvent ME_SET_NONE
Domain operation has not changed domain.
const Gecode::ModEvent ME_SET_VAL
Domain operation has resulted in a value (assigned variable)
const Gecode::ModEvent ME_SET_GLB
Domain operation has changed the greatest lower bound.
const Gecode::ModEvent ME_SET_CGLB
Domain operation has changed the greatest lower bound and the cardinality.
const Gecode::ModEvent ME_SET_LUB
Domain operation has changed the least upper bound.
Gecode toplevel namespace
Post propagator for SetVar x
int ModEvent
Type for modification events.