ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
Minisat::Solver Class Reference

#include <Solver.h>

Inheritance diagram for Minisat::Solver:
Collaboration diagram for Minisat::Solver:

Classes

struct  VarData
 
struct  VarOrderLt
 
struct  Watcher
 
struct  WatcherDeleted
 

Public Member Functions

 Solver ()
 
virtual ~Solver ()
 
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 simplify ()
 
bool solve (const vec< Lit > &assumps)
 
lbool solveLimited (const vec< Lit > &assumps)
 
bool solve ()
 
bool solve (Lit p)
 
bool solve (Lit p, Lit q)
 
bool solve (Lit p, Lit q, Lit r)
 
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 ()
 
virtual void garbageCollect ()
 
void checkGarbage (double gf)
 
void checkGarbage ()
 

Public Attributes

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

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)
 
void removeClause (CRef cr)
 
bool locked (const Clause &c) const
 
bool satisfied (const Clause &c) const
 
void relocAll (ClauseAllocator &to)
 
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

bool ok
 
vec< CRefclauses
 
vec< CReflearnts
 
double cla_inc
 
vec< double > activity
 
double var_inc
 
OccLists< Lit, vec< Watcher >, WatcherDeletedwatches
 
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 37 of file Solver.h.

Constructor & Destructor Documentation

◆ Solver()

Solver::Solver ( )

Definition at line 53 of file Solver.cpp.

53 :
54
55 // Parameters (user settable):
56 //
57 verbosity (0)
58 , var_decay (opt_var_decay)
59 , clause_decay (opt_clause_decay)
60 , random_var_freq (opt_random_var_freq)
61 , random_seed (opt_random_seed)
62 , luby_restart (opt_luby_restart)
63 , ccmin_mode (opt_ccmin_mode)
64 , phase_saving (opt_phase_saving)
65 , rnd_pol (false)
66 , rnd_init_act (opt_rnd_init_act)
67 , garbage_frac (opt_garbage_frac)
68 , restart_first (opt_restart_first)
69 , restart_inc (opt_restart_inc)
70
71 // Parameters (the rest):
72 //
73 , learntsize_factor((double)1/(double)3), learntsize_inc(1.1)
74
75 // Parameters (experimental):
76 //
79
80 // Statistics: (formerly in 'SolverStats')
81 //
84
85 , ok (true)
86 , cla_inc (1)
87 , var_inc (1)
89 , qhead (0)
90 , simpDB_assigns (-1)
91 , simpDB_props (0)
94 , remove_satisfied (true)
95
96 // Resource constraints:
97 //
98 , conflict_budget (-1)
100 , asynch_interrupt (false)
101{}
double learntsize_factor
Definition Solver.h:131
int64_t simpDB_props
Definition Solver.h:188
vec< double > activity
Definition Solver.h:176
uint64_t tot_literals
Definition Solver.h:140
uint64_t clauses_literals
Definition Solver.h:140
uint64_t starts
Definition Solver.h:139
double learntsize_inc
Definition Solver.h:132
double random_seed
Definition Solver.h:121
int simpDB_assigns
Definition Solver.h:187
uint64_t propagations
Definition Solver.h:139
bool remove_satisfied
Definition Solver.h:192
uint64_t rnd_decisions
Definition Solver.h:139
int64_t propagation_budget
Definition Solver.h:211
int64_t conflict_budget
Definition Solver.h:210
double var_inc
Definition Solver.h:177
bool rnd_init_act
Definition Solver.h:126
double clause_decay
Definition Solver.h:119
double restart_inc
Definition Solver.h:130
bool luby_restart
Definition Solver.h:122
uint64_t conflicts
Definition Solver.h:139
double var_decay
Definition Solver.h:118
double random_var_freq
Definition Solver.h:120
uint64_t learnts_literals
Definition Solver.h:140
double cla_inc
Definition Solver.h:175
OccLists< Lit, vec< Watcher >, WatcherDeleted > watches
Definition Solver.h:179
ClauseAllocator ca
Definition Solver.h:194
uint64_t dec_vars
Definition Solver.h:140
uint64_t max_literals
Definition Solver.h:140
double garbage_frac
Definition Solver.h:127
double learntsize_adjust_inc
Definition Solver.h:135
double progress_estimate
Definition Solver.h:191
uint64_t decisions
Definition Solver.h:139
uint64_t solves
Definition Solver.h:139
int restart_first
Definition Solver.h:129
bool asynch_interrupt
Definition Solver.h:212
Heap< VarOrderLt > order_heap
Definition Solver.h:190
int learntsize_adjust_start_confl
Definition Solver.h:134

◆ ~Solver()

Solver::~Solver ( )
virtual

Definition at line 104 of file Solver.cpp.

105{
106}

Member Function Documentation

◆ abstractLevel()

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

Definition at line 321 of file Solver.h.

321{ return 1 << (level(x) & 31); }
int level(Var x) const
Definition Solver.h:279
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addClause() [1/4]

bool Minisat::Solver::addClause ( const vec< Lit > & ps)
inline

Definition at line 312 of file Solver.h.

312{ ps.copyTo(add_tmp); return addClause_(add_tmp); }
bool addClause_(vec< Lit > &ps)
Definition Solver.cpp:134
vec< Lit > add_tmp
Definition Solver.h:202
Here is the call graph for this function:

◆ addClause() [2/4]

bool Minisat::Solver::addClause ( Lit p)
inline

Definition at line 314 of file Solver.h.

314{ add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); }
Cube * p
Definition exorList.c:222
Here is the call graph for this function:

◆ addClause() [3/4]

bool Minisat::Solver::addClause ( Lit p,
Lit q )
inline

Definition at line 315 of file Solver.h.

315{ add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); }
Here is the call graph for this function:

◆ addClause() [4/4]

bool Minisat::Solver::addClause ( Lit p,
Lit q,
Lit r )
inline

Definition at line 316 of file Solver.h.

316{ add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); }
Here is the call graph for this function:

