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>
78 template<
class View,
class View0,
class View1>
91 template<
class View,
class View0,
class View1>
105 template<
class View,
class View0,
class View1>
111 template<
class View,
class View0,
class View1>
145 unsigned int maxCard = 0;
151 if (iv[
i].idx < vx0ub.
val()) {
156 assert(iv[
i].idx == vx0ub.
val());
159 View candidate = iv[j].view;
160 int candidateInd = iv[j].idx;
168 bool selectSingleInconsistent =
false;
169 if (x0.cardMax() <= 1) {
174 selectSingleInconsistent =
175 diff2() || candidate.cardMax() < x1.cardMin();
186 if (selectSingleInconsistent ||
187 candidate.cardMin() > x1.cardMax() ||
189 ModEvent me = (x0.exclude(home,candidateInd));
200 if (vx0() && vx0.
val()==candidateInd) {
203 ModEvent me = x1.includeI(home,candlb);
208 me = candidate.intersectI(home,x1ub);
214 before[j].update(home,sofarBefore);
219 maxCard =
std::max(maxCard, candidate.cardMax());
220 minCard =
std::min(minCard, candidate.cardMin());
229 for (
int k=
i; k<
n; k++) {
235 if (x0.cardMax()==0) {
245 if (x0.cardMin() > 0) {
252 me = x1.cardMin(home, minCard);
258 if (x0.cardMax() <= 1) {
259 ModEvent me = x1.cardMax(home, maxCard);
267 ModEvent me = x1.intersectI(home,sfB);
278 for (
int i=
n;
i--;) {
290 ModEvent me = (x0.include(home,iv[
i].idx));
295 me = iv[
i].view.includeI(home,diff);
309 if (x0.assigned() && !x1.assigned()) {
310 int ubsize =
static_cast<int>(x0.lubSize());
317 ::
post(home(*
this),is,x1)));
318 }
else if (ubsize == 2) {
323 ::
post(home(*
this),
a,
b,x1)));
324 }
else if (ubsize == 1) {
334 bool allAssigned =
true;
335 for (
int i=iv.
size();
i--;) {
336 if (!iv[
i].view.assigned()) {
341 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
int size(void) const
Return size of array (number of elements)
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.
Actor must always be disposed.
Propagator for ternary union
virtual void reschedule(Space &home)
Schedule function.
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.
int val(void) const
Return current value.
Range iterator for the least upper bound.
Base-class for both propagators and branchers.
struct Gecode::@579::NNF::@61::@63 a
For atomic nodes.
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.
bool failed(void) const
Check whether space is failed.
Value iterator from range iterator.
struct Gecode::@579::NNF::@61::@62 b
For binary nodes (and, or, eqv)
Range iterator for integer sets.
static ExecStatus post(Home home, IdxViewArray &x, View0 y, View1 z)
int size(void) const
Return the current size.
#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)
Post propagator for SetVar SetOpType SetVar SetRelType r
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 PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
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
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
TFE post(PropagatorGroup g)
Only post functions (but not propagators) from g are considered.
void update(Space &home, bool share, IdxViewArray< View > &x)
Cloning.