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());
62 template<
class View,
bool subscribe>
66 x.update(home, share, p.
x);
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>
95 #define GECODE_LAST_TUPLE(l) (*(l))
97 template<
class View,
bool subscribe>
103 template<
class View,
bool subscribe>
106 assert(last(i,n) != NULL);
107 assert(last(i,n)[i] == n+ts()->
min);
108 int pos = (i*
static_cast<int>(ts()->domsize)) +
n;
110 if (last(i,n)[
i] != (n+ts()->min))
111 last_data[
pos] = ts()->nullpointer;
116 template<
class View,
bool subscribe>
119 unsigned int domsize = ts()->domsize;
120 for (
int i =
x.size();
i--; ) {
121 dom[
i].
init(home, domsize);
123 dom[i].set(static_cast<unsigned int>(vv.val()-ts()->min));
127 template<
class View,
bool subscribe>
130 for (
int i =
x.size();
i--; )
131 if (!dom[
i].
get(static_cast<unsigned int>(t[
i]-ts()->
min)))
135 #undef GECODE_LAST_TUPLE
136 template<
class View,
bool subscribe>
140 while ((l != NULL) && !
valid(l, dom))
146 template<
class View,
bool subscribe>
154 unsigned int literals = ts()->domsize*
x.size();
155 home.
rfree(last_data,
sizeof(
Tuple*)*literals);
156 (void) tupleSet.~TupleSet();
157 return sizeof(*this);
TupleSet tupleSet
Definition of constraint.
void init_dom(Space &home, Domain dom)
Initialize domain information.
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
bool valid(const FloatVal &n)
Return whether float n is a valid number.
Tuple find_support(Domain dom, int i, int n)
Find support for view at position i and value n.
Actor must always be disposed.
void init_last(Space &home, Tuple **source, Tuple *base)
Initialize last support.
bool pos(const View &x)
Test whether x is postive.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
Base-class for propagators.
Tuple last_next(int i, int n)
Find last support for view at position i and value n.
Tuple last(int i, int n)
Find last support for view at position i and value n.
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.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
virtual size_t dispose(Space &home)
Delete propagator and return its size.
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)
bool valid(Tuple t, Domain dom)
Check wether tuple is valid for domain.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high quadratic)
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Class represeting a set of tuples.
void update(Space &home, bool share, SharedHandle &sh)
Updating during cloning.
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.
virtual size_t dispose(Space &home)
Delete actor and return its size.
#define GECODE_LAST_TUPLE(l)
TupleSet::TupleSetI * ts(void)
Base for domain consistent extensional propagation
Gecode toplevel namespace
int ModEventDelta
Modification event deltas.
Home class for posting propagators
void rfree(void *p, size_t s)
Free memory previously allocated with alloc (might be reused later)