◆ addClause_()

bool Solver::addClause_ ( vec< Lit > & ps)

Definition at line 134 of file Solver.cpp.

135{
136 assert(decisionLevel() == 0);
137 if (!ok) return false;
138
139 // Check if clause is satisfied and remove false/duplicate literals:
140 sort(ps);
141 Lit p; int i, j;
142 for (i = j = 0, p = lit_Undef; i < ps.size(); i++)
143 if (value(ps[i]) == l_True || ps[i] == ~p)
144 return true;
145 else if (value(ps[i]) != l_False && ps[i] != p)
146 ps[j++] = p = ps[i];
147 ps.shrink(i - j);
148
149 if (ps.size() == 0)
150 return ok = false;
151 else if (ps.size() == 1){
152 uncheckedEnqueue(ps[0]);
153 return ok = (propagate() == CRef_Undef);
154 }else{
155 CRef cr = ca.alloc(ps, false);
156 clauses.push(cr);
157 attachClause(cr);
158 }
159
160 return true;
161}
#define l_True
Definition bmcBmcS.c:35
#define l_False
Definition bmcBmcS.c:36
ABC_NAMESPACE_IMPL_START typedef signed char value
CRef propagate()
Definition Solver.cpp:451
void attachClause(CRef cr)
Definition Solver.cpp:164
int decisionLevel() const
Definition Solver.h:320
vec< CRef > clauses
Definition Solver.h:173
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition Solver.cpp:431
void shrink(int nelems)
Definition Vec.h:66
int size(void) const
Definition Vec.h:65
const CRef CRef_Undef
void sort(T *array, int size, LessThan lt)
Definition Sort.h:58
RegionAllocator< uint32_t >::Ref CRef
const Lit lit_Undef
Definition SolverTypes.h:74
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addEmptyClause()

bool Minisat::Solver::addEmptyClause ( )
inline

Definition at line 313 of file Solver.h.

313{ add_tmp.clear(); return addClause_(add_tmp); }
Here is the call graph for this function:

◆ analyze()

void Solver::analyze ( CRef confl,
vec< Lit > & out_learnt,
int & out_btlevel )
protected

Definition at line 266 of file Solver.cpp.

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

◆ analyzeFinal()

void Solver::analyzeFinal ( Lit p,
vec< Lit > & out_conflict )
protected

Definition at line 401 of file Solver.cpp.

402{
403 out_conflict.clear();
404 out_conflict.push(p);
405
406 if (decisionLevel() == 0)
407 return;
408
409 seen[var(p)] = 1;
410
411 for (int i = trail.size()-1; i >= trail_lim[0]; i--){
412 Var x = var(trail[i]);
413 if (seen[x]){
414 if (reason(x) == CRef_Undef){
415 assert(level(x) > 0);
416 out_conflict.push(~trail[i]);
417 }else{
418 Clause& c = ca[reason(x)];
419 for (int j = 1; j < c.size(); j++)
420 if (level(var(c[j])) > 0)
421 seen[var(c[j])] = 1;
422 }
423 seen[x] = 0;
424 }
425 }
426
427 seen[var(p)] = 0;
428}
vec< int > trail_lim
Definition Solver.h:184
void clear(bool dealloc=false)
Definition Vec.h:126
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attachClause()

void Solver::attachClause ( CRef cr)
protected

Definition at line 164 of file Solver.cpp.

164 {
165 const Clause& c = ca[cr];
166 assert(c.size() > 1);
167 watches[~c[0]].push(Watcher(cr, c[1]));
168 watches[~c[1]].push(Watcher(cr, c[0]));
169 if (c.learnt()) learnts_literals += c.size();
170 else clauses_literals += c.size(); }
Here is the caller graph for this function:

◆ budgetOff()

void Minisat::Solver::budgetOff ( )
inline

Definition at line 344 of file Solver.h.

Here is the caller graph for this function:

◆ cancelUntil()

void Solver::cancelUntil ( int level)
protected

Definition at line 209 of file Solver.cpp.

209 {
210 if (decisionLevel() > level){
211 for (int c = trail.size()-1; c >= trail_lim[level]; c--){
212 Var x = var(trail[c]);
213 assigns [x] = l_Undef;
214 if (phase_saving > 1 || ((phase_saving == 1) && c > trail_lim.last()))
215 polarity[x] = sign(trail[c]);
216 insertVarOrder(x); }
218 trail.shrink(trail.size() - trail_lim[level]);
219 trail_lim.shrink(trail_lim.size() - level);
220 } }
#define l_Undef
Definition bmcBmcS.c:34
vec< lbool > assigns
Definition Solver.h:180
void insertVarOrder(Var x)
Definition Solver.h:281
vec< char > polarity
Definition Solver.h:181
bool sign(Lit p)
Definition SolverTypes.h:63
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkGarbage() [1/2]

void Minisat::Solver::checkGarbage ( void )
inline

Definition at line 305 of file Solver.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkGarbage() [2/2]

void Minisat::Solver::checkGarbage ( double gf)
inline

Definition at line 306 of file Solver.h.

306 {
307 if (ca.wasted() > ca.size() * gf)
308 garbageCollect(); }
virtual void garbageCollect()
Definition Solver.cpp:915
Here is the call graph for this function:

◆ claBumpActivity()

void Minisat::Solver::claBumpActivity ( Clause & c)
inlineprotected

Definition at line 298 of file Solver.h.

298 {
299 if ( (c.activity() += cla_inc) > 1e20 ) {
300 // Rescale:
301 for (int i = 0; i < learnts.size(); i++)
302 ca[learnts[i]].activity() *= (float)1e-20;
303 cla_inc *= 1e-20; } }
vec< CRef > learnts
Definition Solver.h:174
Here is the call graph for this function:
Here is the caller graph for this function:

◆ claDecayActivity()

void Minisat::Solver::claDecayActivity ( )
inlineprotected

Definition at line 297 of file Solver.h.

