38 namespace Gecode {
namespace Int {
namespace Linear {
44 template<
class XV,
class YV>
53 template<
class XV,
class YV>
62 template<
class XV,
class YV>
67 y.update(home,share,p.
y);
70 template<
class XV,
class YV>
76 template<
class XV,
class YV>
88 template<
class XV,
class YV>
93 template<
class XV,
class YV>
99 for (
int i = n;
i--; )
102 }
else if (x[
i].zero()) {
110 if (y.min()+c ==
n) {
111 assert(y.assigned());
112 for (
int i = n;
i--; )
116 if (y.max()+c == 0) {
117 assert(y.assigned());
118 for (
int i = n;
i--; )
126 template<
class XV,
class YV>
131 template<
class XV,
class YV>
137 template<
class XV,
class YV>
141 for (
int i = n;
i--; )
144 }
else if (
x[
i].zero()) {
152 if (
y.min()+
c ==
n) {
153 assert(
y.assigned());
154 for (
int i = n;
i--; )
158 if (
y.max()+
c == 0) {
159 assert(
y.assigned());
160 for (
int i = n;
i--; )
174 template<
class XV,
class YV>
179 template<
class XV,
class YV>
185 for (
int i = n;
i--; )
188 }
else if (x[
i].zero()) {
192 if ((n-c < y.min() ) || (-c > y.max()))
198 if ((n == 1) && y.assigned()) {
199 if (y.val()+c == 1) {
202 assert(y.val()+c == 0);
212 template<
class XV,
class YV>
217 template<
class XV,
class YV>
223 template<
class XV,
class YV>
227 for (
int i = n;
i--; )
230 }
else if (
x[
i].zero()) {
234 if ((n-
c <
y.min() ) || (-
c >
y.max()))
240 if ((n == 1) &&
y.assigned()) {
241 if (
y.val()+
c == 1) {
244 assert(
y.val()+
c == 0);
257 template<
class XV,
class YV>
262 template<
class XV,
class YV>
269 for (
int i = n;
i--; )
272 }
else if (x[
i].zero()) {
279 if (y.min()+c ==
n) {
280 for (
int i = n;
i--; )
289 template<
class XV,
class YV>
294 template<
class XV,
class YV>
300 template<
class XV,
class YV>
304 for (
int i = n;
i--; )
307 }
else if (
x[
i].zero()) {
314 if (
y.min()+
c ==
n) {
315 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.
void reschedule(Space &home, Propagator &p, PropCond pc)
Re-schedule propagator p with propagation condition pc.
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.
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
GqBoolView(Space &home, bool share, GqBoolView &p)
Constructor for cloning p.
virtual void reschedule(Space &home)
Schedule function.
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.
int c
Righthandside (constant part from Boolean views assigned to 1)
Propagator for integer less or equal to Boolean sum (cardinality)
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.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as low linear)
void cancel(Space &home, Propagator &p, PropCond pc)
Cancel subscription of propagator p with propagation condition pc to all views.
#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.
Gecode toplevel namespace
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Propagator for disequality to Boolean sum (cardinality)
int size(void) const
Return size of array (number of elements)
int ModEventDelta
Modification event deltas.
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)