abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Minisat::Clause Class Reference

#include <SolverTypes.h>

Public Member Functions

void calcAbstraction ()
 
int size () const
 
void shrink (int i)
 
void pop ()
 
bool learnt () const
 
bool has_extra () const
 
uint32_t mark () const
 
void mark (uint32_t m)
 
const Litlast () const
 
bool reloced () const
 
CRef relocation () const
 
void relocate (CRef c)
 
Litoperator[] (int i)
 
Lit operator[] (int i) const
 
 operator const Lit * (void) const
 
float & activity ()
 
uint32_t abstraction () const
 
Lit subsumes (const Clause &other) const
 
void strengthen (Lit p)
 

Private Member Functions

template<class V >
 Clause (const V &ps, bool use_extra, bool learnt)
 

Private Attributes

struct {
   unsigned   mark: 2
 
   unsigned   learnt: 1
 
   unsigned   has_extra: 1
 
   unsigned   reloced: 1
 
   unsigned   size: 27
 
header
 
union {
   Lit   lit
 
   float   act
 
   uint32_t   abs
 
   CRef   rel
 
data [0]
 

Friends

class ClauseAllocator
 

Detailed Description

Definition at line 123 of file SolverTypes.h.

Constructor & Destructor Documentation

template<class V >
Minisat::Clause::Clause ( const V &  ps,
bool  use_extra,
bool  learnt 
)
inlineprivate

Definition at line 136 of file SolverTypes.h.

136  {
137  header.mark = 0;
138  header.learnt = learnt;
139  header.has_extra = use_extra;
140  header.reloced = 0;
141  header.size = ps.size();
142 
143  for (int i = 0; i < ps.size(); i++)
144  data[i].lit = ps[i];
145 
146  if (header.has_extra){
147  if (header.learnt)
148  data[header.size].act = 0;
149  else
150  calcAbstraction(); }
151  }
union Minisat::Clause::@62 data[0]
int lit
Definition: satVec.h:130
bool learnt() const
Definition: SolverTypes.h:165
struct Minisat::Clause::@61 header
void calcAbstraction()
Definition: SolverTypes.h:154

Member Function Documentation

uint32_t Minisat::Clause::abstraction ( ) const
inline

Definition at line 182 of file SolverTypes.h.

182 { assert(header.has_extra); return data[header.size].abs; }
union Minisat::Clause::@62 data[0]
struct Minisat::Clause::@61 header
#define assert(ex)
Definition: util_old.h:213
float& Minisat::Clause::activity ( )
inline

Definition at line 181 of file SolverTypes.h.

181 { assert(header.has_extra); return data[header.size].act; }
union Minisat::Clause::@62 data[0]
struct Minisat::Clause::@61 header
#define assert(ex)
Definition: util_old.h:213
void Minisat::Clause::calcAbstraction ( )
inline

Definition at line 154 of file SolverTypes.h.

154  {
155  assert(header.has_extra);
156  uint32_t abstraction = 0;
157  for (int i = 0; i < size(); i++)
158  abstraction |= 1 << (var(data[i].lit) & 31);
159  data[header.size].abs = abstraction; }
int size() const
Definition: SolverTypes.h:162
int var(Lit p)
Definition: SolverTypes.h:62
union Minisat::Clause::@62 data[0]
int lit
Definition: satVec.h:130
uint32_t abstraction() const
Definition: SolverTypes.h:182
struct Minisat::Clause::@61 header
#define assert(ex)
Definition: util_old.h:213
bool Minisat::Clause::has_extra ( ) const
inline

Definition at line 166 of file SolverTypes.h.

166 { return header.has_extra; }
struct Minisat::Clause::@61 header
const Lit& Minisat::Clause::last ( ) const
inline

Definition at line 169 of file SolverTypes.h.

169 { return data[header.size-1].lit; }
union Minisat::Clause::@62 data[0]
struct Minisat::Clause::@61 header
bool Minisat::Clause::learnt ( ) const
inline

Definition at line 165 of file SolverTypes.h.

165 { return header.learnt; }
struct Minisat::Clause::@61 header
uint32_t Minisat::Clause::mark ( ) const
inline

Definition at line 167 of file SolverTypes.h.

167 { return header.mark; }
struct Minisat::Clause::@61 header
void Minisat::Clause::mark ( uint32_t  m)
inline

Definition at line 168 of file SolverTypes.h.

168 { header.mark = m; }
struct Minisat::Clause::@61 header
Minisat::Clause::operator const Lit * ( void  ) const
inline

Definition at line 179 of file SolverTypes.h.

179 { return (Lit*)data; }
union Minisat::Clause::@62 data[0]
Lit& Minisat::Clause::operator[] ( int  i)
inline

Definition at line 177 of file SolverTypes.h.

177 { return data[i].lit; }
union Minisat::Clause::@62 data[0]
Lit Minisat::Clause::operator[] ( int  i) const
inline

Definition at line 178 of file SolverTypes.h.

178 { return data[i].lit; }
union Minisat::Clause::@62 data[0]
void Minisat::Clause::pop ( )
inline

Definition at line 164 of file SolverTypes.h.

164 { shrink(1); }
void shrink(int i)
Definition: SolverTypes.h:163
void Minisat::Clause::relocate ( CRef  c)
inline

Definition at line 173 of file SolverTypes.h.

173 { header.reloced = 1; data[0].rel = c; }
union Minisat::Clause::@62 data[0]
struct Minisat::Clause::@61 header
CRef Minisat::Clause::relocation ( ) const
inline

Definition at line 172 of file SolverTypes.h.

172 { return data[0].rel; }
union Minisat::Clause::@62 data[0]
bool Minisat::Clause::reloced ( ) const
inline

Definition at line 171 of file SolverTypes.h.

171 { return header.reloced; }
struct Minisat::Clause::@61 header
void Minisat::Clause::shrink ( int  i)
inline

Definition at line 163 of file SolverTypes.h.

163 { assert(i <= size()); if (header.has_extra) data[header.size-i] = data[header.size]; header.size -= i; }
int size() const
Definition: SolverTypes.h:162
union Minisat::Clause::@62 data[0]
struct Minisat::Clause::@61 header
#define assert(ex)
Definition: util_old.h:213
int Minisat::Clause::size ( ) const
inline

Definition at line 162 of file SolverTypes.h.

162 { return header.size; }
struct Minisat::Clause::@61 header
void Minisat::Clause::strengthen ( Lit  p)
inline

Definition at line 398 of file SolverTypes.h.

399 {
400  remove(*this, p);
401  calcAbstraction();
402 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void calcAbstraction()
Definition: SolverTypes.h:154
Lit Minisat::Clause::subsumes ( const Clause other) const
inline

Definition at line 367 of file SolverTypes.h.

368 {
369  //if (other.size() < size() || (extra.abst & ~other.extra.abst) != 0)
370  //if (other.size() < size() || (!learnt() && !other.learnt() && (extra.abst & ~other.extra.abst) != 0))
371  assert(!header.learnt); assert(!other.header.learnt);
372  assert(header.has_extra); assert(other.header.has_extra);
373  if (other.header.size < header.size || (data[header.size].abs & ~other.data[other.header.size].abs) != 0)
374  return lit_Error;
375 
376  Lit ret = lit_Undef;
377  const Lit* c = (const Lit*)(*this);
378  const Lit* d = (const Lit*)other;
379 
380  for (unsigned i = 0; i < header.size; i++) {
381  // search for c[i] or ~c[i]
382  for (unsigned j = 0; j < other.header.size; j++)
383  if (c[i] == d[j])
384  goto ok;
385  else if (ret == lit_Undef && c[i] == ~d[j]){
386  ret = c[i];
387  goto ok;
388  }
389 
390  // did not find it
391  return lit_Error;
392  ok:;
393  }
394 
395  return ret;
396 }
union Minisat::Clause::@62 data[0]
struct Minisat::Clause::@61 header
const Lit lit_Error
Definition: SolverTypes.h:73
const Lit lit_Undef
Definition: SolverTypes.h:72
#define assert(ex)
Definition: util_old.h:213

Friends And Related Function Documentation

friend class ClauseAllocator
friend

Definition at line 132 of file SolverTypes.h.

Field Documentation

uint32_t Minisat::Clause::abs

Definition at line 130 of file SolverTypes.h.

float Minisat::Clause::act

Definition at line 130 of file SolverTypes.h.

union { ... } Minisat::Clause::data[0]
unsigned Minisat::Clause::has_extra

Definition at line 127 of file SolverTypes.h.

struct { ... } Minisat::Clause::header
unsigned Minisat::Clause::learnt

Definition at line 126 of file SolverTypes.h.

Lit Minisat::Clause::lit

Definition at line 130 of file SolverTypes.h.

unsigned Minisat::Clause::mark

Definition at line 125 of file SolverTypes.h.

CRef Minisat::Clause::rel

Definition at line 130 of file SolverTypes.h.

unsigned Minisat::Clause::reloced

Definition at line 128 of file SolverTypes.h.

unsigned Minisat::Clause::size

Definition at line 129 of file SolverTypes.h.


The documentation for this class was generated from the following file: