40 namespace Gecode {
namespace Set {
namespace Element {
42 template<
class View,
class View0,
class View1>
53 template<
class View,
class View0,
class View1>
58 x0.update(home,share,p.
x0);
59 x1.update(home,share,p.
x1);
63 template<
class View,
class View0,
class View1>
70 template<
class View,
class View0,
class View1>
83 template<
class View,
class View0,
class View1>
97 template<
class View,
class View0,
class View1>
103 template<
class View,
class View0,
class View1>
137 unsigned int maxCard = 0;
143 if (iv[i].idx < vx0ub.
val()) {
148 assert(iv[i].idx == vx0ub.
val());
151 View candidate = iv[j].view;
152 int candidateInd = iv[j].idx;
160 bool selectSingleInconsistent =
false;
161 if (x0.cardMax() <= 1) {
166 selectSingleInconsistent =
167 diff2() || candidate.cardMax() < x1.cardMin();
178 if (selectSingleInconsistent ||
179 candidate.cardMin() > x1.cardMax() ||
181 ModEvent me = (x0.exclude(home,candidateInd));
192 if (vx0() && vx0.
val()==candidateInd) {
195 ModEvent me = x1.includeI(home,candlb);
200 me = candidate.intersectI(home,x1ub);
206 before[j].
update(home,sofarBefore);
211 maxCard =
std::max(maxCard, candidate.cardMax());
212 minCard =
std::min(minCard, candidate.cardMin());
221 for (
int k=i; k<
n; k++) {
227 if (x0.cardMax()==0) {
233 before[i].dispose(home);
237 if (x0.cardMin() > 0) {
241 ModEvent me = x1.includeI(home, si);
244 me = x1.cardMin(home, minCard);
250 if (x0.cardMax() <= 1) {
251 ModEvent me = x1.cardMax(home, maxCard);
259 ModEvent me = x1.intersectI(home,sfB);
270 for (
int i=n; i--;) {
282 ModEvent me = (x0.include(home,iv[i].idx));
287 me = iv[
i].view.includeI(home,diff);
301 if (x0.assigned() && !x1.assigned()) {
302 int ubsize =
static_cast<int>(x0.lubSize());
309 ::
post(home(*
this),is,x1)));
310 }
else if (ubsize == 2) {
315 ::
post(home(*
this),a,b,x1)));
316 }
else if (ubsize == 1) {
326 bool allAssigned =
true;
327 for (
int i=iv.
size();
i--;) {
328 if (!iv[
i].view.assigned()) {
333 if (x1.assigned() && x0.assigned() && allAssigned) {
#define GECODE_REWRITE(prop, post)
Rewrite propagator by executing post function.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
Propagator for nary union
void post(Home home, Term *t, int n, FloatRelType frt, FloatVal c)
Post propagator for linear constraint over floats.
Range iterator for singleton range.
static PropCost linear(PropCost::Mod m, unsigned int n)
Linear complexity for modifier pcm and size measure n.
const int min
Smallest allowed integer in integer set.
ExecStatus ES_SUBSUMED(Propagator &p)
const FloatNum max
Largest allowed float value.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Actor must always be disposed.
int size(void) const
Return size of array (number of elements)
Propagator for ternary union
Shrinking sets of integers.
int ModEvent
Type for modification events.
Base-class for propagators.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Range iterator for the greatest lower bound.
Propagation has computed fixpoint.
const unsigned int card
Maximum cardinality of an integer set.
const int max
Largest allowed integer in integer set.
bool failed(void) const
Check whether space is failed.
Range iterator for the least upper bound.
Base-class for both propagators and branchers.
int p
Number of positive literals for node type.
const FloatNum min
Smallest allowed float value.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
bool intersectI(Space &home, I &i)
Exclude all elements not in the set represented by i from this set.
Value iterator from range iterator.
Range iterator for integer sets.
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z)
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.
bool includeI(Space &home, I &i)
Include the set represented by i in this set.
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.
Range iterator for computing union (binary)
SetExpr inter(const SetVarArgs &x)
Intersection of set variables.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
Propagator for element with union
virtual size_t dispose(Space &home)
Delete actor and return its size.
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Growing sets of integers.
ElementUnion(Space &home, bool share, ElementUnion &p)
Constructor for cloning p.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
Propagator for set equality
int val(void) const
Return current value.
An array of IdxView pairs.
struct Gecode::@518::NNF::@57::@58 b
For binary nodes (and, or, eqv)
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
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
void * ralloc(size_t s)
Allocate memory from region.
int size(void) const
Return the current size.
void update(Space &home, bool share, IdxViewArray< View > &x)
Cloning.