38 namespace Gecode {
namespace Set {
52 ArrayRanges(
void) : _ranges(NULL), _size(0), _pos(0) {}
56 : _ranges(ranges), _size(size), _pos(0) {}
59 _ranges = ranges; _size =
size; _pos = 0;
73 int min(
void)
const {
return _ranges[_pos*2]; }
76 int max(
void)
const {
return _ranges[_pos*2+1]; }
78 unsigned int width(
void)
const {
79 return static_cast<unsigned int>(_ranges[_pos*2+1]-_ranges[_pos*2]+1);
92 ranges = home.
alloc<
int>(2*size);
94 for (
int i=0; dr(); ++dr,
i+=2) {
95 int min = dr.min();
int max = dr.max();
98 domSize +=
static_cast<unsigned int>(max-min+1);
116 for (
int j=size; j--; ) {
117 if (ranges[2*j+1] < i)
119 if (ranges[2*j] >= i)
176 ranges[0]==ranges[1] && ranges[0]==c)) ?
225 home.
free<
int>(ranges, 2);
233 ranges = home.
alloc<
int>(2*size);
234 for (
int i=size;
i--; ) {
235 ranges[2*
i] = p.ranges[2*
i];
236 ranges[2*
i+1] = p.ranges[2*
i+1];
589 : Iter::Ranges::Singleton(Limits::
min,
613 : Iter::Ranges::Singleton(Limits::
min,
640 ar.
init(x.ranges,x.size);
654 int min(
void)
const {
return ar.
min(); }
689 if ((x.size != y.size) || (x.domSize != y.domSize))
691 for (
int i=x.size;
i--; )
692 if (x.ranges[2*
i] != y.ranges[2*
i] ||
693 x.ranges[2*
i+1] != y.ranges[2*
i+1])
701 if (x.domSize < y.domSize)
703 for (
int i=x.size;
i--; )
704 if (x.ranges[2*
i] < y.ranges[2*
i] ||
705 x.ranges[2*
i+1] < y.ranges[2*
i+1])
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
int max(void) const
Return largest value of range.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
unsigned int cardMin(void) const
Return minimum cardinality.
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
void update(Space &home, bool share, ConstSetView &y)
Update this view to be a clone of view y.
ConstSetView(void)
Default constructor.
Range iterator for singleton range.
ArrayRanges(void)
Default constructor.
bool notContains(int i) const
Test whether i is not in the least upper bound.
const int min
Smallest allowed integer in integer set.
Range iterator for integer sets.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
unsigned int cardMax(void) const
Return maximum cardinality.
bool operator()(void) const
Test whether iterator is still at a range or done.
LubRanges(const ConstSetView &x)
Initialize with ranges for view x.
int max(void) const
Return largest value of range.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
int max(void) const
Return largest value of range.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
void init(const UniverseView &x)
Initialize with ranges for view x.
void init(const EmptyView &x)
Initialize with ranges for view x.
void update(Space &home, bool share, ConstView &y)
Update this view to be a clone of view y.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
int ModEvent
Type for modification events.
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
int lubMin(void) const
Return minimum of the least upper bound.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
Range iterator for the greatest lower bound.
void init(const ConstSetView &x)
Initialize with ranges for view x.
unsigned int unknownSize(void) const
Return the number of unknown elements.
int min(void) const
Return smallest value of range.
bool contains(int i) const
Test whether i is in the greatest lower bound.
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j...
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
const unsigned int card
Maximum cardinality of an integer set.
const int max
Largest allowed integer in integer set.
Range iterator for the least upper bound.
UniverseView(void)
Default constructor.
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
unsigned int unknownSize(void) const
Return the number of unknown elements.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
int min(void) const
Return smallest value of range.
ArrayRanges(int *ranges, int size)
Initialize with ranges for array ranges which is of size size.
unsigned int unknownSize(void) const
Return the number of unknown elements.
unsigned int cardMax(void) const
Return maximum cardinality.
void init(const UniverseView &x)
Initialize with ranges for view x.
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
Gecode::FloatVal c(-8, 8)
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
int max(void) const
Return largest value of range.
int p
Number of positive literals for node type.
int glbMax(void) const
Return maximum of the greatest lower bound.
Gecode::IntArgs i(4, 1, 2, 3, 4)
GlbRanges(const ConstSetView &x)
Initialize with ranges for view x.
int glbMin(void) const
Return minimum of the greatest lower bound.
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j...
int glbMin(void) const
Return minimum of the greatest lower bound.
Constant view for the universe.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
int ranges(void) const
Return number of ranges of the specification.
bool notContains(int i) const
Test whether i is not in the least upper bound.
int lubMax(void) const
Return maximum of the least upper bound.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
void operator++(void)
Move iterator to next range (if possible)
unsigned int size(I &i)
Size of all ranges of range iterator i.
EmptyView(void)
Default constructor.
unsigned int cardMax(void) const
Return maximum cardinality.
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j...
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
int min(void) const
Return smallest value of range.
bool contains(int i) const
Test whether i is in the greatest lower bound.
const Gecode::ModEvent ME_SET_NONE
Domain operation has not changed domain.
int lubMax(void) const
Return maximum of the least upper bound.
void init(const ConstSetView &x)
Initialize with ranges for view x.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
int lubMax(void) const
Return maximum of the least upper bound.
LubRanges(const EmptyView &x)
Initialize with ranges for view x.
bool same(const ConstSetView &x, const ConstSetView &y)
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j...
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
GlbRanges(const UniverseView &x)
Initialize with ranges for view x.
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j...
LubRanges(const UniverseView &x)
Initialize with ranges for view x.
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void init(int *ranges, int size)
Initialize with ranges for array ranges which is of size size.
Node * x
Pointer to corresponding Boolean expression node.
Generic domain change information to be supplied to advisors.
void init(const EmptyView &x)
Initialize with ranges for view x.
GlbRanges(const EmptyView &x)
Initialize with ranges for view x.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
GlbRanges(void)
Default constructor.
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
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.
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j...
bool operator()(void) const
Test whether iterator is still at a range or done.
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
Range iterator for a two-dimensional array
bool notContains(int i) const
Test whether i is not in the least upper bound.
Gecode toplevel namespace
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
int glbMax(void) const
Return maximum of the greatest lower bound.
LubRanges(void)
Default constructor.
Range iterator for empty range.
Constant view for the empty set.
bool before(const ConstSetView &x, const ConstSetView &y)
int glbMax(void) const
Return maximum of the greatest lower bound.
unsigned int cardMin(void) const
Return minimum cardinality.
void operator++(void)
Move iterator to next range (if possible)
#define GECODE_NEVER
Assert that this command is never executed.
int glbMin(void) const
Return minimum of the greatest lower bound.
unsigned int cardMin(void) const
Return minimum cardinality.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
bool contains(int i) const
Test whether i is in the greatest lower bound.
int lubMin(void) const
Return minimum of the least upper bound.