50 int m = l + (
r - l) / 2;
51 if (v == a[m].card()) {
55 }
else if (v < a[m].card()) {
167 unsigned int size(
void)
const;
171 int card(
void)
const;
218 _min =
min; _max=
max; _card = c; _counter = 0;
249 if (++_counter > _max)
267 if ((_min > n) || (_max < n))
281 _min=
x._min; _max=
x._max; _card=
x._card; _counter=
x._counter;
354 return x.narrow_v(home,i,depends);
359 return x.inter_v(home,i,depends);
364 return x.minus_v(home,i,depends);
FloatNum size(void) const
Return size of float value (distance between maximum and minimum)
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Cancel subscription of propagator p with propagation condition pc to view.
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to view.
int card(void) const
Return cardinality.
ModEvent inc(void)
Increment counter.
int min(void) const
Return minimum of domain.
static const bool propagate
This view does not require propagation.
int counter(void) const
Return the number of times the value occurs.
void init(Space &home, int min, int max, int c)
Initialize with min, max, and cardinality c.
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
int max(void) const
Return maximum of domain.
void update(Space &home, CardConst &x)
bool assigned(void) const
CardConst(void)
Default constructor.
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
IntView base(void) const
Return used IntView (cannot be used)
Cardinality integer view.
ModEvent eq(Space &home, int n)
Restrict domain values to be equal to n.
ModEvent minus_v(Space &home, I &i, bool depends=true)
Remove from domain the values described by i.
int card(void) const
Return cardinality.
int counter(void) const
Return the number of times the value occurs.
unsigned int size(void) const
Return size (cardinality) of domain.
void init(const IntView &y, int c)
Initialize with integer view y and value c.
int min(void) const
Return minimum of domain.
ModEvent inter_v(Space &home, I &i, bool depends=true)
Intersect domain with values described by i.
void update(Space &home, CardView &x)
ModEvent lq(Space &home, int n)
Restrict domain values to be less or equal than n.
ModEvent gq(Space &home, int n)
Restrict domain values to be greater or equal than n.
CardView(void)
Default constructor.
static const bool propagate
This view does require propagation.
int max(void) const
Return maximum of domain.
ModEvent inc(void)
Increment counter.
ModEvent narrow_v(Space &home, I &i, bool depends=true)
Replace domain by values described by i.
Integer view for integer variables.
ViewRanges(void)
Initialize with ranges for view x.
Range iterator for integer views.
void init(const View &x)
Initialize with ranges for view x.
ViewRanges(void)
Default constructor.
Base-class for propagators.
Global cardinality propagators (Counting)
bool lookupValue(T &a, int v, int &i)
Return index of v in array a.
const Gecode::ModEvent ME_INT_FAILED
Domain operation has resulted in failure.
const Gecode::ModEvent ME_INT_NONE
Domain operation has not changed domain.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
Post propagator for SetVar SetOpType SetVar y
const ModEvent ME_GEN_NONE
Generic modification event: no modification.
int PropCond
Type for propagation conditions.
Post propagator for SetVar x
int ModEvent
Type for modification events.
#define GECODE_NEVER
Assert that this command is never executed.