81 rv[i].minb=rv[i].maxb=rv[i].le=rv[i].gr=rv[i].eq=0;
83 for (
int i = n; i--; ) {
87 if (
x[i].assigned()) {
106 for (
int i = 1; i < m; i++) {
107 rv[i].
le = c_min + rv[i - 1].
maxb;
108 c_min += rv[i - 1].
maxb;
113 for (
int i = m-1; i--; ) {
114 rv[i].
gr = c_max + rv[i + 1].
minb;
115 c_max += rv[i + 1].
minb;
118 for (
int i = m; i--; ) {
119 int reachable =
x.size() - rv[i].
le - rv[i].
gr;
120 if (!k[i].assigned()) {
125 if ((rv[i].eq > k[i].
max()) || (k[i].
max() > reachable))
142 for (
int i = k.
size(); i--; ) {
147 return (smin <=
x.size()) && (
x.size() <= smax);
186 return x[i].max() <
x[j].max();
209 return x[i].min() <
x[j].min();
226 return x.card() <
y.card();
255 operator bool(
void)
const;
260 int sumup(
int from,
int to)
const;
309 for (i = 1; i < elements.
size(); i++) {
310 if (elements[i].card() != elements[i-1].card() + 1)
311 holes += elements[i].card()-elements[i-1].card()-1;
315 size = elements.
size() + holes + 5;
319 sum = home.
alloc<
int>(2*size);
321 int* ds = &sum[size];
323 int first = elements[0].card();
335 int prevCard = elements[0].card()-1;
337 for (j = 2; j < elements.
size() + holes + 2; j++) {
338 if (elements[i].card() != prevCard + 1) {
341 sum[j + 1] = sum[j] + elements[i].max();
344 sum[j + 1] = sum[j] + elements[i].min();
349 sum[j + 1] = sum[j] + 1;
350 sum[j + 2] = sum[j + 1] + 1;
353 i = elements.
size() + holes + 3;
356 while(sum[i] == sum[i - 1]) {
405 int* ds = &sum[size];
406 return (ds[value] < value ? value : ds[value]) +
firstValue;
412 int* ds = &sum[size];
413 return (ds[value] > value ? ds[ds[value]] : value) +
firstValue;
420 for (
int i = 3; i < size - 2; i++) {
424 if ((sum[i] - sum[i - 1]) !=
max)
434 for (
int i = 3; i < size - 2; i++) {
438 if ((sum[i] - sum[i - 1]) !=
min)
509 for (l=start; (k=l) != end; hall[k].
ps=to) {
517 for (l=start; (k=l) != end; hall[k].
s=to) {
525 for (l=start; (k=l) != end; hall[k].
t=to) {
533 for (l=start; (k=l) != end; hall[k].
h=to) {
550 while (hall[i].h < i)
557 while (hall[i].t < i)
573 while (hall[i].h > i)
580 while (hall[i].t > i) {
588 while (hall[i].s > i)
595 while (hall[i].ps > i)
Container class provding information about the Hall structure of the problem variables.
int t
Critical capacity pointer t represents a predecessor function where denotes the predecessor of i in ...
int newBound
Bound update.
int bounds
Represents the union of all lower and upper domain bounds.
int ps
Potentially Stable Set pointer.
int d
Difference between critical capacities.
ViewArray< View > x
View array for comparison.
MaxInc(const ViewArray< View > &x0)
Constructor.
bool operator()(const int i, const int j)
Order.
Compares two cardinality views according to the index.
bool operator()(const Card &x, const Card &y)
Comparison.
MinInc(const ViewArray< View > &x0)
Constructor.
ViewArray< View > x
View array for comparison.
bool operator()(const int i, const int j)
Comparison.
int firstValue
Sentinels indicating whether an end of sum is reached.
int skipNonNullElementsLeft(int v) const
Skip neigbouring array entries if their values do not differ.
int maxValue(void) const
Return largest bound of variables.
void reinit(void)
Mark datstructure as requiring reinitialization.
bool check_update_max(ViewArray< Card > &k)
Check whether the values in the partial sum structure containting the upper cardinality bounds differ...
int minValue(void) const
Return smallest bound of variables.
PartialSum(void)
Constructor.
bool check_update_min(ViewArray< Card > &k)
Check whether the values in the partial sum structure containting the lower cardinality bounds differ...
void init(Space &home, ViewArray< Card > &k, bool up)
Initialization.
int sumup(int from, int to) const
Compute the maximum capacity of an interval.
int skipNonNullElementsRight(int v) const
Skip neigbouring array entries if their values do not differ.
Maps domain bounds to their position in hall[].bounds.
Class for computing unreachable values in the value GCC propagator.
int maxb
Number of variables with upper bound.
int gr
Number of greater variables.
int minb
Number of variables with lower bound.
int eq
Number of equal variables.
int le
Number of smaller variables.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
int size(void) const
Return size of array (number of elements)
bool card_consistent(ViewArray< IntView > &x, ViewArray< Card > &k)
Consistency check, whether the cardinality values are feasible.
ExecStatus prop_card(Space &home, ViewArray< IntView > &x, ViewArray< Card > &k)
Bounds consistency check for cardinality variables.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Global cardinality propagators (Counting)
int pathmin_h(const HallInfo hall[], int i)
Path minimum for hall pointer structure.
int pathmax_t(const HallInfo hall[], int i)
Path maximum for capacity pointer structure.
void pathset_ps(HallInfo hall[], int start, int end, int to)
Path compression for potentially stable set structure.
int pathmax_s(const HallInfo hall[], int i)
Path maximum for stable set pointer structure.
void pathset_t(HallInfo hall[], int start, int end, int to)
Path compression for capacity pointer structure.
int pathmin_t(const HallInfo hall[], int i)
Path minimum for capacity pointer structure.
void pathset_h(HallInfo hall[], int start, int end, int to)
Path compression for hall pointer structure.
void pathset_s(HallInfo hall[], int start, int end, int to)
Path compression for stable set structure.
bool lookupValue(T &a, int v, int &i)
Return index of v in array a.
int pathmax_h(const HallInfo hall[], int i)
Path maximum for hall pointer structure.
int pathmax_ps(const HallInfo hall[], int i)
Path maximum for potentially stable set pointer structure.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar SetOpType SetVar y
@ ES_OK
Execution is okay.
@ ES_FAILED
Execution has resulted in failure.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar x