34namespace Gecode {
namespace Int {
namespace Bool {
61 (
Home home, BV b0, BV b1)
101 template<
class BVA,
class BVB>
106 template<
class BVA,
class BVB>
111 template<
class BVA,
class BVB>
117 template<
class BVA,
class BVB>
123 template<
class BVA,
class BVB>
135 }
else if (b1.zero()) {
137 }
else if (!b0.one() && !b1.one()) {
146 template<
class BVA,
class BVB>
149#define GECODE_INT_STATUS(S0,S1) \
150 ((BVA::S0<<(1*BVA::BITS))|(BVB::S1<<(0*BVB::BITS)))
151 switch ((x0.status() << (1*BVA::BITS)) | (x1.status() << (0*BVB::BITS))) {
171#undef GECODE_INT_STATUS
188 return sizeof(*this);
195 x2.update(home,
p.x2);
209 assert(x0.none() && x1.none());
228#define GECODE_INT_STATUS(S0,S1,S2) \
229 ((BV::S0<<(2*BV::BITS))|(BV::S1<<(1*BV::BITS))|(BV::S2<<(0*BV::BITS)))
230 switch ((x0.status() << (2*BV::BITS)) | (x1.status() << (1*BV::BITS)) |
231 (x2.status() << (0*BV::BITS))) {
237 std::swap(x1,x2); x1.subscribe(home,*
this,
PC_BOOL_VAL);
247 std::swap(x0,x2); x0.subscribe(home,*
this,
PC_BOOL_VAL);
275#undef GECODE_INT_STATUS
286 :
BoolBinary<BV,BV>(home,b0,b1), x2(b2), x3(b3) {}
292 return sizeof(*this);
299 x2.update(home,
p.x2);
300 x3.update(home,
p.x3);
306 BV b0, BV b1, BV b2, BV b3)
315 assert(x0.none() && x1.none());
316 if (x2.one() || x3.one())
318 else if (x2.zero() && x3.zero())
338#define GECODE_INT_STATUS(S0,S1,S2,S3) \
339 ((BV::S0 << (3*BV::BITS)) | (BV::S1 << (2*BV::BITS)) | \
340 (BV::S2 << (1*BV::BITS)) | (BV::S3 << (0*BV::BITS)))
341 switch ((x0.status() << (3*BV::BITS)) | (x1.status() << (2*BV::BITS)) |
342 (x2.status() << (1*BV::BITS)) | (x3.status() << (0*BV::BITS))) {
355 std::swap(x1,x2); x1.subscribe(home,*
this,
PC_BOOL_VAL,
false);
360 std::swap(x1,x3); x1.subscribe(home,*
this,
PC_BOOL_VAL,
false);
380 std::swap(x0,x2); x0.subscribe(home,*
this,
PC_BOOL_VAL,
false);
385 std::swap(x0,x3); x0.subscribe(home,*
this,
PC_BOOL_VAL,
false);
395 std::swap(x0,x2); x0.subscribe(home,*
this,
PC_BOOL_VAL,
false);
396 std::swap(x1,x3); x1.subscribe(home,*
this,
PC_BOOL_VAL,
false);
451#undef GECODE_INT_STATUS
459 template<
class BVA,
class BVB,
class BVC>
464 template<
class BVA,
class BVB,
class BVC>
469 template<
class BVA,
class BVB,
class BVC>
472 BVA b0, BVB b1, BVC b2)
475 template<
class BVA,
class BVB,
class BVC>
479 assert(x0.none() && x1.none());
481 }
else if (x0.zero()) {
482 assert(x1.none() && x2.none());
484 }
else if (x1.zero()) {
485 assert(x0.none() && x2.none());
492 template<
class BVA,
class BVB,
class BVC>
498 }
else if (b2.one()) {
508 if (b0.one() || b1.one()) {
510 }
else if (b0.zero()) {
512 }
else if (b1.zero()) {
524 template<
class BVA,
class BVB,
class BVC>
527#define GECODE_INT_STATUS(S0,S1,S2) \
528 ((BVA::S0<<(2*BVA::BITS))|(BVB::S1<<(1*BVB::BITS))|(BVC::S2<<(0*BVC::BITS)))
529 switch ((x0.status() << (2*BVA::BITS)) | (x1.status() << (1*BVB::BITS)) |
530 (x2.status() << (0*BVC::BITS))) {
603#undef GECODE_INT_STATUS
615 assert(
x.
size() > 2);
641 x[0]=
x[i];
x.size(1);
643 }
else if (
x[i].zero()) {
664 for (
int i=
b.
size(); i--; )
667 else if (
b[i].zero())
673 }
else if (
b.size() == 2) {
675 }
else if (
b.size() == 3) {
677 }
else if (
b.size() == 4) {
689 return sizeof(*this);
700 }
else if (
x[i].zero()) {
704 x0=
x[i];
x[i]=
x[--
n];
734 template<
class VX,
class VY>
742 template<
class VX,
class VY>
750 template<
class VX,
class VY>
753 assert(n_zero <
x.size());
763 assert(n_zero <
x.size());
767 template<
class VX,
class VY>
774 for (
int i=0; i<
x.size(); i++)
778 for (
int i=
x.size(); i--; )
782 }
else if (
x[i].zero()) {
787 }
else if (
x.size() == 1) {
789 }
else if (
x.size() == 2) {
797 template<
class VX,
class VY>
803 template<
class VX,
class VY>
807 if (VX::zero(d) && (++n_zero <
x.size()))
813 template<
class VX,
class VY>
817 if (n_zero ==
x.size())
819 for (
int i=0; i<
x.size(); i++)
826 template<
class VX,
class VY>
834 return sizeof(*this);
837 template<
class VX,
class VY>
844 for (
int i=0; i<
x.size(); i++)
846 }
else if (n_zero ==
x.size()) {
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.
Base-class for both propagators and branchers.
Class to iterate over advisors of a council.
A & advisor(void) const
Return advisor.
int size(void) const
Return size of array (number of elements)
Generic domain change information to be supplied to advisors.
Home class for posting propagators
Binary Boolean disjunction propagator (true)
BinOrTrue(Home home, BVA b0, BVB b1)
Constructor for posting.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, BVA b0, BVB b1)
Post propagator .
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Base-class for binary Boolean propagators.
Base-class for ternary Boolean propagators.
Boolean equality propagator.
static ExecStatus post(Home home, BVA x0, BVB x1)
Post propagator .
Boolean n-ary disjunction propagator (true)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
ExecStatus resubscribe(Space &home, BV &x0, BV x1)
Update subscription.
static ExecStatus post(Home home, ViewArray< BV > &b)
Post propagator .
ViewArray< BV > x
Views not yet subscribed to.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low unary)
NaryOrTrue(Home home, ViewArray< BV > &x)
Constructor for posting.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Boolean n-ary disjunction propagator.
virtual void reschedule(Space &home)
Schedule function.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
NaryOr(Home home, ViewArray< VX > &x, VY y)
Constructor for posting.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low unary)
Council< Advisor > c
The advisor council.
static ExecStatus post(Home home, ViewArray< VX > &x, VY y)
Post propagator .
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Binary Boolean disjunction propagator (subsumed)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, BV b0, BV b1)
Post propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
OrTrueSubsumed(Space &home, OrTrueSubsumed &p)
Constructor for cloning p.
Boolean disjunction 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, BVA b0, BVB b1, BVC b2)
Post propagator .
Or(Home home, BVA b0, BVB b1, BVC b2)
Constructor for posting.
Quarternary Boolean disjunction propagator (true)
QuadOrTrue(Home home, BV b0, BV b1, BV b2, BV b3)
Constructor for posting.
BV x2
Boolean view without subscription.
BV x3
Boolean view without subscription.
static ExecStatus post(Home home, BV b0, BV b1, BV b2, BV b3)
Post propagator .
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Ternary Boolean disjunction propagator (true)
TerOrTrue(Home home, BV b0, BV b1, BV b2)
Constructor for posting.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
BV x2
Boolean view without subscription.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, BV b0, BV b1, BV b2)
Post propagator .
Mixed (n+1)-ary propagator.
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
Base-class for propagators.
ModEventDelta med
A set of modification events (used during propagation)
struct Gecode::Space::@61::@63 c
Data available only during copying.
void update(Space &home, ViewArray< View > &a)
Update array to be a clone of array a.
void drop_fst(int i)
Drop views from positions 0 to i-1 from array.
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
int size(void) const
Return size of array (number of elements)
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.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
#define GECODE_INT_STATUS(S0, S1)
ExecStatus resubscribe(Space &home, Propagator &p, VX &x0, ViewArray< VX > &x, VY &x1, ViewArray< VY > &y)
const Gecode::PropCond PC_BOOL_NONE
Propagation condition to be ignored (convenience)
const Gecode::ModEvent ME_BOOL_VAL
Domain operation has resulted in a value (assigned variable)
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
BoolTest bool_test(const BoolView &b0, const BoolView &b1)
@ BT_COMP
Same variable but complement.
Gecode toplevel namespace
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.
bool shared(ViewArray< ViewX > x, ViewArray< ViewY > y)
Post propagator for SetVar x
#define GECODE_NEVER
Assert that this command is never executed.