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)
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) {
270 return notify(home, me, d);
285 if (glb.
include(home, i, j, d))
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) {
344 return notify(home, me, d);
359 if (lub.
exclude(home, i, j, d))
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) {
417 return notify(home, me, d);
431 perform_copy(home,share);
bool in(int i) const
Test whether i is an element of this set.
static bool lubAny(const Delta &d)
Test whether arbitrary values got pruned from lub.
bool excludeI(Space &home, I &i)
Exclude all elements in the set represented by i from this set.
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
ModEvent exclude(Space &home, int n)
Exclude n from the least upper bound.
const Gecode::ModEvent ME_SET_LUB
Domain operation has changed the least upper bound.
Range iterator for singleton range.
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc.
SetVarImp * copy(Space &home, bool share)
Return copy of this variable.
int glbMin(void) const
Return minimum of the greatest lower bound.
const FloatNum max
Largest allowed float value.
SetVarImp(Space &home, bool share, SetVarImp &x)
Constructor for cloning x.
int lubMinN(unsigned int n) const
Return n -th smallest element in the least upper bound.
ModEvent excludeI(Space &home, I &i)
Exclude set described by i from the least upper bound.
int ModEvent
Type for modification events.
Base-class for propagators.
Range iterator for the greatest lower bound.
Finite integer set variable implementation.
unsigned int card(void) const
Return cardinality.
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
Range iterator for the least upper bound.
void subscribe(Gecode::Space &home, Gecode::Propagator &p, Gecode::PropCond pc, bool assigned, bool schedule)
Subscribe propagator p with propagation condition pc.
int glbMax(void) const
Return maximum of the greatest lower bound.
int minN(unsigned int n) const
Return n -th smallest element.
void cancel(Space &home)
Cancel all subscriptions when variable implementation is assigned.
unsigned int size(void) const
Return size.
int lubMax(void) const
Return maximum of the least upper bound.
int p
Number of positive literals for node type.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
bool copied(void) const
Is variable already copied.
int n
Number of negative literals for node type.
unsigned int cardMax(void) const
Return current cardinality maximum.
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.
unsigned int cardMin(void) const
Return current cardinality minimum.
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.
int PropCond
Type for propagation conditions.
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.
const Gecode::ModEvent ME_SET_GLB
Domain operation has changed the greatest lower bound.
bool knownOut(int) const
Test whether n is not contained in least upper 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.
bool knownIn(int n) const
Test whether n is contained in greatest lower 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 .
Node * x
Pointer to corresponding Boolean expression node.
Generic domain change information to be supplied to advisors.
unsigned int lubSize(void) const
Return the size of the least upper bound.
const Gecode::ModEvent ME_SET_CLUB
Domain operation has changed the least upper bound and the cardinality.
GlbRanges(void)
Default constructor.
int min(void) const
Return smallest element.
void init(const T &x)
Initialize with least upper bound ranges for set variable x.
int lubMin(void) const
Return minimum of the least upper bound.
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...
unsigned int glbSize(void) const
Return the size of the greatest lower bound.
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)
bool assigned(void) const
Test whether variable is assigned.
int max(void) const
Return greatest element.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
void init(const T &x)
Initialize with greatest lower bound ranges for set variable x.
VarImp * forward(void) const
Use forward pointer if variable already copied.
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.