297{ cla_inc *= (1 / clause_decay); }
Here is the caller graph for this function:

◆ clearInterrupt()

void Minisat::Solver::clearInterrupt ( )
inline

Definition at line 343 of file Solver.h.

343{ asynch_interrupt = false; }

◆ decisionLevel()

int Minisat::Solver::decisionLevel ( ) const
inlineprotected

Definition at line 320 of file Solver.h.

320{ return trail_lim.size(); }
Here is the caller graph for this function:

◆ detachClause()

void Solver::detachClause ( CRef cr,
bool strict = false )
protected

Definition at line 173 of file Solver.cpp.

173 {
174 const Clause& c = ca[cr];
175 assert(c.size() > 1);
176
177 if (strict){
178 remove(watches[~c[0]], Watcher(cr, c[1]));
179 remove(watches[~c[1]], Watcher(cr, c[0]));
180 }else{
181 // Lazy detaching: (NOTE! Must clean all watcher lists before garbage collecting this clause)
182 watches.smudge(~c[0]);
183 watches.smudge(~c[1]);
184 }
185
186 if (c.learnt()) learnts_literals -= c.size();
187 else clauses_literals -= c.size(); }
Here is the caller graph for this function:

◆ drand()

static double Minisat::Solver::drand ( double & seed)
inlinestaticprotected

Definition at line 263 of file Solver.h.

263 {
264 seed *= 1389796;
265 int q = (int)(seed / 2147483647);
266 seed -= (double)q * 2147483647;
267 return seed / 2147483647; }
Here is the caller graph for this function:

◆ enqueue()

bool Minisat::Solver::enqueue ( Lit p,
CRef from = CRef_Undef )
inlineprotected

Definition at line 311 of file Solver.h.

