42 namespace Gecode {
namespace Int {
namespace Extensional {
51 Incremental<View>::SupportAdvisor::
52 SupportAdvisor(Space& home, Propagator&
p, Council<SupportAdvisor>&
c,
54 : Advisor(home,p,c),
i(i0) {}
58 Incremental<View>::SupportAdvisor::
59 SupportAdvisor(Space& home,
bool share, SupportAdvisor&
a)
60 : Advisor(home,share,a),
i(a.
i) {}
64 Incremental<View>::SupportAdvisor::
65 dispose(Space& home, Council<SupportAdvisor>&
c) {
66 Advisor::dispose(home,c);
159 return home.fl_alloc<
sizeof(
WorkEntry)>();
211 int literals =
static_cast<int>(
ts()->
domsize*
x.size());
213 for (
int i = literals;
i--; )
220 for (
int i =
x.size();
i--; ) {
246 for (
int j =
x.size(); j--; ) {
248 int ov = v -
ts()->
min;
254 while ((*a)->t != l) {
255 assert((*a)->next() != NULL);
283 for (
int i = x.
size();
i--; )
287 x[
i].
subscribe(home,*
new (home) SupportAdvisor(home,*
this,ac,
i));
295 for (
int i = x.
size();
i--; )
301 View::schedule(home,*
this,
309 for (
int i = x.
size();
i--; ) {
320 :
Base<View,false>(home,share,p), support_data(NULL),
321 unassigned(p.unassigned) {
322 ac.
update(home,share,p.ac);
325 for (
int i = static_cast<int>(
ts()->domsize*
x.size());
i--; ) {
360 int literals =
static_cast<int>(ts()->domsize*
x.size());
361 for (
int i = literals;
i--; )
362 if (support_data[
i]) {
364 while (lastse->
next() != NULL)
365 lastse = lastse->
next();
366 support_data[
i]->
dispose(home, lastse);
372 return sizeof(*this);
378 assert(!w_support.empty() || !w_remove.empty() || unassigned==0);
387 while (!w_support.empty() || !w_remove.empty()) {
388 while (!w_remove.empty()) {
390 w_remove.pop(home,i,n);
392 if (dom[i].
get(static_cast<unsigned int>(n-ts()->
min))) {
394 dom[
i].
clear(static_cast<unsigned int>(n-ts()->
min));
397 while (!w_support.empty()) {
399 w_support.pop(home,i,n);
401 if (dom[i].
get(static_cast<unsigned int>(n-ts()->
min)))
402 find_support(home, dom, i, n);
415 SupportAdvisor&
a =
static_cast<SupportAdvisor&
>(
_a);
417 bool scheduled = !w_support.empty() || !w_remove.empty();
421 for (
int n = ts()->
min;
n <= ts()->max;
n++) {
422 if (vv() && (
n == vv.
val())) {
427 remove_support(home, s->t, a.i,
n);
430 for (
int n =
x[a.i].min(d);
n <=
x[a.i].max(d);
n++)
432 remove_support(home, s->t, a.i,
n);
439 if (((w_support.empty() && w_remove.empty()) || scheduled) &&
444 }
else if ((w_support.empty() && w_remove.empty()) || scheduled) {
virtual Actor * copy(Space &home, bool share)
Copy propagator during cloning.
Work w_remove
Work for removing values.
void init_dom(Space &home, Domain dom)
Initialize domain information.
Description of work to be done.
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
int min(void) const
Minimum domain element.
ExecStatus ES_SUBSUMED(Propagator &p)
void update(Space &home, bool share, Council< A > &c)
Update during cloning (copies all advisors)
Tuple find_support(Domain dom, int i, int n)
Find support for view at position i and value n.
void clear(unsigned int i)
Clear bit i.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
void dispose(Space &home)
Free memory for this element.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
WorkEntry(int i, int n, WorkEntry *ne)
Initialize with position i, value n, and next entry ne.
size_t dispose(Space &home)
Delete propagator and return its size.
bool pos(const View &x)
Test whether x is postive.
void dom(Home home, FloatVar x, FloatVal n)
Propagates .
int ModEvent
Type for modification events.
FreeList * next(void) const
Return next freelist object.
ExecStatus ES_NOFIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed and its propagator must be run
Value iterator for integer views.
void dispose(Space &home, SupportEntry *l)
Free memory for all elements between this and l (inclusive)
Propagation has computed fixpoint.
void add_support(Space &home, Tuple l)
Add support.
void init_support(Space &home)
Initialize support.
bool failed(void) const
Check whether space is failed.
Base-class for both propagators and branchers.
SupportEntry ** support_data
Support information.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from space heap.
Gecode::FloatVal c(-8, 8)
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.
void remove_support(Space &home, Tuple l, int i, int n)
Remove support for view at position i and value n.
void subscribe(Space &home, Propagator &p, PropCond pc, bool process=true)
Subscribe propagator p with propagation condition pc to variable.
SupportEntry(Tuple t)
Initialize with Tuple t.
ViewArray< View > x
Variables.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
Entry for storing support.
FreeList ** nextRef(void)
Return pointer to next link in freelist object.
unsigned int domsize
Domain size.
void find_support(Space &home, Domain dom, int i, int n)
Find a next support for view at position i and value n.
size_t size
The size of the propagator (used during subsumption)
int min
Minimum and maximum in domain-values.
int i
Position of view in view array.
bool empty(void) const
Check whether work stack is empty.
ExecStatus ES_FIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
int unassigned
Number of unassigned views.
int max(void) const
Maximum domain element.
Work(void)
Initialize as empty.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Class represeting a set of tuples.
SupportEntry ** nextRef(void)
Return reference to field for next support entry.
void push(Space &home, int i, int n)
Push new work entry for position i and value n.
Work w_support
Work for finding support.
Domain consistent extensional propagator.
static PropCost cubic(PropCost::Mod m, unsigned int n)
Cubic complexity for modifier m and size measure n.
Node * x
Pointer to corresponding Boolean expression node.
Generic domain change information to be supplied to advisors.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &t)
Post propagator for views x.
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
Incremental(Space &home, bool share, Incremental< View > &p)
Constructor for cloning p.
bool assigned(View x, int v)
Whether x is assigned to value v.
SupportEntry * support(int i, int n)
Creat support entry for view at position i and value n.
Base-class for freelist-managed objects.
TupleSet::TupleSetI * ts(void)
void fl_dispose(FreeList *f, FreeList *l)
Return freelist-managed memory to freelist.
Propagation has not computed fixpoint.
int val(void) const
Return current value.
int size(void) const
Return size of array (number of elements)
Base for domain consistent extensional propagation
Gecode toplevel namespace
void pop(Space &home, int &i, int &n)
Pop current top entry and set position i and value n.
int ModEventDelta
Modification event deltas.
Home class for posting propagators
#define GECODE_NEVER
Assert that this command is never executed.
struct Gecode::@518::NNF::@57::@59 a
For atomic nodes.
SupportEntry * next(void) const
Return next support entry.
WorkEntry * next(void) const
Return next work entry.
void rfree(void *p, size_t s)
Free memory previously allocated with alloc (might be reused later)