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) {
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,
310 View::schedule(home,*
this,
318 for (
int i = x.
size();
i--; ) {
331 ac.
update(home,share,p.ac);
334 for (
int i = static_cast<int>(
ts()->domsize*
x.size());
i--; ) {
369 int literals =
static_cast<int>(
ts()->
domsize*
x.size());
370 for (
int i = literals;
i--; )
373 while (lastse->
next() != NULL)
374 lastse = lastse->
next();
381 return sizeof(*this);
401 if (dom[i].
get(static_cast<unsigned int>(n-
ts()->
min))) {
403 dom[
i].
clear(static_cast<unsigned int>(n-
ts()->
min));
410 if (dom[i].
get(static_cast<unsigned int>(n-
ts()->
min)))
424 SupportAdvisor&
a =
static_cast<SupportAdvisor&
>(
_a);
431 if (vv() && (
n == vv.
val())) {
439 for (
int n =
x[a.i].min(d);
n <=
x[a.i].max(d);
n++)
SupportEntry * next(void) const
Return next support entry.
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.
virtual void reschedule(Space &home)
Schedule function.
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.
FreeList * next(void) const
Return next freelist object.
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.
void subscribe(Space &home, Propagator &p, PropCond pc, bool schedule=true)
Subscribe propagator p with propagation condition pc to variable.
int max(void) const
Maximum domain element.
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.
WorkEntry * next(void) const
Return next work entry.
void init_support(Space &home)
Initialize support.
int val(void) const
Return current value.
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)
struct Gecode::@554::NNF::@60::@62 a
For atomic nodes.
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.
SupportEntry(Tuple t)
Initialize with Tuple t.
ViewArray< View > x
Variables.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
bool failed(void) const
Check whether space is failed.
ModEventDelta med
A set of modification events (used during propagation)
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.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
int i
Position of view in view array.
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.
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.
int min(void) const
Minimum domain element.
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.
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.
void dispose(Space &home, Council< A > &c)
Dispose the advisor.
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
bool empty(void) const
Check whether work stack is empty.
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.
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.
int size(void) const
Return size of array (number of elements)
Home class for posting propagators
void dispose(Space &home)
Dispose council.
#define GECODE_NEVER
Assert that this command is never executed.
void rfree(void *p, size_t s)
Free memory previously allocated with alloc (might be reused later)