34 namespace Gecode {
namespace Int {
namespace Linear {
40 template<
class XV,
class YV>
49 template<
class XV,
class YV>
58 template<
class XV,
class YV>
66 template<
class XV,
class YV>
72 template<
class XV,
class YV>
84 template<
class XV,
class YV>
89 template<
class XV,
class YV>
95 for (
int i = n;
i--; )
98 }
else if (x[
i].zero()) {
106 if (y.min()+c ==
n) {
107 assert(y.assigned());
108 for (
int i = n;
i--; )
112 if (y.max()+c == 0) {
113 assert(y.assigned());
114 for (
int i = n;
i--; )
122 template<
class XV,
class YV>
127 template<
class XV,
class YV>
133 template<
class XV,
class YV>
137 for (
int i = n;
i--; )
140 }
else if (
x[
i].zero()) {
148 if (
y.min()+
c ==
n) {
149 assert(
y.assigned());
150 for (
int i = n;
i--; )
154 if (
y.max()+
c == 0) {
155 assert(
y.assigned());
156 for (
int i = n;
i--; )
170 template<
class XV,
class YV>
175 template<
class XV,
class YV>
181 for (
int i = n;
i--; )
184 }
else if (x[
i].zero()) {
188 if ((n-c < y.min() ) || (-c > y.max()))
194 if ((n == 1) && y.assigned()) {
195 if (y.val()+c == 1) {
198 assert(y.val()+c == 0);
208 template<
class XV,
class YV>
213 template<
class XV,
class YV>
219 template<
class XV,
class YV>
223 for (
int i = n;
i--; )
226 }
else if (
x[
i].zero()) {
230 if ((n-
c <
y.min() ) || (-
c >
y.max()))
236 if ((n == 1) &&
y.assigned()) {
237 if (
y.val()+
c == 1) {
240 assert(
y.val()+
c == 0);
253 template<
class XV,
class YV>
258 template<
class XV,
class YV>
265 for (
int i = n;
i--; )
268 }
else if (x[
i].zero()) {
275 if (y.min()+c ==
n) {
276 for (
int i = n;
i--; )
285 template<
class XV,
class YV>
290 template<
class XV,
class YV>
296 template<
class XV,
class YV>
300 for (
int i = n;
i--; )
303 }
else if (
x[
i].zero()) {
310 if (
y.min()+
c ==
n) {
311 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 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.
void update(Space &home, ViewArray< View > &a)
Update array to be a clone of array a.
ExecStatus ES_SUBSUMED(Propagator &p)
virtual Actor * copy(Space &home)
Create copy during cloning.
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)
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.
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)
virtual Actor * copy(Space &home)
Create copy during cloning.
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 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.
Post propagator for SetVar SetOpType SetVar y
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual size_t dispose(Space &home)
Delete actor and return its size.
GqBoolView(Space &home, GqBoolView &p)
Constructor for cloning p.
NqBoolView(Space &home, NqBoolView &p)
Constructor for cloning p.
Post propagator for SetVar x
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Gecode toplevel namespace
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Propagator for disequality to Boolean sum (cardinality)
EqBoolView(Space &home, EqBoolView &p)
Constructor for cloning p.
LinBoolView(Space &home, LinBoolView &p)
Constructor for cloning p.
virtual Actor * copy(Space &home)
Create copy during cloning.
int size(void) const
Return size of array (number of elements)
int ModEventDelta
Modification event deltas.
Home class for posting propagators
const Gecode::PropCond PC_INT_VAL
Propagate when a view becomes assigned (single value)