40namespace Gecode {
namespace Set {
56 unsigned int cardMin,
unsigned int cardMax)
58 lub(home,ubMin,ubMax), glb(home,lbMin,lbMax) {
65 const IntSet& theGlb,
int ubMin,
int ubMax,
66 unsigned int cardMin,
unsigned int cardMax)
68 lub(home,ubMin,ubMax), glb(home,theGlb) {
75 int lbMin,
int lbMax,
const IntSet& theLub,
76 unsigned int cardMin,
unsigned int cardMax)
78 lub(home,theLub), glb(home,lbMin,lbMax) {
86 unsigned int cardMin,
unsigned int cardMax)
167 return cardMin_full(home);
177 return cardMax_full(home);
189 int oldMin = lub.
min();
190 int oldMax = lub.
max();
194 d._lubMin = lub.
max()+1;
196 }
else if (j == oldMax) {
198 d._lubMax = lub.
min()-1;
200 return processLubChange(home, d);
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) {
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) {
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) {
int n
Number of negative literals for node type.
Generic domain change information to be supplied to advisors.
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.
void init(const BndSet &s)
Initialize with BndSet s.
int min(void) const
Return smallest element.
int minN(unsigned int n) const
Return n -th smallest element.
unsigned int size(void) const
Return size.
bool in(int i) const
Test whether i is an element of this set.
void become(Space &home, const BndSet &s)
Make this set equal to s.
int max(void) const
Return greatest element.
unsigned int card(void) const
Return cardinality.
bool includeI(Space &home, I &i)
Include the set represented by i in this set.
bool include(Space &home, int i, int j, SetDelta &d)
Include the set in this set.
Range iterator for the greatest lower bound.
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.
bool intersect(Space &home, int i, int j)
Intersect this set with the set .
void excludeAll(Space &home)
Exclude all elements from this set.
bool exclude(Space &home, int i, int j, SetDelta &d)
Exclude the set from this set.
Range iterator for the least upper bound.
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.
Base-class for Set-variable implementations.
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.