41 template<
class View0,
class View1>
46 template<
class View0,
class View1>
51 }
else if (
x1.assigned()) {
53 }
else if (
x0 !=
x1) {
59 template<
class View0,
class View1>
64 template<
class View0,
class View1>
71 template<
class View0,
class View1>
77 template<
class View0,
class View1>
83 template<
class View0,
class View1>
89 assert(
x1.assigned());
101 template<
class View0,
class View1>
106 template<
class View0,
class View1>
111 }
else if (
x1.assigned()) {
113 }
else if (
x0 !=
x1) {
123 template<
class View0,
class View1>
128 template<
class View0,
class View1>
135 template<
class View0,
class View1>
141 template<
class View0,
class View1>
146 }
else if (
x1.assigned()) {
152 }
while (
x0.min() !=
x1.min());
156 }
while (
x0.max() !=
x1.max());
160 assert(
x0.assigned() &&
x1.assigned());
169 template<
class View0,
class View1>
174 template<
class View0,
class View1>
179 }
else if (
x1.assigned()) {
181 }
else if (
x0 !=
x1) {
192 template<
class View0,
class View1>
197 template<
class View0,
class View1>
204 template<
class View0,
class View1>
210 template<
class View0,
class View1>
221 template<
class View0,
class View1>
236 }
while (
x0.min() !=
x1.min());
240 }
while (
x0.max() !=
x1.max());
243 if (
x0.range() &&
x1.range())
274 }
else if (
x.size() > 2) {
277 for (
int i=1; i<
x.size(); i++) {
278 l = std::max(l,
x[i].
min());
279 u = std::min(u,
x[i].
max());
281 for (
int i=0; i<
x.size(); i++) {
314 assert(
x.size() > 2);
320 if (
x[i].assigned()) {
323 for (
int j=0; j<
x.size(); j++)
335 for (
int i=0; i<
x.size(); i++) {
337 if (mn <
x[i].
min()) {
347 for (
int i=0; i<
x.size(); i++) {
349 if (mx >
x[i].
max()) {
364 for (
int i=0; i<n; i++) {
375 for (
int i=0; i<n; i++) {
380 for (
int i=0; i<n; i++) {
406 }
else if (
x.size() > 2) {
409 for (
int i=1; i<
x.size(); i++) {
410 l = std::max(l,
x[i].
min());
411 u = std::min(u,
x[i].
max());
413 for (
int i=0; i<
x.size(); i++) {
445 assert(
x.size() > 2);
448 for (
int i = 0; ; i++)
449 if (
x[i].assigned()) {
452 for (
int j=0; j<
x.size(); j++)
461 for (
int i=0; i<
x.size(); i++) {
463 if (mn <
x[i].
min()) {
470 for (
int i=0; i<
x.size(); i++) {
472 if (mx >
x[i].
max()) {
487 template<
class View,
class CtrlView, ReifyMode rm>
492 template<
class View,
class CtrlView, ReifyMode rm>
507 }
else if (rm !=
RM_IMP) {
514 template<
class View,
class CtrlView, ReifyMode rm>
519 template<
class View,
class CtrlView, ReifyMode rm>
525 template<
class View,
class CtrlView, ReifyMode rm>
561 template<
class View,
class CtrlView, ReifyMode rm>
566 template<
class View,
class CtrlView, ReifyMode rm>
581 }
else if (rm !=
RM_IMP) {
588 template<
class View,
class CtrlView, ReifyMode rm>
593 template<
class View,
class CtrlView, ReifyMode rm>
599 template<
class View,
class CtrlView, ReifyMode rm>
636 template<
class View,
class CtrlView, ReifyMode rm>
642 template<
class View,
class CtrlView, ReifyMode rm>
648 }
else if (
b.zero()) {
651 }
else if (x.assigned()) {
667 template<
class View,
class CtrlView, ReifyMode rm>
672 template<
class View,
class CtrlView, ReifyMode rm>
678 template<
class View,
class CtrlView, ReifyMode rm>
684 }
else if (
b.zero()) {
713 template<
class View,
class CtrlView, ReifyMode rm>
719 template<
class View,
class CtrlView, ReifyMode rm>
725 }
else if (
b.zero()) {
728 }
else if (x.assigned()) {
744 template<
class View,
class CtrlView, ReifyMode rm>
749 template<
class View,
class CtrlView, ReifyMode rm>
755 template<
class View,
class CtrlView, ReifyMode rm>
761 }
else if (
b.zero()) {
Base-class for both propagators and branchers.
Home class for posting propagators
ReBinaryPropagator(Space &home, ReBinaryPropagator &p)
ReUnaryPropagator(Space &home, ReUnaryPropagator &p)
virtual Actor * copy(Space &home)
Copy propagator during cloning.
EqBnd(Space &home, EqBnd< View0, View1 > &p)
Constructor for cloning p.
static ExecStatus post(Home home, View0 x0, View1 x1)
Post bounds consistent propagator .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, View0 x0, View1 x1)
Post domain consistent propagator .
EqDom(Space &home, EqDom< View0, View1 > &p)
Constructor for cloning p.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function: low unary.
static ExecStatus post(Home home, View0 x0, View1 x1)
Post value propagation propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
EqVal(Space &home, EqVal< View0, View1 > &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, ViewArray< View > &x)
Post bounds consistent propagator .
NaryEqBnd(Space &home, NaryEqBnd< View > &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
NaryEqDom(Space &home, NaryEqDom< View > &p)
Constructor for cloning p.
static ExecStatus post(Home home, ViewArray< View > &x)
Post domain consistent propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, V0 x0, V1 x1)
Post propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
int c
Integer constant to check.
static ExecStatus post(Home home, View x, int c, CtrlView b)
Post bounds consistent propagator .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
ReEqBndInt(Space &home, ReEqBndInt &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post bounds consistent propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
ReEqBnd(Space &home, ReEqBnd &p)
Constructor for cloning p.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
static ExecStatus post(Home home, View x, int c, CtrlView b)
Post domain consistent propagator .
ReEqDomInt(Space &home, ReEqDomInt &p)
Constructor for cloning p.
int c
Integer constant to check.
ReEqDom(Space &home, ReEqDom &p)
Constructor for cloning p.
static ExecStatus post(Home home, View x0, View x1, CtrlView b)
Post domain consistent propagator .
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Range iterator for integer views.
Range iterator for intersection of iterators.
int max(void) const
Return largest value of range.
void reset(void)
Reset iterator to start.
int min(void) const
Return smallest value of range.
MixBinaryPropagator(Space &home, MixBinaryPropagator &p)
NaryPropagator(Space &home, NaryPropagator &p)
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
ModEventDelta med
A set of modification events (used during propagation).
Propagator(Home home)
Constructor for posting.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
virtual Val val(const Space &home, View x, int i)=0
Return value of view x at position i.
ExecStatus ES_FIX_PARTIAL(Propagator &p, const ModEventDelta &med)
Propagator p has computed partial fixpoint
ExecStatus ES_SUBSUMED(Propagator &p)
Propagator p is subsumed
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.
@ RM_IMP
Implication for reification.
@ RM_PMI
Inverse implication for reification.
Simple relation propagators.
const Gecode::ModEvent ME_INT_BND
Domain operation has changed the minimum or maximum of the domain.
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value).
RelTest rtest_eq_dom(VX x, VY y)
Test whether views x and y are equal (use full domain information).
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
RelTest rtest_eq_bnd(VX x, VY y)
Test whether views x and y are equal (use bounds information).
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable).
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
@ RT_TRUE
Relation does hold.
@ RT_MAYBE
Relation may hold or not.
@ RT_FALSE
Relation does not hold.
Gecode toplevel namespace
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
@ ES_OK
Execution is okay.
@ ES_FIX
Propagation has computed fixpoint.
@ ES_FAILED
Execution has resulted in failure.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
bool shared(ViewArray< ViewX > x, ViewArray< ViewY > y)
int ModEvent
Type for modification events.
#define GECODE_NEVER
Assert that this command is never executed.