30#ifndef Glucose_SolverTypes_h
31#define Glucose_SolverTypes_h
93#define l_True (Gluco::lbool((uint8_t)0))
94#define l_False (Gluco::lbool((uint8_t)1))
95#define l_Undef (Gluco::lbool((uint8_t)2))
104 explicit lbool(
bool x) : value(!x) { }
106 bool operator == (
lbool b)
const {
return (((b.value&2) & (value&2)) | (!(b.value&2)&(value == b.value))) != 0; }
111 uint8_t sel = (this->value << 1) | (b.value << 3);
112 uint8_t v = (0xF7F755F4 >> sel) & 3;
116 uint8_t sel = (this->value << 1) | (b.value << 3);
117 uint8_t v = (0xFCFCF400 >> sel) & 3;
150 Clause(
const V& ps,
bool use_extra,
bool learnt) {
153 header.has_extra = use_extra;
155 header.size = ps.size();
158 for (
int i = 0; i < ps.size(); i++)
161 if (header.has_extra){
163 data[header.size].act = 0;
172 for (
int i = 0; i <
size(); i++)
177 int size ()
const {
return header.size; }
178 void shrink (
int i) {
assert(i <=
size());
if (header.has_extra) data[header.size-i] = data[header.size]; header.size -= i; }
180 bool learnt ()
const {
return header.learnt; }
184 const Lit&
last ()
const {
return data[header.size-1].lit; }
186 bool reloced ()
const {
return header.reloced; }
194 operator const Lit* (void)
const {
return (
Lit*)data; }
203 unsigned int lbd ()
const {
return header.lbd; }
219 static int clauseWord32Size(
int size,
bool has_extra){
239 new (
lea(cid))
Clause(ps, use_extra, learnt);
268 to[cr].mark(c.
mark());
269 if (to[cr].learnt()) {
271 to[cr].setLBD(c.
lbd());
275 else if (to[cr].has_extra()) to[cr].calcAbstraction();
283template<
class Idx,
class Vec,
class Deleted>
294 void init (
const Idx& idx){ occs.growTo(
toInt(idx)+1); dirty.growTo(
toInt(idx)+1, 0); }
302 if (dirty[
toInt(idx)] == 0){
303 dirty[
toInt(idx)] = 1;
314 occs .shrink_(occs .size());
315 dirty .shrink_(dirty .size());
316 dirties.shrink_(dirties.size());
322template<
class Idx,
class Vec,
class Deleted>
325 for (
int i = 0; i < dirties.size(); i++)
327 if (dirty[
toInt(dirties[i])])
333template<
class Idx,
class Vec,
class Deleted>
338 for (i = j = 0; i <
vec.
size(); i++)
339 if (!deleted(
vec[i]))
342 dirty[
toInt(idx)] = 0;
362 int size ()
const {
return map.elems(); }
369 bool has (
CRef cr, T& t) {
return map.peek(cr, t); }
384 printf(
" --- size = %d, bucket_count = %d\n",
size(), map.bucket_count()); }
407 if (other.header.
size < header.size || (data[header.size].abs & ~other.data[other.header.
size].
abs) != 0)
411 const Lit* c = (
const Lit*)(*
this);
412 const Lit* d = (
const Lit*)other;
414 for (
unsigned i = 0; i < header.size; i++) {
416 for (
unsigned j = 0; j < other.header.
size; j++)
419 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)
Clause & operator[](Ref r)
void moveTo(ClauseAllocator &to)
const Clause & operator[](Ref r) const
const Clause * lea(Ref r) const
CRef alloc(const Lits &ps, bool learnt=false)
void reloc(CRef &cr, ClauseAllocator &to)
ClauseAllocator(uint32_t start_cap)
friend class ClauseAllocator
void setSizeWithoutSelectors(unsigned int n)
unsigned int sizeWithoutSelectors() const
Lit subsumes(const Clause &other) const
unsigned szWithoutSelectors
uint32_t abstraction() const
OccLists(const Deleted &d)
Vec & lookup(const Idx &idx)
void clear(bool free=true)
void clean(const Idx &idx)
Vec & operator[](const Idx &idx)
void smudge(const Idx &idx)
void init(const Idx &idx)
RegionAllocator(uint32_t start_cap=1024 *1024)
void moveTo(RegionAllocator &to)
bool operator==(lbool b) const
friend int toInt(lbool l)
bool operator!=(lbool b) const
lbool operator||(lbool b) const
friend lbool toLbool(int v)
lbool operator^(bool b) const
lbool operator&&(lbool b) const
RegionAllocator< uint32_t >::Ref CRef
Lit operator^(Lit p, bool b)
Lit mkLit(Var var, bool sign=false)
friend Lit mkLit(Var var, bool sign)
bool operator<(Lit p) const
bool operator==(Lit p) const
bool operator!=(Lit p) const