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,
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])
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
unsigned int cardMax(void) const
Return maximum cardinality.
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
int min(void) const
Return smallest value of range.
void update(Space &home, bool share, ConstSetView &y)
Update this view to be a clone of view y.
ConstSetView(void)
Default constructor.
int glbMax(void) const
Return maximum of the greatest lower bound.
Range iterator for singleton range.
ArrayRanges(void)
Default constructor.
const int min
Smallest allowed integer in integer set.
unsigned int unknownSize(void) const
Return the number of unknown elements.
Range iterator for integer sets.
unsigned int cardMax(void) const
Return maximum cardinality.
bool contains(int i) const
Test whether i is in the greatest lower bound.
int max(void) const
Return largest value of range.
LubRanges(const ConstSetView &x)
Initialize with ranges for view x.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
unsigned int cardMin(void) const
Return minimum cardinality.
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.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
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 glbMin(void) const
Return minimum 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.
unsigned int unknownSize(void) const
Return the number of unknown elements.
Range iterator for the greatest lower bound.
void init(const ConstSetView &x)
Initialize with ranges for view x.
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...
static const int MIN_OF_EMPTY
Returned by empty sets when asked for their minimum element.
int max(void) const
Return largest value of range.
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.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.
UniverseView(void)
Default constructor.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
int lubMin(void) const
Return minimum of the least upper bound.
ModEvent excludeI(Space &home, I &i)
Remove range sequence described by i from least upper bound.
int glbMin(void) const
Return minimum of the greatest lower bound.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
ArrayRanges(int *ranges, int size)
Initialize with ranges for array ranges which is of size size.
void init(const UniverseView &x)
Initialize with ranges for view x.
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.
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 p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
GlbRanges(const ConstSetView &x)
Initialize with ranges for view x.
int glbMax(void) const
Return maximum 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...
unsigned int glbSize(void) const
Return the number of elements in the greatest lower bound.
Constant view for the universe.
int min(void) const
Return smallest value of range.
void operator++(void)
Move iterator to next range (if possible)
int lubMax(void) const
Return maximum of the least upper bound.
bool glbAny(const Delta &d) const
Test whether arbitrary values got pruned from glb.
unsigned int size(I &i)
Size of all ranges of range iterator i.
EmptyView(void)
Default constructor.
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.
const Gecode::ModEvent ME_SET_NONE
Domain operation has not changed domain.
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.
bool notContains(int i) const
Test whether i is not in the least upper bound.
bool operator()(void) const
Test whether iterator is still at a range or done.
LubRanges(const EmptyView &x)
Initialize with ranges for view x.
bool contains(int i) const
Test whether i is in the greatest lower bound.
bool same(const ConstSetView &x, const ConstSetView &y)
ModEvent intersect(Space &home, int i, int j)
Update least upper bound to contain at most all elements between and including i and j...
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.
int max(void) const
Return largest value of range.
int lubMin(void) const
Return minimum of the least upper bound.
Post propagator for SetVar SetOpType SetVar y
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.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
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 cardMin(void) const
Return minimum cardinality.
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 glbMin(void) const
Return minimum of the greatest lower bound.
bool notContains(int i) const
Test whether i is not in 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...
Post propagator for SetVar x
unsigned int cardMin(void) const
Return minimum cardinality.
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.
Range iterator for a two-dimensional array
int max(void) const
Return largest value of range.
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 lubMax(void) const
Return maximum of the least upper bound.
bool contains(int i) const
Test whether i is in the greatest lower bound.
LubRanges(void)
Default constructor.
Range iterator for empty range.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
bool lubAny(const Delta &d) const
Test whether arbitrary values got pruned from lub.
int glbMax(void) const
Return maximum of the greatest lower bound.
int min(void) const
Return smallest value of range.
Constant view for the empty set.
bool before(const ConstSetView &x, const ConstSetView &y)
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
bool operator()(void) const
Test whether iterator is still at a range or done.
int lubMin(void) const
Return minimum of the least upper bound.
void operator++(void)
Move iterator to next range (if possible)
#define GECODE_NEVER
Assert that this command is never executed.
ModEvent intersectI(Space &home, I &iter)
Intersect least upper bound with range sequence described by i.
unsigned int cardMax(void) const
Return maximum cardinality.
unsigned int lubSize(void) const
Return the number of elements in the least upper bound.