Go to the documentation of this file.
60 return new (home)
Pack(home,share,*
this);
85 : _nq(region.alloc<int>(m)), _n_nq(0), _eq(-1) {}
102 }
else if (
_eq >= 0) {
127 int* s = region.
alloc<
int>(m);
136 for (
int i=0;
i<
n;
i++)
138 int j =
bs[
i].bin().val();
139 l[j].offset(
l[j].offset() -
bs[
i].size());
143 s[j.val()] +=
bs[
i].size();
148 for (
int i=
n;
i--; ) {
151 s[j.val()] +=
bs[
i].size();
157 for (
int j=m; j--; ) {
160 min -=
l[j].max();
max -=
l[j].min();
164 for (
bool mod =
true;
mod; ) {
166 for (
int j=m; j--; ) {
167 int lj_min =
l[j].min();
168 me =
l[j].gq(home,
min +
l[j].
max());
172 max += lj_min -
l[j].min();
mod =
true;
174 int lj_max =
l[j].max();
175 me =
l[j].lq(home,
max +
l[j].
min());
179 min += lj_max -
l[j].max();
mod =
true;
185 assert(
l.assigned());
194 for (
int i=0;
i<
n;
i++) {
196 if (
bs[
i].
size() >
l[j.val()].max())
198 if (s[j.val()] -
bs[
i].size() <
l[j.val()].min())
204 int j =
bs[
i].bin().val();
205 l[j].offset(
l[j].offset() -
bs[
i].
size());
232 for (
int i=0;
i<
n;
i++) {
238 for (
int j=m; j--; ) {
256 for (
int i=0;
i<
n;
i++) {
262 if (
nosum(s[j.val()],
263 l[j.val()].min() -
bs[
i].size(),
264 l[j.val()].max() -
bs[
i].size()))
267 if (
nosum(s[j.val()],
l[j.val()].min(),
l[j.val()].max()))
272 int j =
bs[
i].bin().val();
273 l[j].offset(
l[j].offset() -
bs[
i].
size());
288 int c =
bs[0].size();
293 int* n_s = region.
alloc<
int>(
c+1);
295 for (
int i=
c+1;
i--; )
307 if (
l[j].
max() < 0) {
309 }
else if (
c >
l[j].
max()) {
310 n_s[
c -
l[j].max()]++; nm++;
314 int* s = region.
alloc<
int>(nm);
319 for (
int i=
c+1;
i--; )
320 for (
int j=n_s[
i]; j--; )
337 for (; (n12 < nm) && (s[n12] >
c/2); n12++)
341 for (n3 = n12; n3 < nm; n3++)
345 for (
int k=0; k<=
c/2; k++) {
347 for (; (n1 < nm) && (s[n1] >
c-k); n1++)
351 for (; (s[n3-1] < k) && (n3 > n12); n3--)
354 int o = (s3 > f2) ? ((s3 - f2 +
c - 1) /
c) : 0;
370 for (
int i=
bs.size();
i--; ) {
378 while ((
n > 0) && (
bs[
n-1].
size() == 0))
382 if (
bs.size() == 0) {
384 for (
int i=
l.size();
i--; )
387 }
else if (
l.size() == 0) {
392 for (
int j=
l.size(); j--; ) {
396 (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.
Gecode::IntArgs i(4, 1, 2, 3, 4)
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.
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
static ModEvent me(const ModEventDelta &med)
Return modification event for view type in med.
#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.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
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.
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.
@ ES_FAILED
Execution has resulted in failure.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
int ModEventDelta
Modification event deltas.
@ ES_NOFIX
Propagation has not computed fixpoint.
@ ES_OK
Execution is okay.
const FloatNum max
Largest allowed float value.