41 namespace Gecode {
namespace Int {
namespace Extensional {
47 template<
class View,
bool subscribe>
51 :
Propagator(home),
x(x0), tupleSet(t), last_data(NULL) {
55 assert(ts()->finalized());
57 init_last(home, ts()->last, ts()->tuple_data);
62 template<
class View,
bool subscribe>
66 x.update(home, share, p.
x);
67 tupleSet.update(home, share, p.
tupleSet);
72 template<
class View,
bool subscribe>
75 if (last_data == NULL) {
76 int literals =
static_cast<int>(ts()->domsize*
x.size());
78 for (
int i = literals;
i--; )
79 last_data[
i] = ts()->tuple_data+(source[
i]-
base);
83 template<
class View,
bool subscribe>
86 return tupleSet.implementation();
89 template<
class View,
bool subscribe>
96 template<
class View,
bool subscribe>
99 return PropCost::quadratic(PropCost::HI,
x.size());
102 #define GECODE_LAST_TUPLE(l) (*(l)) 104 template<
class View,
bool subscribe>
110 template<
class View,
bool subscribe>
113 assert(last(i,n) != NULL);
114 assert(last(i,n)[i] == n+ts()->
min);
115 int pos = (i*
static_cast<int>(ts()->domsize)) +
n;
117 if (last(i,n)[
i] != (n+ts()->min))
118 last_data[
pos] = ts()->nullpointer;
123 template<
class View,
bool subscribe>
126 unsigned int domsize = ts()->domsize;
127 for (
int i =
x.size();
i--; ) {
128 dom[
i].
init(home, domsize);
130 dom[i].
set(static_cast<unsigned int>(vv.val()-ts()->min));
134 template<
class View,
bool subscribe>
137 for (
int i =
x.size();
i--; )
138 if (!dom[
i].
get(static_cast<unsigned int>(t[
i]-ts()->
min)))
142 #undef GECODE_LAST_TUPLE 143 template<
class View,
bool subscribe>
147 while ((l != NULL) && !
valid(l, dom))
153 template<
class View,
bool subscribe>
157 (void) Propagator::dispose(home);
161 unsigned int literals = ts()->domsize*
x.size();
162 home.
rfree(last_data,
sizeof(
Tuple*)*literals);
163 (void) tupleSet.~TupleSet();
164 return sizeof(*this);
TupleSet tupleSet
Definition of constraint.
bool valid(const FloatVal &n)
Return whether float n is a valid number.
Actor must always be disposed.
bool pos(const View &x)
Test whether x is postive.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Base-class for propagators.
Value iterator for integer views.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
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.
ViewArray< View > x
Variables.
void subscribe(Space &home, Propagator &p, IntSet &y)
Tuple ** last_data
Last tuple looked at Access real tuple-set.
const Gecode::PropCond PC_INT_DOM
Propagate when domain changes.
void init(A &a, unsigned int s, bool setbits=false)
Initialize for s bits and allocator a (only after default constructor)
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
Class represeting a set of tuples.
const double base
Base for geometric restart sequence.
Node * x
Pointer to corresponding Boolean expression node.
Base(Space &home, bool share, Base< View, subscribe > &p)
Constructor for cloning p.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
TupleSet::TupleSetI * ts(void)
Post propagator for SetVar x
Base for domain consistent extensional propagation
Gecode toplevel namespace
void reschedule(Space &home, Propagator &p, IntSet &y)
int ModEventDelta
Modification event deltas.
Home class for posting propagators
#define GECODE_LAST_TUPLE(l)
void rfree(void *p, size_t s)
Free memory previously allocated with alloc (might be reused later)