30#ifndef Glucose_SolverTypes_h
31#define Glucose_SolverTypes_h
95#define l_True (Gluco2::lbool((uint8_t)0))
96#define l_False (Gluco2::lbool((uint8_t)1))
97#define l_Undef (Gluco2::lbool((uint8_t)2))
106 explicit lbool(
bool x) : value(!x) { }
108 bool operator == (
lbool b)
const {
return (((b.value&2) & (value&2)) | (!(b.value&2)&(value == b.value))) != 0; }
113 uint8_t sel = (this->value << 1) | (b.value << 3);
114 uint8_t v = (0xF7F755F4 >> sel) & 3;
118 uint8_t sel = (this->value << 1) | (b.value << 3);
119 uint8_t v = (0xFCFCF400 >> sel) & 3;
156 Clause(
const V& ps,
bool use_extra,
bool learnt) {
159 header.has_extra = use_extra;
161 header.size = ps.size();
164 for (
int i = 0; i < ps.size(); i++)
167 if (header.has_extra){
169 data[header.size].act = 0;
178 for (
int i = 0; i <
size(); i++)
183 int size ()
const {
return header.size; }
184 void shrink (
int i) {
assert(i <=
size());
if (header.has_extra) data[header.size-i] = data[header.size]; header.size -= i; }
186 bool learnt ()
const {
return header.learnt; }
190 const Lit&
last ()
const {
return data[header.size-1].lit; }
192 bool reloced ()
const {
return header.reloced; }
200 operator const Lit* (void)
const {
return (
Lit*)data; }
209 unsigned int lbd ()
const {
return header.lbd; }
225 static int clauseWord32Size(
int size,
bool has_extra){
245 new (
lea(cid))
Clause(ps, use_extra, learnt);
274 to[cr].mark(c.
mark());
275 if (to[cr].learnt()) {
277 to[cr].setLBD(c.
lbd());
281 else if (to[cr].has_extra()) to[cr].calcAbstraction();
289template<
class Idx,
class Vec,
class Deleted>
300 void init (
const Idx& idx){ occs.growTo(
toInt(idx)+1); dirty.growTo(
toInt(idx)+1, 0); }
301 void prelocate (
const int num){ occs.prelocate(num); dirty.prelocate(num); }
309 if (dirty[
toInt(idx)] == 0){
310 dirty[
toInt(idx)] = 1;
321 occs .shrink (occs .size());
322 dirty .shrink_(dirty .size());
323 dirties.shrink_(dirties.size());
329template<
class Idx,
class Vec,
class Deleted>
332 for (
int i = 0; i < dirties.size(); i++)
334 if (dirty[
toInt(dirties[i])])
336 dirties.shrink_( dirties.size() );
340template<
class Idx,
class Vec,
class Deleted>
345 for (i = j = 0; i <
vec.
size(); i++)
346 if (!deleted(
vec[i]))
349 dirty[
toInt(idx)] = 0;
369 int size ()
const {
return map.elems(); }
376 bool has (
CRef cr, T& t) {
return map.peek(cr, t); }
391 printf(
" --- size = %d, bucket_count = %d\n",
size(), map.bucket_count()); }
414 if (other.header.
size < header.size || (data[header.size].abs & ~other.data[other.header.
size].
abs) != 0)
418 const Lit* c = (
const Lit*)(*
this);
419 const Lit* d = (
const Lit*)other;
421 for (
unsigned i = 0; i < header.size; i++) {
423 for (
unsigned j = 0; j < other.header.
size; j++)
426 else if (ret ==
lit_Undef && c[i] == ~d[j]){
ABC_NAMESPACE_HEADER_START typedef unsigned char uint8_t
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
void growTo(CRef cr, const T &t)
const T & operator[](CRef cr) const
const vec< typename HashTable::Pair > & bucket(int i) const
void insert(CRef cr, const T &t)
void moveTo(ClauseAllocator &to)
Clause & operator[](Ref r)
const Clause * lea(Ref r) const
CRef alloc(const Lits &ps, bool learnt=false)
ClauseAllocator(uint32_t start_cap)
const Clause & operator[](Ref r) const
void reloc(CRef &cr, ClauseAllocator &to)
unsigned int sizeWithoutSelectors() const
void setSizeWithoutSelectors(unsigned int n)
uint32_t abstraction() const
friend class ClauseAllocator
Lit subsumes(const Clause &other) const
unsigned szWithoutSelectors
OccLists(const Deleted &d)
void init(const Idx &idx)
Vec & lookup(const Idx &idx)
void clear(bool free=true)
void clean(const Idx &idx)
void smudge(const Idx &idx)
void prelocate(const int num)
Vec & operator[](const Idx &idx)
RegionAllocator(uint32_t start_cap=1024 *1024)
void moveTo(RegionAllocator &to)
lbool operator||(lbool b) const
bool operator==(lbool b) const
friend int toInt(lbool l)
lbool operator&&(lbool b) const
friend lbool toLbool(int v)
lbool operator^(bool b) const
bool operator!=(lbool b) const
Lit mkLit(Var var, bool sign=false)
Lit operator^(Lit p, bool b)
RegionAllocator< uint32_t >::Ref CRef
friend Lit mkLit(Var var, bool sign)
bool operator!=(Lit p) const
bool operator<(Lit p) const
bool operator==(Lit p) const