Go to the documentation of this file.
44 namespace Gecode {
namespace Int {
namespace GCC {
85 rv[
i].minb=rv[
i].maxb=rv[
i].le=rv[
i].gr=rv[
i].eq=0;
87 for (
int i =
n;
i--; ) {
110 for (
int i = 1;
i < m;
i++) {
112 c_min += rv[
i - 1].
maxb;
117 for (
int i = m-1;
i--; ) {
119 c_max += rv[
i + 1].
minb;
122 for (
int i = m;
i--; ) {
123 int reachable =
x.size() - rv[
i].
le - rv[
i].
gr;
129 if ((rv[
i].eq > k[
i].
max()) || (k[
i].
max() > reachable))
146 for (
int i = k.
size();
i--; ) {
151 return (smin <=
x.size()) && (
x.size() <= smax);
190 return x[
i].max() <
x[j].max();
213 return x[
i].min() <
x[j].min();
230 return x.card() <
y.card();
259 operator bool(
void)
const;
263 int sumup(
int from,
int to)
const;
313 for (
i = 1;
i < elements.
size();
i++) {
314 if (elements[
i].
card() != elements[
i-1].
card() + 1)
315 holes += elements[
i].card()-elements[
i-1].card()-1;
327 int first = elements[0].card();
329 firstValue = first - 3;
330 lastValue = first + elements.
size() + holes + 1;
339 int prevCard = elements[0].card()-1;
341 for (j = 2; j < elements.
size() + holes + 2; j++) {
342 if (elements[
i].
card() != prevCard + 1) {
345 sum[j + 1] =
sum[j] + elements[
i].max();
348 sum[j + 1] =
sum[j] + elements[
i].min();
354 sum[j + 2] =
sum[j + 1] + 1;
357 i = elements.
size() + holes + 3;
383 return sum[to - firstValue] -
sum[from - firstValue - 1];
385 assert(to - firstValue - 1 >= 0);
386 assert(to - firstValue - 1 <
size);
387 assert(from - firstValue >= 0);
388 assert(from - firstValue <
size);
389 return sum[to - firstValue - 1] -
sum[from - firstValue];
396 return firstValue + 3;
401 return lastValue - 2;
410 return (ds[value] < value ? value : ds[value]) + firstValue;
417 return (ds[value] > value ? ds[ds[value]] : value) + firstValue;
424 for (
int i = 3;
i <
size - 2;
i++) {
426 if (k[j].
card() ==
i+firstValue)
438 for (
int i = 3;
i <
size - 2;
i++) {
440 if (k[j].
card() ==
i+firstValue)
513 for (
l=start; (k=
l) != end; hall[k].
ps=to) {
521 for (
l=start; (k=
l) != end; hall[k].
s=to) {
529 for (
l=start; (k=
l) != end; hall[k].
t=to) {
537 for (
l=start; (k=
l) != end; hall[k].
h=to) {
554 while (hall[
i].h <
i)
561 while (hall[
i].
t <
i)
577 while (hall[
i].h >
i)
584 while (hall[
i].
t >
i) {
592 while (hall[
i].s >
i)
599 while (hall[
i].ps >
i)
void reinit(void)
Mark datstructure as requiring reinitialization.
LinFloatExpr sum(const FloatVarArgs &x)
Construct linear float expression as sum of float variables.
int minb
Number of variables with lower bound.
void pathset_h(HallInfo hall[], int start, int end, int to)
Path compression for hall pointer structure.
Post propagator for SetVar x
int t
Critical capacity pointer t represents a predecessor function where denotes the predecessor of i in ...
Post propagator for SetVar SetOpType SetVar y
Compares two indices i, j of two views according to the ascending order of the views upper bounds.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
int firstValue
Sentinels indicating whether an end of sum is reached.
bool operator()(const int i, const int j)
Comparison.
int maxValue(void) const
Return largest bound of variables.
unsigned int size(I &i)
Size of all ranges of range iterator i.
int newBound
Bound update.
int gr
Number of greater variables.
bool assigned(View x, int v)
Whether x is assigned to value v.
int eq
Number of equal variables.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int pathmin_h(const HallInfo hall[], int i)
Path minimum for hall pointer structure.
int d
Difference between critical capacities.
int maxb
Number of variables with upper bound.
bool lookupValue(T &a, int v, int &i)
Return index of v in array a.
int sumup(int from, int to) const
Compute the maximum capacity of an interval.
ExecStatus prop_card(Space &home, ViewArray< IntView > &x, ViewArray< Card > &k)
Bounds consistency check for cardinality variables.
bool operator()(const int i, const int j)
Order.
Gecode toplevel namespace
int pathmax_t(const HallInfo hall[], int i)
Path maximum for capacity pointer structure.
const unsigned int card
Maximum cardinality of an integer set.
MaxInc(const ViewArray< View > &x0)
Constructor.
int pathmin_t(const HallInfo hall[], int i)
Path minimum for capacity pointer structure.
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.
Post propagator for SetVar SetOpType SetVar SetRelType r
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
void pathset_ps(HallInfo hall[], int start, int end, int to)
Path compression for potentially stable set structure.
void init(Space &home, ViewArray< Card > &k, bool up)
Initialization.
Maps domain bounds to their position in hall[].bounds.
int pathmax_ps(const HallInfo hall[], int i)
Path maximum for potentially stable set pointer structure.
void pathset_t(HallInfo hall[], int start, int end, int to)
Path compression for capacity pointer structure.
int bounds
Represents the union of all lower and upper domain bounds.
int ps
Potentially Stable Set pointer.
void pathset_s(HallInfo hall[], int start, int end, int to)
Path compression for stable set structure.
Container class provding information about the Hall structure of the problem variables.
bool check_update_min(ViewArray< Card > &k)
Check whether the values in the partial sum structure containting the lower cardinality bounds differ...
ViewArray< View > x
View array for comparison.
int size(void) const
Return size of array (number of elements)
int pathmax_h(const HallInfo hall[], int i)
Path maximum for hall pointer structure.
int skipNonNullElementsLeft(int v) const
Skip neigbouring array entries if their values do not differ.
Partial sum structure for constant time computation of the maximal capacity of an interval.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Compares two cardinality views according to the index.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
int n
Number of negative literals for node type.
@ ES_FAILED
Execution has resulted in failure.
int le
Number of smaller variables.
bool operator()(const Card &x, const Card &y)
Comparison.
int pathmax_s(const HallInfo hall[], int i)
Path maximum for stable set pointer structure.
MinInc(const ViewArray< View > &x0)
Constructor.
@ ES_OK
Execution is okay.
bool card_consistent(ViewArray< IntView > &x, ViewArray< Card > &k)
Consistency check, whether the cardinality values are feasible.
ViewArray< View > x
View array for comparison.
int skipNonNullElementsRight(int v) const
Skip neigbouring array entries if their values do not differ.
Class for computing unreachable values in the value GCC propagator.
PartialSum(void)
Constructor.
Compares two indices i, j of two views according to the ascending order of the views lower bounds.