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

#include <SolverTypes.h>

+ Collaboration diagram for Minisat::Clause:

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

 Clause (const vec< Lit > &ps, bool use_extra, bool learnt)
 
 Clause (const Clause &from, bool use_extra)
 

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 140 of file SolverTypes.h.

Constructor & Destructor Documentation

Minisat::Clause::Clause ( const vec< Lit > &  ps,
bool  use_extra,
bool  learnt 
)
inlineprivate

Definition at line 152 of file SolverTypes.h.

152  {
153  header.mark = 0;
154  header.learnt = learnt;
155  header.has_extra = use_extra;
156  header.reloced = 0;
157  header.size = ps.size();
158 
159  for (int i = 0; i < ps.size(); i++)
160  data[i].lit = ps[i];
161 
162  if (header.has_extra){
163  if (header.learnt)
164  data[header.size].act = 0;
165  else
166  calcAbstraction();
167  }
168  }
struct Minisat::Clause::@5 header
Size size(void) const
Definition: Vec.h:64
union Minisat::Clause::@6 data[0]
bool learnt() const
Definition: SolverTypes.h:198
void calcAbstraction()
Definition: SolverTypes.h:187

+ Here is the call graph for this function:

Minisat::Clause::Clause ( const Clause from,
bool  use_extra 
)
inlineprivate

Definition at line 171 of file SolverTypes.h.

171  {
172  header = from.header;
173  header.has_extra = use_extra; // NOTE: the copied clause may lose the extra field.
174 
175  for (int i = 0; i < from.size(); i++)
176  data[i].lit = from[i];
177 
178  if (header.has_extra){
179  if (header.learnt)
180  data[header.size].act = from.data[header.size].act;
181  else
182  data[header.size].abs = from.data[header.size].abs;
183  }
184  }
struct Minisat::Clause::@5 header
union Minisat::Clause::@6 data[0]

Member Function Documentation

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

Definition at line 215 of file SolverTypes.h.

215 { assert(header.has_extra); return data[header.size].abs; }
struct Minisat::Clause::@5 header
union Minisat::Clause::@6 data[0]

+ Here is the caller graph for this function:

float& Minisat::Clause::activity ( )
inline

Definition at line 214 of file SolverTypes.h.

214 { assert(header.has_extra); return data[header.size].act; }
struct Minisat::Clause::@5 header
union Minisat::Clause::@6 data[0]

+ Here is the caller graph for this function:

void Minisat::Clause::calcAbstraction ( )
inline

Definition at line 187 of file SolverTypes.h.

187  {
188  assert(header.has_extra);
189  uint32_t abstraction = 0;
190  for (int i = 0; i < size(); i++)
191  abstraction |= 1 << (var(data[i].lit) & 31);
192  data[header.size].abs = abstraction; }
int size() const
Definition: SolverTypes.h:195
int var(Lit p)
Definition: SolverTypes.h:67
uint32_t abstraction() const
Definition: SolverTypes.h:215
struct Minisat::Clause::@5 header
union Minisat::Clause::@6 data[0]

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Minisat::Clause::has_extra ( ) const
inline

Definition at line 199 of file SolverTypes.h.

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

Definition at line 202 of file SolverTypes.h.

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

Definition at line 198 of file SolverTypes.h.

198 { return header.learnt; }
struct Minisat::Clause::@5 header

+ Here is the caller graph for this function:

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

Definition at line 200 of file SolverTypes.h.

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

Definition at line 201 of file SolverTypes.h.

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

Definition at line 212 of file SolverTypes.h.

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

Definition at line 210 of file SolverTypes.h.

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

Definition at line 211 of file SolverTypes.h.

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

Definition at line 197 of file SolverTypes.h.

197 { shrink(1); }
void shrink(int i)
Definition: SolverTypes.h:196

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Minisat::Clause::relocate ( CRef  c)
inline

Definition at line 206 of file SolverTypes.h.

206 { header.reloced = 1; data[0].rel = c; }
struct Minisat::Clause::@5 header
union Minisat::Clause::@6 data[0]

+ Here is the caller graph for this function:

CRef Minisat::Clause::relocation ( ) const
inline

Definition at line 205 of file SolverTypes.h.

205 { return data[0].rel; }
union Minisat::Clause::@6 data[0]

+ Here is the caller graph for this function:

bool Minisat::Clause::reloced ( ) const
inline

Definition at line 204 of file SolverTypes.h.

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

Definition at line 196 of file SolverTypes.h.

196 { assert(i <= size()); if (header.has_extra) data[header.size-i] = data[header.size]; header.size -= i; }
int size() const
Definition: SolverTypes.h:195
struct Minisat::Clause::@5 header
union Minisat::Clause::@6 data[0]

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int Minisat::Clause::size ( void  ) const
inline

Definition at line 195 of file SolverTypes.h.

195 { return header.size; }
struct Minisat::Clause::@5 header

+ Here is the caller graph for this function:

void Minisat::Clause::strengthen ( Lit  p)
inline

Definition at line 469 of file SolverTypes.h.

470 {
471  remove(*this, p);
472  calcAbstraction();
473 }
void calcAbstraction()
Definition: SolverTypes.h:187

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Lit Minisat::Clause::subsumes ( const Clause other) const
inline

Definition at line 438 of file SolverTypes.h.

439 {
440  //if (other.size() < size() || (extra.abst & ~other.extra.abst) != 0)
441  //if (other.size() < size() || (!learnt() && !other.learnt() && (extra.abst & ~other.extra.abst) != 0))
442  assert(!header.learnt); assert(!other.header.learnt);
443  assert(header.has_extra); assert(other.header.has_extra);
444  if (other.header.size < header.size || (data[header.size].abs & ~other.data[other.header.size].abs) != 0)
445  return lit_Error;
446 
447  Lit ret = lit_Undef;
448  const Lit* c = (const Lit*)(*this);
449  const Lit* d = (const Lit*)other;
450 
451  for (unsigned i = 0; i < header.size; i++) {
452  // search for c[i] or ~c[i]
453  for (unsigned j = 0; j < other.header.size; j++)
454  if (c[i] == d[j])
455  goto ok;
456  else if (ret == lit_Undef && c[i] == ~d[j]){
457  ret = c[i];
458  goto ok;
459  }
460 
461  // did not find it
462  return lit_Error;
463  ok:;
464  }
465 
466  return ret;
467 }
struct Minisat::Clause::@5 header
union Minisat::Clause::@6 data[0]
const Lit lit_Error
Definition: SolverTypes.h:78
const Lit lit_Undef
Definition: SolverTypes.h:77

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class ClauseAllocator
friend

Definition at line 149 of file SolverTypes.h.

Field Documentation

uint32_t Minisat::Clause::abs

Definition at line 147 of file SolverTypes.h.

float Minisat::Clause::act

Definition at line 147 of file SolverTypes.h.

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

Definition at line 144 of file SolverTypes.h.

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

Definition at line 143 of file SolverTypes.h.

Lit Minisat::Clause::lit

Definition at line 147 of file SolverTypes.h.

unsigned Minisat::Clause::mark

Definition at line 142 of file SolverTypes.h.

CRef Minisat::Clause::rel

Definition at line 147 of file SolverTypes.h.

unsigned Minisat::Clause::reloced

Definition at line 145 of file SolverTypes.h.

unsigned Minisat::Clause::size

Definition at line 146 of file SolverTypes.h.


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