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

#include <SimpSolver.h>

Inherits Minisat::Solver.

Data Structures

struct  ClauseDeleted
 
struct  ElimLt
 

Public Member Functions

 SimpSolver ()
 
 ~SimpSolver ()
 
Var newVar (bool polarity=true, bool dvar=true)
 
bool addClause (const vec< Lit > &ps)
 
bool addEmptyClause ()
 
bool addClause (Lit p)
 
bool addClause (Lit p, Lit q)
 
bool addClause (Lit p, Lit q, Lit r)
 
bool addClause_ (vec< Lit > &ps)
 
bool substitute (Var v, Lit x)
 
void setFrozen (Var v, bool b)
 
bool isEliminated (Var v) const
 
bool solve (const vec< Lit > &assumps, bool do_simp=true, bool turn_off_simp=false)
 
lbool solveLimited (const vec< Lit > &assumps, bool do_simp=true, bool turn_off_simp=false)
 
bool solve (bool do_simp=true, bool turn_off_simp=false)
 
bool solve (Lit p, bool do_simp=true, bool turn_off_simp=false)
 
bool solve (Lit p, Lit q, bool do_simp=true, bool turn_off_simp=false)
 
bool solve (Lit p, Lit q, Lit r, bool do_simp=true, bool turn_off_simp=false)
 
bool eliminate (bool turn_off_elim=false)
 
virtual void garbageCollect ()
 
bool simplify ()
 
bool solve (const vec< Lit > &assumps)
 
bool solve ()
 
bool solve (Lit p)
 
bool solve (Lit p, Lit q)
 
bool solve (Lit p, Lit q, Lit r)
 
lbool solveLimited (const vec< Lit > &assumps)
 
bool okay () const
 
void toDimacs (FILE *f, const vec< Lit > &assumps)
 
void toDimacs (const char *file, const vec< Lit > &assumps)
 
void toDimacs (FILE *f, Clause &c, vec< Var > &map, Var &max)
 
void toDimacs (const char *file)
 
void toDimacs (const char *file, Lit p)
 
void toDimacs (const char *file, Lit p, Lit q)
 
void toDimacs (const char *file, Lit p, Lit q, Lit r)
 
void setPolarity (Var v, bool b)
 
void setDecisionVar (Var v, bool b)
 
lbool value (Var x) const
 
lbool value (Lit p) const
 
lbool modelValue (Var x) const
 
lbool modelValue (Lit p) const
 
int nAssigns () const
 
int nClauses () const
 
int nLearnts () const
 
int nVars () const
 
int nFreeVars () const
 
void setConfBudget (int64_t x)
 
void setPropBudget (int64_t x)
 
void budgetOff ()
 
void interrupt ()
 
void clearInterrupt ()
 
void checkGarbage (double gf)
 
void checkGarbage ()
 

Data Fields

int grow
 
int clause_lim
 
int subsumption_lim
 
double simp_garbage_frac
 
bool use_asymm
 
bool use_rcheck
 
bool use_elim
 
int merges
 
int asymm_lits
 
int eliminated_vars
 
vec< lboolmodel
 
vec< Litconflict
 
int verbosity
 
double var_decay
 
double clause_decay
 
double random_var_freq
 
double random_seed
 
bool luby_restart
 
int ccmin_mode
 
int phase_saving
 
bool rnd_pol
 
bool rnd_init_act
 
double garbage_frac
 
int restart_first
 
double restart_inc
 
double learntsize_factor
 
double learntsize_inc
 
int learntsize_adjust_start_confl
 
double learntsize_adjust_inc
 
uint64_t solves
 
uint64_t starts
 
uint64_t decisions
 
uint64_t rnd_decisions
 
uint64_t propagations
 
uint64_t conflicts
 
uint64_t dec_vars
 
uint64_t clauses_literals
 
uint64_t learnts_literals
 
uint64_t max_literals
 
uint64_t tot_literals
 

Protected Member Functions

lbool solve_ (bool do_simp=true, bool turn_off_simp=false)
 
bool asymm (Var v, CRef cr)
 
bool asymmVar (Var v)
 
void updateElimHeap (Var v)
 
void gatherTouchedClauses ()
 
bool merge (const Clause &_ps, const Clause &_qs, Var v, vec< Lit > &out_clause)
 
bool merge (const Clause &_ps, const Clause &_qs, Var v, int &size)
 
bool backwardSubsumptionCheck (bool verbose=false)
 
bool eliminateVar (Var v)
 
void extendModel ()
 
void removeClause (CRef cr)
 
bool strengthenClause (CRef cr, Lit l)
 
void cleanUpClauses ()
 
bool implied (const vec< Lit > &c)
 
void relocAll (ClauseAllocator &to)
 
void insertVarOrder (Var x)
 
Lit pickBranchLit ()
 
void newDecisionLevel ()
 
void uncheckedEnqueue (Lit p, CRef from=CRef_Undef)
 
bool enqueue (Lit p, CRef from=CRef_Undef)
 
CRef propagate ()
 
void cancelUntil (int level)
 
void analyze (CRef confl, vec< Lit > &out_learnt, int &out_btlevel)
 
void analyzeFinal (Lit p, vec< Lit > &out_conflict)
 
bool litRedundant (Lit p, uint32_t abstract_levels)
 
lbool search (int nof_conflicts)
 
lbool solve_ ()
 
void reduceDB ()
 
void removeSatisfied (vec< CRef > &cs)
 
void rebuildOrderHeap ()
 
void varDecayActivity ()
 
void varBumpActivity (Var v, double inc)
 
void varBumpActivity (Var v)
 
void claDecayActivity ()
 
void claBumpActivity (Clause &c)
 
void attachClause (CRef cr)
 
void detachClause (CRef cr, bool strict=false)
 
bool locked (const Clause &c) const
 
bool satisfied (const Clause &c) const
 
int decisionLevel () const
 
uint32_t abstractLevel (Var x) const
 
CRef reason (Var x) const
 
int level (Var x) const
 
double progressEstimate () const
 
bool withinBudget () const
 

Static Protected Member Functions

static VarData mkVarData (CRef cr, int l)
 
static double drand (double &seed)
 
static int irand (double &seed, int size)
 

Protected Attributes

int elimorder
 
bool use_simplification
 
vec< uint32_t > elimclauses
 
vec< char > touched
 
OccLists< Var, vec< CRef >
, ClauseDeleted
occurs
 
vec< int > n_occ
 
Heap< ElimLtelim_heap
 
Queue< CRefsubsumption_queue
 
vec< char > frozen
 
vec< char > eliminated
 
int bwdsub_assigns
 
int n_touched
 
CRef bwdsub_tmpunit
 
bool ok
 
vec< CRefclauses
 
vec< CReflearnts
 
double cla_inc
 
vec< double > activity
 
double var_inc
 
OccLists< Lit, vec< Watcher >
, WatcherDeleted
watches
 
vec< lboolassigns
 
vec< char > polarity
 
vec< char > decision
 
vec< Littrail
 
vec< int > trail_lim
 
vec< VarDatavardata
 
int qhead
 
int simpDB_assigns
 
int64_t simpDB_props
 
vec< Litassumptions
 
Heap< VarOrderLtorder_heap
 
double progress_estimate
 
bool remove_satisfied
 
ClauseAllocator ca
 
vec< char > seen
 
vec< Litanalyze_stack
 
vec< Litanalyze_toclear
 
vec< Litadd_tmp
 
double max_learnts
 
double learntsize_adjust_confl
 
int learntsize_adjust_cnt
 
int64_t conflict_budget
 
int64_t propagation_budget
 
bool asynch_interrupt
 

Detailed Description

Definition at line 33 of file SimpSolver.h.

Constructor & Destructor Documentation

SimpSolver::SimpSolver ( )

Definition at line 46 of file SimpSolver.cpp.

46  :
47  grow (opt_grow)
54  , merges (0)
55  , asymm_lits (0)
56  , eliminated_vars (0)
57  , elimorder (1)
58  , use_simplification (true)
59  , occurs (ClauseDeleted(ca))
60  , elim_heap (ElimLt(n_occ))
61  , bwdsub_assigns (0)
62  , n_touched (0)
63 {
64  vec<Lit> dummy(1,lit_Undef);
65  ca.extra_clause_field = true; // NOTE: must happen before allocating the dummy clause below.
66  bwdsub_tmpunit = ca.alloc(dummy);
67  remove_satisfied = false;
68 }
vec< int > n_occ
Definition: SimpSolver.h:132
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
static DoubleOption opt_simp_garbage_frac(_cat,"simp-gc-frac","The fraction of wasted memory allowed before a garbage collection is triggered during simplification.", 0.5, DoubleRange(0, false, HUGE_VAL, false))
static BoolOption opt_use_elim(_cat,"elim","Perform variable elimination.", true)
static IntOption opt_subsumption_lim(_cat,"sub-lim","Do not check if subsumption against a clause larger than this. -1 means no limit.", 1000, IntRange(-1, INT32_MAX))
CRef alloc(const Lits &ps, bool learnt=false)
Definition: SolverTypes.h:209
static BoolOption opt_use_rcheck(_cat,"rcheck","Check if a clause is already implied. (costly)", false)
static IntOption opt_clause_lim(_cat,"cl-lim","Variables are not eliminated if it produces a resolvent with a length above this limit. -1 means no limit", 20, IntRange(-1, INT32_MAX))
static BoolOption opt_use_asymm(_cat,"asymm","Shrink clauses by asymmetric branching.", false)
Heap< ElimLt > elim_heap
Definition: SimpSolver.h:133
static IntOption opt_grow(_cat,"grow","Allow a variable elimination step to grow by a number of clauses.", 0)
const Lit lit_Undef
Definition: SolverTypes.h:72
double simp_garbage_frac
Definition: SimpSolver.h:87
bool remove_satisfied
Definition: Solver.h:191
SimpSolver::~SimpSolver ( )

Definition at line 71 of file SimpSolver.cpp.

72 {
73 }

Member Function Documentation

uint32_t Minisat::Solver::abstractLevel ( Var  x) const
inlineprotectedinherited

Definition at line 320 of file Solver.h.

320 { return 1 << (level(x) & 31); }
int level(Var x) const
Definition: Solver.h:278
bool Minisat::SimpSolver::addClause ( const vec< Lit > &  ps)
inline

Definition at line 177 of file SimpSolver.h.

177 { ps.copyTo(add_tmp); return addClause_(add_tmp); }
bool addClause_(vec< Lit > &ps)
Definition: SimpSolver.cpp:135
vec< Lit > add_tmp
Definition: Solver.h:201
bool Minisat::SimpSolver::addClause ( Lit  p)
inline

Definition at line 179 of file SimpSolver.h.