311{ return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ garbageCollect()

void Solver::garbageCollect ( )
virtual

Reimplemented in Minisat::SimpSolver.

Definition at line 915 of file Solver.cpp.

916{
917 // Initialize the next region to a size corresponding to the estimated utilization degree. This
918 // is not precise but should avoid some unnecessary reallocations for the new region:
919 ClauseAllocator to(ca.size() - ca.wasted());
920
921 relocAll(to);
922 if (verbosity >= 2)
923 printf("| Garbage collection: %12d bytes => %12d bytes |\n",
925 to.moveTo(ca);
926}
void relocAll(ClauseAllocator &to)
Definition Solver.cpp:878
Here is the call graph for this function:
Here is the caller graph for this function:

◆ insertVarOrder()

void Minisat::Solver::insertVarOrder ( Var x)
inlineprotected

Definition at line 281 of file Solver.h.

281 {
282 if (!order_heap.inHeap(x) && decision[x]) order_heap.insert(x); }
vec< char > decision
Definition Solver.h:182
Here is the caller graph for this function:

◆ interrupt()

void Minisat::Solver::interrupt ( )
inline

Definition at line 342 of file Solver.h.

342{ asynch_interrupt = true; }

◆ irand()

static int Minisat::Solver::irand ( double & seed,
int size )
inlinestaticprotected

Definition at line 270 of file Solver.h.

270 {
271 return (int)(drand(seed) * size); }
static double drand(double &seed)
Definition Solver.h:263
unsigned long long size
Definition giaNewBdd.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ level()

int Minisat::Solver::level ( Var x) const
inlineprotected

Definition at line 279 of file Solver.h.

279{ return vardata[x].level; }
vec< VarData > vardata
Definition Solver.h:185
Here is the caller graph for this function:

◆ litRedundant()

bool Solver::litRedundant ( Lit p,
uint32_t abstract_levels )
protected

Definition at line 363 of file Solver.cpp.

364{
365 analyze_stack.clear(); analyze_stack.push(p);
366 int top = analyze_toclear.size();
367 while (analyze_stack.size() > 0){
369 Clause& c = ca[reason(var(analyze_stack.last()))]; analyze_stack.pop();
370
371 for (int i = 1; i < c.size(); i++){
372 Lit p = c[i];
373 if (!seen[var(p)] && level(var(p)) > 0){
374 if (reason(var(p)) != CRef_Undef && (abstractLevel(var(p)) & abstract_levels) != 0){
375 seen[var(p)] = 1;
376 analyze_stack.push(p);
377 analyze_toclear.push(p);
378 }else{
379 for (int j = top; j < analyze_toclear.size(); j++)
380 seen[var(analyze_toclear[j])] = 0;
381 analyze_toclear.shrink(analyze_toclear.size() - top);
382 return false;
383 }
384 }
385 }
386 }
387
388 return true;
389}
vec< Lit > analyze_stack
Definition Solver.h:200
Here is the call graph for this function:
Here is the caller graph for this function:

◆ locked()

bool Minisat::Solver::locked ( const Clause & c) const
inlineprotected

Definition at line 317 of file Solver.h.

317{ return value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mkVarData()

static VarData Minisat::Solver::mkVarData ( CRef cr,
int l )
inlinestaticprotected

Definition at line 147 of file Solver.h.

147{ VarData d = {cr, l}; return d; }
Here is the caller graph for this function:

◆ modelValue() [1/2]

lbool Minisat::Solver::modelValue ( Lit p) const
inline

Definition at line 325 of file Solver.h.

325{ return model[var(p)] ^ sign(p); }
vec< lbool > model
Definition Solver.h:111
Here is the call graph for this function:

◆ modelValue() [2/2]

lbool Minisat::Solver::modelValue ( Var x) const
inline

Definition at line 324 of file Solver.h.

324{ return model[x]; }
Here is the caller graph for this function:

◆ nAssigns()

int Minisat::Solver::nAssigns ( ) const
inline

Definition at line 326 of file Solver.h.

326{ return trail.size(); }
Here is the caller graph for this function:

◆ nClauses()

int Minisat::Solver::nClauses ( ) const
inline

Definition at line 327 of file Solver.h.

327{ return clauses.size(); }
Here is the caller graph for this function:

◆ newDecisionLevel()

void Minisat::Solver::newDecisionLevel ( )
inlineprotected

Definition at line 318 of file Solver.h.

318{ trail_lim.push(trail.size()); }
Here is the caller graph for this function:

◆ newVar()

Var Solver::newVar ( bool polarity = true,
bool dvar = true )

Definition at line 116 of file Solver.cpp.

117{
118 int v = nVars();
119 watches .init(mkLit(v, false));
120 watches .init(mkLit(v, true ));
121 assigns .push(l_Undef);
122 vardata .push(mkVarData(CRef_Undef, 0));
123 //activity .push(0);
124 activity .push(rnd_init_act ? drand(random_seed) * 0.00001 : 0);
125 seen .push(0);
126 polarity .push(sign);
127 decision .push();
128 trail .capacity(v+1);
129 setDecisionVar(v, dvar);
130 return v;
131}
int nVars() const
Definition Solver.h:329
static VarData mkVarData(CRef cr, int l)
Definition Solver.h:147
void setDecisionVar(Var v, bool b)
Definition Solver.h:332
Lit mkLit(Var var, bool sign=false)
Definition SolverTypes.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nFreeVars()

int Minisat::Solver::nFreeVars ( ) const
inline

Definition at line 330 of file Solver.h.

330{ return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); }

◆ nLearnts()

int Minisat::Solver::nLearnts ( ) const
inline

Definition at line 328 of file Solver.h.

328{ return learnts.size(); }
Here is the caller graph for this function:

◆ nVars()

int Minisat::Solver::nVars ( ) const
inline

Definition at line 329 of file Solver.h.

329{ return vardata.size(); }
Here is the caller graph for this function:

◆ okay()

bool Minisat::Solver::okay ( ) const
inline

Definition at line 359 of file Solver.h.

359{ return ok; }

◆ pickBranchLit()

Lit Solver::pickBranchLit ( )
protected

Definition at line 227 of file Solver.cpp.

228{
229 Var next = var_Undef;
230
231 // Random decision:
232 if (drand(random_seed) < random_var_freq && !order_heap.empty()){
233 next = order_heap[irand(random_seed,order_heap.size())];
234 if (value(next) == l_Undef && decision[next])
235 rnd_decisions++; }
236
237 // Activity based decision:
238 while (next == var_Undef || value(next) != l_Undef || !decision[next])
239 if (order_heap.empty()){
240 next = var_Undef;
241 break;
242 }else
243 next = order_heap.removeMin();
244
245 return next == var_Undef ? lit_Undef : mkLit(next, rnd_pol ? drand(random_seed) < 0.5 : polarity[next]);
246}
#define var_Undef
Definition SolverTypes.h:45
static int irand(double &seed, int size)
Definition Solver.h:270
Here is the call graph for this function:
Here is the caller graph for this function:

◆ progressEstimate()

double Solver::progressEstimate ( ) const
protected

Definition at line 710 of file Solver.cpp.

711{
712 double progress = 0;
713 double F = 1.0 / nVars();
714
715 for (int i = 0; i <= decisionLevel(); i++){
716 int beg = i == 0 ? 0 : trail_lim[i - 1];
717 int end = i == decisionLevel() ? trail.size() : trail_lim[i];
718 progress += pow(F, i) * (end - beg);
719 }
720
721 return progress / nVars();
722}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ propagate()

CRef Solver::propagate ( )
protected

Definition at line 451 of file Solver.cpp.

452{
453 CRef confl = CRef_Undef;
454 int num_props = 0;
455 watches.cleanAll();
456
457 while (qhead < trail.size()){
458 Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate.
459 vec<Watcher>& ws = watches[p];
460 Watcher *i, *j, *end;
461 num_props++;
462
463 for (i = j = (Watcher*)ws, end = i + ws.size(); i != end;){
464 // Try to avoid inspecting the clause:
465 Lit blocker = i->blocker;
466 if (value(blocker) == l_True){
467 *j++ = *i++; continue; }
468
469 // Make sure the false literal is data[1]:
470 CRef cr = i->cref;
471 Clause& c = ca[cr];
472 Lit false_lit = ~p;
473 if (c[0] == false_lit)
474 c[0] = c[1], c[1] = false_lit;
475 assert(c[1] == false_lit);
476 i++;
477
478 // If 0th watch is true, then clause is already satisfied.
479 Lit first = c[0];
480 Watcher w = Watcher(cr, first);
481 if (first != blocker && value(first) == l_True){
482 *j++ = w; continue; }
483
484 // Look for new watch:
485 for (int k = 2; k < c.size(); k++)
486 if (value(c[k]) != l_False){
487 c[1] = c[k]; c[k] = false_lit;
488 watches[~c[1]].push(w);
489 goto NextClause; }
490
491 // Did not find watch -- clause is unit under assignment:
492 *j++ = w;
493 if (value(first) == l_False){
494 confl = cr;
495 qhead = trail.size();
496 // Copy the remaining watches:
497 while (i < end)
498 *j++ = *i++;
499 }else
500 uncheckedEnqueue(first, cr);
501
502 NextClause:;
503 }
504 ws.shrink(i - j);
505 }
506 propagations += num_props;
507 simpDB_props -= num_props;
508
509 return confl;
510}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reason()

CRef Minisat::Solver::reason ( Var x) const
inlineprotected

Definition at line 278 of file Solver.h.

278{ return vardata[x].reason; }
Here is the caller graph for this function:

◆ rebuildOrderHeap()

void Solver::rebuildOrderHeap ( )
protected

Definition at line 561 of file Solver.cpp.

562{
563 vec<Var> vs;
564 for (Var v = 0; v < nVars(); v++)
565 if (decision[v] && value(v) == l_Undef)
566 vs.push(v);
567 order_heap.build(vs);
568}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduceDB()

void Solver::reduceDB ( )
protected

Definition at line 527 of file Solver.cpp.

528{
529 int i, j;
530 double extra_lim = cla_inc / learnts.size(); // Remove any clause below this activity
531
532 sort(learnts, reduceDB_lt(ca));
533 // Don't delete binary or locked clauses. From the rest, delete clauses from the first half
534 // and clauses with activity smaller than 'extra_lim':
535 for (i = j = 0; i < learnts.size(); i++){
536 Clause& c = ca[learnts[i]];
537 if (c.size() > 2 && !locked(c) && (i < learnts.size() / 2 || c.activity() < extra_lim))
539 else
540 learnts[j++] = learnts[i];
541 }
542 learnts.shrink(i - j);
543 checkGarbage();
544}
float & activity()
bool locked(const Clause &c) const
Definition Solver.h:317
void removeClause(CRef cr)
Definition Solver.cpp:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ relocAll()

void Solver::relocAll ( ClauseAllocator & to)
protected

Definition at line 878 of file Solver.cpp.

879{
880 // All watchers:
881 //
882 // for (int i = 0; i < watches.size(); i++)
883 watches.cleanAll();
884 for (int v = 0; v < nVars(); v++)
885 for (int s = 0; s < 2; s++){
886 Lit p = mkLit(v, s);
887 // printf(" >>> RELOCING: %s%d\n", sign(p)?"-":"", var(p)+1);
888 vec<Watcher>& ws = watches[p];
889 for (int j = 0; j < ws.size(); j++)
890 ca.reloc(ws[j].cref, to);
891 }
892
893 // All reasons:
894 //
895 int i;
896 for (i = 0; i < trail.size(); i++){
897 Var v = var(trail[i]);
898
899 if (reason(v) != CRef_Undef && (ca[reason(v)].reloced() || locked(ca[reason(v)])))
900 ca.reloc(vardata[v].reason, to);
901 }
902
903 // All learnt:
904 //
905 for (i = 0; i < learnts.size(); i++)
906 ca.reloc(learnts[i], to);
907
908 // All original:
909 //
910 for (i = 0; i < clauses.size(); i++)
911 ca.reloc(clauses[i], to);
912}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeClause()

void Solver::removeClause ( CRef cr)
protected

Definition at line 190 of file Solver.cpp.

190 {
191 Clause& c = ca[cr];
192 detachClause(cr);
193 // Don't leave pointers to free'd memory!
194 if (locked(c)) vardata[var(c[0])].reason = CRef_Undef;
195 c.mark(1);
196 ca._free(cr);
197}
void detachClause(CRef cr, bool strict=false)
Definition Solver.cpp:173
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeSatisfied()

void Solver::removeSatisfied ( vec< CRef > & cs)
protected

Definition at line 547 of file Solver.cpp.

548{
549 int i, j;
550 for (i = j = 0; i < cs.size(); i++){
551 Clause& c = ca[cs[i]];
552 if (satisfied(c))
553 removeClause(cs[i]);
554 else
555 cs[j++] = cs[i];
556 }
557 cs.shrink(i - j);
558}
bool satisfied(const Clause &c) const
Definition Solver.cpp:200
Here is the call graph for this function:
Here is the caller graph for this function:

◆ satisfied()

bool Solver::satisfied ( const Clause & c) const
protected

Definition at line 200 of file Solver.cpp.

200 {
201 for (int i = 0; i < c.size(); i++)
202 if (value(c[i]) == l_True)
203 return true;
204 return false; }
Here is the caller graph for this function:

◆ search()

lbool Solver::search ( int nof_conflicts)
protected

Definition at line 616 of file Solver.cpp.

617{
618 assert(ok);
619 int backtrack_level;
620 int conflictC = 0;
621 vec<Lit> learnt_clause;
622 starts++;
623
624 for (;;){
625 CRef confl = propagate();
626 if (confl != CRef_Undef){
627 // CONFLICT
628 conflicts++; conflictC++;
629 if (decisionLevel() == 0) return l_False;
630
631 learnt_clause.clear();
632 analyze(confl, learnt_clause, backtrack_level);
633 cancelUntil(backtrack_level);
634
635 if (learnt_clause.size() == 1){
636 uncheckedEnqueue(learnt_clause[0]);
637 }else{
638 CRef cr = ca.alloc(learnt_clause, true);
639 learnts.push(cr);
640 attachClause(cr);
641 claBumpActivity(ca[cr]);
642 uncheckedEnqueue(learnt_clause[0], cr);
643 }
644
647
648 if (--learntsize_adjust_cnt == 0){
652
653 if (verbosity >= 1)
654 printf("| %9d | %7d %8d %8d | %8d %8d %6.0f | %6.3f %% |\n",
655 (int)conflicts,
656 (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]), nClauses(), (int)clauses_literals,
657 (int)max_learnts, nLearnts(), ((double)((int64_t)learnts_literals))/nLearnts(), progressEstimate()*100);
658 }
659
660 }else{
661 // NO CONFLICT
662 if ( (nof_conflicts >= 0 && conflictC >= nof_conflicts) || !withinBudget()){
663 // Reached bound on number of conflicts:
665 cancelUntil(0);
666 return l_Undef; }
667
668 // Simplify the set of problem clauses:
669 if (decisionLevel() == 0 && !simplify())
670 return l_False;
671
672 if (learnts.size()-nAssigns() >= max_learnts)
673 // Reduce the set of learnt clauses:
674 reduceDB();
675
676 Lit next = lit_Undef;
677 while (decisionLevel() < assumptions.size()){
678 // Perform user provided assumption:
679 Lit p = assumptions[decisionLevel()];
680 if (value(p) == l_True){
681 // Dummy decision level:
683 }else if (value(p) == l_False){
685 return l_False;
686 }else{
687 next = p;
688 break;
689 }
690 }
691
692 if (next == lit_Undef){
693 // New variable decision:
694 decisions++;
695 next = pickBranchLit();
696
697 if (next == lit_Undef)
698 // Model found:
699 return l_True;
700 }
701
702 // Increase decision level and enqueue 'next'
704 uncheckedEnqueue(next);
705 }
706 }
707}
vec< Lit > conflict
Definition Solver.h:112
Lit pickBranchLit()
Definition Solver.cpp:227
int nLearnts() const
Definition Solver.h:328
void cancelUntil(int level)
Definition Solver.cpp:209
void claDecayActivity()
Definition Solver.h:297
void varDecayActivity()
Definition Solver.h:284
double progressEstimate() const
Definition Solver.cpp:710
void reduceDB()
Definition Solver.cpp:527
void newDecisionLevel()
Definition Solver.h:318
void analyze(CRef confl, vec< Lit > &out_learnt, int &out_btlevel)
Definition Solver.cpp:266
void analyzeFinal(Lit p, vec< Lit > &out_conflict)
Definition Solver.cpp:401
double max_learnts
Definition Solver.h:204
int learntsize_adjust_cnt
Definition Solver.h:206
bool withinBudget() const
Definition Solver.h:345
int nAssigns() const
Definition Solver.h:326
bool simplify()
Definition Solver.cpp:579
vec< Lit > assumptions
Definition Solver.h:189
double learntsize_adjust_confl
Definition Solver.h:205
int nClauses() const
Definition Solver.h:327
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setConfBudget()

void Minisat::Solver::setConfBudget ( int64_t x)
inline

Definition at line 340 of file Solver.h.

340{ conflict_budget = conflicts + x; }

◆ setDecisionVar()

void Minisat::Solver::setDecisionVar ( Var v,
bool b )
inline

Definition at line 332 of file Solver.h.

333{
334 if ( b && !decision[v]) dec_vars++;
335 else if (!b && decision[v]) dec_vars--;
336
337 decision[v] = b;
339}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setPolarity()

void Minisat::Solver::setPolarity ( Var v,
bool b )
inline

Definition at line 331 of file Solver.h.

331{ polarity[v] = b; }

◆ setPropBudget()

void Minisat::Solver::setPropBudget ( int64_t x)
inline

Definition at line 341 of file Solver.h.

◆ simplify()

bool Solver::simplify ( )

Definition at line 579 of file Solver.cpp.

580{
581 assert(decisionLevel() == 0);
582
583 if (!ok || propagate() != CRef_Undef)
584 return ok = false;
585
586 if (nAssigns() == simpDB_assigns || (simpDB_props > 0))
587 return true;
588
589 // Remove satisfied clauses:
591 if (remove_satisfied) // Can be turned off.
593 checkGarbage();
595
597 simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now)
598
599 return true;
600}
void rebuildOrderHeap()
Definition Solver.cpp:561
void removeSatisfied(vec< CRef > &cs)
Definition Solver.cpp:547
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solve() [1/5]

