36namespace Gecode {
namespace Int {
namespace Rel {
43 template<
class V0,
class V1>
48 template<
class V0,
class V1>
53 if ((x0 != x1) && (x0.max() > x1.min()))
58 template<
class V0,
class V1>
63 template<
class V0,
class V1>
69 template<
class V0,
class V1>
84 template<
class V0,
class V1>
89 template<
class V0,
class V1>
96 if (x0.max() >= x1.min())
101 template<
class V0,
class V1>
106 template<
class V0,
class V1>
112 template<
class V0,
class V1>
127 template<
class View,
int o>
133 template<
class View,
int o>
140 template<
class View,
int o>
145 template<
class View,
int o>
151 template<
class View,
int o>
155 template<
class View,
int o>
161 template<
class View,
int o>
164 return home.fl_alloc<
sizeof(
Pos)>();
167 template<
class View,
int o>
174 template<
class View,
int o>
179 template<
class View,
int o>
187 template<
class View,
int o>
197 template<
class View,
int o>
202 for (
int i=0; i<
x.
size(); i++)
203 x[i].subscribe(home, *
new (home)
Index(home,*
this,
c,i));
206 template<
class View,
int o>
209 assert((o == 0) || (o == 1));
219 for (
int i=0; i<
n; i++)
220 for (
int j=
n-1; j>i; j--)
225 for (
int k=j-i; k--; )
229 for (
int k=0; k<
n-1-j-1+1; k++)
238 for (
int i=1; i<
x.size(); i++)
240 for (
int i=
x.size()-1; i--;)
247 while ((i+1 <
x.size()) && (
x[i].max()+o <=
x[i+1].min()))
254 while ((i > 0) && (
x[i-1].
max()+o <=
x[i].
min()))
261 for (
int i=1; i+1<
x.size(); i++)
262 if ((
x[j-1].
max()+o >
x[i].
min()) ||
265 x[j++]=
x[
x.size()-1];
274 }
else if (
x.size() >= 2) {
280 template<
class View,
int o>
284 pos(NULL), run(false), n_subsumed(
p.n_subsumed) {
285 assert(
p.pos == NULL);
289 template<
class View,
int o>
292 if (n_subsumed > n_threshold) {
297 a.set(
static_cast<unsigned int>(as.advisor().i));
299 int* m =
r.alloc<
int>(
x.size());
301 for (
int i=0; i<
x.size(); i++)
302 if (
a.get(
static_cast<unsigned int>(i))) {
303 m[i] = j;
x[j++] =
x[i];
308 as.advisor().i = m[as.advisor().i];
315 template<
class View,
int o>
321 template<
class View,
int o>
325 x[as.advisor().i].cancel(home,as.advisor());
330 return sizeof(*this);
334 template<
class View,
int o>
339 switch (View::modevent(d)) {
345 if (((i == 0) || (
x[i-1].
max()+o <=
x[i].
min())) &&
346 ((i ==
x.size()-1) || (
x[i].max()+o <=
x[i+1].min()))) {
358 if (((i <
x.size()-1) && (
x[i+1].min() <
x[i].min()+o)) ||
359 ((i > 0) && (
x[i-1].max() >
x[i].max()-o))) {
366 template<
class View,
int o>
372 template<
class View,
int o>
379 for (
int i=
p; i<
n-1; i++) {
386 for (
int i=
p; i>0; i--) {
395 for (
int i=0; i<
n-1; i++)
397 for (
int i=
n-1; i>0; i--)
400 if (n_subsumed+1 >=
n)
413 template<
class View,
class CtrlView, ReifyMode rm>
418 template<
class View,
class CtrlView, ReifyMode rm>
446 }
else if (rm !=
RM_IMP) {
452 template<
class View,
class CtrlView, ReifyMode rm>
457 template<
class View,
class CtrlView, ReifyMode rm>
463 template<
class View,
class CtrlView, ReifyMode rm>
469 }
else if (
b.zero()) {
495 template<
class View,
class CtrlView, ReifyMode rm>
500 template<
class View,
class CtrlView, ReifyMode rm>
506 }
else if (
b.zero()) {
529 template<
class View,
class CtrlView, ReifyMode rm>
534 template<
class View,
class CtrlView, ReifyMode rm>
540 template<
class View,
class CtrlView, ReifyMode rm>
546 }
else if (
b.zero()) {
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
Base-class for both propagators and branchers.
Class to iterate over advisors of a council.
int size(void) const
Return size of array (number of elements)
Generic domain change information to be supplied to advisors.
Base-class for freelist-managed objects.
FreeList * next(void) const
Return next freelist object.
Home class for posting propagators
Reified binary propagator.
Reified unary propagator.
Le(Space &home, Le &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, V0 x0, V1 x1)
Post propagator .
Less or equal propagator.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, V0 x0, V1 x1)
Post propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Lq(Space &home, Lq &p)
Constructor for cloning p.
n-ary bounds consistent equality propagator
Advisors for views (by position in array)
Index(Space &home, Propagator &p, Council< Index > &c, int i)
Create index advisor.
Positions in view array that have to be propagated.
int p
Position of view in view array.
Pos(int p, Pos *n)
Initialize with position p and next position n.
void dispose(Space &home)
Free memory for this position.
Pos * next(void) const
Return next position.
n-ary less and less or equal propagator
bool empty(void) const
Whether no more positions must be propagated.
void push(Space &home, int p)
Push a new position p to be propagated.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Council< Index > c
The advisor council.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
bool run
Whether the propagator is currently running.
int n_subsumed
Number of already subsumed advisors (or views)
virtual void reschedule(Space &home)
Schedule function.
static ExecStatus post(Home home, ViewArray< View > &x)
Post propagator for .
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
NaryLqLe(Space &home, NaryLqLe< View, o > &p)
Constructor for cloning p.
Pos * pos
Stack of positions.
int pop(Space &home)
Pop a position to be propagated and return it.
Reified less or equal with integer propagator.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
ReLqInt(Space &home, ReLqInt &p)
Constructor for cloning p.
static ExecStatus post(Home home, View x, int c, CtrlView b)
Post propagator for .
Reified less or equal propagator.
ReLq(Space &home, ReLq &p)
Constructor for cloning p.
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post propagator for .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Base-class for propagators.
struct Gecode::Space::@61::@63 c
Data available only during copying.
void fl_dispose(FreeList *f, FreeList *l)
Return freelist-managed memory to freelist.
ExecStatus ES_SUBSUMED(Propagator &p)
int ModEventDelta
Modification event deltas.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
@ RM_IMP
Implication for reification.
@ RM_PMI
Inverse implication for reification.
const Gecode::ModEvent ME_INT_BND
Domain operation has changed the minimum or maximum of the domain.
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
RelTest rtest_lq(VX x, VY y)
Test whether view x is less or equal than view y.
const Gecode::PropCond PC_INT_NONE
Propagation condition to be ignored (convenience)
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
@ RT_TRUE
Relation does hold.
@ RT_MAYBE
Relation may hold or not.
@ RT_FALSE
Relation does not hold.
Gecode toplevel namespace
Post propagator for SetVar SetOpType SetVar SetRelType r
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar SetOpType SetVar y
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_FAILED
Execution has resulted in failure.
@ ES_NOFIX
Propagation has not computed fixpoint.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Post propagator for SetVar x
int ModEvent
Type for modification events.
#define GECODE_NEVER
Assert that this command is never executed.