42 namespace Gecode {
namespace Set {
52 for (
int i =
n;
i--; ) {
66 assert(
fst() != NULL);
72 if (
c->
max() >= mi-1){
73 if (
c->
min() > ma+1) {
93 d._glbMin =
c->
max()+1;
96 assert(
c->
max()+1>=mi);
98 d._glbMax =
c->
min()-1;
103 int prevMax =
c->
max();
106 while (q->next() != NULL && q->next()->min() <= ma+1) {
108 growth += q->
min()-prevMax-1;
114 _size += ma-q->max();
117 d._glbMax = q->
min()-1;
121 RangeList* oldCNext =
c->next();
122 assert(oldCNext!=NULL);
124 if (q->next()==NULL){
128 oldCNext->dispose(home,q);
132 RangeList* nc =
c->next();
137 RangeList* q =
new (home) RangeList(mi, ma, NULL);
147 LUBndSet::intersect_full(Space& home,
int mi,
int ma) {
149 RangeList*
c =
fst();
154 while (
c != NULL &&
c->
max() < mi) {
156 RangeList *nc =
c->next();
166 bool changed =
false;
180 while (
c != NULL &&
c->
max() <= ma) {
181 RangeList *nc =
c->next();
188 RangeList* newlst =
p;
189 if (ma >=
c->
min()) {
193 RangeList* nc =
c->next();
196 }
else if (
p != NULL) {
200 for (RangeList* cc =
c ; cc != NULL; cc = cc->next())
201 _size -= cc->width();
202 c->dispose(home,
lst());
211 LUBndSet::exclude_full(Space& home,
int mi,
int ma, SetDelta&
d) {
213 assert(mi <=
max() && ma >=
min() &&
214 (mi >
min() || ma <
max()));
218 RangeList*
c =
fst();
222 if (
c->
min() > ma) {
return result; }
226 new (home) RangeList(ma+1,
c->
max(),
c->next());
249 d._lubMax =
c->
max();
253 d._lubMin =
c->
min();
256 while ((cend->next()!=NULL) && (cend->next()->max()<=ma)){
258 _size-=cend->width();
260 d._lubMax = cend->
max();
264 p->next(cend->next());
269 RangeList* nc=cend->next();
270 c->dispose(home,cend);
273 if (
c != NULL &&
c->
min() <= ma ) {
282 RangeList *nc =
c->next();
296 if (lst()!=NULL ||
size()!=0) {
297 std::cerr<<
"Strange empty set.\n";
302 if (fst()!=NULL && lst()==NULL) {
303 std::cerr<<
"First is not null, last is.\n";
314 std::cerr <<
"Single range list twisted: ("<<
min<<
","<<
max<<
")" ;
329 if (
c->next()==NULL &&
c!=lst()) {
const FloatNum max
Largest allowed float value.
RangeList * lst(void) const
Return last range.
RangeList * next(void) const
Return next element.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
int max(void) const
Return greatest element.
unsigned int width(int i) const
Return width of range at position i.
const int max
Largest allowed integer in integer set.
int min(int i) const
Return minimum of range at position i.
RangeList * fst(void) const
Return first range.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
int max(int i) const
Return maximum of range at position i.
unsigned int size(I &i)
Size of all ranges of range iterator i.
unsigned int _size
The size of this set.
bool isConsistent(void) const
Check whether internal invariants hold.
Post propagator for SetVar SetOpType SetVar SetRelType r
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
int ranges(void) const
Return number of ranges of the specification.
void dispose(Space &home, RangeList *l)
Free memory for all elements between this and l (inclusive)
Lists of ranges (intervals)
Gecode toplevel namespace
friend FloatVal max(const FloatVal &x, const FloatVal &y)
friend FloatVal min(const FloatVal &x, const FloatVal &y)
BndSet(void)
Default constructor. Creates an empty set.
int min(void) const
Return smallest element.
Finite set delta information for advisors.