bool Minisat::Solver::solve ( )
inline

Definition at line 353 of file Solver.h.

353{ budgetOff(); assumptions.clear(); return solve_() == l_True; }
void budgetOff()
Definition Solver.h:344
lbool solve_()
Definition Solver.cpp:753
Here is the call graph for this function:

◆ solve() [2/5]

bool Minisat::Solver::solve ( const vec< Lit > & assumps)
inline

Definition at line 357 of file Solver.h.

357{ budgetOff(); assumps.copyTo(assumptions); return solve_() == l_True; }
Here is the call graph for this function:

◆ solve() [3/5]

bool Minisat::Solver::solve ( Lit p)
inline

Definition at line 354 of file Solver.h.

354{ budgetOff(); assumptions.clear(); assumptions.push(p); return solve_() == l_True; }
Here is the call graph for this function:

◆ solve() [4/5]

bool Minisat::Solver::solve ( Lit p,
Lit q )
inline

Definition at line 355 of file Solver.h.

355{ budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_() == l_True; }
Here is the call graph for this function:

◆ solve() [5/5]

bool Minisat::Solver::solve ( Lit p,
Lit q,
Lit r )
inline

Definition at line 356 of file Solver.h.

356{ budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_() == l_True; }
Here is the call graph for this function:

