52 : _ranges(ranges), _size(size), _pos(0) {}
54 void init(
int* ranges,
int size) {
55 _ranges = ranges; _size = size; _pos = 0;
70 int min(
void)
const {
return _ranges[_pos*2]; }
72 int max(
void)
const {
return _ranges[_pos*2+1]; }
74 unsigned int width(
void)
const {
75 return static_cast<unsigned int>(_ranges[_pos*2+1]-_ranges[_pos*2]+1);
88 ranges = home.
alloc<
int>(2*size);
90 for (
int i=0; dr(); ++dr, i+=2) {
91 int min = dr.min();
int max = dr.max();
94 domSize +=
static_cast<unsigned int>(
max-
min+1);
112 for (
int j=size; j--; ) {
113 if (ranges[2*j+1] < i)
115 if (ranges[2*j] >= i)
172 ranges[0]==ranges[1] && ranges[0]==c)) ?
221 home.
free<
int>(ranges, 2);
229 ranges = home.
alloc<
int>(2*size);
230 for (
int i=size; i--; ) {
231 ranges[2*i] = p.ranges[2*i];
232 ranges[2*i+1] = p.ranges[2*i+1];
636 ar.init(
x.ranges,
x.size);
651 int min(
void)
const {
return ar.min(); }
653 int max(
void)
const {
return ar.max(); }
655 unsigned int width(
void)
const {
return ar.width(); }
685 if (domSize <
y.domSize)
687 if (domSize >
y.domSize)
689 for (
int i=size; i--; ) {
690 if (ranges[2*i] <
y.ranges[2*i])
692 if (ranges[2*i] >
y.ranges[2*i])
694 if (ranges[2*i+1] <
y.ranges[2*i+1])
696 if (ranges[2*i+1] >
y.ranges[2*i+1])
708 if ((
x.size !=
y.size) || (
x.domSize !=
y.domSize))
710 for (
int i=
x.size; i--; )
711 if ((
x.ranges[2*i] !=
y.ranges[2*i]) ||
712 (
x.ranges[2*i+1] !=
y.ranges[2*i+1]))
void update(Space &home, ConstView &y)
Update this view to be a clone of view y.
Generic domain change information to be supplied to advisors.
Range iterator for integer sets.
Range iterator for empty range.
Range iterator for singleton range.
Singleton(void)
Default constructor.
Range iterator for a two-dimensional array
bool operator()(void) const
Test whether iterator is still at a range or done.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
ArrayRanges(int *ranges, int size)
Initialize with ranges for array ranges which is of size size.
int max(void) const
Return largest value of range.
ArrayRanges(void)
Default constructor.
void init(int *ranges, int size)
Initialize with ranges for array ranges which is of size size.
int min(void) const
Return smallest value of range.
void operator++(void)
Move iterator to next range (if possible)
static const int MAX_OF_EMPTY
Returned by empty sets when asked for their maximum element.
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
bool notContains(int i) const
Test whether i is not in the least upper bound.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
unsigned int cardMin(void) const
Return minimum cardinality.
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 contains(int i) const
Test whether i is in the greatest lower bound.
bool operator<(const ConstSetView &y) const
Whether this view comes before view y (arbitray order)
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.
int lubMax(void) const
Return maximum of the least upper bound.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in 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 glbMax(void) const
Return maximum of the greatest lower bound.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
unsigned int unknownSize(void) const
Return the number of unknown elements.
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
int lubMin(void) const
Return minimum of the least upper bound.
int glbMin(void) const
Return minimum of the greatest lower bound.
void update(Space &home, ConstSetView &y)
Update this view to be a clone of view y.
ConstSetView(void)
Default constructor.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
unsigned int cardMax(void) const
Return maximum cardinality.
Constant view for the empty set.
EmptyView(void)
Default constructor.
unsigned int cardMin(void) const
Return minimum cardinality.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
bool contains(int i) const
Test whether i is in the greatest lower bound.
int lubMax(void) const
Return maximum of the least upper bound.
bool notContains(int i) const
Test whether i is not in the least upper bound.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
int lubMin(void) const
Return minimum of the least upper bound.
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
int glbMin(void) const
Return minimum of the greatest lower bound.
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.
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
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 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 lubSize(void) const
Return the number of elements in the least upper bound.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
unsigned int unknownSize(void) const
Return the number of unknown elements.
void init(const ConstSetView &x)
Initialize with ranges for view x.
GlbRanges(const ConstSetView &x)
Initialize with ranges for view x.
GlbRanges(void)
Default constructor.
GlbRanges(const EmptyView &x)
Initialize with ranges for view x.
void init(const EmptyView &x)
Initialize with ranges for view x.
GlbRanges(void)
Default constructor.
GlbRanges(const UniverseView &x)
Initialize with ranges for view x.
void init(const UniverseView &x)
Initialize with ranges for view x.
GlbRanges(void)
Default constructor.
LubRanges(void)
Default constructor.
int max(void) const
Return largest value of range.
int min(void) const
Return smallest value of range.
LubRanges(const ConstSetView &x)
Initialize with ranges for view x.
void init(const ConstSetView &x)
Initialize with ranges for view x.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
LubRanges(const EmptyView &x)
Initialize with ranges for view x.
LubRanges(void)
Default constructor.
void init(const EmptyView &x)
Initialize with ranges for view x.
LubRanges(void)
Default constructor.
void init(const UniverseView &x)
Initialize with ranges for view x.
LubRanges(const UniverseView &x)
Initialize with ranges for view x.
void init(const T &x)
Initialize with least upper bound ranges for set variable x.
bool operator()(void) const
Test whether iterator is still at a range or done.
void operator++(void)
Move iterator to next range (if possible)
Constant view for the universe.
int glbMax(void) const
Return maximum of the greatest lower bound.
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper 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.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
UniverseView(void)
Default constructor.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
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 notContains(int i) const
Test whether i is not in the least upper bound.
bool contains(int i) const
Test whether i is in the greatest lower bound.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
int lubMax(void) const
Return maximum of the least upper bound.
unsigned int unknownSize(void) const
Return the number of unknown elements.
unsigned int cardMin(void) const
Return minimum cardinality.
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
unsigned int cardMax(void) const
Return maximum cardinality.
int lubMin(void) const
Return minimum of the least upper bound.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
void free(T *b, long unsigned int n)
Delete n objects allocated from space heap starting at b.
Numerical limits for integer variables.
bool operator==(const CachedView< View > &x, const CachedView< View > &y)
bool operator!=(const CachedView< View > &x, const CachedView< View > &y)
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
Range and value iterators.
const int min
Smallest allowed integer in integer set.
const unsigned int card
Maximum cardinality of an integer set.
const int max
Largest allowed integer in integer set.
const Gecode::ModEvent ME_SET_NONE
Domain operation has not changed domain.
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
Gecode toplevel namespace
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Post propagator for SetVar SetOpType SetVar y
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar x
int ModEvent
Type for modification events.
#define GECODE_NEVER
Assert that this command is never executed.