36 template<
class View,
class A>
39 rp = rp_fst; v = rp->min;
40 max = rp->min +
static_cast<int>((rp+1)->pos - rp->pos) - 1;
43 template<
class View,
class A>
46 : a(a0), x(x0), bs(a,x.size(),true) {
50 rp_fst = a.template alloc<RangePos>(n+1);
55 rp_fst[i].min =
r.min();
63 template<
class View,
class A>
67 a.free(rp_fst,
static_cast<unsigned long int>(rp_lst-rp_fst+1));
70 template<
class View,
class A>
76 max = rp->min +
static_cast<int>((rp+1)->pos - rp->pos) - 1;
80 template<
class View,
class A>
86 template<
class View,
class A>
92 template<
class View,
class A>
95 bs.clear(rp->pos +
static_cast<unsigned int>(v-rp->min));
98 template<
class View,
class A>
100 SupportValues<View,A>::_support(
int n) {
101 RangePos* l = rp_fst;
102 RangePos*
r = rp_lst-1;
104 if (l >
r)
return false;
105 RangePos* m = l + (
r-l)/2;
106 int max = m->min +
static_cast<int>((m+1)->pos - m->pos) - 1;
107 if ((n >= m->min) && (n <=
max)) {
108 bs.clear(m->pos +
static_cast<unsigned int>(n-m->min));
111 if (l ==
r)
return false;
121 template<
class View,
class A>
124 if ((n < x.min()) || (n > x.max()))
129 template<
class View,
class A>
132 if ((n < x.min()) || (n > x.max()))
134 return _support(
static_cast<int>(n));
137 template<
class View,
class A>
139 SupportValues<View,A>::Unsupported::find(
void) {
141 while ((p < sv.x.size()) && !sv.bs.
get(p))
144 while ((rp < sv.rp_lst) && (p >= (rp+1)->pos))
148 template<
class View,
class A>
150 SupportValues<View,A>::Unsupported::Unsupported(
SupportValues& sv0)
151 : rp(sv0.rp_fst), p(0), sv(sv0) {
155 template<
class View,
class A>
157 SupportValues<View,A>::Unsupported::operator ++(
void) {
161 template<
class View,
class A>
164 return rp < sv.rp_lst;
167 template<
class View,
class A>
170 return static_cast<int>(rp->min+(p-rp->pos));
173 template<
class View,
class A>
176 Unsupported u(*
this);
177 return x.minus_v(home,u,
false);
Support value iterator and recorder
int val(void) const
Return current value.
void support(void)
Mark current (iterator) value as supported.
~SupportValues(void)
Destructor.
SupportValues(A &a, View x)
Initialize for view x.
ModEvent tell(Space &home)
Remove all unsupported values.
void operator++(void)
Move iterator to next value (if possible)
void reset(void)
Reset iterator.
bool operator()(void) const
Test whether iterator is still at a value or done.
Range iterator for integer views.
bool get(unsigned int i) const
Access value at bit i.
unsigned int next(unsigned int i) const
Return position greater or equal i of next set bit (i is allowed to be equal to size)
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
int ModEvent
Type for modification events.
#define GECODE_NEVER
Assert that this command is never executed.