38namespace Gecode {
namespace Int {
namespace Extensional {
40 template<
class IndexType>
43 return static_cast<unsigned int>(_limit);
46 template<
class IndexType>
52 template<
class IndexType>
55 return static_cast<unsigned int>(_limit);
58 template<
class IndexType>
64 template<
class IndexType>
68 IndexType width = _index[0];
69 for (IndexType i=1; i<_limit; i++)
70 width = std::max(width,_index[i]);
71 assert(
static_cast<unsigned int>(width+1U) >= words());
72 return static_cast<unsigned int>(width+1U);
75 template<
class IndexType>
78 : _limit(static_cast<IndexType>(
n)),
79 _index(home.alloc<IndexType>(
n)),
82 for (IndexType i=0; i<
_limit; i++) {
88 template<
class IndexType>
89 template<
class OldIndexType>
93 : _limit(static_cast<IndexType>(bs._limit)),
94 _index(home.alloc<IndexType>(_limit)),
97 for (IndexType i=0; i<
_limit; i++) {
103 template<
class IndexType>
110 template<
class IndexType>
115 template<
class IndexType>
120 template<
class IndexType>
125 template<
class IndexType>
131 template<
class IndexType>
139 assert(_bits[i].none());
141 _bits[i] = _bits[_limit];
142 _index[i] = _index[_limit];
147 template<
class IndexType>
151 for (IndexType i=0; i<_limit; i++) {
153 assert(mask[i].none());
157 template<
class IndexType>
161 for (IndexType i=0; i<_limit; i++)
165 template<
class IndexType>
166 template<
bool sparse>
171 for (IndexType i = _limit; i--; ) {
172 assert(!_bits[i].none());
175 replace_and_decrease(i,w_a);
176 assert(i == _limit || !_bits[i].none());
179 for (IndexType i = _limit; i--; ) {
180 assert(!_bits[i].none());
183 replace_and_decrease(i,w_a);
184 assert(i == _limit || !_bits[i].none());
189 template<
class IndexType>
194 for (IndexType i = _limit; i--; ) {
195 assert(!_bits[i].none());
197 IndexType
offset = _index[i];
200 replace_and_decrease(i,w_a);
201 assert(i == _limit || !_bits[i].none());
205 template<
class IndexType>
209 for (IndexType i = _limit; i--; ) {
210 assert(!_bits[i].none());
212 replace_and_decrease(i,w);
213 assert(i == _limit || !_bits[i].none());
217 template<
class IndexType>
220 for (IndexType i=0; i<_limit; i++)
226 template<
class IndexType>
229 unsigned long long int o = 0U;
230 for (IndexType i=0; i<_limit; i++)
231 o +=
static_cast<unsigned long long int>
236 template<
class IndexType>
239 unsigned long long int o = 0U;
240 for (IndexType i=0; i<_limit; i++)
241 o +=
static_cast<unsigned long long int>(_bits[i].ones());
245 template<
class IndexType>
248 return (
static_cast<unsigned long long int>(_limit) *
struct Gecode::@603::NNF::@65::@66 b
For binary nodes (and, or, eqv)
int n
Number of negative literals for node type.
struct Gecode::@603::NNF::@65::@67 a
For atomic nodes.
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.
static const unsigned int bpb
Bits per base.
void init(bool setbits=false)
Initialize with all bits set if setbits.
void a(BitSetData a)
Perform "and" with a.
bool none(void) const
Whether no bits are set.
void o(BitSetData a)
Perform "or" with a.
int offset(void) const
Integer-precision integer scale view.
Gecode toplevel namespace
#define GECODE_NEVER
Assert that this command is never executed.