43 #include <type_traits> 45 namespace Gecode {
namespace Int {
namespace Extensional {
59 assert((
_fst->
min <= n) && (n <= _lst->max));
66 assert((
_fst->
min <= n) && (n <= _lst->max));
159 const Range* m = f + ((l-
f) >> 1);
162 }
else if (n > m->
max) {
168 assert((f->
min <= n) && (n <= f->
max));
180 }
else if (n >= lst->
min) {
186 assert((fnd->
min <= n) && (n <= fnd->max));
195 xr(a.view()), sr(a.fst()),
n(xr.
min()) {
214 assert(n <= sr->
max);
216 }
else if (
n <=
max) {
223 assert((
xr.min() <=
n) && (
n <=
xr.max()));
224 assert((
sr->
min <=
n) && (n <= sr->
max));
264 while ((
l <= h) && (
l >
r->max)) {
265 r++;
l=
r->min;
s=
r->s;
276 assert((
l >=
r->min) && (l <= r->
max));
305 return sizeof(*this);
313 template<
class View,
class Table>
314 template<
class TableProp>
317 :
Compact<View>(home,p), table(home,p.table) {
318 assert(!
table.empty());
321 template<
class View,
class Table>
325 if (
table.words() <= 4U) {
326 switch (
table.width()) {
372 template<
class View,
class Table>
380 for (
int i = x.
size(); i--; ) {
381 table.clear_mask(mask);
383 table.add_to_mask(vs.supports(),mask);
384 table.template intersect_with_mask<false>(mask);
389 for (
int i = x.
size(); i--; ) {
391 (
void)
new (home)
CTAdvisor(home,*
this,c,ts,x[i],i);
402 template<
class View,
class Table>
406 return sizeof(*this);
409 template<
class View,
class Table>
415 template<
class View,
class Table>
423 template<
class View,
class Table>
443 if (touched.
single(a) || x.assigned())
457 int* nq = r.
alloc<
int>(x.size());
458 unsigned int n_nq = 0U;
460 int last_support = 0;
462 if (!
table.intersects(vs.supports()))
463 nq[n_nq++] = vs.val();
465 last_support = vs.val();
472 }
else if (n_nq == x.size() - 1U) {
479 ModEvent me = x.minus_v(home,rnq,
false);
493 assert(!
table.empty());
498 template<
class View,
class Table>
503 for (
int i=x.
size(); i--; ) {
509 if (ct->
table.empty())
515 template<
class View,
class Table>
538 table.template intersect_with_mask<true>(
supports(a,x.val()));
543 if (!x.any(d) && (x.min(d) == x.max(d))) {
546 }
else if (!x.any(d) && (x.width(d) <= x.size())) {
548 for (
LostSupports ls(*
this,a,x.min(d),x.max(d)); ls(); ++ls) {
549 table.nand_with_mask(ls.supports());
564 table.clear_mask(mask);
566 table.add_to_mask(vs.supports(),mask);
567 table.template intersect_with_mask<false>(mask);
586 assert(ts.
words() > 0U);
588 for (
int i=x.
size(); i--; ) {
593 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.