Go to the documentation of this file.
34 namespace Gecode {
namespace Set {
48 ArrayRanges(
void) : _ranges(NULL), _size(0), _pos(0) {}
52 : _ranges(ranges), _size(
size), _pos(0) {}
55 _ranges = ranges; _size =
size; _pos = 0;
69 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];
585 : Iter::Ranges::Singleton(Limits::
min,
609 : Iter::Ranges::Singleton(Limits::
min,
650 int min(
void)
const {
return ar.
min(); }
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]))
bool contains(int i) const
Test whether i is in 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 glbMin(void) const
Return minimum of the greatest lower bound.
Post propagator for SetVar x
unsigned int cardMin(void) const
Return minimum cardinality.
Post propagator for SetVar SetOpType SetVar y
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
bool operator()(void) const
Test whether iterator is still at a range or done.
GlbRanges(const UniverseView &x)
Initialize with ranges for view x.
unsigned int cardMax(void) const
Return maximum cardinality.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
GlbRanges(const EmptyView &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.
bool operator()(void) const
Test whether iterator is still at a range or done.
unsigned int cardMax(void) const
Return maximum cardinality.
int max(void) const
Return largest value of range.
int lubMin(void) const
Return minimum of the least upper bound.
int glbMax(void) const
Return maximum of the greatest lower bound.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
void init(const UniverseView &x)
Initialize with ranges for view x.
unsigned int size(I &i)
Size of all ranges of range iterator i.
unsigned int cardMax(void) const
Return maximum cardinality.
const int min
Smallest allowed integer in integer set.
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
LubRanges(void)
Default constructor.
UniverseView(void)
Default constructor.
void init(int *ranges, int size)
Initialize with ranges for array ranges which is of size size.
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.
unsigned int unknownSize(void) const
Return the number of unknown elements.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
ConstSetView(void)
Default constructor.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
unsigned int unknownSize(void) const
Return the number of unknown elements.
void init(const T &x)
Initialize with least upper bound ranges for set variable x.
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
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.
LubRanges(const EmptyView &x)
Initialize with ranges for view x.
Range iterator for integer sets.
int glbMin(void) const
Return minimum of the greatest lower bound.
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
int min(void) const
Return smallest value of range.
LubRanges(const ConstSetView &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.
bool operator!=(const CachedView< View > &x, const CachedView< View > &y)
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Gecode toplevel namespace
const int max
Largest allowed integer in integer set.
int max(void) const
Return largest value of range.
const unsigned int card
Maximum cardinality of an integer set.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
LubRanges(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.
GlbRanges(void)
Default constructor.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
Generic domain change information to be supplied to advisors.
void operator++(void)
Move iterator to next range (if possible)
int lubMax(void) const
Return maximum of the least upper bound.
Constant view for the empty set.
int lubMax(void) const
Return maximum 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.
EmptyView(void)
Default constructor.
int glbMax(void) const
Return maximum of the greatest lower bound.
bool operator<(const ConstSetView &y) const
Whether this view comes before view y (arbitray order)
int lubMin(void) const
Return minimum of the least upper bound.
void init(const EmptyView &x)
Initialize with ranges for view x.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
void init(const EmptyView &x)
Initialize with ranges for view x.
bool notContains(int i) const
Test whether i is not in the least upper bound.
ModEvent includeI(Space &home, I &i)
Include range sequence described by i in greatest lower bound.
void update(Space &home, ConstView &y)
Update this view to be a clone of view y.
Range iterator for the greatest lower bound.
int max(void) const
Return largest value of range.
const Gecode::ModEvent ME_SET_NONE
Domain operation has not changed domain.
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
unsigned int cardMin(void) const
Return minimum cardinality.
int glbMax(void) const
Return maximum of the greatest lower bound.
void update(Space &home, ConstSetView &y)
Update this view to be a clone of view y.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
void init(const ConstSetView &x)
Initialize with ranges for view x.
#define GECODE_NEVER
Assert that this command is never executed.
void init(const UniverseView &x)
Initialize with ranges for view x.
ArrayRanges(void)
Default constructor.
int min(void) const
Return smallest value of range.
int ModEvent
Type for modification events.
ModEvent exclude(Space &home, int i, int j)
Restrict least upper bound to not contain all elements between and including i and j.
bool operator==(const CachedView< View > &x, const CachedView< View > &y)
Constant view for the universe.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
void init(const ConstSetView &x)
Initialize with ranges for view x.
void operator++(void)
Move iterator to next range (if possible)
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
bool notContains(int i) const
Test whether i is not in the least upper bound.
unsigned int cardMin(void) const
Return minimum cardinality.
Range iterator for the least upper bound.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
int lubMax(void) const
Return maximum of the least upper bound.
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.
int max(void) const
Return largest value of range.
Range iterator for singleton range.
ArrayRanges(int *ranges, int size)
Initialize with ranges for array ranges which is of size size.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Gecode::FloatVal c(-8, 8)
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.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
int min(void) const
Return smallest value of range.
Gecode::IntArgs i({1, 2, 3, 4})
ModEvent include(Space &home, int i, int j)
Update greatest lower bound to include all elements between and including i and j.
int glbMin(void) const
Return minimum of the greatest lower bound.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
GlbRanges(const ConstSetView &x)
Initialize with ranges for view x.
Range iterator for empty range.
int p
Number of positive literals for node type.
unsigned int glbSize(void) const
Return the number of elements 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.
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.
Range iterator for a two-dimensional array