38 namespace Gecode {
namespace Int {
namespace Bool {
45 template<
class VX,
class VY>
50 (home,x0[x0.
size()-1],y0[y0.
size()-1]),
x(x0), y(y0) {
55 template<
class VX,
class VY>
61 template<
class VX,
class VY>
69 template<
class VX,
class VY>
79 x[0]=
x[
i]; n=1;
break;
80 }
else if (
x[
i].zero()) {
94 y[0]=y[
i]; n=1;
break;
95 }
else if (y[
i].zero()) {
102 if ((
x.size() == 0) && (y.size() == 0))
108 template<
class VX,
class VY>
111 for (
int i=x.
size();
i--; )
114 else if (x[
i].zero())
118 for (
int i=y.
size();
i--; )
121 else if (y[
i].zero())
125 if ((x.
size() == 1) && (y.
size() == 1)) {
127 }
else if (!x.
shared(home,y)) {
133 template<
class VX,
class VY>
137 return sizeof(*this);
140 template<
class VX,
class VY>
151 }
else if (x[
i].zero()) {
155 if ((
i == 0) && (y.
size() == 0)) {
156 VX z = x[0]; x.
size(0);
160 x0=x[
i]; x[
i]=x[--
n];
167 for (
int i=y.
size();
i--; )
175 template<
class VX,
class VY>
178 if (x0.one() || x1.one())
195 template<
class VX,
class VY>
201 template<
class VX,
class VY>
206 template<
class VX,
class VY>
216 template<
class VX,
class VY>
219 :
Propagator(home,share,p), n_zero(p.n_zero) {
222 z.update(home,share,p.
z);
223 c.update(home,share,p.
c);
234 x[
i]=x[--
n]; n_zero--;
240 template<
class VX,
class VY>
248 template<
class VX,
class VY>
255 for (
int i=x.
size();
i--; )
257 for (
int i=y.
size();
i--; )
261 for (
int i=x.
size();
i--; )
265 }
else if (x[
i].zero()) {
270 for (
int i=y.
size();
i--; )
274 }
else if (y[
i].zero()) {
279 if ((x.
size() == 1) && (y.
size() == 1)) {
281 }
else if (x.
shared(home,y)) {
289 template<
class VX,
class VY>
295 template<
class VX,
class VY>
300 x.cancel(home,as.advisor());
302 y.cancel(home,as.advisor());
303 as.advisor().dispose(home,
c);
309 template<
class VX,
class VY>
314 return sizeof(*this);
318 template<
class VX,
class VY>
323 if ((a.
x && VX::zero(d)) || (!a.
x && VY::zero(d)))
324 if (++n_zero <
x.size() + y.size())
329 template<
class VX,
class VY>
335 for (
int i =
x.size();
i--; )
337 for (
int i = y.
size();
i--; )
340 }
else if (n_zero ==
x.size() + y.size()) {
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
void update(Space &, bool share, ViewArray< View > &a)
Update array to be a clone of array a.
Boolean clause propagator (disjunctive, true)
ViewArray< VY > y
Positive views (origin from negative variables)
ExecStatus ES_SUBSUMED(Propagator &p)
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low binary)
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
int size(void) const
Return size of array (number of elements)
void cancel(Space &home, Propagator &p, IntSet &y)
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low unary)
ExecStatus resubscribe(Space &home, Propagator &p, VX &x0, ViewArray< VX > &x, VY &x1, ViewArray< VY > &y)
Clause(Home home, ViewArray< VX > &x, ViewArray< VY > &y, VX z)
Constructor for posting.
Base-class for propagators.
Boolean clause propagator (disjunctive)
static ExecStatus post(Home home, BVA b0, BVB b1, BVC b2)
Post propagator .
Class to iterate over advisors of a council.
ViewArray< VX > x
Positive views.
Propagation has computed fixpoint.
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
Base-class for both propagators and branchers.
#define GECODE_ES_CHECK(es)
Check whether execution status es is failed or subsumed, and forward failure or subsumption.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
int n
Number of negative literals for node type.
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
bool shared(const Space &home) const
Test whether array contains shared views.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
static ExecStatus post(Home home, ViewArray< VX > &x, ViewArray< VY > &y, VX z)
Post propagator .
ViewArray< VX > x
Views not yet subscribed to.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
unsigned int size(I &i)
Size of all ranges of range iterator i.
void cancel(Space &home)
Cancel subscriptions.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
ViewArray< VY > y
Views not yet subscribed to (origin from negative variables)
Council< Tagged > c
The advisor council.
int n_zero
The number of views assigned to zero in x and y.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
void move_lst(int i)
Move view from position size()-1 to position i (truncate array by one)
Boolean n-ary disjunction propagator (true)
static ExecStatus post(Home home, BVA b0, BVB b1)
Post propagator .
static ExecStatus post(Home home, ViewArray< VX > &x, ViewArray< VY > &y)
Post propagator .
Node * x
Pointer to corresponding Boolean expression node.
Generic domain change information to be supplied to advisors.
virtual size_t dispose(Space &home)
Delete actor and return its size.
Boolean n-ary disjunction propagator.
Binary Boolean disjunction propagator (true)
void eliminate_zero(ViewArray< VX > &x, int &n_zero)
Propagation has not computed fixpoint.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
int size(void) const
Return size of array (number of elements)
Tagged(Space &home, Propagator &p, Council< Tagged > &c, bool x)
Create tagged advisor.
Gecode toplevel namespace
Advisors for views (tagged whether for x or y)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
int ModEventDelta
Modification event deltas.
Home class for posting propagators
static PropCost binary(PropCost::Mod m)
Two variables for modifier pcm.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
const bool x
Whether advises a view for x or y.
ClauseTrue(Home home, ViewArray< VX > &x, ViewArray< VY > &y)
Constructor for posting.
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)