50 return static_cast<unsigned int>(
max -
min + 1);
55 assert((
min <= n) && (n <=
max));
56 return s + n_words *
static_cast<unsigned int>(n -
min);
66 :
arity(a), n_words(0U),
67 n_tuples(0), n_free(n_initial_free),
69 td(
heap.alloc<int>(n_initial_free * a)),
71 range(nullptr), support(nullptr) {
99 unsigned int l=0U, h=
n-1U;
102 unsigned int m = l + ((h-
l) >> 1);
105 else if (k >
r[m].
max)
128 return static_cast<unsigned int>((t -
td) / static_cast<unsigned int>(
arity));
147 _add(t);
return *
this;
154 TupleSet::operator bool(
void)
const {
155 return object() !=
nullptr;
182 return !(*
this ==
t);
236 template<
class Char,
class Traits>
237 std::basic_ostream<Char,Traits>&
238 operator <<(std::basic_ostream<Char,Traits>& os,
const TupleSet& ts) {
239 std::basic_ostringstream<Char,Traits> s;
240 s.copyfmt(os); s.width(0);
241 s <<
"Number of tuples: " << ts.
tuples()
242 <<
" (number of words: " << ts.words() <<
" with " 244 for (
int a=0;
a < ts.arity();
a++) {
245 unsigned int size = 0U;
248 s <<
"\t[" <<
a <<
"] size: " << size
250 <<
static_cast<unsigned int>(ts.lst(
a)->max - ts.fst(
a)->min + 1)
252 << (ts.lst(
a) - ts.fst(
a) + 1U)
255 return os << s.str();
bool operator()(void) const
Test whether iterator is still at a range.
bool operator!=(const TupleSet &t) const
Test whether tuple set is different from t.
Tuple operator[](int i) const
Get tuple i.
void finalize(void)
Finalize tuple set.
int n_free
Number of free tuple entries of arity.
int max(void) const
Return largest value of range.
unsigned int start(int n) const
Find start range for value n.
void resize(void)
Resize tuple data.
unsigned int width(void) const
Return the width.
void set(unsigned int i)
Set bit i.
int arity(void) const
Arity of tuple set.
int min(void) const
Return smallest value of range.
static void set(BitSetData *d, unsigned int n)
Set bit n in bitset data d.
unsigned int width(void) const
Return width of range (distance between minimum and maximum)
int * Tuple
Type of a tuple.
int max(void) const
Return maximal value in all tuples.
bool finalized(void) const
Is tuple set finalized.
void _add(const IntArgs &t)
Add tuple t to tuple set.
unsigned int tuple2idx(Tuple t) const
Map tuple address to index.
ValueData * vd
Value data.
int tuples(void) const
Number of tuples.
Tuple add(void)
Return newly added tuple.
Gecode::FloatVal c(-8, 8)
std::size_t hash(void) const
Return hash key.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
unsigned int n_words
Number of words for support.
SharedHandle::Object * object(void) const
Access to the shared object.
Data(int a)
Initialize as empty tuple set with arity a.
const Range * lst(int i) const
Return last range for position i.
unsigned int size(I &i)
Size of all ranges of range iterator i.
const BitSetData * supports(unsigned int n_words, int n) const
Return the supports for value n.
void range(Home home, const IntVarArgs &x, SetVar y, SetVar z)
Post constraint .
BitSetData * s
Begin of supports.
Data & data(void) const
Get data (must be initialized and finalized)
Passing integer arguments.
const Range * fst(int i) const
Return first range for position i.
Data & raw(void) const
Get raw data (must be initialized)
bool operator==(const TupleSet &t) const
Test whether tuple set is equal to t.
Post propagator for SetVar SetOpType SetVar SetRelType r
Class represeting a set of tuples.
TupleSet(void)
Construct an unitialized tuple set.
Tuple get(int i) const
Return tuple with number i.
int min(void) const
Return minimal value in all tuples.
struct Gecode::@585::NNF::@62::@64 a
For atomic nodes.
Heap heap
The single global heap.
Ranges(const TupleSet &ts, int i)
Initialize for column i.
int n_tuples
Number of Tuples.
const Range * fst(int i) const
Return first range for position i.
bool get(unsigned int i) const
Access value at bit i.
const Range * lst(int i) const
Return last range for position i.
void operator++(void)
Move iterator to next range (if possible)
TupleSet & add(const IntArgs &t)
Add tuple t to tuple set.
bool finalized(void) const
Is datastructure finalized.
Gecode toplevel namespace
Data about values in the table.
unsigned int n
Number of ranges.
friend FloatVal max(const FloatVal &x, const FloatVal &y)
friend FloatVal min(const FloatVal &x, const FloatVal &y)
static const unsigned int bpb
Bits per base.
#define GECODE_NEVER
Assert that this command is never executed.
void finalize(void)
Finalize datastructure (disallows additions of more Tuples)
bool equal(const TupleSet &t) const
Test whether tuple set is equal to t.
unsigned int words(void) const
Return number of required bit set words.