Go to the documentation of this file.
56 return new (home)
Pack(home,*
this);
81 : _nq(region.alloc<int>(m)), _n_nq(0), _eq(-1) {}
98 }
else if (
_eq >= 0) {
123 int* s = region.
alloc<
int>(m);
125 for (
int j=0; j<m; j++)
132 for (
int i=0;
i<
n;
i++)
134 int j =
bs[
i].bin().val();
135 l[j].offset(
l[j].offset() -
bs[
i].
size());
139 s[j.val()] +=
bs[
i].size();
144 for (
int i=0;
i<
n;
i++) {
147 s[j.val()] +=
bs[
i].size();
153 for (
int j=0; j<m; j++) {
156 min -=
l[j].max();
max -=
l[j].min();
160 for (
bool mod =
true;
mod; ) {
162 for (
int j=0; j<m; j++) {
163 int lj_min =
l[j].min();
164 me =
l[j].gq(home,
min +
l[j].
max());
168 max += lj_min -
l[j].min();
mod =
true;
170 int lj_max =
l[j].max();
171 me =
l[j].lq(home,
max +
l[j].
min());
175 min += lj_max -
l[j].max();
mod =
true;
181 assert(
l.assigned());
190 for (
int i=0;
i<
n;
i++) {
192 if (
bs[
i].
size() >
l[j.val()].max())
194 if (s[j.val()] -
bs[
i].size() <
l[j.val()].min())
200 int j =
bs[
i].bin().val();
201 l[j].offset(
l[j].offset() -
bs[
i].
size());
223 for (
int j=0; j<m; j++)
227 for (
int i=0;
i<
n;
i++) {
233 for (
int j=0; j<m; j++) {
235 if (
nosum(static_cast<SizeSet&>(s[j]),
l[j].
min(),
l[j].
max()))
239 if (
nosum(static_cast<SizeSet&>(s[j]),
l[j].
min(),
l[j].
min(),
243 if (
nosum(static_cast<SizeSet&>(s[j]),
l[j].
max(),
l[j].
max(),
251 for (
int i=0;
i<
n;
i++) {
257 if (
nosum(s[j.val()],
258 l[j.val()].min() -
bs[
i].size(),
259 l[j.val()].max() -
bs[
i].size()))
262 if (
nosum(s[j.val()],
l[j.val()].min(),
l[j.val()].max()))
267 int j =
bs[
i].bin().val();
268 l[j].offset(
l[j].offset() -
bs[
i].
size());
283 int c =
bs[0].size();
284 for (
int j=0; j<m; j++)
288 int* n_s = region.
alloc<
int>(
c+1);
290 for (
int i=0;
i<
c+1;
i++)
294 for (
int i=0;
i<
n;
i++)
301 for (
int j=0; j<m; j++)
302 if (
l[j].
max() < 0) {
304 }
else if (
c >
l[j].
max()) {
305 n_s[
c -
l[j].max()]++; nm++;
309 int* s = region.
alloc<
int>(nm);
314 for (
int i=
c+1;
i--; )
315 for (
int j=n_s[
i]; j--; )
332 for (; (n12 < nm) && (s[n12] >
c/2); n12++)
336 for (n3 = n12; n3 < nm; n3++)
340 for (
int k=0; k<=
c/2; k++) {
342 for (; (n1 < nm) && (s[n1] >
c-k); n1++)
346 for (; (s[n3-1] < k) && (n3 > n12); n3--)
349 int o = (s3 > f2) ? ((s3 - f2 +
c - 1) /
c) : 0;
366 for (
int i=0;
i<
bs.size();
i++) {
374 while ((
n > 0) && (
bs[
n-1].
size() == 0))
378 if (
bs.size() == 0) {
380 for (
int i=0;
i<
l.size();
i++)
383 }
else if (
l.size() == 0) {
388 for (
int j=0; j<
l.size(); j++) {
392 (void)
new (home)
Pack(home,
l,
bs);
Post propagator for SetVar x
size_t size
The size of the propagator (used during subsumption)
bool me_failed(ModEvent me)
Check whether modification event me is failed.
int _eq
Value to which view should be assigned.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
ExecStatus ES_SUBSUMED(Propagator &p)
void eq(int j)
Record that view must be equal to j, return false if not possible.
bool nosum(const SizeSet &s, int a, int b, int &ap, int &bp)
Detect non-existence of sums in a .. b.
bool assigned(View x, int v)
Whether x is assigned to value v.
ViewArray< Item > bs
Items with bin and size.
Value iterator for array of integers
const Gecode::ModEvent ME_INT_NONE
Domain operation has not changed domain.
int t
Total size of all items.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, ViewArray< OffsetView > &l, ViewArray< Item > &bs)
Post propagator for loads l and items bs.
Base-class for both propagators and branchers.
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
Pack(Home home, ViewArray< OffsetView > &l, ViewArray< Item > &bs)
Constructor for posting.
ViewArray< OffsetView > l
Views for load of bins.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
void quicksort(Type *l, Type *r, Less &less)
Standard quick sort.
Gecode toplevel namespace
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
void minus(int s)
Discard size s.
Home class for posting propagators
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
int * _nq
Values (sorted) to be pruned from view.
TellCache(Region ®ion, int m)
Initialize cache for at most m values.
ModEventDelta med
A set of modification events (used during propagation)
ModEventDelta modeventdelta(void) const
Return the modification event delta.
void add(int s)
Add new size s.
void free(void)
Free allocate memory.
Size sets with one element discarded.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
int ModEvent
Type for modification events.
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
void mod(Home home, IntVar x0, IntVar x1, IntVar x2, IntPropLevel ipl)
Post propagator for .
Integer view for integer variables.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
void nq(int j)
Record that view must be different from j.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Gecode::FloatVal c(-8, 8)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual void reschedule(Space &home)
Schedule function.
ExecStatus tell(Space &home, IntView x)
Perform tell to view x and reset cache.
int n
Number of negative literals for node type.
int _n_nq
Number of values to be pruned.
Execution has resulted in failure.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
int ModEventDelta
Modification event deltas.
Propagation has not computed fixpoint.
Gecode::IntArgs i({1, 2, 3, 4})
const FloatNum max
Largest allowed float value.