◆ solve_()

lbool Solver::solve_ ( )
protected

Definition at line 753 of file Solver.cpp.

754{
755 model.clear();
756 conflict.clear();
757 if (!ok) return l_False;
758
759 solves++;
760
764 lbool status = l_Undef;
765
766 if (verbosity >= 1){
767 printf("============================[ Search Statistics ]==============================\n");
768 printf("| Conflicts | ORIGINAL | LEARNT | Progress |\n");
769 printf("| | Vars Clauses Literals | Limit Clauses Lit/Cl | |\n");
770 printf("===============================================================================\n");
771 }
772
773 // Search:
774 int curr_restarts = 0;
775 while (status == l_Undef){
776 double rest_base = luby_restart ? luby(restart_inc, curr_restarts) : pow(restart_inc, curr_restarts);
777 status = search(rest_base * restart_first);
778 if (!withinBudget()) break;
779 curr_restarts++;
780 }
781
782 if (verbosity >= 1)
783 printf("===============================================================================\n");
784
785
786 if (status == l_True){
787 // Extend & copy model:
788 model.growTo(nVars());
789 for (int i = 0; i < nVars(); i++) model[i] = value(i);
790 }else if (status == l_False && conflict.size() == 0)
791 ok = false;
792
793 cancelUntil(0);
794 return status;
795}
lbool search(int nof_conflicts)
Definition Solver.cpp:616
double luby(double y, int x)
Definition satSolver.c:1797
signed char lbool
Definition satVec.h:135
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solveLimited()

lbool Minisat::Solver::solveLimited ( const vec< Lit > & assumps)
inline

Definition at line 358 of file Solver.h.

358{ assumps.copyTo(assumptions); return solve_(); }
Here is the call graph for this function:

◆ toDimacs() [1/7]

void Minisat::Solver::toDimacs ( const char * file)
inline

Definition at line 361 of file Solver.h.

