40 namespace Gecode {
namespace Set {
namespace Element {
42 template<
class SView,
class RView>
53 for (
unsigned int i=iv0.
size();
i--;)
57 template<
class SView,
class RView>
63 x0.update(home,share,p.
x0);
64 x1.update(home,share,p.
x1);
66 for (
unsigned int i=
n_iv;
i--;)
67 iv[
i].update(home,share,p.
iv[
i]);
70 template<
class SView,
class RView>
76 template<
class SView,
class RView>
84 for (
unsigned int i=n_iv;
i--;)
90 template<
class SView,
class RView>
105 template<
class SView,
class RView>
111 template<
class SView,
class RView>
116 bool* stillSelected = r.
alloc<
bool>(n_iv);
121 for (
int i=n_iv;
i--;)
122 stillSelected[
i] =
false;
146 unsigned int maxCard = 0;
160 bool selectSingleInconsistent =
false;
161 if (x1.cardMax() <= 1) {
163 IntSetRanges candub(iv[i]);
165 IntSetRanges > diff2(x0lb, candub);
166 selectSingleInconsistent = diff2() || candidateCard < x0.cardMin();
177 if (selectSingleInconsistent ||
178 candidateCard > x0.cardMax() ||
184 stillSelected[
i] =
true;
187 if (vx1() && vx1.
val()==
i) {
190 IntSetRanges candlb(iv[i]);
191 ModEvent me = x0.includeI(home,candlb);
197 before[
i].
update(home,sofarBefore);
198 IntSetRanges cub(iv[i]);
200 IntSetRanges clb(iv[i]);
202 maxCard =
std::max(maxCard, candidateCard);
203 minCard =
std::min(minCard, candidateCard);
209 if (x1.cardMax()==0) {
214 for (
int i=n_iv;
i--;)
215 if (stillSelected[
i])
222 if (x1.cardMin() > 0) {
226 ModEvent me = x0.includeI(home, si);
229 me = x0.cardMin(home, minCard);
235 if (x1.cardMax() <= 1) {
236 ModEvent me = x0.cardMax(home, maxCard);
244 ModEvent me = x0.intersectI(home,sfB);
255 for (
int i=n_iv;
i--;) {
256 if (!stillSelected[
i])
284 assert(x0.assigned());
const Gecode::ModEvent ME_SET_FAILED
Domain operation has resulted in failure.
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.
Range iterator for integer sets.
ExecStatus ES_SUBSUMED(Propagator &p)
const FloatNum max
Largest allowed float value.
Actor must always be disposed.
static ExecStatus post(Home home, SView z, const IntSetArgs &x, RView y)
int size(void) const
Return size of array (number of elements)
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Shrinking sets of integers.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
int ModEvent
Type for modification events.
Base-class for propagators.
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.
Propagator for element with union of constant sets
bool failed(void) const
Check whether space is failed.
Range iterator for the least upper bound.
Base-class for both propagators and branchers.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
virtual Actor * copy(Space &home, bool)
Copy propagator during cloning.
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.
ElementUnionConst(Space &home, bool share, ElementUnionConst &p)
Constructor for cloning p.
bool intersectI(Space &home, I &i)
Exclude all elements not in the set represented by i from this set.
Value iterator from range iterator.
unsigned int size(I &i)
Size of all ranges of range iterator i.
Range iterator for integer sets.
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.
virtual size_t dispose(Space &home)
Delete actor and return its size.
Growing sets of integers.
bool me_modified(ModEvent me)
Check whether modification event me describes variable modification.
int val(void) const
Return current value.
bool subset(I &i, J &j)
Check whether range iterator i is subset of range iterator j.
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
void * ralloc(size_t s)
Allocate memory from region.