44 namespace Gecode {
namespace Int {
namespace Linear {
54 :
Propagator(home), co(home),
x(x0), n_as(n_s), n_hs(n_s),
c(c0) {
79 }
else if (
x[
i].zero()) {
92 co.update(home,share,p.
co);
110 return sizeof(*this);
152 }
else if (
x[
i].
one()) {
168 if ((
c <= 0) || (
c == n))
194 for (
int i=n_x;
i--; )
197 }
else if (x[
i].
one()) {
198 x[
i] = x[--n_x]; c--;
212 for (
int i=n_x;
i--; )
263 }
else if (
x[
i].
one()) {
272 if ((
c < 0) || (
c > n))
274 if ((
c == 0) || (
c == n))
305 for (
int i=n_x;
i--; )
308 }
else if (x[
i].
one()) {
309 x[
i] = x[--n_x]; c--;
313 if ((c < 0) || (c > n_x))
317 for (
int i=n_x;
i--; )
323 for (
int i=n_x;
i--; )
342 b[b.
size()-1]),
x(b),
c(c0) {
343 assert(
x.
size() >= 2);
351 return sizeof(*this);
364 }
else if (p.
x[
i].one()) {
365 n--; p_c--; p.
x[
i]=p.
x[
n];
x[
i]=
x[
n];
380 }
else if (x[
i].zero()) {
384 if ((n < c) || (c < 0))
421 }
else if (
x[
i].zero()) {
425 assert(!
x[
i].zero() && !
x[
i].
one());
441 if (
x0.zero() ||
x0.one())
444 if (
x1.zero() ||
x1.one())
446 int n =
x.
size() + s0 + s1;
447 if ((n <
c) || (
c < 0))
475 template<
class VX,
class VB>
484 template<
class VX,
class VB>
489 for (
int i=n_x;
i--; )
497 template<
class VX,
class VB>
503 co.update(home,share,p.
co);
505 b.update(home,share,p.
b);
508 template<
class VX,
class VB>
516 return sizeof(*this);
519 template<
class VX,
class VB>
555 template<
class VX,
class VB, ReifyMode rm>
560 template<
class VX,
class VB, ReifyMode rm>
566 template<
class VX,
class VB, ReifyMode rm>
572 template<
class VX,
class VB, ReifyMode rm>
578 if ((
n_s <
c) || (
c <= 0))
584 template<
class VX,
class VB, ReifyMode rm>
613 template<
class VX,
class VB, ReifyMode rm>
616 assert(!b.assigned());
620 for (
int i=n_x;
i--; )
623 }
else if (x[
i].
one()) {
624 x[
i] = x[--n_x]; c--;
635 }
else if ((c == 1) && (rm ==
RM_EQV)) {
638 }
else if ((c == n_x) && (rm ==
RM_EQV)) {
641 for (
int i=n_x;
i--; )
657 template<
class VX,
class VB, ReifyMode rm>
662 template<
class VX,
class VB, ReifyMode rm>
668 template<
class VX,
class VB, ReifyMode rm>
674 template<
class VX,
class VB, ReifyMode rm>
681 if ((
c < 0) || (
c >
n_s) || (
n_s == 0))
687 template<
class VX,
class VB, ReifyMode rm>
691 if ((
c == 0) && (
n_s == 0)) {
711 template<
class VX,
class VB, ReifyMode rm>
714 assert(!b.assigned());
718 for (
int i=n_x;
i--; )
721 }
else if (x[
i].
one()) {
722 x[
i] = x[--n_x]; c--;
725 if ((n_x < c) || (c < 0)) {
729 }
else if ((c == 0) && (n_x == 0)) {
733 }
else if ((c == 0) && (rm ==
RM_EQV)) {
737 }
else if ((c == n_x) && (rm ==
RM_EQV)) {
740 for (
int i=n_x;
i--; )
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
ViewArray< VX > x
Boolean views.
View base(void) const
Return view from which this view is derived.
#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.
Inverse implication for reification.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
ExecStatus ES_SUBSUMED(Propagator &p)
GqBoolInt(Space &home, bool share, GqBoolInt &p)
Constructor for cloning p.
int n_s
Number of subscriptions.
NqBoolInt(Home home, ViewArray< VX > &b, int c)
Constructor for posting.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
void cancel(Space &home, Propagator &p, IntSet &y)
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high unary)
Baseclass for integer Boolean sum.
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
static ExecStatus post(Home home, ViewArray< VX > &x, int c, VB b)
Post propagator for .
static ExecStatus post(Home home, ViewArray< VX > &x, int c, VB b)
Post propagator for .
static ExecStatus post(Home home, ViewArray< VX > &x, int c)
Post propagator for .
Propagator for integer disequal to Boolean sum (cardinality)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Base-class for propagators.
ReGqBoolInt(Space &home, bool share, ReGqBoolInt &p)
Constructor for cloning p.
ReEqBoolInt(Space &home, bool share, ReEqBoolInt &p)
Constructor for cloning p.
Class to iterate over advisors of a council.
ReLinBoolInt(Space &home, bool share, ReLinBoolInt &p)
Constructor for cloning p.
Propagation has computed fixpoint.
static PropCost unary(PropCost::Mod m)
Single variable for modifier pcm.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Base-class for both propagators and branchers.
Council< Advisor > co
Council for single advisor.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
int n_as
Number of active subscriptions.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Execution has resulted in failure.
EqBoolInt(Space &home, bool share, EqBoolInt &p)
Constructor for cloning p.
Propagator for integer less or equal to Boolean sum (cardinality)
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
Propagator for integer equal to Boolean sum (cardinality)
void subscribe(Space &home, Propagator &p, IntSet &y)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
size_t size
The size of the propagator (used during subsumption)
struct Gecode::@519::NNF::@60::@62 a
For atomic nodes.
static ExecStatus post(Home home, ViewArray< VX > &x, int c)
Post propagator for .
bool resubscribe(Space &home, VX &y)
Update subscription.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
void normalize(void)
Normalize by removing unused views.
Propagator for reified integer less or equal to Boolean sum (cardinality)
void normalize(void)
Normalize by removing unused views.
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
Propagator for reified integer equal to Boolean sum (cardinality)
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Baseclass for reified integer Boolean sum.
void check(const FloatVal &n, const char *l)
Check whether float n is a valid number, otherwise throw out of limits exception with information l...
struct Gecode::@519::NNF::@60::@61 b
For binary nodes (and, or, eqv)
static NegBoolView neg(BoolView x)
Return negated View.
static ExecStatus post(Home home, ViewArray< VX > &b, int c)
Post propagator for .
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
Node * x
Pointer to corresponding Boolean expression node.
NegBoolView NegView
The negated view.
Generic domain change information to be supplied to advisors.
Traits for Boolean negation view.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual size_t dispose(Space &home)
Delete actor and return its size.
BoolView NegView
The negated view.
Boolean n-ary disjunction propagator.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
LinBoolInt(Space &home, bool share, LinBoolInt &p)
Constructor for cloning p.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Propagation has not computed fixpoint.
Council< Advisor > co
Council for managing single advisor.
int n_hs
Number of views that have or had subscriptions.
static ExecStatus post(Home home, ViewArray< BV > &b)
Post propagator .
ViewArray< VX > x
Views not yet subscribed to.
static ExecStatus post(Home home, ViewArray< VX > &x, VY y)
Post propagator .
Gecode toplevel namespace
Implication for reification.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
static BoolView neg(NegBoolView x)
Return negated View.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high unary)
int ModEventDelta
Modification event deltas.
int size(void) const
Return size of array (number of elements)
Home class for posting propagators
A & advisor(void) const
Return advisor.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
Equivalence for reification (default)
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)
const Gecode::PropCond PC_BOOL_VAL
Propagate when a view becomes assigned (single value)
Boolean view for Boolean variables.