22 #ifndef Minisat_SolverTypes_h
23 #define Minisat_SolverTypes_h
43 #define var_Undef (-1)
64 inline int var (
Lit p) {
return p.
x >> 1; }
77 else if (l ==
lit_Error) os <<
"lit_Error";
97 #define l_True (Minisat::lbool((uint8_t)0))
98 #define l_False (Minisat::lbool((uint8_t)1))
99 #define l_Undef (Minisat::lbool((uint8_t)2))
115 uint8_t sel = ((uint8_t) (this->value << 1)) | ((uint8_t) (b.
value << 3));
116 uint8_t v = (0xF7F755F4 >> sel) & 3;
120 uint8_t sel = ((uint8_t) (this->value << 1)) | ((uint8_t) (b.
value << 3));
121 uint8_t v = (0xFCFCF400 >> sel) & 3;
132 case 0:
return os <<
"true";
133 case 1:
return os <<
"false";
134 case 2:
return os <<
"unknown";
135 default:
return os <<
"??? (" <<
toInt(b) <<
")";
150 #define BITMASK_MARK 0x03
151 #define BITMASK_TYPE 0x03
152 #define BITMASK_HASEXTRA 0x01
153 #define BITMASK_RELOCED 0x01
154 #define BITMASK_SIZE 0x3fff
168 Clause(
const V& ps,
bool use_extra,
unsigned _type ) {
171 header.has_extra = use_extra;
175 for (
int i = 0; i < ps.size(); i++)
189 assert(
sizeof(
Lit) ==
sizeof(uint32_t) );
190 assert(
sizeof(
float) ==
sizeof(uint32_t) );
191 void* mem = malloc(
sizeof(
Clause) +
sizeof(uint32_t) * (ps.size()));
199 for (
int i = 0; i <
size(); i++)
234 for (
int i = 0; i < c.
size(); i++) {
235 if (i != 0) os <<
", ";
252 return ((
int)
sizeof(
Clause) + ((
int)
sizeof(
Lit) * (
size + (
int)has_extra))) / (int)
sizeof(uint32_t); }
266 assert(
sizeof(
Lit) ==
sizeof(uint32_t));
267 assert(
sizeof(
float) ==
sizeof(uint32_t));
271 new (
lea(cid))
Clause(ps, use_extra, _type);
300 to[cr].mark(c.
mark());
301 if (to[cr].learnt()) to[cr].activity() = c.
activity();
302 else if (to[cr].has_extra()) to[cr].calcAbstraction();
310 template<
class Idx,
class Vec,
class Deleted>
343 template<
class Idx,
class Vec,
class Deleted>
346 for (
int i = 0; i < dirties.size(); i++)
348 if (dirty[
toInt(dirties[i])])
354 template<
class Idx,
class Vec,
class Deleted>
359 for (i = j = 0; i <
vec.
size(); i++)
360 if (!deleted(
vec[i]))
363 dirty[
toInt(idx)] = 0;
432 const Lit* c = (
const Lit*)(*
this);
433 const Lit* d = (
const Lit*)other;
435 for (
unsigned i = 0; i <
header.size; i++) {
437 for (
unsigned j = 0; j < other.
header.
size; j++)
440 else if (ret ==
lit_Undef && c[i] == ~d[j]){
488 return os <<
"watch(" << w.
cref <<
", " << w.
blocker <<
")";
const vec< typename HashTable::Pair > & bucket(int i) const
void growTo(CRef cr, const T &t)
void insert(CRef cr, const T &t)
const T & operator[](CRef cr) const
Map< CRef, T, CRefHash > HashTable
void moveTo(ClauseAllocator &to)
void reloc(CRef &cr, ClauseAllocator &to)
static int clauseWord32Size(int size, bool has_extra)
const Clause & operator[](Ref r) const
ClauseAllocator(uint32_t start_cap)
CRef alloc(const Lits &ps, unsigned _type)
const Clause * lea(Ref r) const
Clause & operator[](Ref r)
union Minisat::Clause::@5 data[0]
Clause(const V &ps, bool use_extra, unsigned _type)
struct Minisat::Clause::@4 header
uint32_t abstraction() const
Lit subsumes(const Clause &other) const
friend Clause * Clause_new(const V &ps, bool learnt=false)
void insert(const K &k, const D &d)
const vec< Pair > & bucket(int i) const
bool peek(const K &k, D &d) const
const Vec & operator[](const Idx &idx) const
void init(const Idx &idx)
void clean(const Idx &idx)
Vec & lookup(const Idx &idx)
Vec & operator[](const Idx &idx)
OccLists(const Deleted &d)
void clear(bool free=true)
void smudge(const Idx &idx)
void moveTo(RegionAllocator &to)
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)
void clear(bool dealloc=false)
static const unsigned PERMANENT_CLAUSE
const CRef CRef_TPropagation
static const unsigned CONFLICT_CLAUSE
RegionAllocator< uint32_t >::Ref CRef
static const unsigned NORMAL_CLAUSE
Lit operator^(Lit p, bool b)
Lit mkLit(Var var, bool sign=false)
static const unsigned LEMMA_CLAUSE
static void remove(V &ts, const T &t)
std::ostream & operator<<(std::ostream &os, const Lit &l)
uint32_t operator()(CRef cr) const
bool operator<(Lit p) const
bool operator==(Lit p) const
bool operator!=(Lit p) const
friend Lit mkLit(Var var, bool sign)
Minisat::CRef cref
[Minisat related code]
bool operator==(const Watcher &w) const
[Minisat related code]
Watcher(Minisat::CRef cr, Minisat::Lit p)
[Minisat related code]
bool operator!=(const Watcher &w) const
[Minisat related code]
Minisat::Lit blocker
[Minisat related code]
friend std::ostream & operator<<(std::ostream &os, const Watcher &w)