361{ vec<Lit> as; toDimacs(file, as); }
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition Solver.cpp:833
struct file file
Definition file.h:21
Here is the call graph for this function:

◆ toDimacs() [2/7]

void Solver::toDimacs ( const char * file,
const vec< Lit > & assumps )

Definition at line 823 of file Solver.cpp.

824{
825 FILE* f = fopen(file, "wb");
826 if (f == NULL)
827 fprintf(stderr, "could not open file %s\n", file), exit(1);
828 toDimacs(f, assumps);
829 fclose(f);
830}
VOID_HACK exit()
Here is the call graph for this function:

◆ toDimacs() [3/7]

void Minisat::Solver::toDimacs ( const char * file,
Lit p )
inline

Definition at line 362 of file Solver.h.

362{ vec<Lit> as; as.push(p); toDimacs(file, as); }
Here is the call graph for this function:

◆ toDimacs() [4/7]

void Minisat::Solver::toDimacs ( const char * file,
Lit p,
Lit q )
inline

Definition at line 363 of file Solver.h.

363{ vec<Lit> as; as.push(p); as.push(q); toDimacs(file, as); }
Here is the call graph for this function:

◆ toDimacs() [5/7]

void Minisat::Solver::toDimacs ( const char * file,
Lit p,
Lit q,
Lit r )
inline

Definition at line 364 of file Solver.h.

364{ vec<Lit> as; as.push(p); as.push(q); as.push(r); toDimacs(file, as); }
Here is the call graph for this function:

◆ toDimacs() [6/7]

void Solver::toDimacs ( FILE * f,
Clause & c,
vec< Var > & map,
Var & max )

Definition at line 812 of file Solver.cpp.

813{
814 if (satisfied(c)) return;
815
816 for (int i = 0; i < c.size(); i++)
817 if (value(c[i]) != l_False)
818 fprintf(f, "%s%d ", sign(c[i]) ? "-" : "", mapVar(var(c[i]), map, max)+1);
819 fprintf(f, "0\n");
820}
void map()
Here is the call graph for this function:

◆ toDimacs() [7/7]

void Solver::toDimacs ( FILE * f,
const vec< Lit > & assumps )

Definition at line 833 of file Solver.cpp.

834{
835 // Handle case when solver is in contradictory state:
836 if (!ok){
837 fprintf(f, "p cnf 1 2\n1 0\n-1 0\n");
838 return; }
839
840 vec<Var> map; Var max = 0;
841
842 // Cannot use removeClauses here because it is not safe
843 // to deallocate them at this point. Could be improved.
844 int i, cnt = 0;
845 for (i = 0; i < clauses.size(); i++)
846 if (!satisfied(ca[clauses[i]]))
847 cnt++;
848
849 for (i = 0; i < clauses.size(); i++)
850 if (!satisfied(ca[clauses[i]])){
851 Clause& c = ca[clauses[i]];
852 for (int j = 0; j < c.size(); j++)
853 if (value(c[j]) != l_False)
854 mapVar(var(c[j]), map, max);
855 }
856
857 // Assumptions are added as unit clauses:
858 cnt += assumptions.size();
859
860 fprintf(f, "p cnf %d %d\n", max, cnt);
861
862 for (i = 0; i < assumptions.size(); i++){
864 fprintf(f, "%s%d 0\n", sign(assumptions[i]) ? "-" : "", mapVar(var(assumptions[i]), map, max)+1);
865 }
866
867 for (i = 0; i < clauses.size(); i++)
868 toDimacs(f, ca[clauses[i]], map, max);
869
870 if (verbosity > 0)
871 printf("Wrote %d clauses with %d variables.\n", cnt, max);
872}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ uncheckedEnqueue()

void Solver::uncheckedEnqueue ( Lit p,
CRef from = CRef_Undef )
protected

Definition at line 431 of file Solver.cpp.

432{
433 assert(value(p) == l_Undef);
434 assigns[var(p)] = lbool(!sign(p));
435 vardata[var(p)] = mkVarData(from, decisionLevel());
436 trail.push_(p);
437}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ value() [1/2]

lbool Minisat::Solver::value ( Lit p) const
inline

Definition at line 323 of file Solver.h.

323{ return assigns[var(p)] ^ sign(p); }
Here is the call graph for this function:

◆ value() [2/2]

lbool Minisat::Solver::value ( Var x) const
inline

Definition at line 322 of file Solver.h.

322{ return assigns[x]; }
Here is the caller graph for this function:

◆ varBumpActivity() [1/2]

void Minisat::Solver::varBumpActivity ( Var v)
inlineprotected

Definition at line 285 of file Solver.h.

Here is the call graph for this function:

◆ varBumpActivity() [2/2]

void Minisat::Solver::varBumpActivity ( Var v,
double inc )
inlineprotected

Definition at line 286 of file Solver.h.

286 {
287 if ( (activity[v] += inc) > 1e100 ) {
288 // Rescale:
289 for (int i = 0; i < nVars(); i++)
290 activity[i] *= 1e-100;
291 var_inc *= 1e-100; }
292
293 // Update order_heap with respect to new activity:
294 if (order_heap.inHeap(v))
295 order_heap.decrease(v); }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ varDecayActivity()

void Minisat::Solver::varDecayActivity ( )
inlineprotected

Definition at line 284 of file Solver.h.

284{ var_inc *= (1 / var_decay); }
Here is the caller graph for this function:

◆ withinBudget()

bool Minisat::Solver::withinBudget ( ) const
inlineprotected

Definition at line 345 of file Solver.h.

