39 #include <type_traits> 41 namespace Gecode {
namespace Int {
namespace Extensional {
55 assert((
_fst->
min <= n) && (n <= _lst->max));
62 assert((
_fst->
min <= n) && (n <= _lst->max));
155 const Range* m = f + ((l-
f) >> 1);
158 }
else if (n > m->
max) {
164 assert((f->
min <= n) && (n <= f->
max));
176 }
else if (n >= lst->
min) {
182 assert((fnd->
min <= n) && (n <= fnd->max));
191 xr(a.view()), sr(a.fst()),
n(xr.
min()) {
210 assert(n <= sr->
max);
212 }
else if (
n <=
max) {
219 assert((
xr.min() <=
n) && (
n <=
xr.max()));
220 assert((
sr->
min <=
n) && (n <= sr->
max));
260 while ((
l <= h) && (
l >
r->max)) {
261 r++;
l=
r->min;
s=
r->s;
272 assert((
l >=
r->min) && (l <= r->
max));
301 return sizeof(*this);
309 template<
class View,
class Table>
310 template<
class TableProp>
313 :
Compact<View>(home,p), table(home,p.table) {
314 assert(!
table.empty());
317 template<
class View,
class Table>
321 if (
table.words() <= 4U) {
322 switch (
table.width()) {
368 template<
class View,
class Table>
376 for (
int i = x.
size(); i--; ) {
377 table.clear_mask(mask);
379 table.add_to_mask(vs.supports(),mask);
380 table.template intersect_with_mask<false>(mask);
385 for (
int i = x.
size(); i--; ) {
387 (
void)
new (home)
CTAdvisor(home,*
this,c,ts,x[i],i);
398 template<
class View,
class Table>
402 return sizeof(*this);
405 template<
class View,
class Table>
411 template<
class View,
class Table>
419 template<
class View,
class Table>
439 if (touched.
single(a) || x.assigned())
453 int* nq = r.
alloc<
int>(x.size());
454 unsigned int n_nq = 0U;
456 int last_support = 0;
458 if (!
table.intersects(vs.supports()))
459 nq[n_nq++] = vs.val();
461 last_support = vs.val();
468 }
else if (n_nq == x.size() - 1U) {
475 ModEvent me = x.minus_v(home,rnq,
false);
489 assert(!
table.empty());
494 template<
class View,
class Table>
499 for (
int i=x.
size(); i--; ) {
505 if (ct->
table.empty())
511 template<
class View,
class Table>
534 table.template intersect_with_mask<true>(
supports(a,x.val()));
539 if (!x.any(d) && (x.min(d) == x.max(d))) {
542 }
else if (!x.any(d) && (x.width(d) <= x.size())) {
544 for (
LostSupports ls(*
this,a,x.min(d),x.max(d)); ls(); ++ls) {
545 table.nand_with_mask(ls.supports());
560 table.clear_mask(mask);
562 table.add_to_mask(vs.supports(),mask);
563 table.template intersect_with_mask<false>(mask);
582 assert(ts.
words() > 0U);
584 for (
int i=x.
size(); i--; ) {
589 switch (ts.
words()) {
void free(void)
Free allocate memory.
CompactTable(Space &home, TableProp &p)
Constructor for cloning p.
const BitSetData * supports(void) const
Provide access to corresponding supports.
void dispose(Space &home, Council< A > &c)
Delete advisor.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Status(StatusType t)
Initialize with type t (either NONE or SEVERAL)
const Range * lst(void) const
Return lasst range of support data structure.
static PropCost quadratic(PropCost::Mod m, unsigned int n)
Quadratic complexity for modifier m and size measure n.
TupleSet ts
The tuple set.
StatusType type(void) const
Return status type.
const Range * range(CTAdvisor &a, int n)
Find range for n.
ExecStatus ES_SUBSUMED(Propagator &p)
#define GECODE_ASSUME(p)
Assert certain property.
const FloatNum max
Largest allowed float value.
Actor must always be disposed.
const Range * fst(void) const
Return first range of support data structure.
T * alloc(long unsigned int n)
Allocate block of n objects of type T from region.
Iterator over valid supports.
Value iterator for array of integers
void max(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
const unsigned int n_words
Number of words in supports.
IntType u_type(unsigned int n)
Return type required to represent n.
void operator++(void)
Move to next supports.
int ModEvent
Type for modification events.
Base-class for propagators.
Compact< View >::CTAdvisor CTAdvisor
ExecStatus ES_NOFIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed and its propagator must be run
int val(void) const
Return supported value.
Iterator over lost supports.
Class to iterate over advisors of a council.
const BitSetData * supports(void) const
Return supports.
Propagation has computed fixpoint.
ViewRanges< View > xr
Range iterator.
Advisor storing a single view
const BitSetData * supports(CTAdvisor &a, int n)
Return supports for value n.
Base-class for both propagators and branchers.
Status status
Propagator status.
CTAdvisor(Space &home, Propagator &p, Council< CTAdvisor > &c, const TupleSet &ts, View x0, int i)
Initialise from parameters.
int tuples(void) const
Number of tuples.
View view(void) const
Access view.
size_t dispose(Space &home)
Delete propagator and return its size.
Multiple view have been touched.
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
Domain consistent extensional propagator.
int n
Number of negative literals for node type.
ExecStatus postcompact(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for compact table propagator.
Execution has resulted in failure.
A single view has been touched.
void none(void)
Set status to NONE.
const Gecode::ModEvent ME_INT_VAL
Domain operation has resulted in a value (assigned variable)
const Range * lst(int i) const
Return last range for position i.
LostSupports(const Compact< View > &p, CTAdvisor &a, int l, int h)
Initialize iterator for values between l and h.
const BitSetData * supports(unsigned int n_words, int n) const
Return the supports for value n.
const Gecode::ModEvent ME_INT_BND
Domain operation has changed the minimum or maximum of the domain.
size_t size
The size of the propagator (used during subsumption)
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts)
Post propagator for views x and table t.
ExecStatus ES_FIX_DISPOSE(Council< A > &c, A &a)
Advisor a must be disposed
const Range * _lst
Last range of support data structure.
bool single(CTAdvisor &a) const
Check whether status is single and equal to a.
Council< CTAdvisor > c
The advisor council.
#define GECODE_ME_CHECK(me)
Check whether modification event me is failed, and forward failure.
size_t dispose(Space &home)
Delete propagator and return its size.
void notice(Actor &a, ActorProperty p, bool duplicate=false)
Notice actor property.
const Range * fst(int i) const
Return first range for position i.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
const BitSetData * s
The value's support.
Table table
Current table.
Post propagator for SetVar SetOpType SetVar SetRelType r
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
void min(Home home, FloatVar x0, FloatVar x1, FloatVar x2)
Post propagator for .
Class represeting a set of tuples.
virtual void reschedule(Space &home)
Schedule function.
const Range * sr
Support iterator.
Post propagator for f(x \diamond_{\mathit{op}} y) \sim_r z \f$ void rel(Home home
Generic domain change information to be supplied to advisors.
void ignore(Actor &a, ActorProperty p, bool duplicate=false)
Ignore actor property.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
virtual size_t dispose(Space &home)
Delete actor and return its size.
const Range * _fst
First range of support data structure.
const Gecode::ModEvent ME_INT_DOM
Domain operation has changed the domain.
void dispose(Space &home, Council< CTAdvisor > &c)
Dispose advisor.
void touched(CTAdvisor &a)
Set status to SINGLE or MULTIPLE depending on a.
bool assigned(View x, int v)
Whether x is assigned to value v.
bool operator()(void) const
Whether there are still supports left.
Compact(Space &home, Compact &p)
Constructor for cloning p.
Advisor for updating current table.
void adjust(void)
Adjust supports.
Post propagator for SetVar x
Propagation has not computed fixpoint.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
ptrdiff_t s
A tagged pointer for storing the status.
Gecode toplevel namespace
const unsigned int n_words
Number of words.
Base class for compact table propagator.
int unassigned
Number of unassigned views.
void operator++(void)
Move iterator to next value.
StatusType
Type of status.
bool operator()(void) const
Whether iterator is done.
int ModEventDelta
Modification event deltas.
int size(void) const
Return size of array (number of elements)
void propagating(void)
Set status to PROPAGATING.
Home class for posting propagators
ValidSupports(const Compact< View > &p, CTAdvisor &a)
Initialize from initialized propagator.
No view has been touched.
#define GECODE_NEVER
Assert that this command is never executed.
The propagator is currently running.
bool me_failed(ModEvent me)
Check whether modification event me is failed.
unsigned int words(void) const
Return number of required bit set words.