73 return (i.bin() == j.
bin()) && (i.
size() == j.
size());
95 :
n(0),
t(0),
s(region.alloc<int>(n_max)) {}
139 return s[(i <
p) ? i : i+1];
154 for (
int i=0; i<
bs.size(); i++)
162 bs.update(home,p.
bs);
170 return sizeof(*this);
173 template<
class SizeSet>
176 if ((a <= 0) || (b >= s.
total()))
181 while (sc + s[n-kp] < a) {
186 int sa=0, sb = s[n-kp];
187 while ((sa < a) && (sb <= b)) {
193 while (sa + sc >= a) {
196 sb += s[n-kp] - s[n-kp-k-1];
200 ap = sa + sc; bp = sb;
204 template<
class SizeSet>
208 return nosum(s, a, b, ap, bp);
virtual size_t dispose(Space &home)
Delete actor and return its size.
int size(void) const
Return size of array (number of elements)
Home class for posting propagators
Item combining bin and size information.
IntView bin(void) const
Return bin of item.
void update(Space &home, Item &i)
Update item during cloning.
Item(void)
Default constructor.
int size(void) const
Return size of item.
ViewArray< OffsetView > l
Views for load of bins.
ViewArray< Item > bs
Items with bin and size.
Pack(Home home, ViewArray< OffsetView > &l, ViewArray< Item > &bs)
Constructor for posting.
int t
Total size of all items.
bool nosum(const SizeSet &s, int a, int b, int &ap, int &bp)
Detect non-existence of sums in a .. b.
virtual size_t dispose(Space &home)
Destructor.
int operator[](int i) const
Return size of item i.
void minus(int s)
Discard size s.
SizeSetMinusOne(void)
Default constructor.
int p
Position of discarded item.
int total(void) const
Return total size.
int card(void) const
Return cardinality of set (number of entries)
int t
Total size of the set.
SizeSet(void)
Default constructor.
void add(int s)
Add new size s.
int total(void) const
Return total size.
int operator[](int i) const
Return size of item i.
int n
Number of size entries in the set.
int * s
Array of sizes (will have more elements)
int card(void) const
Return cardinality of set (number of entries)
Integer view for integer variables.
Propagator(Home home)
Constructor for posting.
bool operator<(const Item &i, const Item &j)
Order, also for sorting according to size.
bool operator!=(const Item &i, const Item &j)
Whether two items are not the same.
bool operator==(const Item &i, const Item &j)
Whether two items are the same.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
Gecode toplevel namespace