44 namespace Gecode {
namespace Set {
60 unsigned int cardMin,
unsigned int cardMax)
62 lub(home,ubMin,ubMax), glb(home,lbMin,lbMax) {
69 const IntSet& theGlb,
int ubMin,
int ubMax,
70 unsigned int cardMin,
unsigned int cardMax)
72 lub(home,ubMin,ubMax), glb(home,theGlb) {
79 int lbMin,
int lbMax,
const IntSet& theLub,
80 unsigned int cardMin,
unsigned int cardMax)
82 lub(home,theLub), glb(home,lbMin,lbMax) {
90 unsigned int cardMin,
unsigned int cardMax)
141 return static_cast<const SetDelta&>(
d).glbMin();
145 return static_cast<const SetDelta&>(
d).glbMax();
149 return static_cast<const SetDelta&>(
d).glbAny();
153 return static_cast<const SetDelta&>(
d).lubMin();
157 return static_cast<const SetDelta&>(
d).lubMax();
161 return static_cast<const SetDelta&>(
d).lubAny();
171 return cardMin_full(home);
181 return cardMax_full(home);
193 int oldMin = lub.
min();
194 int oldMax = lub.
max();
198 d._lubMin = lub.
max()+1;
200 }
else if (j == oldMax) {
202 d._lubMax = lub.
min()-1;
204 return processLubChange(home,
d);
232 int mi=iterator.min();
233 int ma=iterator.max();
236 return intersectI_full(home, mi, ma, iterator);
243 SetVarImp::intersectI_full(
Space& home,
int mi,
int ma, I& iterator) {
286 return processGlbChange(home,
d);
306 int mi=iterator.min();
307 int ma=iterator.max();
310 return includeI_full(home, mi, ma, iterator);
317 SetVarImp::includeI_full(
Space& home,
int mi,
int ma, I& iterator) {
360 return processLubChange(home,
d);
379 int mi=iterator.min();
380 int ma=iterator.max();
383 return excludeI_full(home, mi, ma, iterator);
390 SetVarImp::excludeI_full(
Space& home,
int mi,
int ma, I& iterator) {
430 static_cast<SetVarImp*>(
forward()) :
431 perform_copy(home,share);
static bool lubAny(const Delta &d)
Test whether arbitrary values got pruned from lub.
int lubMax(void) const
Return maximum of the least upper bound.
bool excludeI(Space &home, I &i)
Exclude all elements in the set represented by i from this set.
unsigned int cardMin(void) const
Return current cardinality minimum.
ModEvent exclude(Space &home, int n)
Exclude n from the least upper bound.
VarImp * forward(void) const
Use forward pointer if variable already copied.
const Gecode::ModEvent ME_SET_LUB
Domain operation has changed the least upper bound.
Range iterator for singleton range.
SetVarImp * copy(Space &home, bool share)
Return copy of this variable.
const FloatNum max
Largest allowed float value.
SetVarImp(Space &home, bool share, SetVarImp &x)
Constructor for cloning x.
int max(void) const
Return greatest element.
bool assigned(void) const
Test whether variable is assigned.
ModEvent excludeI(Space &home, I &i)
Exclude set described by i from the least upper bound.
bool knownOut(int) const
Test whether n is not contained in least upper bound.
int ModEvent
Type for modification events.
Range iterator for the greatest lower bound.
int minN(unsigned int n) const
Return n -th smallest element.
Finite integer set variable implementation.
bool in(int i) const
Test whether i is an element of this set.
const unsigned int card
Maximum cardinality of an integer set.
ModEvent intersect(Space &home, int n)
Exclude everything but n from the least upper bound.
Range iterator for appending a singleton with a range iterator
int lubMinN(unsigned int n) const
Return n -th smallest element in the least upper bound.
Range iterator for the least upper bound.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
unsigned int size(void) const
Return size.
void become(Space &home, const BndSet &s)
Make this set equal to s.
static bool glbAny(const Delta &d)
Test whether arbitrary values got pruned from glb.
static ModEvent me(const ModEventDelta &med)
Project modification event for this variable type from med.
bool copied(void) const
Is variable already copied.
unsigned int cardMax(void) const
Return current cardinality maximum.
Range iterator for computing intersection (binary)
ModEvent includeI(Space &home, I &i)
Include set described by i in the greatest lower bound.
const Gecode::ModEvent ME_SET_CGLB
Domain operation has changed the greatest lower bound and the cardinality.
bool intersectI(Space &home, I &i)
Exclude all elements not in the set represented by i from this set.
Range iterator for integer sets.
void init(const BndSet &s)
Initialize with BndSet s.
unsigned int glbSize(void) const
Return the size of the greatest lower bound.
const Gecode::ModEvent ME_SET_GLB
Domain operation has changed the greatest lower bound.
const Gecode::ModEvent ME_SET_NONE
Domain operation has not changed domain.
ModEvent include(Space &home, int n)
Include n in the greatest lower bound.
bool exclude(Space &home, int i, int j, SetDelta &d)
Exclude the set from this set.
bool includeI(Space &home, I &i)
Include the set represented by i in this set.
int lubMin(void) const
Return minimum of the least upper bound.
Base-class for Set-variable implementations.
ModEvent intersectI(Space &home, I &i)
Exclude everything but set described by i from the least upper bound.
bool intersect(Space &home, int i, int j)
Intersect this set with the set .
unsigned int lubSize(void) const
Return the size of the least upper bound.
Generic domain change information to be supplied to advisors.
int glbMin(void) const
Return minimum of the greatest lower bound.
const Gecode::ModEvent ME_SET_CLUB
Domain operation has changed the least upper bound and the cardinality.
GlbRanges(void)
Default constructor.
void init(const T &x)
Initialize with least upper bound ranges for set variable x.
int glbMax(void) const
Return maximum of the greatest lower bound.
bool knownIn(int n) const
Test whether n is contained in greatest lower bound.
ModEvent fail(Space &home)
Run advisors to be run on failure and returns ME_GEN_FAILED.
Post propagator for SetVar 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...
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
Gecode toplevel namespace
Range iterator for computing set difference.
LubRanges(void)
Default constructor.
const Gecode::ModEvent ME_SET_VAL
Domain operation has resulted in a value (assigned variable)
unsigned int card(void) const
Return cardinality.
int min(void) const
Return smallest element.
void init(const T &x)
Initialize with greatest lower bound ranges for set variable x.
bool include(Space &home, int i, int j, SetDelta &d)
Include the set in this set.
void excludeAll(Space &home)
Exclude all elements from this set.
Finite set delta information for advisors.