Generated on for Gecode by doxygen 1.17.0
extensional.hh
Go to the documentation of this file.
1/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2/*
3 * Main authors:
4 * Linnea Ingmar <linnea.ingmar@hotmail.com>
5 * Mikael Zayenz Lagerkvist <lagerkvist@gecode.dev>
6 * Christian Schulte <schulte@gecode.dev>
7 *
8 * Copyright:
9 * Linnea Ingmar, 2017
10 * Mikael Zayenz Lagerkvist, 2007
11 * Christian Schulte, 2004
12 *
13 * This file is part of Gecode, the generic constraint
14 * development environment:
15 * http://www.gecode.dev
16 *
17 * Permission is hereby granted, free of charge, to any person obtaining
18 * a copy of this software and associated documentation files (the
19 * "Software"), to deal in the Software without restriction, including
20 * without limitation the rights to use, copy, modify, merge, publish,
21 * distribute, sublicense, and/or sell copies of the Software, and to
22 * permit persons to whom the Software is furnished to do so, subject to
23 * the following conditions:
24 *
25 * The above copyright notice and this permission notice shall be
26 * included in all copies or substantial portions of the Software.
27 *
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35 *
36 */
37
38#ifndef GECODE_INT_EXTENSIONAL_HH
39#define GECODE_INT_EXTENSIONAL_HH
40
41#include <gecode/int.hh>
42
43#include <gecode/int/rel.hh>
44
49
50namespace Gecode { namespace Int { namespace Extensional {
51
54 protected:
59 public:
64 const TupleSet::CSupportWord* e0);
66 const TupleSet::CSupportWord* begin(void) const;
68 const TupleSet::CSupportWord* end(void) const;
70 bool empty(void) const;
71 };
72
87 template<class View, class Val, class Degree, class StateIdx>
88 class LayeredGraph : public Propagator {
89 protected:
91 class State {
92 public:
93 Degree i_deg;
94 Degree o_deg;
96 void init(void);
97 };
98
99 class Edge {
100 public:
101 StateIdx i_state;
102 StateIdx o_state;
103 };
104
105 class Support {
106 public:
108 Degree n_edges;
110 };
111
114 class Layer {
115 public:
117 StateIdx n_states;
121 };
122
124 private:
125 const Support* s1;
126 const Support* s2;
127 public:
129 LayerValues(void);
131 LayerValues(const Layer& l);
133 void init(const Layer& l);
135 bool operator ()(void) const;
137 void operator ++(void);
139 int val(void) const;
140 };
141
142 class Index : public Advisor {
143 public:
145 int i;
147 Index(Space& home, Propagator& p, Council<Index>& c, int i);
149 Index(Space& home, Index& a);
150 };
151
153 private:
154 int _fst;
155 int _lst;
156 public:
158 IndexRange(void);
160 void reset(void);
162 void add(int i);
164 void add(const IndexRange& ir);
166 void lshift(int n);
168 bool empty(void) const;
170 int fst(void) const;
172 int lst(void) const;
173 };
174
177 int n;
181 StateIdx max_states;
183 unsigned int n_states;
185 unsigned int n_edges;
193 State& i_state(int i, StateIdx is);
195 State& i_state(int i, const Edge& e);
197 bool i_dec(int i, const Edge& e);
199 State& o_state(int i, StateIdx os);
201 State& o_state(int i, const Edge& e);
203 bool o_dec(int i, const Edge& e);
205 void audit(void);
207 template<class Var>
209 const VarArgArray<Var>& x, const DFA& dfa);
212 public:
214 template<class Var>
215 LayeredGraph(Home home,
216 const VarArgArray<Var>& x, const DFA& dfa);
218 virtual Actor* copy(Space& home);
220 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
222 virtual void reschedule(Space& home);
224 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
226 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
228 virtual size_t dispose(Space& home);
230 template<class Var>
231 static ExecStatus post(Home home,
232 const VarArgArray<Var>& x, const DFA& dfa);
233 };
234
236 template<class Var>
238 const VarArgArray<Var>& x, const DFA& dfa);
239
240}}}
241
243
244namespace Gecode { namespace Int { namespace Extensional {
245
248
249 /*
250 * Forward declarations
251 */
252 template<unsigned int size> class TinyBitSet;
253
255 template<class IndexType>
256 class BitSet {
257 template<class> friend class BitSet;
258 template<unsigned int> friend class TinyBitSet;
259 protected:
261 IndexType _active_words;
263 IndexType _word_capacity;
265 IndexType* _word_index;
271 void replace_and_decrease(IndexType active_pos, BitSetData word);
272 public:
274 BitSet(Space& home, unsigned int n, bool indexed=false);
276 template<class OldIndexType>
277 BitSet(Space& home, const BitSet<OldIndexType>& bs);
279 BitSet(Space& home, const TinyBitSet<1U>& tbs);
281 BitSet(Space& home, const TinyBitSet<2U>& tbs);
283 BitSet(Space& home, const TinyBitSet<3U>& tbs);
285 BitSet(Space& home, const TinyBitSet<4U>& tbs);
287 unsigned int limit(void) const;
289 bool empty(void) const;
291 void flush(void);
293 unsigned int width(void) const;
295 void clear_mask(BitSetData* mask) const;
297 void add_to_mask(const BitSetData* support, BitSetData* mask) const;
299 void add_to_mask(const CompressedSupport& support, BitSetData* mask) const;
301 template<bool sparse>
302 void intersect_with_mask(const BitSetData* mask);
304 void intersect_with_mask(const CompressedSupport& support);
306 void intersect_with_masks(const BitSetData* a, const BitSetData* b);
309 const CompressedSupport& b);
311 bool intersects(const BitSetData* mask) const;
313 bool intersects(const CompressedSupport& support) const;
315 void nand_with_mask(const BitSetData* mask);
317 void nand_with_mask(const CompressedSupport& support);
319 unsigned long long int ones(void) const;
321 unsigned long long int ones(const BitSetData* mask) const;
323 unsigned long long int ones(const CompressedSupport& support) const;
325 unsigned long long int bits(void) const;
327 unsigned int words(void) const;
329 unsigned int size(void) const;
330 };
331
332}}}
333
335
336namespace Gecode { namespace Int { namespace Extensional {
337
339 template<unsigned int _size>
341 template<unsigned int> friend class TinyBitSet;
342 protected:
345 public:
347 TinyBitSet(Space& home, unsigned int n, bool indexed=false);
349 template<unsigned int largersize>
352 template<class IndexType>
353 TinyBitSet(Space& home, const BitSet<IndexType>& bs);
355 int limit(void) const;
357 bool empty(void) const;
359 void flush(void);
361 unsigned int width(void) const;
363 void clear_mask(BitSetData* mask);
365 void add_to_mask(const BitSetData* b, BitSetData* mask) const;
367 void add_to_mask(const CompressedSupport& s, BitSetData* mask) const;
369 template<bool sparse>
370 void intersect_with_mask(const BitSetData* mask);
374 void intersect_with_masks(const BitSetData* a, const BitSetData* b);
377 const CompressedSupport& b);
379 bool intersects(const BitSetData* b);
381 bool intersects(const CompressedSupport& s);
383 void nand_with_mask(const BitSetData* b);
385 void nand_with_mask(const CompressedSupport& s);
387 void nand_with_masks(const BitSetData* a, const BitSetData* b);
389 unsigned long long int ones(void) const;
391 unsigned long long int ones(const BitSetData* b) const;
393 unsigned long long int ones(const CompressedSupport& s) const;
395 unsigned long long int bits(void) const;
397 unsigned int words(void) const;
399 unsigned int size(void) const;
400 };
401
402}}}
403
405
406namespace Gecode { namespace Int { namespace Extensional {
407
410
412 template<bool indexed>
414
416 template<>
417 class CompactAdvisorIndex<false> {
418 protected:
420 CompactAdvisorIndex(int i);
422 int index(void) const;
423 };
424
426 template<>
428 protected:
432 CompactAdvisorIndex(int i);
434 int index(void) const;
435 };
436
438 template<class View, bool pos, bool indexed>
439 class CompactAdvisor : public ViewAdvisor<View>,
440 private CompactAdvisorIndex<indexed> {
441 protected:
445 const Range* _fst;
447 const Range* _lst;
448 public:
449 using ViewAdvisor<View>::view;
452 Council<CompactAdvisor>& c, const TupleSet& ts,
453 View x, int i);
457 void adjust(void);
459 int index(void) const;
461 const Range* fst(void) const;
463 const Range* lst(void) const;
466 };
467
469 template<class Advisor>
471 protected:
473 ptrdiff_t s;
474 public:
482
487 StatusType type(void) const;
489 bool single(Advisor& a) const;
491 void touched(Advisor& a);
493 void none(void);
495 void propagating(void);
496 };
497
499 template<class Actor>
502 template<class Actor>
505 template<class Actor>
506 class ReCompactAlgorithm;
507
509 template<class View, bool pos>
510 class Compact : public Propagator {
511 protected:
517
519
521 protected:
523 const unsigned int n_words;
533 int value;
537 void find(void);
538 public:
542 ValidSupports(const TupleSet& ts, int i, View x);
544 void operator ++(void);
546 bool operator ()(void) const;
548 const BitSetData* support(void) const;
550 int val(void) const;
551 };
552
554 protected:
556 const unsigned int n_words;
562 int value;
567 public:
570 int first_value, int last_value);
572 void operator ++(void);
574 bool operator ()(void) const;
576 const BitSetData* support(void) const;
577 };
578
579
581
582 bool all(void) const;
584 bool atmostone(void) const;
586 protected:
588 const unsigned int n_words;
596 Compact(Home home, const TupleSet& ts);
598 template<class Table>
599 void setup(Space& home, Table& table, ViewArray<View>& x);
601 template<class Table>
602 bool full(const Table& table) const;
604 const Range* range(CTAdvisor& a, int n);
606 const BitSetData* supports(CTAdvisor& a, int n);
607 public:
609 virtual PropCost cost(const Space& home, const ModEventDelta& med) const;
611 size_t dispose(Space& home);
612 };
613
626 template<class View, class Table>
627 class PosCompact : public Compact<View,true> {
628 template<class Actor> friend class PosCompactAlgorithm;
629 public:
630 typedef View ViewType;
635
636 using Compact<View,true>::setup;
637 using Compact<View,true>::supports;
638 using Compact<View,true>::all;
639 using Compact<View,true>::atmostone;
640 using Compact<View,true>::c;
641 using Compact<View,true>::ts;
642
650 Table table;
652 bool empty(void) const;
654 template<class TableProp>
655 PosCompact(Space& home, TableProp& p);
657 PosCompact(Home home, ViewArray<View>& x, const TupleSet& ts);
658 public:
660 virtual void reschedule(Space& home);
662 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
664 virtual Actor* copy(Space& home);
666 static ExecStatus post(Home home, ViewArray<View>& x, const TupleSet& ts);
668 size_t dispose(Space& home);
670 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
671 };
672
674 template<class View>
677 template<class View>
679 const TupleSet& ts);
680
696 template<class View, class Table>
697 class NegCompact : public Compact<View,false> {
698 template<class Actor> friend class NegCompactAlgorithm;
699 public:
700 typedef View ViewType;
704
705 using Compact<View,false>::setup;
706 using Compact<View,false>::full;
707 using Compact<View,false>::supports;
708 using Compact<View,false>::atmostone;
709 using Compact<View,false>::c;
710 using Compact<View,false>::ts;
711
713 Table table;
715 template<class TableProp>
716 NegCompact(Space& home, TableProp& p);
718 NegCompact(Home home, ViewArray<View>& x, const TupleSet& ts);
719 public:
721 virtual void reschedule(Space& home);
723 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
725 virtual Actor* copy(Space& home);
727 static ExecStatus post(Home home, ViewArray<View>& x, const TupleSet& ts);
729 size_t dispose(Space& home);
731 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
732 };
733
735 template<class View>
738 template<class View>
740 const TupleSet& ts);
741
742
744 template<class View, class Table, class CtrlView, ReifyMode rm>
745 class ReCompact : public Compact<View,false> {
746 template<class Actor> friend class ReCompactAlgorithm;
747 public:
748 typedef View ViewType;
749 static constexpr ReifyMode mode = rm;
753
754 using Compact<View,false>::setup;
755 using Compact<View,false>::full;
756 using Compact<View,false>::supports;
757 using Compact<View,false>::c;
758 using Compact<View,false>::ts;
759
761 Table table;
763 CtrlView b;
767 template<class TableProp>
768 ReCompact(Space& home, TableProp& p);
770 ReCompact(Home home, ViewArray<View>& x, const TupleSet& ts, CtrlView b);
771 static ExecStatus post_pos(Home home, ViewArray<View>& x,
772 const TupleSet& ts);
773 static ExecStatus post_neg(Home home, ViewArray<View>& x,
774 const TupleSet& ts);
775 public:
777 virtual void reschedule(Space& home);
779 virtual ExecStatus propagate(Space& home, const ModEventDelta& med);
781 virtual Actor* copy(Space& home);
783 static ExecStatus post(Home home, ViewArray<View>& x, const TupleSet& ts,
784 CtrlView b);
786 size_t dispose(Space& home);
788 virtual ExecStatus advise(Space& home, Advisor& a, const Delta& d);
789 };
790
792 template<class View, class CtrlView, ReifyMode rm>
794 CtrlView b);
796 template<class View, class CtrlView, ReifyMode rm>
798 const TupleSet& ts, CtrlView b);
799
800}}}
801
803
804#endif
805
806// STATISTICS: int-prop
Base-class for advisors.
Definition core.hpp:1301
Advisor(Space &home, Propagator &p, Council< A > &c)
Constructor for creation.
Definition core.hpp:3952
friend class Council
Definition core.hpp:1303
Deterministic finite automaton (DFA).
Definition int.hh:2203
Generic domain change information to be supplied to advisors.
Definition core.hpp:209
Home class for posting propagators
Definition core.hpp:863
BitSetData * _word_bits
Active word data.
unsigned long long int bits(void) const
Return an upper bound on the number of bits.
Definition bit-set.hpp:478
void add_to_mask(const BitSetData *support, BitSetData *mask) const
Add support to mask.
Definition bit-set.hpp:229
bool intersects(const BitSetData *mask) const
Check if has a non-empty intersection with the set.
Definition bit-set.hpp:394
void intersect_with_mask(const BitSetData *mask)
Intersect with mask, sparse mask if sparse is true.
Definition bit-set.hpp:265
unsigned int width(void) const
Return the highest active index.
Definition bit-set.hpp:107
IndexType _word_capacity
Number of addressable word slots.
unsigned long long int ones(void) const
Return the number of ones.
Definition bit-set.hpp:469
IndexType _active_words
Number of active words.
void intersect_with_masks(const BitSetData *a, const BitSetData *b)
Intersect with the "or" of a and b.
Definition bit-set.hpp:308
IndexType * _word_index
Original word index for each active word position.
unsigned int size(void) const
Return the number of required bit set words.
Definition bit-set.hpp:101
unsigned int limit(void) const
Get the number of active words.
Definition bit-set.hpp:83
void replace_and_decrease(IndexType active_pos, BitSetData word)
Replace active word active_pos, dropping it if word is zero.
Definition bit-set.hpp:195
void clear_mask(BitSetData *mask) const
Clear all active words in mask.
Definition bit-set.hpp:219
bool empty(void) const
Check whether the set is empty.
Definition bit-set.hpp:89
unsigned int words(void) const
Return the number of required bit set words.
Definition bit-set.hpp:95
IndexType * _active_position
Reverse map from word index to active position+1 (optional).
void flush(void)
Make the set empty.
Definition bit-set.hpp:163
void nand_with_mask(const BitSetData *mask)
Perform "nand" with mask.
Definition bit-set.hpp:350
CompactAdvisorIndex(int i)
Initialize without storing i.
Definition compact.hpp:46
int index(void) const
Return a dummy index.
Definition compact.hpp:49
int index(void) const
Return the variable index.
Definition compact.hpp:58
CompactAdvisorIndex(int i)
Initialize with index i.
Definition compact.hpp:54
Optional variable index stored by a compact-table advisor.
Advisor shared by compact-table support representations.
TupleSet::Range Range
Range type for supports.
void dispose(Space &home, Council< CompactAdvisor > &c)
Dispose advisor.
Definition compact.hpp:136
const Range * lst(void) const
Return last range of support data structure.
Definition compact.hpp:129
CompactAdvisor(Space &home, CompactAdvisor &a)
Clone advisor a.
Definition compact.hpp:111
const Range * fst(void) const
Return first range of support data structure.
Definition compact.hpp:123
int index(void) const
Return the variable index.
Definition compact.hpp:117
CompactAdvisor(Space &home, Propagator &p, Council< CompactAdvisor > &c, const TupleSet &ts, View x, int i)
Initialize from parameters.
Definition compact.hpp:101
void adjust(void)
Adjust supports to the current view bounds.
Definition compact.hpp:64
Touched-advisor status shared by positive compact-table propagators.
void propagating(void)
Record that propagation is in progress.
Definition compact.hpp:187
CompactStatus(StatusType t)
Initialize with status t.
Definition compact.hpp:147
void touched(Advisor &a)
Record that advisor a was touched.
Definition compact.hpp:170
void none(void)
Record that no advisor has been touched.
Definition compact.hpp:181
CompactStatus(const CompactStatus &status)
Copy constructor.
Definition compact.hpp:152
bool single(Advisor &a) const
Test whether only advisor a was touched.
Definition compact.hpp:163
StatusType type(void) const
Return status type.
Definition compact.hpp:157
const Range * support_range
Range information.
const BitSetData * support(void) const
Return support representation.
Definition compact.hpp:583
LostSupports(const Compact< View, pos > &p, CTAdvisor &a, int first_value, int last_value)
Initialize iterator for values between first_value and last_value.
Definition compact.hpp:553
bool operator()(void) const
Whether iterator is done.
Definition compact.hpp:578
void operator++(void)
Move iterator to next value.
Definition compact.hpp:567
const unsigned int n_words
Number of words.
const BitSetData * support_words
The lost value's support.
const Range * last_support_range
The last range.
ViewRanges< View > view_ranges
Range iterator.
bool operator()(void) const
Whether there are still supports left.
Definition compact.hpp:531
const BitSetData * support(void) const
Return support representation.
Definition compact.hpp:536
void operator++(void)
Move to next supports.
Definition compact.hpp:501
ValidSupports(const Compact< View, pos > &p, CTAdvisor &a)
Initialize from initialized propagator.
Definition compact.hpp:469
const BitSetData * support_words
The value's support.
void find(void)
Find a new value (only for negative case).
Definition compact.hpp:438
const unsigned int n_words
Number of words.
int val(void) const
Return supported value.
Definition compact.hpp:542
const Range * support_range
Support iterator.
Compact(Space &home, Compact &p)
Constructor for cloning p.
Definition compact.hpp:602
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:637
Compact(Home home, const TupleSet &ts)
Constructor for posting.
Definition compact.hpp:609
const BitSetData * supports(CTAdvisor &a, int n)
Return supports for value n.
Definition compact.hpp:405
CompactAdvisor< View, pos, false > CTAdvisor
Advisor for updating current table.
bool full(const Table &table) const
Check whether the table covers the whole Cartedion product.
Definition compact.hpp:625
void setup(Space &home, Table &table, ViewArray< View > &x)
Setup the actual table.
Definition compact.hpp:617
virtual PropCost cost(const Space &home, const ModEventDelta &med) const
Cost function.
Definition compact.hpp:631
bool all(void) const
Whether all variables are assigned.
Definition compact.hpp:591
const Range * range(CTAdvisor &a, int n)
Find range for n.
Definition compact.hpp:373
bool atmostone(void) const
Whether at most one variable is unassigned.
Definition compact.hpp:596
TupleSet::Range Range
Range type for supports.
Compressed tuple-word support list.
const TupleSet::CSupportWord * end(void) const
Return one past last support word.
Definition bit-set.hpp:55
const TupleSet::CSupportWord * begin(void) const
Return first support word.
Definition bit-set.hpp:50
bool empty(void) const
Whether support list is empty.
Definition bit-set.hpp:60
const TupleSet::CSupportWord * e
One past last support word.
const TupleSet::CSupportWord * b
First support word.
CompressedSupport(void)
Initialize as empty support list.
Definition bit-set.hpp:41
Edge defined by in-state and out-state
Range approximation of which positions have changed.
void add(const IndexRange &ir)
Add index range ir 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.
Index(Space &home, Propagator &p, Council< Index > &c, int i)
Create index advisor.
int i
The position of the view in the view array.
bool operator()(void) const
Test whether more values supported.
void operator++(void)
Move to next supported value.
int val(void) const
Return supported value.
Layer for a view in the layered graph
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).
Edge * edges
Supporting edges in layered graph.
Degree n_edges
Number of supporting edges.
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.
Gecode::Support::IntTypeTraits< Val >::utype ValSize
Type for support size.
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).
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.
Shared implementation of negative compact-table propagation.
Definition compact.hpp:782
Compact< View, false >::ValidSupports ValidSupports
Compact< View, false >::CTAdvisor CTAdvisor
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition compact.hpp:1090
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition compact.hpp:1132
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition compact.hpp:1126
NegCompact(Space &home, TableProp &p)
Constructor for cloning p.
Definition compact.hpp:1085
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:1113
virtual void reschedule(Space &home)
Schedule function.
Definition compact.hpp:1120
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts)
Post propagator for views x and table t.
Definition compact.hpp:1105
Compact< View, false >::Range Range
Shared implementation of positive compact-table propagation.
Definition compact.hpp:646
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:1006
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition compact.hpp:981
Compact< View, true >::ValidSupports ValidSupports
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition compact.hpp:1024
Compact< View, true >::Range Range
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition compact.hpp:1018
Compact< View, true >::CTAdvisor CTAdvisor
Status status
Propagator status.
CompactStatus< CTAdvisor > Status
Status management.
Compact< View, true >::LostSupports LostSupports
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts)
Post propagator for views x and table t.
Definition compact.hpp:997
virtual void reschedule(Space &home)
Schedule function.
Definition compact.hpp:1012
bool empty(void) const
Check whether the table is empty.
PosCompact(Space &home, TableProp &p)
Constructor for cloning p.
Definition compact.hpp:973
Status::StatusType StatusType
Status type.
Shared implementation of reified compact-table propagation.
Definition compact.hpp:895
Compact< View, false >::Range Range
virtual Actor * copy(Space &home)
Copy propagator during cloning.
Definition compact.hpp:1201
ViewArray< View > y
The views (for rewriting).
Compact< View, false >::CTAdvisor CTAdvisor
static constexpr ReifyMode mode
virtual ExecStatus advise(Space &home, Advisor &a, const Delta &d)
Give advice to propagator.
Definition compact.hpp:1271
virtual ExecStatus propagate(Space &home, const ModEventDelta &med)
Perform propagation.
Definition compact.hpp:1264
ReCompact(Space &home, TableProp &p)
Constructor for cloning p.
Definition compact.hpp:1193
static ExecStatus post(Home home, ViewArray< View > &x, const TupleSet &ts, CtrlView b)
Post propagator for views x and table t.
Definition compact.hpp:1217
static ExecStatus post_neg(Home home, ViewArray< View > &x, const TupleSet &ts)
Definition compact.hpp:1243
static ExecStatus post_pos(Home home, ViewArray< View > &x, const TupleSet &ts)
Definition compact.hpp:1236
CtrlView b
Boolean control view.
Compact< View, false >::ValidSupports ValidSupports
virtual void reschedule(Space &home)
Schedule function.
Definition compact.hpp:1257
size_t dispose(Space &home)
Delete propagator and return its size.
Definition compact.hpp:1249
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.
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.
Definition view.hpp:54
Propagation cost.
Definition core.hpp:493
friend class Space
Definition core.hpp:1075
friend class Advisor
Definition core.hpp:1077
friend class Council
Definition core.hpp:1078
ModEventDelta med
A set of modification events (used during propagation).
Definition core.hpp:1084
Propagator(Home home)
Constructor for posting.
Definition core.hpp:3607
Computation spaces.
Definition core.hpp:1775
Date item for bitsets.
Traits to for information about integer types.
Definition int-type.hpp:52
Compressed support data for one tuple-word block.
Definition int.hh:2393
Range information.
Definition int.hh:2399
Class representing a set of tuples.
Definition int.hh:2382
int * Tuple
Type of a tuple.
Definition int.hh:2389
Argument array for variables.
Definition array.hpp:781
ViewAdvisor(Space &home, Propagator &p, Council< A > &c, View x0)
Constructor for creation.
Definition advisor.hpp:66
View x
The single view.
Definition advisor.hpp:46
View view(void) const
Access view.
Definition advisor.hpp:79
View arrays.
Definition array.hpp:255
int ModEventDelta
Modification event deltas.
Definition core.hpp:94
ReifyMode
Mode for reification.
Definition int.hh:882
Extensional propagators
Definition int.hh:2335
ExecStatus postnegcompact(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for compact table propagator.
Definition compact.hpp:1143
TupleSet::Tuple Tuple
Tuple type.
ExecStatus postposcompact(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for positive compact table propagator.
Definition compact.hpp:1034
Gecode::Support::BitSetData BitSetData
Import type.
ExecStatus postrecompact(Home home, ViewArray< View > &x, const TupleSet &ts, CtrlView b)
Post function for compact table propagator.
Definition compact.hpp:1281
ExecStatus postposcompact_compressed(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for positive compact table with compressed supports.
Definition compact.hpp:1606
ExecStatus post_lgp(Home home, const VarArgArray< Var > &x, const DFA &dfa)
Select small types for the layered graph propagator.
ExecStatus postnegcompact_compressed(Home home, ViewArray< View > &x, const TupleSet &ts)
Post function for negative compact table with compressed supports.
Definition compact.hpp:1696
ExecStatus postrecompact_compressed(Home home, ViewArray< View > &x, const TupleSet &ts, CtrlView b)
Post function for reified compact table with compressed supports.
Definition compact.hpp:1816
Finite domain integers.
Definition lastval.hh:52
Gecode toplevel namespace
ExecStatus
Definition core.hpp:479