38 namespace Gecode {
namespace Int {
namespace Linear {
44 template<
class XV,
class YV>
52 template<
class XV,
class YV>
61 template<
class XV,
class YV>
66 y.update(home,share,p.
y);
69 template<
class XV,
class YV>
80 template<
class XV,
class YV>
85 template<
class XV,
class YV>
91 for (
int i = n;
i--; )
94 }
else if (x[
i].zero()) {
102 if (y.min()+c ==
n) {
103 assert(y.assigned());
104 for (
int i = n;
i--; )
108 if (y.max()+c == 0) {
109 assert(y.assigned());
110 for (
int i = n;
i--; )
118 template<
class XV,
class YV>
123 template<
class XV,
class YV>
129 template<
class XV,
class YV>
133 for (
int i = n;
i--; )
136 }
else if (
x[
i].zero()) {
144 if (y.min()+
c ==
n) {
145 assert(y.assigned());
146 for (
int i = n;
i--; )
150 if (y.max()+
c == 0) {
151 assert(y.assigned());
152 for (
int i = n;
i--; )
166 template<
class XV,
class YV>
171 template<
class XV,
class YV>
177 for (
int i = n;
i--; )
180 }
else if (x[
i].zero()) {
184 if ((n-c < y.min() ) || (-c > y.max()))
190 if ((n == 1) && y.assigned()) {
191 if (y.val()+c == 1) {
194 assert(y.val()+c == 0);
204 template<
class XV,
class YV>
209 template<
class XV,
class YV>
215 template<
class XV,
class YV>
219 for (
int i = n;
i--; )
222 }
else if (
x[
i].zero()) {
226 if ((n-
c < y.
min() ) || (-
c > y.
max()))
232 if ((n == 1) && y.assigned()) {
233 if (y.val()+
c == 1) {
236 assert(y.val()+
c == 0);
249 template<
class XV,
class YV>
254 template<
class XV,
class YV>
261 for (
int i = n;
i--; )
264 }
else if (x[
i].zero()) {
271 if (y.min()+c ==
n) {
272 for (
int i = n;
i--; )
281 template<
class XV,
class YV>
286 template<
class XV,
class YV>
292 template<
class XV,
class YV>
296 for (
int i = n;
i--; )
299 }
else if (
x[
i].zero()) {
306 if (y.min()+
c ==
n) {
307 for (
int i = n;
i--; )
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
#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.
ViewArray< XV > x
Boolean views.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
ExecStatus ES_SUBSUMED(Propagator &p)
bool one(const Gecode::FloatValArgs &a)
Check whether has only one coefficients.
Base-class for Boolean linear propagators.
Propagator for integer disequal to Boolean sum (cardinality)
EqBoolView(Space &home, bool share, EqBoolView &p)
Constructor for cloning p.
Base-class for propagators.
YV y
View to compare number of assigned Boolean views to.
GqBoolView(Space &home, bool share, GqBoolView &p)
Constructor for cloning p.
Propagation has computed fixpoint.
static ExecStatus post(Home home, ViewArray< XV > &x, YV y, int c)
Post propagator for .
Propagator for equality to Boolean sum (cardinality)
Base-class for both propagators and branchers.
static ExecStatus post(Home home, ViewArray< XV > &x, YV y, int c)
Post propagator for .
static ExecStatus post(Home home, ViewArray< XV > &x, YV y, int c)
Post propagator for .
Gecode::FloatVal c(-8, 8)
Propagator for greater or equal to Boolean sum (cardinality)
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.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
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)
const Gecode::PropCond PC_INT_BND
Propagate when minimum or maximum of a view changes.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
NqBoolView(Space &home, bool share, NqBoolView &p)
Constructor for cloning p.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
Node * x
Pointer to corresponding Boolean expression node.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual size_t dispose(Space &home)
Delete actor and return its size.
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
LinBoolView(Space &home, bool share, LinBoolView &p)
Constructor for cloning p.
int size(void) const
Return size of array (number of elements)
Gecode toplevel namespace
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Propagator for disequality to Boolean sum (cardinality)
friend FloatVal max(const FloatVal &x, const FloatVal &y)
int ModEventDelta
Modification event deltas.
friend FloatVal min(const FloatVal &x, const FloatVal &y)
Home class for posting propagators
virtual Actor * copy(Space &home, bool share)
Create copy during cloning.
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)