40 namespace Gecode {
namespace Set {
namespace Element {
42 template<
class View,
class View0,
class View1>
47 :
Propagator(home), universe(theUniverse), iv(iv0), x0(y0), x1(y1) {
54 template<
class View,
class View0,
class View1>
64 template<
class View,
class View0,
class View1>
71 template<
class View,
class View0,
class View1>
79 template<
class View,
class View0,
class View1>
93 template<
class View,
class View0,
class View1>
108 template<
class View,
class View0,
class View1>
114 template<
class View,
class View0,
class View1>
148 if (
iv[i].idx < vx0ub.
val()) {
153 assert(
iv[i].idx == vx0ub.
val());
156 View candidate = iv[j].view;
157 int candidateInd = iv[j].idx;
170 if (candidate.cardMax() <
x1.cardMin() ||
172 ModEvent me = (
x0.exclude(home,candidateInd));
183 if (vx0() && vx0.
val()==candidateInd) {
186 ModEvent me = candidate.includeI(home,x1lb);
191 me =
x1.intersectI(home,candub);
197 before[j].
update(home,sofarBefore);
208 for (
int k=i; k<
n; k++) {
214 if (
x0.cardMax()==0) {
243 for (
int i=n; i--;) {
244 if (sofarAfter.
size() == 0)
break;
259 me =
iv[
i].view.excludeI(home,diff);
273 if (
x0.assigned() && !
x1.assigned()) {
274 int ubsize =
static_cast<int>(
x0.lubSize());
281 ::
post(home(*
this),is,
x1)));
282 }
else if (ubsize == 2) {
287 ::
post(home(*
this),a,b,
x1)));
288 }
else if (ubsize == 1) {
298 bool allAssigned =
true;
300 if (!
iv[
i].view.assigned()) {
305 if (
x1.assigned() &&
x0.assigned() && allAssigned) {
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z, const IntSet &u)
Range iterator for singleton range.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
Range iterator for integer sets.
ExecStatus ES_SUBSUMED(Propagator &p)
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Actor must always be disposed.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Shrinking sets of integers.
int ModEvent
Type for modification events.
Base-class for propagators.
void update(Space &home, IdxViewArray< View > &x)
Cloning.
Range iterator for the greatest lower bound.
Propagation has computed fixpoint.
int val(void) const
Return current value.
Range iterator for the least upper bound.
Base-class for both propagators and branchers.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual void reschedule(Space &home)
Schedule function.
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.
unsigned int size(void) const
Return size.
Range iterator for computing intersection (binary)
void cancel(Space &home, Propagator &p, PropCond pc)
ElementIntersection(Space &home, ElementIntersection &p)
Constructor for cloning p.
bool intersectI(Space &home, I &i)
Exclude all elements not in the set represented by i from this set.
bool failed(void) const
Check whether space is failed.
Value iterator from range iterator.
Range iterator for integer sets.
int size(void) const
Return the current size.
void update(Space &home, BndSet &x)
Update this set to be a clone of set x.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
void dispose(Space &home)
Free memory used by this set.
const Gecode::PropCond PC_SET_ANY
Propagate when any bound or the cardinality of a view changes.
Propagator for element with intersection
Post propagator for SetVar SetOpType SetVar SetRelType r
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
void reschedule(Space &home, Propagator &p, PropCond pc)
Schedule propagator p.
struct Gecode::@585::NNF::@62::@63 b
For binary nodes (and, or, eqv)
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
virtual size_t dispose(Space &home)
Delete actor and return its size.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
virtual size_t dispose(Space &home)
Delete propagator and return its size.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Propagator for set equality
An array of IdxView pairs.
Gecode toplevel namespace
Range iterator for computing set difference.
int ModEventDelta
Modification event deltas.
bool before(const ConstSetView &x, const ConstSetView &y)
Home class for posting propagators
Propagator for nary intersection
Propagator for ternary intersection