Go to the documentation of this file.
40 namespace Gecode {
namespace Int {
namespace Rel {
47 template<
class V0,
class V1>
52 template<
class V0,
class V1>
71 template<
class V0,
class V1>
76 if (!
same(x0,x1) && (x0.max() > x1.min()))
81 template<
class V0,
class V1>
86 template<
class V0,
class V1>
89 return new (home)
Lq<V0,V1>(home,share,*
this);
92 template<
class V0,
class V1>
107 template<
class V0,
class V1>
112 template<
class V0,
class V1>
115 (void) x0; (void) x1;
137 template<
class V0,
class V1>
144 if (x0.max() >= x1.min())
149 template<
class V0,
class V1>
154 template<
class V0,
class V1>
157 return new (home)
Le<V0,V1>(home,share,*
this);
160 template<
class V0,
class V1>
175 template<
class View,
int o>
181 template<
class View,
int o>
188 template<
class View,
int o>
193 template<
class View,
int o>
199 template<
class View,
int o>
203 template<
class View,
int o>
209 template<
class View,
int o>
212 return home.fl_alloc<
sizeof(
Pos)>();
215 template<
class View,
int o>
222 template<
class View,
int o>
227 template<
class View,
int o>
235 template<
class View,
int o>
245 template<
class View,
int o>
250 for (
int i=
x.size();
i--; )
251 x[
i].subscribe(home, *
new (home)
Index(home,*
this,
c,
i));
254 template<
class View,
int o>
257 assert((o == 0) || (o == 1));
267 for (
int i=0;
i<
n;
i++)
268 for (
int j=
n-1; j>
i; j--)
273 for (
int k=j-
i; k--; )
277 for (
int k=0; k<
n-1-j-1+1; k++)
286 for (
int i=1;
i<
x.size();
i++)
288 for (
int i=
x.size()-1;
i--;)
295 while ((
i+1 <
x.size()) && (
x[
i].max()+o <=
x[
i+1].min()))
309 for (
int i=1;
i+1<
x.size();
i++)
313 x[j++]=
x[
x.size()-1];
322 }
else if (
x.size() >= 2) {
328 template<
class View,
int o>
332 pos(NULL), run(false), n_subsumed(
p.n_subsumed) {
333 assert(
p.pos == NULL);
334 c.update(home, share,
p.c);
337 template<
class View,
int o>
340 if (n_subsumed > n_threshold) {
345 a.set(
static_cast<unsigned int>(as.advisor().i));
347 int* m =
r.alloc<
int>(
x.size());
349 for (
int i=0;
i<
x.size();
i++)
350 if (
a.get(
static_cast<unsigned int>(
i))) {
351 m[
i] = j;
x[j++] =
x[
i];
356 as.advisor().i = m[as.advisor().i];
363 template<
class View,
int o>
369 template<
class View,
int o>
373 x[as.advisor().i].cancel(home,as.advisor());
378 return sizeof(*this);
382 template<
class View,
int o>
387 switch (View::modevent(
d)) {
393 if (((
i == 0) || (
x[
i-1].
max()+o <=
x[
i].
min())) &&
394 ((
i ==
x.size()-1) || (
x[
i].
max()+o <=
x[
i+1].min()))) {
406 if (((
i <
x.size()-1) && (
x[
i+1].
min() <
x[
i].min()+o)) ||
407 ((
i > 0) && (
x[
i-1].
max() >
x[
i].max()-o))) {
414 template<
class View,
int o>
420 template<
class View,
int o>
427 for (
int i=
p;
i<
n-1;
i++) {
434 for (
int i=
p;
i>0;
i--) {
443 for (
int i=0;
i<
n-1;
i++)
445 for (
int i=
n-1;
i>0;
i--)
448 if (n_subsumed+1 >=
n)
461 template<
class View,
class CtrlView, ReifyMode rm>
466 template<
class View,
class CtrlView, ReifyMode rm>
494 }
else if (rm !=
RM_IMP) {
500 template<
class View,
class CtrlView, ReifyMode rm>
505 template<
class View,
class CtrlView, ReifyMode rm>
511 template<
class View,
class CtrlView, ReifyMode rm>
517 }
else if (
b.zero()) {
543 template<
class View,
class CtrlView, ReifyMode rm>
548 template<
class View,
class CtrlView, ReifyMode rm>
554 }
else if (
b.zero()) {
577 template<
class View,
class CtrlView, ReifyMode rm>
582 template<
class View,
class CtrlView, ReifyMode rm>
588 template<
class View,
class CtrlView, ReifyMode rm>
594 }
else if (
b.zero()) {
Post propagator for SetVar x
Post propagator for SetVar SetOpType SetVar y
n-ary less and less or equal propagator
Less or equal propagator.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
@ RM_PMI
Inverse implication for reification.
static bool same(V0 x0, V1 x1)
Whether views refer to same variable.
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post propagator for .
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Reified less or equal with integer propagator.
ExecStatus ES_SUBSUMED(Propagator &p)
bool empty(void) const
Whether no more positions must be propagated.
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for .
Pos * next(void) const
Return next position.
Class to iterate over advisors of a council.
RelTest rtest_lq(VX x, VY y)
Test whether view x is less or equal than view y.
int n_subsumed
Number of already subsumed advisors (or views)
@ RM_IMP
Implication for reification.
Gecode::IntArgs i(4, 1, 2, 3, 4)
bool same(const Item &i, const Item &j)
Whether two items are the same.
bool same(const VarImpVar< VarImp > &y) const
Test whether variable is the same as y.
bool same(const CachedView< View > &x, const CachedView< View > &y)
void dispose(Space &home)
Free memory for this position.
void push(Space &home, int p)
Push a new position p to be propagated.
Le(Space &home, bool share, Le &p)
Constructor for cloning p.
Base-class for both propagators and branchers.
@ RT_TRUE
Relation does hold.
static ExecStatus post(Home home, V0 x0, V1 x1)
Post propagator .
ViewArray< View > x
Array of views.
Reified unary propagator.
Index(Space &home, Propagator &p, Council< Index > &c, int i)
Create index advisor.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
void fl_dispose(FreeList *f, FreeList *l)
Return freelist-managed memory to freelist.
Boolean view for Boolean variables.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Gecode toplevel namespace
Base-class for propagators.
@ RT_MAYBE
Relation may hold or not.
Advisors for views (by position in array)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
@ RT_FALSE
Relation does not hold.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
bool run
Whether the propagator is currently running.
Generic domain change information to be supplied to advisors.
FreeList * next(void) const
Return next freelist object.
Home class for posting propagators
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
const Gecode::ModEvent ME_INT_BND
Domain operation has changed the minimum or maximum of the domain.
Lq(Space &home, bool share, Lq &p)
Constructor for cloning p.
Reified less or equal propagator.
Reified binary propagator.
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
int p
Position of view in view array.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
#define GECODE_NEVER
Assert that this command is never executed.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
virtual void reschedule(Space &home)
Schedule function.
int ModEvent
Type for modification events.
Council< Index > c
The advisor council.
Base-class for freelist-managed objects.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
int pop(Space &home)
Pop a position to be propagated and return it.
static ExecStatus post(Home home, V0 x0, V1 x1)
Post propagator .
Pos * pos
Stack of positions.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Positions in view array that have to be propagated.
static ExecStatus post(Home home, View x, int c, CtrlView b)
Post propagator for .
@ ES_FIX
Propagation has computed fixpoint.
Integer view for integer variables.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const Gecode::PropCond PC_INT_NONE
Propagation condition to be ignored (convenience)
Pos(int p, Pos *n)
Initialize with position p and next position n.
ReLqInt(Space &home, bool share, ReLqInt &p)
Constructor for cloning p.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
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.
n-ary bounds consistent equality propagator
Gecode::FloatVal c(-8, 8)
int n
Number of negative literals for node type.
@ ES_FAILED
Execution has resulted in failure.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
int ModEventDelta
Modification event deltas.
static bool same(V0 x0, V1 x1)
Whether views refer to same variable.
@ ES_NOFIX
Propagation has not computed fixpoint.
bool pos(const View &x)
Test whether x is postive.
NaryLqLe(Space &home, bool share, NaryLqLe< View, o > &p)
Constructor for cloning p.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
@ ES_OK
Execution is okay.
int p
Number of positive literals for node type.
ReLq(Space &home, bool share, ReLq &p)
Constructor for cloning p.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.