22#ifndef Minisat_SolverTypes_h
23#define Minisat_SolverTypes_h
86#define l_True (lbool((uint8_t)0))
87#define l_False (lbool((uint8_t)1))
88#define l_Undef (lbool((uint8_t)2))
97 explicit lbool(
bool x) : value(!x) { }
99 bool operator == (
lbool b)
const {
return ((b.value&2) & (value&2)) | (!(b.value&2)&(value == b.value)); }
104 uint8_t sel = (this->value << 1) | (b.value << 3);
105 uint8_t v = (0xF7F755F4 >> sel) & 3;
109 uint8_t sel = (this->value << 1) | (b.value << 3);
110 uint8_t v = (0xFCFCF400 >> sel) & 3;
138 Clause(
const V& ps,
bool use_extra,
bool learnt) {
141 header.has_extra = use_extra;
143 header.size = ps.size();
145 for (
int i = 0; i < ps.size(); i++)
148 if (header.has_extra){
150 data[header.size].act = 0;
159 for (
int i = 0; i <
size(); i++)
164 int size ()
const {
return header.size; }
165 void shrink (
int i) {
assert(i <=
size());
if (header.has_extra) data[header.size-i] = data[header.size]; header.size -= i; }
167 bool learnt ()
const {
return header.learnt; }
171 const Lit&
last ()
const {
return data[header.size-1].lit; }
173 bool reloced ()
const {
return header.reloced; }
181 operator const Lit* (void)
const {
return (
Lit*)data; }
198 static int clauseWord32Size(
int size,
bool has_extra){
218 new (
lea(cid))
Clause(ps, use_extra, learnt);
247 to[cr].mark(c.
mark());
248 if (to[cr].learnt()) to[cr].activity() = c.
activity();
249 else if (to[cr].has_extra()) to[cr].calcAbstraction();
257template<
class Idx,
class Vec,
class Deleted>
268 void init (
const Idx& idx){ occs.growTo(
toInt(idx)+1); dirty.growTo(
toInt(idx)+1, 0); }
276 if (dirty[
toInt(idx)] == 0){
277 dirty[
toInt(idx)] = 1;
290template<
class Idx,
class Vec,
class Deleted>
293 for (
int i = 0; i < dirties.size(); i++)
295 if (dirty[
toInt(dirties[i])])
301template<
class Idx,
class Vec,
class Deleted>
306 for (i = j = 0; i <
vec.
size(); i++)
307 if (!deleted(
vec[i]))
310 dirty[
toInt(idx)] = 0;
330 int size ()
const {
return map.elems(); }
337 bool has (
CRef cr, T& t) {
return map.peek(cr, t); }
352 printf(
" --- size = %d, bucket_count = %d\n",
size(), map.bucket_count()); }
375 if (other.header.
size < header.size || (data[header.size].abs & ~other.data[other.header.
size].
abs) != 0)
379 const Lit* c = (
const Lit*)(*
this);
380 const Lit* d = (
const Lit*)other;
382 for (
unsigned i = 0; i < header.size; i++) {
384 for (
unsigned j = 0; j < other.header.
size; j++)
387 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)
void insert(CRef cr, const T &t)
const vec< typename HashTable::Pair > & bucket(int i) const
const T & operator[](CRef cr) const
Clause & operator[](Ref r)
const Clause * lea(Ref r) const
void moveTo(ClauseAllocator &to)
void reloc(CRef &cr, ClauseAllocator &to)
CRef alloc(const Lits &ps, bool learnt=false)
ClauseAllocator(uint32_t start_cap)
const Clause & operator[](Ref r) const
friend class ClauseAllocator
uint32_t abstraction() const
Lit subsumes(const Clause &other) const
void init(const Idx &idx)
void clean(const Idx &idx)
OccLists(const Deleted &d)
void clear(bool free=true)
Vec & operator[](const Idx &idx)
Vec & lookup(const Idx &idx)
void smudge(const Idx &idx)
void moveTo(RegionAllocator &to)
RegionAllocator(uint32_t start_cap=1024 *1024)
bool operator!=(lbool b) const
friend int toInt(lbool l)
lbool operator||(lbool b) const
lbool operator&&(lbool b) const
bool operator==(lbool b) const
lbool operator^(bool b) const
friend lbool toLbool(int v)
RegionAllocator< uint32_t >::Ref CRef
Lit operator^(Lit p, bool b)
Lit mkLit(Var var, bool sign=false)
bool operator<(Lit p) const
bool operator==(Lit p) const
friend Lit mkLit(Var var, bool sign)
bool operator!=(Lit p) const