38#ifndef __GECODE_INT_EXTENSIONAL_HH__
39#define __GECODE_INT_EXTENSIONAL_HH__
50namespace Gecode {
namespace Int {
namespace Extensional {
66 template<
class View,
class Val,
class Degree,
class StateIdx>
147 bool empty(
void)
const;
223namespace Gecode {
namespace Int {
namespace Extensional {
234 template<
class IndexType>
251 template<
class OldIndexType>
262 unsigned int limit(
void)
const;
264 bool empty(
void)
const;
268 unsigned int width(
void)
const;
274 template<
bool sparse>
283 unsigned long long int ones(
void)
const;
287 unsigned long long int bits(
void)
const;
289 unsigned int words(
void)
const;
291 unsigned int size(
void)
const;
298namespace Gecode {
namespace Int {
namespace Extensional {
301 template<
unsigned int _size>
311 template<
unsigned int largersize>
314 template<
class IndexType>
319 bool empty(
void)
const;
323 unsigned int width(
void)
const;
329 template<
bool sparse>
340 unsigned long long int ones(
void)
const;
344 unsigned long long int bits(
void)
const;
346 unsigned int words(
void)
const;
348 unsigned int size(
void)
const;
355namespace Gecode {
namespace Int {
namespace Extensional {
361 template<
class View,
bool pos>
459 bool all(
void)
const;
475 template<
class Table>
478 template<
class Table>
479 bool full(
const Table& table)
const;
503 template<
class View,
class Table>
555 template<
class TableProp>
593 template<
class View,
class Table>
610 template<
class TableProp>
635 template<
class View,
class Table,
class CtrlView, ReifyMode rm>
655 template<
class TableProp>
676 template<
class View,
class CtrlView, ReifyMode rm>
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int p
Number of positive literals for node type.
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
void init(void)
Initialize links (self-linked)
Base-class for both propagators and branchers.
Deterministic finite automaton (DFA)
Generic domain change information to be supplied to advisors.
Home class for posting propagators
unsigned long long int bits(void) const
Return an upper bound on the number of bits.
void intersect_with_mask(const BitSetData *mask)
Intersect with mask, sparse mask if sparse is true.
unsigned int width(void) const
Return the highest active index.
void replace_and_decrease(IndexType i, BitSetData w)
Replace the i th word with w, decrease limit if w is zero.
unsigned long long int ones(void) const
Return the number of ones.
bool intersects(const BitSetData *b) const
Check if has a non-empty intersection with the set.
void intersect_with_masks(const BitSetData *a, const BitSetData *b)
Intersect with the "or" of and b.
void add_to_mask(const BitSetData *b, BitSetData *mask) const
Add to mask.
IndexType * _index
Indices.
unsigned int size(void) const
Return the number of required bit set words.
unsigned int limit(void) const
Get the limit.
void clear_mask(BitSetData *mask) const
Clear the first limit words in mask.
bool empty(void) const
Check whether the set is empty.
unsigned int words(void) const
Return the number of required bit set words.
void flush(void)
Make the set empty.
void nand_with_mask(const BitSetData *b)
Perform "nand" with b.
Advisor for updating current table.
const Range * lst(void) const
Return lasst range of support data structure.
const Range * _lst
Last range of support data structure.
const Range * fst(void) const
Return first range of support data structure.
void adjust(void)
Adjust supports.
void dispose(Space &home, Council< CTAdvisor > &c)
Dispose advisor.
CTAdvisor(Space &home, Propagator &p, Council< CTAdvisor > &c, const TupleSet &ts, View x0, int i)
Initialise from parameters.
const Range * _fst
First range of support data structure.
Iterator over lost supports.
const BitSetData * s
The lost value's support.
bool operator()(void) const
Whether iterator is done.
const BitSetData * supports(void) const
Provide access to corresponding supports.
void operator++(void)
Move iterator to next value.
LostSupports(const Compact< View, pos > &p, CTAdvisor &a, int l, int h)
Initialize iterator for values between l and h.
const Range * r
Range information.
const unsigned int n_words
Number of words.
const Range * lst
Last range.
Iterator over valid supports.
bool operator()(void) const
Whether there are still supports left.
const BitSetData * supports(void) const
Return supports.
const Range * lst
The last range.
void operator++(void)
Move to next supports.
ViewRanges< View > xr
Range iterator.
ValidSupports(const Compact< View, pos > &p, CTAdvisor &a)
Initialize from initialized propagator.
const Range * sr
Support iterator.
void find(void)
Find a new value (only for negative case)
const BitSetData * s
The value's support.
const unsigned int n_words
Number of words.
int val(void) const
Return supported value.
Base class for compact table propagator.
Compact(Space &home, Compact &p)
Constructor for cloning p.
size_t dispose(Space &home)
Delete propagator and return its size.
TupleSet ts
The tuple set.
TupleSet::Range Range
Range type for supports.
const BitSetData * supports(CTAdvisor &a, int n)
Return supports for value n.
bool full(const Table &table) const
Check whether the table covers the whole Cartedion product.
void setup(Space &home, Table &table, ViewArray< View > &x)
Setup the actual table.
const unsigned int n_words
Number of words in supports.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
bool all(void) const
Whether all variables are assigned.
const Range * range(CTAdvisor &a, int n)
Find range for n.
bool atmostone(void) const
Whether at most one variable is unassigned.
Council< CTAdvisor > c
The advisor council.
Edge defined by in-state and out-state
StateIdx o_state
Number of out-state.
StateIdx i_state
Number of in-state.
Range approximation of which positions have changed.
void reset(void)
Reset range to be empty.
void add(const IndexRange &ir)
Add index range ir to range.
void add(int i)
Add index i to range.
int fst(void) const
Return first position.
void lshift(int n)
Shift index range by n elements to the left.
int lst(void) const
Return last position.
bool empty(void) const
Test whether range is empty.
IndexRange(void)
Initialize range as empty.
Advisors for views (by position in array)
Index(Space &home, Propagator &p, Council< Index > &c, int i)
Create index advisor.
int i
The position of the view in the view array.
Iterator for telling variable domains by scanning support.
bool operator()(void) const
Test whether more values supported.
void operator++(void)
Move to next supported value.
LayerValues(void)
Default constructor.
int val(void) const
Return supported value.
Layer for a view in the layered graph
Support * support
Supported values.
State * states
States used by outgoing edges.
ValSize size
Number of supported values.
StateIdx n_states
Number of states used by outgoing edges.
States are described by number of incoming and outgoing edges.
Degree o_deg
The out-degree (number of outgoing edges) Initialize with zeroes.
Degree i_deg
The in-degree (number of incoming edges)
Support information for a value
Edge * edges
Supporting edges in layered graph.
Degree n_edges
Number of supporting edges.
Domain consistent layered graph (regular) propagator.
ExecStatus initialize(Space &home, const VarArgArray< Var > &x, const DFA &dfa)
Initialize layered graph.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
unsigned int n_edges
Total number of edges.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function (defined as high linear)
StateIdx max_states
Maximal number of states per layer.
unsigned int n_states
Total number of states.
State & o_state(int i, const Edge &e)
Return state for layer i and out state of edge e.
bool i_dec(int i, const Edge &e)
Decrement out degree for in state of edge e for layer i.
int n
Number of layers (and views)
Gecode::Support::IntTypeTraits< Val >::utype ValSize
Type for support size.
IndexRange o_ch
Index range with out-degree modifications.
IndexRange a_ch
Index range for any change (for compression)
virtual size_t dispose(Space &home)
Delete propagator and return its size.
LayeredGraph(Space &home, LayeredGraph< View, Val, Degree, StateIdx > &p)
Constructor for cloning p.
void audit(void)
Perform consistency check on data structures.
IndexRange i_ch
Index range with in-degree modifications.
Council< Index > c
The advisor council.
static ExecStatus post(Home home, const VarArgArray< Var > &x, const DFA &dfa)
Post propagator on views x and DFA dfa.
State & i_state(int i, const Edge &e)
Return in state for layer i and in state of edge e.
State & o_state(int i, StateIdx os)
Return out state for layer i and state index os.
bool o_dec(int i, const Edge &e)
Decrement in degree for out state of edge e for layer i.
State & i_state(int i, StateIdx is)
Return in state for layer i and state index is.
virtual void reschedule(Space &home)
Schedule function.
Layer * layers
The layers of the graph.
Domain consistent negative extensional propagator.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Compact< View, false >::ValidSupports ValidSupports
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Table table
Current table.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
NegCompact(Space &home, TableProp &p)
Constructor for cloning p.
Compact< View, false >::Range Range
size_t dispose(Space &home)
Delete propagator and return its size.
virtual void reschedule(Space &home)
Schedule function.
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts)
Post propagator for views x and table t.
Compact< View, false >::CTAdvisor CTAdvisor
void none(void)
Set status to NONE.
ptrdiff_t s
A tagged pointer for storing the status.
bool single(CTAdvisor &a) const
Check whether status is single and equal to a.
Status(StatusType t)
Initialize with type t (either NONE or SEVERAL)
void touched(CTAdvisor &a)
Set status to SINGLE or MULTIPLE depending on a.
StatusType type(void) const
Return status type.
void propagating(void)
Set status to PROPAGATING.
Domain consistent positive extensional propagator.
size_t dispose(Space &home)
Delete propagator and return its size.
virtual Actor * copy(Space &home)
Copy propagator during cloning.
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Compact< View, true >::LostSupports LostSupports
Compact< View, true >::ValidSupports ValidSupports
Compact< View, true >::Range Range
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Table table
Current table.
Status status
Propagator status.
StatusType
Type of status.
@ NONE
No view has been touched.
@ PROPAGATING
The propagator is currently running.
@ SINGLE
A single view has been touched.
@ MULTIPLE
Multiple view have been touched.
Compact< View, true >::CTAdvisor CTAdvisor
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts)
Post propagator for views x and table t.
virtual void reschedule(Space &home)
Schedule function.
bool empty(void) const
Check whether the table is empty.
PosCompact(Space &home, TableProp &p)
Constructor for cloning p.
Domain consistent reified extensional propagator.
Compact< View, false >::ValidSupports ValidSupports
Compact< View, false >::CTAdvisor CTAdvisor
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Table table
Current table.
Compact< View, false >::Range Range
ViewArray< View > y
The views (for rewriting)
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
ReCompact(Space &home, TableProp &p)
Constructor for cloning p.
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts, CtrlView b)
Post propagator for views x and table t.
CtrlView b
Boolean control view.
virtual void reschedule(Space &home)
Schedule function.
size_t dispose(Space &home)
Delete propagator and return its size.
TinyBitSet(Space &home, const TinyBitSet< largersize > &tbs)
Initialize during cloning.
void intersect_with_mask(const BitSetData *mask)
Intersect with mask, sparse mask if sparse is true.
unsigned int words(void) const
Return the number of required bit set words.
unsigned int width(void) const
Return the highest active index.
bool intersects(const BitSetData *b)
Check if has a non-empty intersection with the set.
void add_to_mask(const BitSetData *b, BitSetData *mask) const
Add to mask.
int limit(void) const
Get the limit.
unsigned long long int bits(void) const
Return an upper bound on the number of bits.
void nand_with_masks(const BitSetData *a, const BitSetData *b)
Perform "nand" with and the "or" of a and b.
unsigned long long int ones(void) const
Return the number of ones.
unsigned int size(void) const
Return the total number of words.
bool empty(void) const
Check whether the set is empty.
BitSetData _bits[_size]
Words.
void intersect_with_masks(const BitSetData *a, const BitSetData *b)
Intersect with the "or" of and b.
void flush(void)
Make the set empty.
void nand_with_mask(const BitSetData *b)
Perform "nand" with b.
void clear_mask(BitSetData *mask)
Clear the first limit words in mask.
Range iterator for integer views.
Base-class for propagators.
ModEventDelta med
A set of modification events (used during propagation)
Traits to for information about integer types.
Class represeting a set of tuples.
int * Tuple
Type of a tuple.
Argument array for variables.
Advisor storing a single view
View view(void) const
Access view.
int ModEventDelta
Modification event deltas.
TupleSet::Tuple Tuple
Tuple type.
ExecStatus postnegcompact(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for compact table propagator.
ExecStatus postposcompact(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for positive compact table propagator.
Gecode::Support::BitSetData BitSetData
Import type.
ExecStatus postrecompact(Home home, ViewArray< View > &x, const TupleSet &ts, CtrlView b)
Post function for compact table propagator.
ExecStatus post_lgp(Home home, const VarArgArray< Var > &x, const DFA &dfa)
Select small types for the layered graph propagator.
Gecode toplevel namespace
Post propagator for SetVar x