179 { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
bool addClause_(vec< Lit > &ps)
Definition: SimpSolver.cpp:135
vec< Lit > add_tmp
Definition: Solver.h:201
bool Minisat::SimpSolver::addClause ( Lit  p,
Lit  q 
)
inline

Definition at line 180 of file SimpSolver.h.

180 { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
bool addClause_(vec< Lit > &ps)
Definition: SimpSolver.cpp:135
vec< Lit > add_tmp
Definition: Solver.h:201
bool Minisat::SimpSolver::addClause ( Lit  p,
Lit  q,
Lit  r 
)
inline

Definition at line 181 of file SimpSolver.h.

181 { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
bool addClause_(vec< Lit > &ps)
Definition: SimpSolver.cpp:135
vec< Lit > add_tmp
Definition: Solver.h:201
bool SimpSolver::addClause_ ( vec< Lit > &  ps)

Definition at line 135 of file SimpSolver.cpp.

136 {
137 #ifndef NDEBUG
138  for (int i = 0; i < ps.size(); i++)
139  assert(!isEliminated(var(ps[i])));
140 #endif
141 
142  int nclauses = clauses.size();
143 
144  if (use_rcheck && implied(ps))
145  return true;
146 
147  if (!Solver::addClause_(ps))
148  return false;
149 
150  if (use_simplification && clauses.size() == nclauses + 1){
151  CRef cr = clauses.last();
152  const Clause& c = ca[cr];
153 
154  // NOTE: the clause is added to the queue immediately and then
155  // again during 'gatherTouchedClauses()'. If nothing happens
156  // in between, it will only be checked once. Otherwise, it may
157  // be checked twice unnecessarily. This is an unfortunate
158  // consequence of how backward subsumption is used to mimic
159  // forward subsumption.
161  for (int i = 0; i < c.size(); i++){
162  occurs[var(c[i])].push(cr);
163  n_occ[toInt(c[i])]++;
164  touched[var(c[i])] = 1;
165  n_touched++;
166  if (elim_heap.inHeap(var(c[i])))
167  elim_heap.increase(var(c[i]));
168  }
169  }
170 
171  return true;
172 }
RegionAllocator< uint32_t >::Ref CRef
Definition: SolverTypes.h:120
vec< int > n_occ
Definition: SimpSolver.h:132
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
int var(Lit p)
Definition: SolverTypes.h:62
Queue< CRef > subsumption_queue
Definition: SimpSolver.h:134
void insert(T elem)
Definition: Queue.h:49
int size(void) const
Definition: Vec.h:63
bool implied(const vec< Lit > &c)
Definition: SimpSolver.cpp:306
vec< CRef > clauses
Definition: Solver.h:172
vec< char > touched
Definition: SimpSolver.h:129
bool addClause_(vec< Lit > &ps)
Definition: Solver.cpp:132
Heap< ElimLt > elim_heap
Definition: SimpSolver.h:133
bool isEliminated(Var v) const
Definition: SimpSolver.h:169
#define assert(ex)
Definition: util_old.h:213
int toInt(Var v)
Definition: SolverTypes.h:65
const T & last(void) const
Definition: Vec.h:82
bool Minisat::SimpSolver::addEmptyClause ( )
inline

Definition at line 178 of file SimpSolver.h.

178 { add_tmp.clear(); return addClause_(add_tmp); }
bool addClause_(vec< Lit > &ps)
Definition: SimpSolver.cpp:135
vec< Lit > add_tmp
Definition: Solver.h:201
void Solver::analyze ( CRef  confl,
vec< Lit > &  out_learnt,
int &  out_btlevel 
)
protectedinherited

Definition at line 264 of file Solver.cpp.

265 {
266  int pathC = 0;
267  Lit p = lit_Undef;
268 
269  // Generate conflict clause:
270  //
271  out_learnt.push(); // (leave room for the asserting literal)
272  int index = trail.size() - 1;
273 
274  do{
275  assert(confl != CRef_Undef); // (otherwise should be UIP)
276  Clause& c = ca[confl];
277 
278  if (c.learnt())
279  claBumpActivity(c);
280 
281  for (int j = (p == lit_Undef) ? 0 : 1; j < c.size(); j++){
282  Lit q = c[j];
283 
284  if (!seen[var(q)] && level(var(q)) > 0){
285  varBumpActivity(var(q));
286  seen[var(q)] = 1;
287  if (level(var(q)) >= decisionLevel())
288  pathC++;
289  else
290  out_learnt.push(q);
291  }
292  }
293 
294  // Select next clause to look at:
295  while (!seen[var(trail[index--])]);
296  p = trail[index+1];
297  confl = reason(var(p));
298  seen[var(p)] = 0;
299  pathC--;
300 
301  }while (pathC > 0);
302  out_learnt[0] = ~p;
303 
304  // Simplify conflict clause:
305  //
306  int i, j;
307  out_learnt.copyTo(analyze_toclear);
308  if (ccmin_mode == 2){
309  uint32_t abstract_level = 0;
310  for (i = 1; i < out_learnt.size(); i++)
311  abstract_level |= abstractLevel(var(out_learnt[i])); // (maintain an abstraction of levels involved in conflict)
312 
313  for (i = j = 1; i < out_learnt.size(); i++)
314  if (reason(var(out_learnt[i])) == CRef_Undef || !litRedundant(out_learnt[i], abstract_level))
315  out_learnt[j++] = out_learnt[i];
316 
317  }else if (ccmin_mode == 1){
318  for (i = j = 1; i < out_learnt.size(); i++){
319  Var x = var(out_learnt[i]);
320 
321  if (reason(x) == CRef_Undef)
322  out_learnt[j++] = out_learnt[i];
323  else{
324  Clause& c = ca[reason(var(out_learnt[i]))];
325  for (int k = 1; k < c.size(); k++)
326  if (!seen[var(c[k])] && level(var(c[k])) > 0){
327  out_learnt[j++] = out_learnt[i];
328  break; }
329  }
330  }
331  }else
332  i = j = out_learnt.size();
333 
334  max_literals += out_learnt.size();
335  out_learnt.shrink(i - j);
336  tot_literals += out_learnt.size();
337 
338  // Find correct backtrack level:
339  //
340  if (out_learnt.size() == 1)
341  out_btlevel = 0;
342  else{
343  int max_i = 1;
344  // Find the first literal assigned at the next-highest level:
345  for (int i = 2; i < out_learnt.size(); i++)
346  if (level(var(out_learnt[i])) > level(var(out_learnt[max_i])))
347  max_i = i;
348  // Swap-in this literal at index 1:
349  Lit p = out_learnt[max_i];
350  out_learnt[max_i] = out_learnt[1];
351  out_learnt[1] = p;
352  out_btlevel = level(var(p));
353  }
354 
355  for (j = 0; j < analyze_toclear.size(); j++) seen[var(analyze_toclear[j])] = 0; // ('seen[]' is now cleared)
356 }
ClauseAllocator ca
Definition: Solver.h:193
CRef reason(Var x) const
Definition: Solver.h:277
int level(Var x) const
Definition: Solver.h:278
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int var(Lit p)
Definition: SolverTypes.h:62
void claBumpActivity(Clause &c)
Definition: Solver.h:297
int ccmin_mode
Definition: Solver.h:122
unsigned learnt
Definition: SolverTypes.h:126
void copyTo(vec< T > &copy) const
Definition: Vec.h:90
void push(void)
Definition: Vec.h:73
int size(void) const
Definition: Vec.h:63
bool litRedundant(Lit p, uint32_t abstract_levels)
Definition: Solver.cpp:361
const CRef CRef_Undef
Definition: SolverTypes.h:193
int decisionLevel() const
Definition: Solver.h:319
vec< char > seen
Definition: Solver.h:198
void shrink(int nelems)
Definition: Vec.h:64
vec< Lit > analyze_toclear
Definition: Solver.h:200
int Var
Definition: SolverTypes.h:42
const Lit lit_Undef
Definition: SolverTypes.h:72
uint32_t abstractLevel(Var x) const
Definition: Solver.h:320
vec< Lit > trail
Definition: Solver.h:182
uint64_t max_literals
Definition: Solver.h:139
#define assert(ex)
Definition: util_old.h:213
void varBumpActivity(Var v, double inc)
Definition: Solver.h:285
uint64_t tot_literals
Definition: Solver.h:139
void Solver::analyzeFinal ( Lit  p,
vec< Lit > &  out_conflict 
)
protectedinherited

Definition at line 399 of file Solver.cpp.

400 {
401  out_conflict.clear();
402  out_conflict.push(p);
403 
404  if (decisionLevel() == 0)
405  return;
406 
407  seen[var(p)] = 1;
408 
409  for (int i = trail.size()-1; i >= trail_lim[0]; i--){
410  Var x = var(trail[i]);
411  if (seen[x]){
412  if (reason(x) == CRef_Undef){
413  assert(level(x) > 0);
414  out_conflict.push(~trail[i]);
415  }else{
416  Clause& c = ca[reason(x)];
417  for (int j = 1; j < c.size(); j++)
418  if (level(var(c[j])) > 0)
419  seen[var(c[j])] = 1;
420  }
421  seen[x] = 0;
422  }
423  }
424 
425  seen[var(p)] = 0;
426 }
ClauseAllocator ca
Definition: Solver.h:193
CRef reason(Var x) const
Definition: Solver.h:277
int level(Var x) const
Definition: Solver.h:278
int var(Lit p)
Definition: SolverTypes.h:62
void push(void)
Definition: Vec.h:73
vec< int > trail_lim
Definition: Solver.h:183
const CRef CRef_Undef
Definition: SolverTypes.h:193
int decisionLevel() const
Definition: Solver.h:319
vec< char > seen
Definition: Solver.h:198
void clear(bool dealloc=false)
Definition: Vec.h:121
int Var
Definition: SolverTypes.h:42
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
bool SimpSolver::asymm ( Var  v,
CRef  cr 
)
protected

Definition at line 394 of file SimpSolver.cpp.

395 {
396  Clause& c = ca[cr];
397  assert(decisionLevel() == 0);
398 
399  if (c.mark() || satisfied(c)) return true;
400 
401  trail_lim.push(trail.size());
402  Lit l = lit_Undef;
403  for (int i = 0; i < c.size(); i++)
404  if (var(c[i]) != v && value(c[i]) != l_False)
405  uncheckedEnqueue(~c[i]);
406  else
407  l = c[i];
408 
409  if (propagate() != CRef_Undef){
410  cancelUntil(0);
411  asymm_lits++;
412  if (!strengthenClause(cr, l))
413  return false;
414  }else
415  cancelUntil(0);
416 
417  return true;
418 }
ClauseAllocator ca
Definition: Solver.h:193
int var(Lit p)
Definition: SolverTypes.h:62
void cancelUntil(int level)
Definition: Solver.cpp:207
void push(void)
Definition: Vec.h:73
vec< int > trail_lim
Definition: Solver.h:183
const CRef CRef_Undef
Definition: SolverTypes.h:193
int decisionLevel() const
Definition: Solver.h:319
bool strengthenClause(CRef cr, Lit l)
Definition: SimpSolver.cpp:190
lbool value(Var x) const
Definition: Solver.h:321
#define l_False
Definition: SolverTypes.h:85
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition: Solver.cpp:429
const Lit lit_Undef
Definition: SolverTypes.h:72
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
bool satisfied(const Clause &c) const
Definition: Solver.cpp:198
CRef propagate()
Definition: Solver.cpp:449
bool SimpSolver::asymmVar ( Var  v)
protected

Definition at line 421 of file SimpSolver.cpp.

422 {
424 
425  const vec<CRef>& cls = occurs.lookup(v);
426 
427  if (value(v) != l_Undef || cls.size() == 0)
428  return true;
429 
430  for (int i = 0; i < cls.size(); i++)
431  if (!asymm(v, cls[i]))
432  return false;
433 
434  return backwardSubsumptionCheck();
435 }
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
#define l_Undef
Definition: SolverTypes.h:86
int size(void) const
Definition: Vec.h:63
bool asymm(Var v, CRef cr)
Definition: SimpSolver.cpp:394
bool backwardSubsumptionCheck(bool verbose=false)
Definition: SimpSolver.cpp:327
lbool value(Var x) const
Definition: Solver.h:321
#define assert(ex)
Definition: util_old.h:213
void Solver::attachClause ( CRef  cr)
protectedinherited

Definition at line 162 of file Solver.cpp.

162  {
163  const Clause& c = ca[cr];
164  assert(c.size() > 1);
165  watches[~c[0]].push(Watcher(cr, c[1]));
166  watches[~c[1]].push(Watcher(cr, c[0]));
167  if (c.learnt()) learnts_literals += c.size();
168  else clauses_literals += c.size(); }
ClauseAllocator ca
Definition: Solver.h:193
unsigned learnt
Definition: SolverTypes.h:126
uint64_t learnts_literals
Definition: Solver.h:139
uint64_t clauses_literals
Definition: Solver.h:139
OccLists< Lit, vec< Watcher >, WatcherDeleted > watches
Definition: Solver.h:178
#define assert(ex)
Definition: util_old.h:213
bool SimpSolver::backwardSubsumptionCheck ( bool  verbose = false)
protected

Definition at line 327 of file SimpSolver.cpp.

328 {
329  int cnt = 0;
330  int subsumed = 0;
331  int deleted_literals = 0;
332  assert(decisionLevel() == 0);
333 
334  while (subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()){
335 
336  // Empty subsumption queue and return immediately on user-interrupt:
337  if (asynch_interrupt){
339  bwdsub_assigns = trail.size();
340  break; }
341 
342  // Check top-level assignments by creating a dummy clause and placing it in the queue:
343  if (subsumption_queue.size() == 0 && bwdsub_assigns < trail.size()){
344  Lit l = trail[bwdsub_assigns++];
345  ca[bwdsub_tmpunit][0] = l;
346  ca[bwdsub_tmpunit].calcAbstraction();
348 
350  Clause& c = ca[cr];
351 
352  if (c.mark()) continue;
353 
354  if (verbose && verbosity >= 2 && cnt++ % 1000 == 0)
355  printf("subsumption left: %10d (%10d subsumed, %10d deleted literals)\r", subsumption_queue.size(), subsumed, deleted_literals);
356 
357  assert(c.size() > 1 || value(c[0]) == l_True); // Unit-clauses should have been propagated before this point.
358 
359  // Find best variable to scan:
360  Var best = var(c[0]);
361  for (int i = 1; i < c.size(); i++)
362  if (occurs[var(c[i])].size() < occurs[best].size())
363  best = var(c[i]);
364 
365  // Search all candidates:
366  vec<CRef>& _cs = occurs.lookup(best);
367  CRef* cs = (CRef*)_cs;
368 
369  for (int j = 0; j < _cs.size(); j++)
370  if (c.mark())
371  break;
372  else if (!ca[cs[j]].mark() && cs[j] != cr && (subsumption_lim == -1 || ca[cs[j]].size() < subsumption_lim)){
373  Lit l = c.subsumes(ca[cs[j]]);
374 
375  if (l == lit_Undef)
376  subsumed++, removeClause(cs[j]);
377  else if (l != lit_Error){
378  deleted_literals++;
379 
380  if (!strengthenClause(cs[j], ~l))
381  return false;
382 
383  // Did current candidate get deleted from cs? Then check candidate at index j again:
384  if (var(l) == best)
385  j--;
386  }
387  }
388  }
389 
390  return true;
391 }
uint32_t size() const
Definition: Alloc.h:56
RegionAllocator< uint32_t >::Ref CRef
Definition: SolverTypes.h:120
void removeClause(CRef cr)
Definition: SimpSolver.cpp:175
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
int var(Lit p)
Definition: SolverTypes.h:62
Queue< CRef > subsumption_queue
Definition: SimpSolver.h:134
int size() const
Definition: Queue.h:42
#define l_True
Definition: SolverTypes.h:84
void clear(bool dealloc=false)
Definition: Queue.h:41
void pop()
Definition: Queue.h:48
void insert(T elem)
Definition: Queue.h:49
int size(void) const
Definition: Vec.h:63
int decisionLevel() const
Definition: Solver.h:319
bool asynch_interrupt
Definition: Solver.h:211
bool strengthenClause(CRef cr, Lit l)
Definition: SimpSolver.cpp:190
T peek() const
Definition: Queue.h:47
lbool value(Var x) const
Definition: Solver.h:321
int Var
Definition: SolverTypes.h:42
const Lit lit_Error
Definition: SolverTypes.h:73
Lit subsumes(const Clause &other) const
Definition: SolverTypes.h:367
const Lit lit_Undef
Definition: SolverTypes.h:72
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
void Minisat::Solver::budgetOff ( )
inlineinherited

Definition at line 343 of file Solver.h.

int64_t conflict_budget
Definition: Solver.h:209
int64_t propagation_budget
Definition: Solver.h:210
void Solver::cancelUntil ( int  level)
protectedinherited

Definition at line 207 of file Solver.cpp.

207  {
208  if (decisionLevel() > level){
209  for (int c = trail.size()-1; c >= trail_lim[level]; c--){
210  Var x = var(trail[c]);
211  assigns [x] = l_Undef;
212  if (phase_saving > 1 || (phase_saving == 1) && c > trail_lim.last())
213  polarity[x] = sign(trail[c]);
214  insertVarOrder(x); }
215  qhead = trail_lim[level];
216  trail.shrink(trail.size() - trail_lim[level]);
218  } }
int level(Var x) const
Definition: Solver.h:278
#define l_Undef
Definition: SolverTypes.h:86
int var(Lit p)
Definition: SolverTypes.h:62
vec< char > polarity
Definition: Solver.h:180
bool sign(Lit p)
Definition: SolverTypes.h:61
void insertVarOrder(Var x)
Definition: Solver.h:280
vec< int > trail_lim
Definition: Solver.h:183
int size(void) const
Definition: Vec.h:63
int decisionLevel() const
Definition: Solver.h:319
void shrink(int nelems)
Definition: Vec.h:64
int phase_saving
Definition: Solver.h:123
int Var
Definition: SolverTypes.h:42
vec< Lit > trail
Definition: Solver.h:182
vec< lbool > assigns
Definition: Solver.h:179
const T & last(void) const
Definition: Vec.h:82
void Minisat::Solver::checkGarbage ( double  gf)
inlineinherited

Definition at line 305 of file Solver.h.

305  {
306  if (ca.wasted() > ca.size() * gf)
307  garbageCollect(); }
uint32_t size() const
Definition: Alloc.h:56
uint32_t wasted() const
Definition: Alloc.h:57
ClauseAllocator ca
Definition: Solver.h:193
virtual void garbageCollect()
Definition: Solver.cpp:913
void Minisat::Solver::checkGarbage ( void  )
inlineinherited

Definition at line 304 of file Solver.h.

void checkGarbage()
Definition: Solver.h:304
double garbage_frac
Definition: Solver.h:126
void Minisat::Solver::claBumpActivity ( Clause c)
inlineprotectedinherited

Definition at line 297 of file Solver.h.

297  {
298  if ( (c.activity() += cla_inc) > 1e20 ) {
299  // Rescale:
300  for (int i = 0; i < learnts.size(); i++)
301  ca[learnts[i]].activity() *= (float)1e-20;
302  cla_inc *= 1e-20; } }
ClauseAllocator ca
Definition: Solver.h:193
double cla_inc
Definition: Solver.h:174
int size(void) const
Definition: Vec.h:63
vec< double > activity
Definition: Solver.h:175
vec< CRef > learnts
Definition: Solver.h:173
void Minisat::Solver::claDecayActivity ( )
inlineprotectedinherited

Definition at line 296 of file Solver.h.

296 { cla_inc *= (1 / clause_decay); }
double clause_decay
Definition: Solver.h:118
double cla_inc
Definition: Solver.h:174
void SimpSolver::cleanUpClauses ( )
protected

Definition at line 667 of file SimpSolver.cpp.

668 {
669  occurs.cleanAll();
670  int i,j;
671  for (i = j = 0; i < clauses.size(); i++)
672  if (ca[clauses[i]].mark() == 0)
673  clauses[j++] = clauses[i];
674  clauses.shrink(i - j);
675 }
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
int size(void) const
Definition: Vec.h:63
vec< CRef > clauses
Definition: Solver.h:172
void shrink(int nelems)
Definition: Vec.h:64
void Minisat::Solver::clearInterrupt ( )
inlineinherited

Definition at line 342 of file Solver.h.

342 { asynch_interrupt = false; }
bool asynch_interrupt
Definition: Solver.h:211
int Minisat::Solver::decisionLevel ( ) const
inlineprotectedinherited

Definition at line 319 of file Solver.h.

319 { return trail_lim.size(); }
vec< int > trail_lim
Definition: Solver.h:183
int size(void) const
Definition: Vec.h:63
void Solver::detachClause ( CRef  cr,
bool  strict = false 
)
protectedinherited

Definition at line 171 of file Solver.cpp.

171  {
172  const Clause& c = ca[cr];
173  assert(c.size() > 1);
174 
175  if (strict){
176  remove(watches[~c[0]], Watcher(cr, c[1]));
177  remove(watches[~c[1]], Watcher(cr, c[0]));
178  }else{
179  // Lazy detaching: (NOTE! Must clean all watcher lists before garbage collecting this clause)
180  watches.smudge(~c[0]);
181  watches.smudge(~c[1]);
182  }
183 
184  if (c.learnt()) learnts_literals -= c.size();
185  else clauses_literals -= c.size(); }
ClauseAllocator ca
Definition: Solver.h:193
unsigned learnt
Definition: SolverTypes.h:126
uint64_t learnts_literals
Definition: Solver.h:139
uint64_t clauses_literals
Definition: Solver.h:139
OccLists< Lit, vec< Watcher >, WatcherDeleted > watches
Definition: Solver.h:178
#define assert(ex)
Definition: util_old.h:213
static double Minisat::Solver::drand ( double &  seed)
inlinestaticprotectedinherited

Definition at line 262 of file Solver.h.

262  {
263  seed *= 1389796;
264  int q = (int)(seed / 2147483647);
265  seed -= (double)q * 2147483647;
266  return seed / 2147483647; }
bool SimpSolver::eliminate ( bool  turn_off_elim = false)

Definition at line 582 of file SimpSolver.cpp.

583 {
584  if (!simplify())
585  return false;
586  else if (!use_simplification)
587  return true;
588 
589  // Main simplification loop:
590  //
591  while (n_touched > 0 || bwdsub_assigns < trail.size() || elim_heap.size() > 0){
592 
594  // printf(" ## (time = %6.2f s) BWD-SUB: queue = %d, trail = %d\n", cpuTime(), subsumption_queue.size(), trail.size() - bwdsub_assigns);
595  if ((subsumption_queue.size() > 0 || bwdsub_assigns < trail.size()) &&
596  !backwardSubsumptionCheck(true)){
597  ok = false; goto cleanup; }
598 
599  // Empty elim_heap and return immediately on user-interrupt:
600  if (asynch_interrupt){
601  assert(bwdsub_assigns == trail.size());
602  assert(subsumption_queue.size() == 0);
603  assert(n_touched == 0);
604  elim_heap.clear();
605  goto cleanup; }
606 
607  // printf(" ## (time = %6.2f s) ELIM: vars = %d\n", cpuTime(), elim_heap.size());
608  for (int cnt = 0; !elim_heap.empty(); cnt++){
609  Var elim = elim_heap.removeMin();
610 
611  if (asynch_interrupt) break;
612 
613  if (isEliminated(elim) || value(elim) != l_Undef) continue;
614 
615  if (verbosity >= 2 && cnt % 100 == 0)
616  printf("elimination left: %10d\r", elim_heap.size());
617 
618  if (use_asymm){
619  // Temporarily freeze variable. Otherwise, it would immediately end up on the queue again:
620  bool was_frozen = frozen[elim];
621  frozen[elim] = true;
622  if (!asymmVar(elim)){
623  ok = false; goto cleanup; }
624  frozen[elim] = was_frozen; }
625 
626  // At this point, the variable may have been set by assymetric branching, so check it
627  // again. Also, don't eliminate frozen variables:
628  if (use_elim && value(elim) == l_Undef && !frozen[elim] && !eliminateVar(elim)){
629  ok = false; goto cleanup; }
630 
632  }
633 
634  assert(subsumption_queue.size() == 0);
635  }
636  cleanup:
637 
638  // If no more simplification is needed, free all simplification-related data structures:
639  if (turn_off_elim){
640  touched .clear(true);
641  occurs .clear(true);
642  n_occ .clear(true);
643  elim_heap.clear(true);
644  subsumption_queue.clear(true);
645 
646  use_simplification = false;
647  remove_satisfied = true;
648  ca.extra_clause_field = false;
649 
650  // Force full cleanup (this is safe and desirable since it only happens once):
652  garbageCollect();
653  }else{
654  // Cheaper cleanup:
655  cleanUpClauses(); // TODO: can we make 'cleanUpClauses()' not be linear in the problem size somehow?
656  checkGarbage();
657  }
658 
659  if (verbosity >= 1 && elimclauses.size() > 0)
660  printf("| Eliminated clauses: %10.2f Mb |\n",
661  double(elimclauses.size() * sizeof(uint32_t)) / (1024*1024));
662 
663  return ok;
664 }
vec< int > n_occ
Definition: SimpSolver.h:132
ClauseAllocator ca
Definition: Solver.h:193
bool simplify()
Definition: Solver.cpp:577
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
#define l_Undef
Definition: SolverTypes.h:86
Queue< CRef > subsumption_queue
Definition: SimpSolver.h:134
int size() const
Definition: Queue.h:42
vec< uint32_t > elimclauses
Definition: SimpSolver.h:128
void clear(bool dealloc=false)
Definition: Queue.h:41
virtual void garbageCollect()
Definition: SimpSolver.cpp:706
int size(void) const
Definition: Vec.h:63
bool eliminateVar(Var v)
Definition: SimpSolver.cpp:471
bool asynch_interrupt
Definition: Solver.h:211
void checkGarbage()
Definition: Solver.h:304
void rebuildOrderHeap()
Definition: Solver.cpp:559
vec< char > touched
Definition: SimpSolver.h:129
void clear(bool dealloc=false)
Definition: Vec.h:121
bool asymmVar(Var v)
Definition: SimpSolver.cpp:421
Heap< ElimLt > elim_heap
Definition: SimpSolver.h:133
bool backwardSubsumptionCheck(bool verbose=false)
Definition: SimpSolver.cpp:327
bool isEliminated(Var v) const
Definition: SimpSolver.h:169
lbool value(Var x) const
Definition: Solver.h:321
int Var
Definition: SolverTypes.h:42
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
double simp_garbage_frac
Definition: SimpSolver.h:87
vec< char > frozen
Definition: SimpSolver.h:135
bool remove_satisfied
Definition: Solver.h:191
bool SimpSolver::eliminateVar ( Var  v)
protected

Definition at line 471 of file SimpSolver.cpp.

472 {
473  assert(!frozen[v]);
474  assert(!isEliminated(v));
475  assert(value(v) == l_Undef);
476  int i;
477 
478  // Split the occurrences into positive and negative:
479  //
480  const vec<CRef>& cls = occurs.lookup(v);
481  vec<CRef> pos, neg;
482  for (i = 0; i < cls.size(); i++)
483  (find(ca[cls[i]], mkLit(v)) ? pos : neg).push(cls[i]);
484 
485  // Check wether the increase in number of clauses stays within the allowed ('grow'). Moreover, no
486  // clause must exceed the limit on the maximal clause size (if it is set):
487  //
488  int cnt = 0;
489  int clause_size = 0;
490 
491  for (i = 0; i < pos.size(); i++)
492  for (int j = 0; j < neg.size(); j++)
493  if (merge(ca[pos[i]], ca[neg[j]], v, clause_size) &&
494  (++cnt > cls.size() + grow || (clause_lim != -1 && clause_size > clause_lim)))
495  return true;
496 
497  // Delete and store old clauses:
498  eliminated[v] = true;
499  setDecisionVar(v, false);
500  eliminated_vars++;
501 
502  if (pos.size() > neg.size()){
503  for (int i = 0; i < neg.size(); i++)
504  mkElimClause(elimclauses, v, ca[neg[i]]);
506  }else{
507  for (int i = 0; i < pos.size(); i++)
508  mkElimClause(elimclauses, v, ca[pos[i]]);
510  }
511 
512  for (i = 0; i < cls.size(); i++)
513  removeClause(cls[i]);
514 
515  // Produce clauses in cross product:
516  vec<Lit>& resolvent = add_tmp;
517  for (i = 0; i < pos.size(); i++)
518  for (int j = 0; j < neg.size(); j++)
519  if (merge(ca[pos[i]], ca[neg[j]], v, resolvent) && !addClause_(resolvent))
520  return false;
521 
522  // Free occurs list for this variable:
523  occurs[v].clear(true);
524 
525  // Free watchers lists for this variable, if possible:
526  if (watches[ mkLit(v)].size() == 0) watches[ mkLit(v)].clear(true);
527  if (watches[~mkLit(v)].size() == 0) watches[~mkLit(v)].clear(true);
528 
529  return backwardSubsumptionCheck();
530 }
void removeClause(CRef cr)
Definition: SimpSolver.cpp:175
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
#define l_Undef
Definition: SolverTypes.h:86
bool pos
Definition: globals.c:30
vec< uint32_t > elimclauses
Definition: SimpSolver.h:128
Lit mkLit(Var var, bool sign)
Definition: SolverTypes.h:58
void setDecisionVar(Var v, bool b)
Definition: Solver.h:331
int size(void) const
Definition: Vec.h:63
static int clause_size(clause *c)
Definition: satClause.h:146
bool merge(const Clause &_ps, const Clause &_qs, Var v, vec< Lit > &out_clause)
Definition: SimpSolver.cpp:217
static int size
Definition: cuddSign.c:86
bool backwardSubsumptionCheck(bool verbose=false)
Definition: SimpSolver.cpp:327
bool isEliminated(Var v) const
Definition: SimpSolver.h:169
OccLists< Lit, vec< Watcher >, WatcherDeleted > watches
Definition: Solver.h:178
lbool value(Var x) const
Definition: Solver.h:321
vec< char > eliminated
Definition: SimpSolver.h:136
bool addClause_(vec< Lit > &ps)
Definition: SimpSolver.cpp:135
vec< Lit > add_tmp
Definition: Solver.h:201
static bool find(V &ts, const T &t)
Definition: Alg.h:47
#define assert(ex)
Definition: util_old.h:213
static void mkElimClause(vec< uint32_t > &elimclauses, Lit x)
Definition: SimpSolver.cpp:438
vec< char > frozen
Definition: SimpSolver.h:135
bool Minisat::Solver::enqueue ( Lit  p,
CRef  from = CRef_Undef 
)
inlineprotectedinherited

Definition at line 310 of file Solver.h.

310 { return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_Undef
Definition: SolverTypes.h:86
lbool value(Var x) const
Definition: Solver.h:321
#define l_False
Definition: SolverTypes.h:85
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition: Solver.cpp:429
void SimpSolver::extendModel ( )
protected

Definition at line 565 of file SimpSolver.cpp.

566 {
567  int i, j;
568  Lit x;
569 
570  for (i = elimclauses.size()-1; i > 0; i -= j){
571  for (j = elimclauses[i--]; j > 1; j--, i--)
572  if (modelValue(toLit(elimclauses[i])) != l_False)
573  goto next;
574 
575  x = toLit(elimclauses[i]);
576  model[var(x)] = lbool(!sign(x));
577  next:;
578  }
579 }
char lbool
Definition: satVec.h:133
lbool modelValue(Var x) const
Definition: Solver.h:323
int var(Lit p)
Definition: SolverTypes.h:62
vec< uint32_t > elimclauses
Definition: SimpSolver.h:128
bool sign(Lit p)
Definition: SolverTypes.h:61
int size(void) const
Definition: Vec.h:63
vec< lbool > model
Definition: Solver.h:110
#define l_False
Definition: SolverTypes.h:85
Lit toLit(int i)
Definition: SolverTypes.h:67
void SimpSolver::garbageCollect ( )
virtual

Reimplemented from Minisat::Solver.

Definition at line 706 of file SimpSolver.cpp.

707 {
708  // Initialize the next region to a size corresponding to the estimated utilization degree. This
709  // is not precise but should avoid some unnecessary reallocations for the new region:
710  ClauseAllocator to(ca.size() - ca.wasted());
711 
712  cleanUpClauses();
713  to.extra_clause_field = ca.extra_clause_field; // NOTE: this is important to keep (or lose) the extra fields.
714  relocAll(to);
715  Solver::relocAll(to);
716  if (verbosity >= 2)
717  printf("| Garbage collection: %12d bytes => %12d bytes |\n",
719  to.moveTo(ca);
720 }
uint32_t size() const
Definition: Alloc.h:56
uint32_t wasted() const
Definition: Alloc.h:57
ClauseAllocator ca
Definition: Solver.h:193
void relocAll(ClauseAllocator &to)
Definition: Solver.cpp:876
void relocAll(ClauseAllocator &to)
Definition: SimpSolver.cpp:682
void SimpSolver::gatherTouchedClauses ( )
protected

Definition at line 278 of file SimpSolver.cpp.

279 {
280  if (n_touched == 0) return;
281 
282  int i,j;
283  for (i = j = 0; i < subsumption_queue.size(); i++)
284  if (ca[subsumption_queue[i]].mark() == 0)
285  ca[subsumption_queue[i]].mark(2);
286 
287  for (i = 0; i < touched.size(); i++)
288  if (touched[i]){
289  const vec<CRef>& cs = occurs.lookup(i);
290  for (j = 0; j < cs.size(); j++)
291  if (ca[cs[j]].mark() == 0){
292  subsumption_queue.insert(cs[j]);
293  ca[cs[j]].mark(2);
294  }
295  touched[i] = 0;
296  }
297 
298  for (i = 0; i < subsumption_queue.size(); i++)
299  if (ca[subsumption_queue[i]].mark() == 2)
300  ca[subsumption_queue[i]].mark(0);
301 
302  n_touched = 0;
303 }
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
Queue< CRef > subsumption_queue
Definition: SimpSolver.h:134
int size() const
Definition: Queue.h:42
void insert(T elem)
Definition: Queue.h:49
int size(void) const
Definition: Vec.h:63
vec< char > touched
Definition: SimpSolver.h:129
bool SimpSolver::implied ( const vec< Lit > &  c)
protected

Definition at line 306 of file SimpSolver.cpp.

307 {
308  assert(decisionLevel() == 0);
309 
310  trail_lim.push(trail.size());
311  for (int i = 0; i < c.size(); i++)
312  if (value(c[i]) == l_True){
313  cancelUntil(0);
314  return false;
315  }else if (value(c[i]) != l_False){
316  assert(value(c[i]) == l_Undef);
317  uncheckedEnqueue(~c[i]);
318  }
319 
320  bool result = propagate() != CRef_Undef;
321  cancelUntil(0);
322  return result;
323 }
#define l_Undef
Definition: SolverTypes.h:86
#define l_True
Definition: SolverTypes.h:84
void cancelUntil(int level)
Definition: Solver.cpp:207
void push(void)
Definition: Vec.h:73
vec< int > trail_lim
Definition: Solver.h:183
int size(void) const
Definition: Vec.h:63
const CRef CRef_Undef
Definition: SolverTypes.h:193
int decisionLevel() const
Definition: Solver.h:319
lbool value(Var x) const
Definition: Solver.h:321
#define l_False
Definition: SolverTypes.h:85
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition: Solver.cpp:429
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
static int result
Definition: cuddGenetic.c:125
CRef propagate()
Definition: Solver.cpp:449
void Minisat::Solver::insertVarOrder ( Var  x)
inlineprotectedinherited

Definition at line 280 of file Solver.h.

280  {
281  if (!order_heap.inHeap(x) && decision[x]) order_heap.insert(x); }
vec< char > decision
Definition: Solver.h:181
Heap< VarOrderLt > order_heap
Definition: Solver.h:189
void Minisat::Solver::interrupt ( )
inlineinherited

Definition at line 341 of file Solver.h.

341 { asynch_interrupt = true; }
bool asynch_interrupt
Definition: Solver.h:211
static int Minisat::Solver::irand ( double &  seed,
int  size 
)
inlinestaticprotectedinherited

Definition at line 269 of file Solver.h.

269  {
270  return (int)(drand(seed) * size); }
static int size
Definition: cuddSign.c:86
static double drand(double &seed)
Definition: Solver.h:262
bool Minisat::SimpSolver::isEliminated ( Var  v) const
inline

Definition at line 169 of file SimpSolver.h.

169 { return eliminated[v]; }
vec< char > eliminated
Definition: SimpSolver.h:136
int Minisat::Solver::level ( Var  x) const
inlineprotectedinherited

Definition at line 278 of file Solver.h.

278 { return vardata[x].level; }
vec< VarData > vardata
Definition: Solver.h:184
bool Solver::litRedundant ( Lit  p,
uint32_t  abstract_levels 
)
protectedinherited

Definition at line 361 of file Solver.cpp.

362 {
363  analyze_stack.clear(); analyze_stack.push(p);
364  int top = analyze_toclear.size();
365  while (analyze_stack.size() > 0){
367  Clause& c = ca[reason(var(analyze_stack.last()))]; analyze_stack.pop();
368 
369  for (int i = 1; i < c.size(); i++){
370  Lit p = c[i];
371  if (!seen[var(p)] && level(var(p)) > 0){
372  if (reason(var(p)) != CRef_Undef && (abstractLevel(var(p)) & abstract_levels) != 0){
373  seen[var(p)] = 1;
374  analyze_stack.push(p);
375  analyze_toclear.push(p);
376  }else{
377  for (int j = top; j < analyze_toclear.size(); j++)
378  seen[var(analyze_toclear[j])] = 0;
379  analyze_toclear.shrink(analyze_toclear.size() - top);
380  return false;
381  }
382  }
383  }
384  }
385 
386  return true;
387 }
ClauseAllocator ca
Definition: Solver.h:193
CRef reason(Var x) const
Definition: Solver.h:277
int level(Var x) const
Definition: Solver.h:278
int var(Lit p)
Definition: SolverTypes.h:62
vec< Lit > analyze_stack
Definition: Solver.h:199
const CRef CRef_Undef
Definition: SolverTypes.h:193
vec< char > seen
Definition: Solver.h:198
vec< Lit > analyze_toclear
Definition: Solver.h:200
uint32_t abstractLevel(Var x) const
Definition: Solver.h:320
#define assert(ex)
Definition: util_old.h:213
bool Minisat::Solver::locked ( const Clause c) const
inlineprotectedinherited

Definition at line 316 of file Solver.h.

316 { return value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c; }
ClauseAllocator ca
Definition: Solver.h:193
CRef reason(Var x) const
Definition: Solver.h:277
int var(Lit p)
Definition: SolverTypes.h:62
#define l_True
Definition: SolverTypes.h:84
Clause * lea(Ref r)
Definition: SolverTypes.h:224
const CRef CRef_Undef
Definition: SolverTypes.h:193
lbool value(Var x) const
Definition: Solver.h:321
bool SimpSolver::merge ( const Clause _ps,
const Clause _qs,
Var  v,
vec< Lit > &  out_clause 
)
protected

Definition at line 217 of file SimpSolver.cpp.

218 {
219  merges++;
220  out_clause.clear();
221 
222  bool ps_smallest = _ps.size() < _qs.size();
223  const Clause& ps = ps_smallest ? _qs : _ps;
224  const Clause& qs = ps_smallest ? _ps : _qs;
225  int i, j;
226 
227  for (i = 0; i < qs.size(); i++){
228  if (var(qs[i]) != v){
229  for (j = 0; j < ps.size(); j++)
230  if (var(ps[j]) == var(qs[i]))
231  if (ps[j] == ~qs[i])
232  return false;
233  else
234  goto next;
235  out_clause.push(qs[i]);
236  }
237  next:;
238  }
239 
240  for (i = 0; i < ps.size(); i++)
241  if (var(ps[i]) != v)
242  out_clause.push(ps[i]);
243 
244  return true;
245 }
int var(Lit p)
Definition: SolverTypes.h:62
void push(void)
Definition: Vec.h:73
void clear(bool dealloc=false)
Definition: Vec.h:121
bool SimpSolver::merge ( const Clause _ps,
const Clause _qs,
Var  v,
int &  size 
)
protected

Definition at line 249 of file SimpSolver.cpp.

250 {
251  merges++;
252 
253  bool ps_smallest = _ps.size() < _qs.size();
254  const Clause& ps = ps_smallest ? _qs : _ps;
255  const Clause& qs = ps_smallest ? _ps : _qs;
256  const Lit* __ps = (const Lit*)ps;
257  const Lit* __qs = (const Lit*)qs;
258 
259  size = ps.size()-1;
260 
261  for (int i = 0; i < qs.size(); i++){
262  if (var(__qs[i]) != v){
263  for (int j = 0; j < ps.size(); j++)
264  if (var(__ps[j]) == var(__qs[i]))
265  if (__ps[j] == ~__qs[i])
266  return false;
267  else
268  goto next;
269  size++;
270  }
271  next:;
272  }
273 
274  return true;
275 }
int var(Lit p)
Definition: SolverTypes.h:62
static int size
Definition: cuddSign.c:86
static VarData Minisat::Solver::mkVarData ( CRef  cr,
int  l 
)
inlinestaticprotectedinherited

Definition at line 146 of file Solver.h.

146 { VarData d = {cr, l}; return d; }
lbool Minisat::Solver::modelValue ( Var  x) const
inlineinherited

Definition at line 323 of file Solver.h.

323 { return model[x]; }
vec< lbool > model
Definition: Solver.h:110
lbool Minisat::Solver::modelValue ( Lit  p) const
inlineinherited

Definition at line 324 of file Solver.h.

324 { return model[var(p)] ^ sign(p); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int var(Lit p)
Definition: SolverTypes.h:62
bool sign(Lit p)
Definition: SolverTypes.h:61
vec< lbool > model
Definition: Solver.h:110
int Minisat::Solver::nAssigns ( ) const
inlineinherited

Definition at line 325 of file Solver.h.

325 { return trail.size(); }
vec< Lit > trail
Definition: Solver.h:182
int Minisat::Solver::nClauses ( ) const
inlineinherited

Definition at line 326 of file Solver.h.

326 { return clauses.size(); }
int size(void) const
Definition: Vec.h:63
vec< CRef > clauses
Definition: Solver.h:172
void Minisat::Solver::newDecisionLevel ( )
inlineprotectedinherited

Definition at line 317 of file Solver.h.

317 { trail_lim.push(trail.size()); }
void push(void)
Definition: Vec.h:73
vec< int > trail_lim
Definition: Solver.h:183
vec< Lit > trail
Definition: Solver.h:182
Var SimpSolver::newVar ( bool  polarity = true,
bool  dvar = true 
)

Definition at line 76 of file SimpSolver.cpp.

76  {
77  Var v = Solver::newVar(sign, dvar);
78 
79  frozen .push((char)false);
80  eliminated.push((char)false);
81 
82  if (use_simplification){
83  n_occ .push(0);
84  n_occ .push(0);
85  occurs .init(v);
86  touched .push(0);
87  elim_heap .insert(v);
88  }
89  return v; }
vec< int > n_occ
Definition: SimpSolver.h:132
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
bool sign(Lit p)
Definition: SolverTypes.h:61
void push(void)
Definition: Vec.h:73
vec< char > touched
Definition: SimpSolver.h:129
Heap< ElimLt > elim_heap
Definition: SimpSolver.h:133
vec< char > eliminated
Definition: SimpSolver.h:136
int Var
Definition: SolverTypes.h:42
Var newVar(bool polarity=true, bool dvar=true)
Definition: Solver.cpp:114
vec< char > frozen
Definition: SimpSolver.h:135
int Minisat::Solver::nFreeVars ( ) const
inlineinherited

Definition at line 329 of file Solver.h.

329 { return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); }
uint64_t dec_vars
Definition: Solver.h:139
vec< int > trail_lim
Definition: Solver.h:183
int size(void) const
Definition: Vec.h:63
vec< Lit > trail
Definition: Solver.h:182
int Minisat::Solver::nLearnts ( ) const
inlineinherited

Definition at line 327 of file Solver.h.

327 { return learnts.size(); }
int size(void) const
Definition: Vec.h:63
vec< CRef > learnts
Definition: Solver.h:173
int Minisat::Solver::nVars ( ) const
inlineinherited

Definition at line 328 of file Solver.h.

328 { return vardata.size(); }
vec< VarData > vardata
Definition: Solver.h:184
bool Minisat::Solver::okay ( ) const
inlineinherited

Definition at line 358 of file Solver.h.

358 { return ok; }
Lit Solver::pickBranchLit ( )
protectedinherited

Definition at line 225 of file Solver.cpp.

226 {
227  Var next = var_Undef;
228 
229  // Random decision:
230  if (drand(random_seed) < random_var_freq && !order_heap.empty()){
231  next = order_heap[irand(random_seed,order_heap.size())];
232  if (value(next) == l_Undef && decision[next])
233  rnd_decisions++; }
234 
235  // Activity based decision:
236  while (next == var_Undef || value(next) != l_Undef || !decision[next])
237  if (order_heap.empty()){
238  next = var_Undef;
239  break;
240  }else
241  next = order_heap.removeMin();
242 
243  return next == var_Undef ? lit_Undef : mkLit(next, rnd_pol ? drand(random_seed) < 0.5 : polarity[next]);
244 }
#define l_Undef
Definition: SolverTypes.h:86
vec< char > polarity
Definition: Solver.h:180
Lit mkLit(Var var, bool sign)
Definition: SolverTypes.h:58
double random_var_freq
Definition: Solver.h:119
static double drand(double &seed)
Definition: Solver.h:262
lbool value(Var x) const
Definition: Solver.h:321
static int irand(double &seed, int size)
Definition: Solver.h:269
int Var
Definition: SolverTypes.h:42
const Lit lit_Undef
Definition: SolverTypes.h:72
#define var_Undef
Definition: SolverTypes.h:43
vec< char > decision
Definition: Solver.h:181
Heap< VarOrderLt > order_heap
Definition: Solver.h:189
uint64_t rnd_decisions
Definition: Solver.h:138
double random_seed
Definition: Solver.h:120
bool rnd_pol
Definition: Solver.h:124
double Solver::progressEstimate ( ) const
protectedinherited

Definition at line 708 of file Solver.cpp.

709 {
710  double progress = 0;
711  double F = 1.0 / nVars();
712 
713  for (int i = 0; i <= decisionLevel(); i++){
714  int beg = i == 0 ? 0 : trail_lim[i - 1];
715  int end = i == decisionLevel() ? trail.size() : trail_lim[i];
716  progress += pow(F, i) * (end - beg);
717  }
718 
719  return progress / nVars();
720 }
vec< int > trail_lim
Definition: Solver.h:183
int nVars() const
Definition: Solver.h:328
int decisionLevel() const
Definition: Solver.h:319
vec< Lit > trail
Definition: Solver.h:182
CRef Solver::propagate ( )
protectedinherited

Definition at line 449 of file Solver.cpp.

450 {
451  CRef confl = CRef_Undef;
452  int num_props = 0;
453  watches.cleanAll();
454 
455  while (qhead < trail.size()){
456  Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate.
457  vec<Watcher>& ws = watches[p];
458  Watcher *i, *j, *end;
459  num_props++;
460 
461  for (i = j = (Watcher*)ws, end = i + ws.size(); i != end;){
462  // Try to avoid inspecting the clause:
463  Lit blocker = i->blocker;
464  if (value(blocker) == l_True){
465  *j++ = *i++; continue; }
466 
467  // Make sure the false literal is data[1]:
468  CRef cr = i->cref;
469  Clause& c = ca[cr];
470  Lit false_lit = ~p;
471  if (c[0] == false_lit)
472  c[0] = c[1], c[1] = false_lit;
473  assert(c[1] == false_lit);
474  i++;
475 
476  // If 0th watch is true, then clause is already satisfied.
477  Lit first = c[0];
478  Watcher w = Watcher(cr, first);
479  if (first != blocker && value(first) == l_True){
480  *j++ = w; continue; }
481 
482  // Look for new watch:
483  for (int k = 2; k < c.size(); k++)
484  if (value(c[k]) != l_False){
485  c[1] = c[k]; c[k] = false_lit;
486  watches[~c[1]].push(w);
487  goto NextClause; }
488 
489  // Did not find watch -- clause is unit under assignment:
490  *j++ = w;
491  if (value(first) == l_False){
492  confl = cr;
493  qhead = trail.size();
494  // Copy the remaining watches:
495  while (i < end)
496  *j++ = *i++;
497  }else
498  uncheckedEnqueue(first, cr);
499 
500  NextClause:;
501  }
502  ws.shrink(i - j);
503  }
504  propagations += num_props;
505  simpDB_props -= num_props;
506 
507  return confl;
508 }
RegionAllocator< uint32_t >::Ref CRef
Definition: SolverTypes.h:120
ClauseAllocator ca
Definition: Solver.h:193
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_True
Definition: SolverTypes.h:84
int size(void) const
Definition: Vec.h:63
const CRef CRef_Undef
Definition: SolverTypes.h:193
void shrink(int nelems)
Definition: Vec.h:64
uint64_t propagations
Definition: Solver.h:138
OccLists< Lit, vec< Watcher >, WatcherDeleted > watches
Definition: Solver.h:178
lbool value(Var x) const
Definition: Solver.h:321
#define l_False
Definition: SolverTypes.h:85
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition: Solver.cpp:429
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
int64_t simpDB_props
Definition: Solver.h:187
CRef Minisat::Solver::reason ( Var  x) const
inlineprotectedinherited

Definition at line 277 of file Solver.h.

277 { return vardata[x].reason; }
vec< VarData > vardata
Definition: Solver.h:184
void Solver::rebuildOrderHeap ( )
protectedinherited

Definition at line 559 of file Solver.cpp.

560 {
561  vec<Var> vs;
562  for (Var v = 0; v < nVars(); v++)
563  if (decision[v] && value(v) == l_Undef)
564  vs.push(v);
565  order_heap.build(vs);
566 }
#define l_Undef
Definition: SolverTypes.h:86
void push(void)
Definition: Vec.h:73
int nVars() const
Definition: Solver.h:328
lbool value(Var x) const
Definition: Solver.h:321
int Var
Definition: SolverTypes.h:42
vec< char > decision
Definition: Solver.h:181
Heap< VarOrderLt > order_heap
Definition: Solver.h:189
void Solver::reduceDB ( )
protectedinherited

Definition at line 525 of file Solver.cpp.

526 {
527  int i, j;
528  double extra_lim = cla_inc / learnts.size(); // Remove any clause below this activity
529 
531  // Don't delete binary or locked clauses. From the rest, delete clauses from the first half
532  // and clauses with activity smaller than 'extra_lim':
533  for (i = j = 0; i < learnts.size(); i++){
534  Clause& c = ca[learnts[i]];
535  if (c.size() > 2 && !locked(c) && (i < learnts.size() / 2 || c.activity() < extra_lim))
536  removeClause(learnts[i]);
537  else
538  learnts[j++] = learnts[i];
539  }
540  learnts.shrink(i - j);
541  checkGarbage();
542 }
bool locked(const Clause &c) const
Definition: Solver.h:316
ClauseAllocator ca
Definition: Solver.h:193
void sort(T *array, int size, LessThan lt)
Definition: Sort.h:57
double cla_inc
Definition: Solver.h:174
int size(void) const
Definition: Vec.h:63
float & activity()
Definition: SolverTypes.h:181
void checkGarbage()
Definition: Solver.h:304
void removeClause(CRef cr)
Definition: Solver.cpp:188
vec< CRef > learnts
Definition: Solver.h:173
void SimpSolver::relocAll ( ClauseAllocator to)
protected

Definition at line 682 of file SimpSolver.cpp.

683 {
684  if (!use_simplification) return;
685 
686  // All occurs lists:
687  //
688  int i;
689  for (i = 0; i < nVars(); i++){
690  vec<CRef>& cs = occurs[i];
691  for (int j = 0; j < cs.size(); j++)
692  ca.reloc(cs[j], to);
693  }
694 
695  // Subsumption queue:
696  //
697  for (i = 0; i < subsumption_queue.size(); i++)
698  ca.reloc(subsumption_queue[i], to);
699 
700  // Temporary clause:
701  //
702  ca.reloc(bwdsub_tmpunit, to);
703 }
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
Queue< CRef > subsumption_queue
Definition: SimpSolver.h:134
int size() const
Definition: Queue.h:42
int nVars() const
Definition: Solver.h:328
int size(void) const
Definition: Vec.h:63
void reloc(CRef &cr, ClauseAllocator &to)
Definition: SolverTypes.h:234
void SimpSolver::removeClause ( CRef  cr)
protected

Definition at line 175 of file SimpSolver.cpp.

176 {
177  const Clause& c = ca[cr];
178 
179  if (use_simplification)
180  for (int i = 0; i < c.size(); i++){
181  n_occ[toInt(c[i])]--;
182  updateElimHeap(var(c[i]));
183  occurs.smudge(var(c[i]));
184  }
185 
187 }
vec< int > n_occ
Definition: SimpSolver.h:132
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
int var(Lit p)
Definition: SolverTypes.h:62
void updateElimHeap(Var v)
Definition: SimpSolver.h:170
void removeClause(CRef cr)
Definition: Solver.cpp:188
int toInt(Var v)
Definition: SolverTypes.h:65
void Solver::removeSatisfied ( vec< CRef > &  cs)
protectedinherited

Definition at line 545 of file Solver.cpp.

546 {
547  int i, j;
548  for (i = j = 0; i < cs.size(); i++){
549  Clause& c = ca[cs[i]];
550  if (satisfied(c))
551  removeClause(cs[i]);
552  else
553  cs[j++] = cs[i];
554  }
555  cs.shrink(i - j);
556 }
ClauseAllocator ca
Definition: Solver.h:193
int size(void) const
Definition: Vec.h:63
void removeClause(CRef cr)
Definition: Solver.cpp:188
bool satisfied(const Clause &c) const
Definition: Solver.cpp:198
bool Solver::satisfied ( const Clause c) const
protectedinherited

Definition at line 198 of file Solver.cpp.

198  {
199  for (int i = 0; i < c.size(); i++)
200  if (value(c[i]) == l_True)
201  return true;
202  return false; }
#define l_True
Definition: SolverTypes.h:84
lbool value(Var x) const
Definition: Solver.h:321
lbool Solver::search ( int  nof_conflicts)
protectedinherited

Definition at line 614 of file Solver.cpp.

615 {
616  assert(ok);
617  int backtrack_level;
618  int conflictC = 0;
619  vec<Lit> learnt_clause;
620  starts++;
621 
622  for (;;){
623  CRef confl = propagate();
624  if (confl != CRef_Undef){
625  // CONFLICT
626  conflicts++; conflictC++;
627  if (decisionLevel() == 0) return l_False;
628 
629  learnt_clause.clear();
630  analyze(confl, learnt_clause, backtrack_level);
631  cancelUntil(backtrack_level);
632 
633  if (learnt_clause.size() == 1){
634  uncheckedEnqueue(learnt_clause[0]);
635  }else{
636  CRef cr = ca.alloc(learnt_clause, true);
637  learnts.push(cr);
638  attachClause(cr);
639  claBumpActivity(ca[cr]);
640  uncheckedEnqueue(learnt_clause[0], cr);
641  }
642 
645 
646  if (--learntsize_adjust_cnt == 0){
650 
651  if (verbosity >= 1)
652  printf("| %9d | %7d %8d %8d | %8d %8d %6.0f | %6.3f %% |\n",
653  (int)conflicts,
654  (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]), nClauses(), (int)clauses_literals,
655  (int)max_learnts, nLearnts(), ((double)((int64_t)learnts_literals))/nLearnts(), progressEstimate()*100);
656  }
657 
658  }else{
659  // NO CONFLICT
660  if (nof_conflicts >= 0 && conflictC >= nof_conflicts || !withinBudget()){
661  // Reached bound on number of conflicts:
663  cancelUntil(0);
664  return l_Undef; }
665 
666  // Simplify the set of problem clauses:
667  if (decisionLevel() == 0 && !simplify())
668  return l_False;
669 
670  if (learnts.size()-nAssigns() >= max_learnts)
671  // Reduce the set of learnt clauses:
672  reduceDB();
673 
674  Lit next = lit_Undef;
675  while (decisionLevel() < assumptions.size()){
676  // Perform user provided assumption:
678  if (value(p) == l_True){
679  // Dummy decision level:
681  }else if (value(p) == l_False){
682  analyzeFinal(~p, conflict);
683  return l_False;
684  }else{
685  next = p;
686  break;
687  }
688  }
689 
690  if (next == lit_Undef){
691  // New variable decision:
692  decisions++;
693  next = pickBranchLit();
694 
695  if (next == lit_Undef)
696  // Model found:
697  return l_True;
698  }
699 
700  // Increase decision level and enqueue 'next'
702  uncheckedEnqueue(next);
703  }
704  }
705 }
RegionAllocator< uint32_t >::Ref CRef
Definition: SolverTypes.h:120
double learntsize_inc
Definition: Solver.h:131
void reduceDB()
Definition: Solver.cpp:525
ClauseAllocator ca
Definition: Solver.h:193
int learntsize_adjust_cnt
Definition: Solver.h:205
bool simplify()
Definition: Solver.cpp:577
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_Undef
Definition: SolverTypes.h:86
double learntsize_adjust_inc
Definition: Solver.h:134
bool withinBudget() const
Definition: Solver.h:344
double max_learnts
Definition: Solver.h:203
void claDecayActivity()
Definition: Solver.h:296
void claBumpActivity(Clause &c)
Definition: Solver.h:297
vec< Lit > conflict
Definition: Solver.h:111
#define l_True
Definition: SolverTypes.h:84
void newDecisionLevel()
Definition: Solver.h:317
CRef alloc(const Lits &ps, bool learnt=false)
Definition: SolverTypes.h:209
uint64_t starts
Definition: Solver.h:138
void attachClause(CRef cr)
Definition: Solver.cpp:162
void cancelUntil(int level)
Definition: Solver.cpp:207
uint64_t dec_vars
Definition: Solver.h:139
void push(void)
Definition: Vec.h:73
vec< int > trail_lim
Definition: Solver.h:183
int size(void) const
Definition: Vec.h:63
Lit pickBranchLit()
Definition: Solver.cpp:225
uint64_t learnts_literals
Definition: Solver.h:139
const CRef CRef_Undef
Definition: SolverTypes.h:193
int decisionLevel() const
Definition: Solver.h:319
uint64_t decisions
Definition: Solver.h:138
vec< Lit > assumptions
Definition: Solver.h:188
double progress_estimate
Definition: Solver.h:190
int nAssigns() const
Definition: Solver.h:325
uint64_t clauses_literals
Definition: Solver.h:139
void clear(bool dealloc=false)
Definition: Vec.h:121
int nClauses() const
Definition: Solver.h:326
lbool value(Var x) const
Definition: Solver.h:321
void varDecayActivity()
Definition: Solver.h:283
vec< CRef > learnts
Definition: Solver.h:173
#define l_False
Definition: SolverTypes.h:85
void analyzeFinal(Lit p, vec< Lit > &out_conflict)
Definition: Solver.cpp:399
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition: Solver.cpp:429
const Lit lit_Undef
Definition: SolverTypes.h:72
void analyze(CRef confl, vec< Lit > &out_learnt, int &out_btlevel)
Definition: Solver.cpp:264
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
int nLearnts() const
Definition: Solver.h:327
double progressEstimate() const
Definition: Solver.cpp:708
CRef propagate()
Definition: Solver.cpp:449
uint64_t conflicts
Definition: Solver.h:138
double learntsize_adjust_confl
Definition: Solver.h:204
void Minisat::Solver::setConfBudget ( int64_t  x)
inlineinherited

Definition at line 339 of file Solver.h.

339 { conflict_budget = conflicts + x; }
int64_t conflict_budget
Definition: Solver.h:209
uint64_t conflicts
Definition: Solver.h:138
void Minisat::Solver::setDecisionVar ( Var  v,
bool  b 
)
inlineinherited

Definition at line 331 of file Solver.h.

332 {
333  if ( b && !decision[v]) dec_vars++;
334  else if (!b && decision[v]) dec_vars--;
335 
336  decision[v] = b;
337  insertVarOrder(v);
338 }
void insertVarOrder(Var x)
Definition: Solver.h:280
uint64_t dec_vars
Definition: Solver.h:139
vec< char > decision
Definition: Solver.h:181
void Minisat::SimpSolver::setFrozen ( Var  v,
bool  b 
)
inline

Definition at line 182 of file SimpSolver.h.

182 { frozen[v] = (char)b; if (use_simplification && !b) { updateElimHeap(v); } }
void updateElimHeap(Var v)
Definition: SimpSolver.h:170
vec< char > frozen
Definition: SimpSolver.h:135
void Minisat::Solver::setPolarity ( Var  v,
bool  b 
)
inlineinherited

Definition at line 330 of file Solver.h.

330 { polarity[v] = b; }
vec< char > polarity
Definition: Solver.h:180
void Minisat::Solver::setPropBudget ( int64_t  x)
inlineinherited

Definition at line 340 of file Solver.h.

int64_t propagation_budget
Definition: Solver.h:210
uint64_t propagations
Definition: Solver.h:138
bool Solver::simplify ( )
inherited

Definition at line 577 of file Solver.cpp.

578 {
579  assert(decisionLevel() == 0);
580 
581  if (!ok || propagate() != CRef_Undef)
582  return ok = false;
583 
584  if (nAssigns() == simpDB_assigns || (simpDB_props > 0))
585  return true;
586 
587  // Remove satisfied clauses:
589  if (remove_satisfied) // Can be turned off.
591  checkGarbage();
593 
595  simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now)
596 
597  return true;
598 }
void removeSatisfied(vec< CRef > &cs)
Definition: Solver.cpp:545
uint64_t learnts_literals
Definition: Solver.h:139
const CRef CRef_Undef
Definition: SolverTypes.h:193
int decisionLevel() const
Definition: Solver.h:319
void checkGarbage()
Definition: Solver.h:304
vec< CRef > clauses
Definition: Solver.h:172
void rebuildOrderHeap()
Definition: Solver.cpp:559
int nAssigns() const
Definition: Solver.h:325
uint64_t clauses_literals
Definition: Solver.h:139
int simpDB_assigns
Definition: Solver.h:186
vec< CRef > learnts
Definition: Solver.h:173
#define assert(ex)
Definition: util_old.h:213
int64_t simpDB_props
Definition: Solver.h:187
CRef propagate()
Definition: Solver.cpp:449
bool remove_satisfied
Definition: Solver.h:191
bool Minisat::SimpSolver::solve ( const vec< Lit > &  assumps,
bool  do_simp = true,
bool  turn_off_simp = false 
)
inline

Definition at line 188 of file SimpSolver.h.

188  {
189  budgetOff(); assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp) == l_True; }
void budgetOff()
Definition: Solver.h:343
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::Solver::solve ( const vec< Lit > &  assumps)
inlineinherited

Definition at line 356 of file Solver.h.

356 { budgetOff(); assumps.copyTo(assumptions); return solve_() == l_True; }
void budgetOff()
Definition: Solver.h:343
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::SimpSolver::solve ( bool  do_simp = true,
bool  turn_off_simp = false 
)
inline

Definition at line 184 of file SimpSolver.h.

184 { budgetOff(); assumptions.clear(); return solve_(do_simp, turn_off_simp) == l_True; }
void budgetOff()
Definition: Solver.h:343
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::Solver::solve ( )
inlineinherited

Definition at line 352 of file Solver.h.

352 { budgetOff(); assumptions.clear(); return solve_() == l_True; }
void budgetOff()
Definition: Solver.h:343
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::SimpSolver::solve ( Lit  p,
bool  do_simp = true,
bool  turn_off_simp = false 
)
inline

Definition at line 185 of file SimpSolver.h.

185 { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_(do_simp, turn_off_simp) == l_True; }
void budgetOff()
Definition: Solver.h:343
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::Solver::solve ( Lit  p)
inlineinherited

Definition at line 353 of file Solver.h.

353 { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_() == l_True; }
void budgetOff()
Definition: Solver.h:343
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::SimpSolver::solve ( Lit  p,
Lit  q,
bool  do_simp = true,
bool  turn_off_simp = false 
)
inline

Definition at line 186 of file SimpSolver.h.

186 { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_(do_simp, turn_off_simp) == l_True; }
void budgetOff()
Definition: Solver.h:343
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::Solver::solve ( Lit  p,
Lit  q 
)
inlineinherited

Definition at line 354 of file Solver.h.

354 { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_() == l_True; }
void budgetOff()
Definition: Solver.h:343
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::SimpSolver::solve ( Lit  p,
Lit  q,
Lit  r,
bool  do_simp = true,
bool  turn_off_simp = false 
)
inline

Definition at line 187 of file SimpSolver.h.

187 { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_(do_simp, turn_off_simp) == l_True; }
void budgetOff()
Definition: Solver.h:343
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool Minisat::Solver::solve ( Lit  p,
Lit  q,
Lit  r 
)
inlineinherited

Definition at line 355 of file Solver.h.

355 { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_() == l_True; }
void budgetOff()
Definition: Solver.h:343
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_True
Definition: SolverTypes.h:84
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
lbool SimpSolver::solve_ ( bool  do_simp = true,
bool  turn_off_simp = false 
)
protected

Definition at line 93 of file SimpSolver.cpp.

94 {
95  vec<Var> extra_frozen;
97 
98  do_simp &= use_simplification;
99 
100  if (do_simp){
101  // Assumptions must be temporarily frozen to run variable elimination:
102  for (int i = 0; i < assumptions.size(); i++){
103  Var v = var(assumptions[i]);
104 
105  // If an assumption has been eliminated, remember it.
106  assert(!isEliminated(v));
107 
108  if (!frozen[v]){
109  // Freeze and store.
110  setFrozen(v, true);
111  extra_frozen.push(v);
112  } }
113 
114  result = lbool(eliminate(turn_off_simp));
115  }
116 
117  if (result == l_True)
118  result = Solver::solve_();
119  else if (verbosity >= 1)
120  printf("===============================================================================\n");
121 
122  if (result == l_True)
123  extendModel();
124 
125  if (do_simp)
126  // Unfreeze the assumptions that were frozen:
127  for (int i = 0; i < extra_frozen.size(); i++)
128  setFrozen(extra_frozen[i], false);
129 
130  return result;
131 }
char lbool
Definition: satVec.h:133
int var(Lit p)
Definition: SolverTypes.h:62
void setFrozen(Var v, bool b)
Definition: SimpSolver.h:182
#define l_True
Definition: SolverTypes.h:84
void push(void)
Definition: Vec.h:73
int size(void) const
Definition: Vec.h:63
vec< Lit > assumptions
Definition: Solver.h:188
bool eliminate(bool turn_off_elim=false)
Definition: SimpSolver.cpp:582
bool isEliminated(Var v) const
Definition: SimpSolver.h:169
lbool solve_()
Definition: Solver.cpp:751
int Var
Definition: SolverTypes.h:42
#define assert(ex)
Definition: util_old.h:213
static int result
Definition: cuddGenetic.c:125
vec< char > frozen
Definition: SimpSolver.h:135
lbool Solver::solve_ ( )
protectedinherited

Definition at line 751 of file Solver.cpp.

752 {
753  model.clear();
754  conflict.clear();
755  if (!ok) return l_False;
756 
757  solves++;
758 
762  lbool status = l_Undef;
763 
764  if (verbosity >= 1){
765  printf("============================[ Search Statistics ]==============================\n");
766  printf("| Conflicts | ORIGINAL | LEARNT | Progress |\n");
767  printf("| | Vars Clauses Literals | Limit Clauses Lit/Cl | |\n");
768  printf("===============================================================================\n");
769  }
770 
771  // Search:
772  int curr_restarts = 0;
773  while (status == l_Undef){
774  double rest_base = luby_restart ? luby(restart_inc, curr_restarts) : pow(restart_inc, curr_restarts);
775  status = search(rest_base * restart_first);
776  if (!withinBudget()) break;
777  curr_restarts++;
778  }
779 
780  if (verbosity >= 1)
781  printf("===============================================================================\n");
782 
783 
784  if (status == l_True){
785  // Extend & copy model:
786  model.growTo(nVars());
787  for (int i = 0; i < nVars(); i++) model[i] = value(i);
788  }else if (status == l_False && conflict.size() == 0)
789  ok = false;
790 
791  cancelUntil(0);
792  return status;
793 }
int learntsize_adjust_cnt
Definition: Solver.h:205
bool luby_restart
Definition: Solver.h:121
int restart_first
Definition: Solver.h:128
#define l_Undef
Definition: SolverTypes.h:86
bool withinBudget() const
Definition: Solver.h:344
double max_learnts
Definition: Solver.h:203
double learntsize_factor
Definition: Solver.h:130
vec< Lit > conflict
Definition: Solver.h:111
#define l_True
Definition: SolverTypes.h:84
int learntsize_adjust_start_confl
Definition: Solver.h:133
lbool search(int nof_conflicts)
Definition: Solver.cpp:614
void cancelUntil(int level)
Definition: Solver.cpp:207
int nVars() const
Definition: Solver.h:328
int nClauses() const
Definition: Solver.h:326
vec< lbool > model
Definition: Solver.h:110
lbool value(Var x) const
Definition: Solver.h:321
uint64_t solves
Definition: Solver.h:138
static double luby(double y, int x)
Definition: Solver.cpp:734
#define l_False
Definition: SolverTypes.h:85
double restart_inc
Definition: Solver.h:129
double learntsize_adjust_confl
Definition: Solver.h:204
lbool Minisat::SimpSolver::solveLimited ( const vec< Lit > &  assumps,
bool  do_simp = true,
bool  turn_off_simp = false 
)
inline

Definition at line 191 of file SimpSolver.h.

191  {
192  assumps.copyTo(assumptions); return solve_(do_simp, turn_off_simp); }
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
lbool Minisat::Solver::solveLimited ( const vec< Lit > &  assumps)
inlineinherited

Definition at line 357 of file Solver.h.

357 { assumps.copyTo(assumptions); return solve_(); }
vec< Lit > assumptions
Definition: Solver.h:188
lbool solve_()
Definition: Solver.cpp:751
bool SimpSolver::strengthenClause ( CRef  cr,
Lit  l 
)
protected

Definition at line 190 of file SimpSolver.cpp.

191 {
192  Clause& c = ca[cr];
193  assert(decisionLevel() == 0);
195 
196  // FIX: this is too inefficient but would be nice to have (properly implemented)
197  // if (!find(subsumption_queue, &c))
199 
200  if (c.size() == 2){
201  removeClause(cr);
202  c.strengthen(l);
203  }else{
204  detachClause(cr, true);
205  c.strengthen(l);
206  attachClause(cr);
207  remove(occurs[var(l)], cr);
208  n_occ[toInt(l)]--;
209  updateElimHeap(var(l));
210  }
211 
212  return c.size() == 1 ? enqueue(c[0]) && propagate() == CRef_Undef : true;
213 }
void removeClause(CRef cr)
Definition: SimpSolver.cpp:175
vec< int > n_occ
Definition: SimpSolver.h:132
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
int var(Lit p)
Definition: SolverTypes.h:62
void strengthen(Lit p)
Definition: SolverTypes.h:398
Queue< CRef > subsumption_queue
Definition: SimpSolver.h:134
void attachClause(CRef cr)
Definition: Solver.cpp:162
void insert(T elem)
Definition: Queue.h:49
void updateElimHeap(Var v)
Definition: SimpSolver.h:170
void detachClause(CRef cr, bool strict=false)
Definition: Solver.cpp:171
const CRef CRef_Undef
Definition: SolverTypes.h:193
int decisionLevel() const
Definition: Solver.h:319
bool enqueue(Lit p, CRef from=CRef_Undef)
Definition: Solver.h:310
#define assert(ex)
Definition: util_old.h:213
CRef propagate()
Definition: Solver.cpp:449
int toInt(Var v)
Definition: SolverTypes.h:65
bool SimpSolver::substitute ( Var  v,
Lit  x 
)

Definition at line 533 of file SimpSolver.cpp.

534 {
535  assert(!frozen[v]);
536  assert(!isEliminated(v));
537  assert(value(v) == l_Undef);
538 
539  if (!ok) return false;
540 
541  eliminated[v] = true;
542  setDecisionVar(v, false);
543  const vec<CRef>& cls = occurs.lookup(v);
544 
545  vec<Lit>& subst_clause = add_tmp;
546  for (int i = 0; i < cls.size(); i++){
547  Clause& c = ca[cls[i]];
548 
549  subst_clause.clear();
550  for (int j = 0; j < c.size(); j++){
551  Lit p = c[j];
552  subst_clause.push(var(p) == v ? x ^ sign(p) : p);
553  }
554 
555  removeClause(cls[i]);
556 
557  if (!addClause_(subst_clause))
558  return ok = false;
559  }
560 
561  return true;
562 }
void removeClause(CRef cr)
Definition: SimpSolver.cpp:175
ClauseAllocator ca
Definition: Solver.h:193
OccLists< Var, vec< CRef >, ClauseDeleted > occurs
Definition: SimpSolver.h:131
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define l_Undef
Definition: SolverTypes.h:86
int var(Lit p)
Definition: SolverTypes.h:62
bool sign(Lit p)
Definition: SolverTypes.h:61
void setDecisionVar(Var v, bool b)
Definition: Solver.h:331
void push(void)
Definition: Vec.h:73
int size(void) const
Definition: Vec.h:63
void clear(bool dealloc=false)
Definition: Vec.h:121
bool isEliminated(Var v) const
Definition: SimpSolver.h:169
lbool value(Var x) const
Definition: Solver.h:321
vec< char > eliminated
Definition: SimpSolver.h:136
bool addClause_(vec< Lit > &ps)
Definition: SimpSolver.cpp:135
vec< Lit > add_tmp
Definition: Solver.h:201
#define assert(ex)
Definition: util_old.h:213
vec< char > frozen
Definition: SimpSolver.h:135
void Solver::toDimacs ( FILE *  f,
const vec< Lit > &  assumps 
)
inherited

Definition at line 831 of file Solver.cpp.

832 {
833  // Handle case when solver is in contradictory state:
834  if (!ok){
835  fprintf(f, "p cnf 1 2\n1 0\n-1 0\n");
836  return; }
837 
838  vec<Var> map; Var max = 0;
839 
840  // Cannot use removeClauses here because it is not safe
841  // to deallocate them at this point. Could be improved.
842  int i, cnt = 0;
843  for (i = 0; i < clauses.size(); i++)
844  if (!satisfied(ca[clauses[i]]))
845  cnt++;
846 
847  for (i = 0; i < clauses.size(); i++)
848  if (!satisfied(ca[clauses[i]])){
849  Clause& c = ca[clauses[i]];
850  for (int j = 0; j < c.size(); j++)
851  if (value(c[j]) != l_False)
852  mapVar(var(c[j]), map, max);
853  }
854 
855  // Assumptions are added as unit clauses:
856  cnt += assumptions.size();
857 
858  fprintf(f, "p cnf %d %d\n", max, cnt);
859 
860  for (i = 0; i < assumptions.size(); i++){
862  fprintf(f, "%s%d 0\n", sign(assumptions[i]) ? "-" : "", mapVar(var(assumptions[i]), map, max)+1);
863  }
864 
865  for (i = 0; i < clauses.size(); i++)
866  toDimacs(f, ca[clauses[i]], map, max);
867 
868  if (verbosity > 0)
869  printf("Wrote %d clauses with %d variables.\n", cnt, max);
870 }
ClauseAllocator ca
Definition: Solver.h:193
int var(Lit p)
Definition: SolverTypes.h:62
void map()
bool sign(Lit p)
Definition: SolverTypes.h:61
static Var mapVar(Var x, vec< Var > &map, Var &max)
Definition: Solver.cpp:800
int size(void) const
Definition: Vec.h:63
vec< Lit > assumptions
Definition: Solver.h:188
vec< CRef > clauses
Definition: Solver.h:172
static double max
Definition: cuddSubsetHB.c:134
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition: Solver.cpp:831
lbool value(Var x) const
Definition: Solver.h:321
#define l_False
Definition: SolverTypes.h:85
int Var
Definition: SolverTypes.h:42
#define assert(ex)
Definition: util_old.h:213
bool satisfied(const Clause &c) const
Definition: Solver.cpp:198
void Solver::toDimacs ( const char *  file,
const vec< Lit > &  assumps 
)
inherited

Definition at line 821 of file Solver.cpp.

822 {
823  FILE* f = fopen(file, "wr");
824  if (f == NULL)
825  fprintf(stderr, "could not open file %s\n", file), exit(1);
826  toDimacs(f, assumps);
827  fclose(f);
828 }
VOID_HACK exit()
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition: Solver.cpp:831
void Solver::toDimacs ( FILE *  f,
Clause c,
vec< Var > &  map,
Var max 
)
inherited

Definition at line 810 of file Solver.cpp.

811 {
812  if (satisfied(c)) return;
813 
814  for (int i = 0; i < c.size(); i++)
815  if (value(c[i]) != l_False)
816  fprintf(f, "%s%d ", sign(c[i]) ? "-" : "", mapVar(var(c[i]), map, max)+1);
817  fprintf(f, "0\n");
818 }
int var(Lit p)
Definition: SolverTypes.h:62
bool sign(Lit p)
Definition: SolverTypes.h:61
static Var mapVar(Var x, vec< Var > &map, Var &max)
Definition: Solver.cpp:800
static double max
Definition: cuddSubsetHB.c:134
lbool value(Var x) const
Definition: Solver.h:321
#define l_False
Definition: SolverTypes.h:85
bool satisfied(const Clause &c) const
Definition: Solver.cpp:198
void Minisat::Solver::toDimacs ( const char *  file)
inlineinherited

Definition at line 360 of file Solver.h.

360 { vec<Lit> as; toDimacs(file, as); }
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition: Solver.cpp:831
void Minisat::Solver::toDimacs ( const char *  file,
Lit  p 
)
inlineinherited

Definition at line 361 of file Solver.h.

361 { vec<Lit> as; as.push(p); toDimacs(file, as); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition: Solver.cpp:831
void Minisat::Solver::toDimacs ( const char *  file,
Lit  p,
Lit  q 
)
inlineinherited

Definition at line 362 of file Solver.h.

362 { vec<Lit> as; as.push(p); as.push(q); toDimacs(file, as); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition: Solver.cpp:831
void Minisat::Solver::toDimacs ( const char *  file,
Lit  p,
Lit  q,
Lit  r 
)
inlineinherited

Definition at line 363 of file Solver.h.

363 { vec<Lit> as; as.push(p); as.push(q); as.push(r); toDimacs(file, as); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition: Solver.cpp:831
void Solver::uncheckedEnqueue ( Lit  p,
CRef  from = CRef_Undef 
)
protectedinherited

Definition at line 429 of file Solver.cpp.

430 {
431  assert(value(p) == l_Undef);
432  assigns[var(p)] = lbool(!sign(p));
433  vardata[var(p)] = mkVarData(from, decisionLevel());
434  trail.push_(p);
435 }
char lbool
Definition: satVec.h:133
#define l_Undef
Definition: SolverTypes.h:86
int var(Lit p)
Definition: SolverTypes.h:62
bool sign(Lit p)
Definition: SolverTypes.h:61
int decisionLevel() const
Definition: Solver.h:319
vec< VarData > vardata
Definition: Solver.h:184
lbool value(Var x) const
Definition: Solver.h:321
vec< Lit > trail
Definition: Solver.h:182
#define assert(ex)
Definition: util_old.h:213
vec< lbool > assigns
Definition: Solver.h:179
static VarData mkVarData(CRef cr, int l)
Definition: Solver.h:146
void Minisat::SimpSolver::updateElimHeap ( Var  v)
inlineprotected

Definition at line 170 of file SimpSolver.h.

170  {
172  // if (!frozen[v] && !isEliminated(v) && value(v) == l_Undef)
173  if (elim_heap.inHeap(v) || (!frozen[v] && !isEliminated(v) && value(v) == l_Undef))
174  elim_heap.update(v); }
#define l_Undef
Definition: SolverTypes.h:86
Heap< ElimLt > elim_heap
Definition: SimpSolver.h:133
bool isEliminated(Var v) const
Definition: SimpSolver.h:169
lbool value(Var x) const
Definition: Solver.h:321
#define assert(ex)
Definition: util_old.h:213
vec< char > frozen
Definition: SimpSolver.h:135
lbool Minisat::Solver::value ( Var  x) const
inlineinherited

Definition at line 321 of file Solver.h.

321 { return assigns[x]; }
vec< lbool > assigns
Definition: Solver.h:179
lbool Minisat::Solver::value ( Lit  p) const
inlineinherited

Definition at line 322 of file Solver.h.

322 { return assigns[var(p)] ^ sign(p); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int var(Lit p)
Definition: SolverTypes.h:62
bool sign(Lit p)
Definition: SolverTypes.h:61
vec< lbool > assigns
Definition: Solver.h:179
void Minisat::Solver::varBumpActivity ( Var  v,
double  inc 
)
inlineprotectedinherited

Definition at line 285 of file Solver.h.

285  {
286  if ( (activity[v] += inc) > 1e100 ) {
287  // Rescale:
288  for (int i = 0; i < nVars(); i++)
289  activity[i] *= 1e-100;
290  var_inc *= 1e-100; }
291 
292  // Update order_heap with respect to new activity:
293  if (order_heap.inHeap(v))
294  order_heap.decrease(v); }
int nVars() const
Definition: Solver.h:328
vec< double > activity
Definition: Solver.h:175
double var_inc
Definition: Solver.h:176
Heap< VarOrderLt > order_heap
Definition: Solver.h:189
void Minisat::Solver::varBumpActivity ( Var  v)
inlineprotectedinherited

Definition at line 284 of file Solver.h.

284 { varBumpActivity(v, var_inc); }
double var_inc
Definition: Solver.h:176
void varBumpActivity(Var v, double inc)
Definition: Solver.h:285
void Minisat::Solver::varDecayActivity ( )
inlineprotectedinherited

Definition at line 283 of file Solver.h.

283 { var_inc *= (1 / var_decay); }
double var_decay
Definition: Solver.h:117
double var_inc
Definition: Solver.h:176
bool Minisat::Solver::withinBudget ( ) const
inlineprotectedinherited

Definition at line 344 of file Solver.h.

344  {
345  return !asynch_interrupt &&
346  (conflict_budget < 0 || conflicts < (uint64_t)conflict_budget) &&
347  (propagation_budget < 0 || propagations < (uint64_t)propagation_budget); }
int64_t conflict_budget
Definition: Solver.h:209
bool asynch_interrupt
Definition: Solver.h:211
int64_t propagation_budget
Definition: Solver.h:210
uint64_t propagations
Definition: Solver.h:138
uint64_t conflicts
Definition: Solver.h:138

Field Documentation

vec<double> Minisat::Solver::activity
protectedinherited

Definition at line 175 of file Solver.h.

vec<Lit> Minisat::Solver::add_tmp
protectedinherited

Definition at line 201 of file Solver.h.

vec<Lit> Minisat::Solver::analyze_stack
protectedinherited

Definition at line 199 of file Solver.h.

vec<Lit> Minisat::Solver::analyze_toclear
protectedinherited

Definition at line 200 of file Solver.h.

vec<lbool> Minisat::Solver::assigns
protectedinherited

Definition at line 179 of file Solver.h.

vec<Lit> Minisat::Solver::assumptions
protectedinherited

Definition at line 188 of file Solver.h.

int Minisat::SimpSolver::asymm_lits

Definition at line 96 of file SimpSolver.h.

bool Minisat::Solver::asynch_interrupt
protectedinherited

Definition at line 211 of file Solver.h.

int Minisat::SimpSolver::bwdsub_assigns
protected

Definition at line 137 of file SimpSolver.h.

CRef Minisat::SimpSolver::bwdsub_tmpunit
protected

Definition at line 142 of file SimpSolver.h.

ClauseAllocator Minisat::Solver::ca
protectedinherited

Definition at line 193 of file Solver.h.

int Minisat::Solver::ccmin_mode
inherited

Definition at line 122 of file Solver.h.

double Minisat::Solver::cla_inc
protectedinherited

Definition at line 174 of file Solver.h.

double Minisat::Solver::clause_decay
inherited

Definition at line 118 of file Solver.h.

int Minisat::SimpSolver::clause_lim

Definition at line 84 of file SimpSolver.h.

vec<CRef> Minisat::Solver::clauses
protectedinherited

Definition at line 172 of file Solver.h.

uint64_t Minisat::Solver::clauses_literals
inherited

Definition at line 139 of file Solver.h.

vec<Lit> Minisat::Solver::conflict
inherited

Definition at line 111 of file Solver.h.

int64_t Minisat::Solver::conflict_budget
protectedinherited

Definition at line 209 of file Solver.h.

uint64_t Minisat::Solver::conflicts
inherited

Definition at line 138 of file Solver.h.

uint64_t Minisat::Solver::dec_vars
inherited

Definition at line 139 of file Solver.h.

vec<char> Minisat::Solver::decision
protectedinherited

Definition at line 181 of file Solver.h.

uint64_t Minisat::Solver::decisions
inherited

Definition at line 138 of file Solver.h.

Heap<ElimLt> Minisat::SimpSolver::elim_heap
protected

Definition at line 133 of file SimpSolver.h.

vec<uint32_t> Minisat::SimpSolver::elimclauses
protected

Definition at line 128 of file SimpSolver.h.

vec<char> Minisat::SimpSolver::eliminated
protected

Definition at line 136 of file SimpSolver.h.

int Minisat::SimpSolver::eliminated_vars

Definition at line 97 of file SimpSolver.h.

int Minisat::SimpSolver::elimorder
protected

Definition at line 126 of file SimpSolver.h.

vec<char> Minisat::SimpSolver::frozen
protected

Definition at line 135 of file SimpSolver.h.

double Minisat::Solver::garbage_frac
inherited

Definition at line 126 of file Solver.h.

int Minisat::SimpSolver::grow

Definition at line 83 of file SimpSolver.h.

vec<CRef> Minisat::Solver::learnts
protectedinherited

Definition at line 173 of file Solver.h.

uint64_t Minisat::Solver::learnts_literals
inherited

Definition at line 139 of file Solver.h.

int Minisat::Solver::learntsize_adjust_cnt
protectedinherited

Definition at line 205 of file Solver.h.

double Minisat::Solver::learntsize_adjust_confl
protectedinherited

Definition at line 204 of file Solver.h.

double Minisat::Solver::learntsize_adjust_inc
inherited

Definition at line 134 of file Solver.h.

int Minisat::Solver::learntsize_adjust_start_confl
inherited

Definition at line 133 of file Solver.h.

double Minisat::Solver::learntsize_factor
inherited

Definition at line 130 of file Solver.h.

double Minisat::Solver::learntsize_inc
inherited

Definition at line 131 of file Solver.h.

bool Minisat::Solver::luby_restart
inherited

Definition at line 121 of file Solver.h.

double Minisat::Solver::max_learnts
protectedinherited

Definition at line 203 of file Solver.h.

uint64_t Minisat::Solver::max_literals
inherited

Definition at line 139 of file Solver.h.

int Minisat::SimpSolver::merges

Definition at line 95 of file SimpSolver.h.

vec<lbool> Minisat::Solver::model
inherited

Definition at line 110 of file Solver.h.

vec<int> Minisat::SimpSolver::n_occ
protected

Definition at line 132 of file SimpSolver.h.

int Minisat::SimpSolver::n_touched
protected

Definition at line 138 of file SimpSolver.h.

OccLists<Var, vec<CRef>, ClauseDeleted> Minisat::SimpSolver::occurs
protected

Definition at line 131 of file SimpSolver.h.

bool Minisat::Solver::ok
protectedinherited

Definition at line 171 of file Solver.h.

Heap<VarOrderLt> Minisat::Solver::order_heap
protectedinherited

Definition at line 189 of file Solver.h.

int Minisat::Solver::phase_saving
inherited

Definition at line 123 of file Solver.h.

vec<char> Minisat::Solver::polarity
protectedinherited

Definition at line 180 of file Solver.h.

double Minisat::Solver::progress_estimate
protectedinherited

Definition at line 190 of file Solver.h.

int64_t Minisat::Solver::propagation_budget
protectedinherited

Definition at line 210 of file Solver.h.

uint64_t Minisat::Solver::propagations
inherited

Definition at line 138 of file Solver.h.

int Minisat::Solver::qhead
protectedinherited

Definition at line 185 of file Solver.h.

double Minisat::Solver::random_seed
inherited

Definition at line 120 of file Solver.h.

double Minisat::Solver::random_var_freq
inherited

Definition at line 119 of file Solver.h.

bool Minisat::Solver::remove_satisfied
protectedinherited

Definition at line 191 of file Solver.h.

int Minisat::Solver::restart_first
inherited

Definition at line 128 of file Solver.h.

double Minisat::Solver::restart_inc
inherited

Definition at line 129 of file Solver.h.

uint64_t Minisat::Solver::rnd_decisions
inherited

Definition at line 138 of file Solver.h.

bool Minisat::Solver::rnd_init_act
inherited

Definition at line 125 of file Solver.h.

bool Minisat::Solver::rnd_pol
inherited

Definition at line 124 of file Solver.h.

vec<char> Minisat::Solver::seen
protectedinherited

Definition at line 198 of file Solver.h.

double Minisat::SimpSolver::simp_garbage_frac

Definition at line 87 of file SimpSolver.h.

int Minisat::Solver::simpDB_assigns
protectedinherited

Definition at line 186 of file Solver.h.

int64_t Minisat::Solver::simpDB_props
protectedinherited

Definition at line 187 of file Solver.h.

uint64_t Minisat::Solver::solves
inherited

Definition at line 138 of file Solver.h.

uint64_t Minisat::Solver::starts
inherited

Definition at line 138 of file Solver.h.

int Minisat::SimpSolver::subsumption_lim

Definition at line 86 of file SimpSolver.h.

Queue<CRef> Minisat::SimpSolver::subsumption_queue
protected

Definition at line 134 of file SimpSolver.h.

uint64_t Minisat::Solver::tot_literals
inherited

Definition at line 139 of file Solver.h.

vec<char> Minisat::SimpSolver::touched
protected

Definition at line 129 of file SimpSolver.h.

vec<Lit> Minisat::Solver::trail
protectedinherited

Definition at line 182 of file Solver.h.

vec<int> Minisat::Solver::trail_lim
protectedinherited

Definition at line 183 of file Solver.h.

bool Minisat::SimpSolver::use_asymm

Definition at line 89 of file SimpSolver.h.

bool Minisat::SimpSolver::use_elim

Definition at line 91 of file SimpSolver.h.

bool Minisat::SimpSolver::use_rcheck

Definition at line 90 of file SimpSolver.h.

bool Minisat::SimpSolver::use_simplification
protected

Definition at line 127 of file SimpSolver.h.

double Minisat::Solver::var_decay
inherited

Definition at line 117 of file Solver.h.

double Minisat::Solver::var_inc
protectedinherited

Definition at line 176 of file Solver.h.

vec<VarData> Minisat::Solver::vardata
protectedinherited

Definition at line 184 of file Solver.h.

int Minisat::Solver::verbosity
inherited

Definition at line 116 of file Solver.h.

OccLists<Lit, vec<Watcher>, WatcherDeleted> Minisat::Solver::watches
protectedinherited

Definition at line 178 of file Solver.h.


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