345 {
346 return !asynch_interrupt &&
347 (conflict_budget < 0 || conflicts < (uint64_t)conflict_budget) &&
Here is the caller graph for this function:

Member Data Documentation

◆ activity

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

Definition at line 176 of file Solver.h.

◆ add_tmp

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

Definition at line 202 of file Solver.h.

◆ analyze_stack

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

Definition at line 200 of file Solver.h.

◆ analyze_toclear

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

Definition at line 201 of file Solver.h.

◆ assigns

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

Definition at line 180 of file Solver.h.

◆ assumptions

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

Definition at line 189 of file Solver.h.

◆ asynch_interrupt

bool Minisat::Solver::asynch_interrupt
protected

Definition at line 212 of file Solver.h.

◆ ca

ClauseAllocator Minisat::Solver::ca
protected

Definition at line 194 of file Solver.h.

◆ ccmin_mode

int Minisat::Solver::ccmin_mode

Definition at line 123 of file Solver.h.

◆ cla_inc

double Minisat::Solver::cla_inc
protected

Definition at line 175 of file Solver.h.

◆ clause_decay

double Minisat::Solver::clause_decay

Definition at line 119 of file Solver.h.

◆ clauses

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

Definition at line 173 of file Solver.h.

◆ clauses_literals

uint64_t Minisat::Solver::clauses_literals

Definition at line 140 of file Solver.h.

◆ conflict

vec<Lit> Minisat::Solver::conflict

Definition at line 112 of file Solver.h.

◆ conflict_budget

int64_t Minisat::Solver::conflict_budget
protected

Definition at line 210 of file Solver.h.

◆ conflicts

uint64_t Minisat::Solver::conflicts

Definition at line 139 of file Solver.h.

◆ dec_vars

uint64_t Minisat::Solver::dec_vars

Definition at line 140 of file Solver.h.

◆ decision

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

Definition at line 182 of file Solver.h.

◆ decisions

uint64_t Minisat::Solver::decisions

Definition at line 139 of file Solver.h.

◆ garbage_frac

double Minisat::Solver::garbage_frac

Definition at line 127 of file Solver.h.

◆ learnts

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

Definition at line 174 of file Solver.h.

◆ learnts_literals

uint64_t Minisat::Solver::learnts_literals

Definition at line 140 of file Solver.h.

◆ learntsize_adjust_cnt

int Minisat::Solver::learntsize_adjust_cnt
protected

Definition at line 206 of file Solver.h.

◆ learntsize_adjust_confl

double Minisat::Solver::learntsize_adjust_confl
protected

Definition at line 205 of file Solver.h.

◆ learntsize_adjust_inc

double Minisat::Solver::learntsize_adjust_inc

Definition at line 135 of file Solver.h.

◆ learntsize_adjust_start_confl

int Minisat::Solver::learntsize_adjust_start_confl

Definition at line 134 of file Solver.h.

◆ learntsize_factor

double Minisat::Solver::learntsize_factor

Definition at line 131 of file Solver.h.

◆ learntsize_inc

double Minisat::Solver::learntsize_inc

Definition at line 132 of file Solver.h.

◆ luby_restart

bool Minisat::Solver::luby_restart

Definition at line 122 of file Solver.h.

◆ max_learnts

double Minisat::Solver::max_learnts
protected

Definition at line 204 of file Solver.h.

◆ max_literals

uint64_t Minisat::Solver::max_literals

Definition at line 140 of file Solver.h.

◆ model

vec<lbool> Minisat::Solver::model

Definition at line 111 of file Solver.h.

◆ ok

bool Minisat::Solver::ok
protected

Definition at line 172 of file Solver.h.

◆ order_heap

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

Definition at line 190 of file Solver.h.

◆ phase_saving

int Minisat::Solver::phase_saving

Definition at line 124 of file Solver.h.

◆ polarity

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

Definition at line 181 of file Solver.h.

◆ progress_estimate

double Minisat::Solver::progress_estimate
protected

Definition at line 191 of file Solver.h.

◆ propagation_budget

int64_t Minisat::Solver::propagation_budget
protected

Definition at line 211 of file Solver.h.

◆ propagations

uint64_t Minisat::Solver::propagations

Definition at line 139 of file Solver.h.

◆ qhead

int Minisat::Solver::qhead
protected

Definition at line 186 of file Solver.h.

◆ random_seed

double Minisat::Solver::random_seed

Definition at line 121 of file Solver.h.

◆ random_var_freq

double Minisat::Solver::random_var_freq

Definition at line 120 of file Solver.h.

◆ remove_satisfied

bool Minisat::Solver::remove_satisfied
protected

Definition at line 192 of file Solver.h.

◆ restart_first

int Minisat::Solver::restart_first

Definition at line 129 of file Solver.h.

◆ restart_inc

double Minisat::Solver::restart_inc

Definition at line 130 of file Solver.h.

◆ rnd_decisions

uint64_t Minisat::Solver::rnd_decisions

Definition at line 139 of file Solver.h.

◆ rnd_init_act

bool Minisat::Solver::rnd_init_act

Definition at line 126 of file Solver.h.

◆ rnd_pol

bool Minisat::Solver::rnd_pol

Definition at line 125 of file Solver.h.

◆ seen

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

Definition at line 199 of file Solver.h.

◆ simpDB_assigns

int Minisat::Solver::simpDB_assigns
protected

Definition at line 187 of file Solver.h.

◆ simpDB_props

int64_t Minisat::Solver::simpDB_props
protected

Definition at line 188 of file Solver.h.

◆ solves

uint64_t Minisat::Solver::solves

Definition at line 139 of file Solver.h.

◆ starts

uint64_t Minisat::Solver::starts

Definition at line 139 of file Solver.h.

◆ tot_literals

uint64_t Minisat::Solver::tot_literals

Definition at line 140 of file Solver.h.

◆ trail

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

Definition at line 183 of file Solver.h.

◆ trail_lim

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

Definition at line 184 of file Solver.h.

◆ var_decay

double Minisat::Solver::var_decay

Definition at line 118 of file Solver.h.

◆ var_inc

double Minisat::Solver::var_inc
protected

Definition at line 177 of file Solver.h.

◆ vardata

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

Definition at line 185 of file Solver.h.

◆ verbosity

int Minisat::Solver::verbosity

Definition at line 117 of file Solver.h.

◆ watches

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

Definition at line 179 of file Solver.h.


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