ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
Solver.h
Go to the documentation of this file.
1/****************************************************************************************[Solver.h]
2 Glucose -- Copyright (c) 2009, Gilles Audemard, Laurent Simon
3 CRIL - Univ. Artois, France
4 LRI - Univ. Paris Sud, France
5
6Glucose sources are based on MiniSat (see below MiniSat copyrights). Permissions and copyrights of
7Glucose are exactly the same as Minisat on which it is based on. (see below).
8
9---------------
10Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
11Copyright (c) 2007-2010, Niklas Sorensson
12
13Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
14associated documentation files (the "Software"), to deal in the Software without restriction,
15including without limitation the rights to use, copy, modify, merge, publish, distribute,
16sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions:
18
19The above copyright notice and this permission notice shall be included in all copies or
20substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
23NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
26OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27**************************************************************************************************/
28
29#ifndef Glucose_Solver_h
30#define Glucose_Solver_h
31
32#include "sat/glucose/Vec.h"
33#include "sat/glucose/Heap.h"
34#include "sat/glucose/Alg.h"
35#include "sat/glucose/Options.h"
39
41
42namespace Gluco {
43
44//=================================================================================================
45// Solver -- the main class:
46
47class Solver {
48public:
49
50 int SolverType; // ABC identifies Glucose's type as 0
51
52 // Constructor/Destructor:
53 //
54 Solver();
55 virtual ~Solver();
56
57 // ABC callbacks
58 void * pCnfMan; // external CNF manager
59 int(*pCnfFunc)(void * p, int, int*); // external callback. messages: 0: unsat; 1: sat; -1: still working
60 int nCallConfl; // callback will be called every this number of conflicts
61 bool terminate_search_early; // used to stop the solver early if it as instructed by an external caller
62 int * pstop; // another callback
63 uint64_t nRuntimeLimit; // runtime limit
66
67 // circuit-based solving
68 int jftr;
69 void sat_solver_set_var_fanin_lit(int, int, int);
71 void sat_solver_mark_cone(int);
72
73 // Problem specification:
74 //
75 Var newVar (bool polarity = true, bool dvar = true); // Add a new variable with parameters specifying variable mode.
76 void addVar (Var v); // Add enough variables to make sure there is variable v.
77
78 bool addClause (const vec<Lit>& ps); // Add a clause to the solver.
79 bool addEmptyClause(); // Add the empty clause, making the solver contradictory.
80 bool addClause (Lit p); // Add a unit clause to the solver.
81 bool addClause (Lit p, Lit q); // Add a binary clause to the solver.
82 bool addClause (Lit p, Lit q, Lit r); // Add a ternary clause to the solver.
83 bool addClause_( vec<Lit>& ps); // Add a clause to the solver without making superflous internal copy. Will
84 // change the passed vector 'ps'.
85
86 // Solving:
87 //
88 bool simplify (); // Removes already satisfied clauses.
89 bool solve (const vec<Lit>& assumps); // Search for a model that respects a given set of assumptions.
90 lbool solveLimited (const vec<Lit>& assumps); // Search for a model that respects a given set of assumptions (With resource constraints).
91 bool solve (); // Search without assumptions.
92 bool solve (Lit p); // Search for a model that respects a single assumption.
93 bool solve (Lit p, Lit q); // Search for a model that respects two assumptions.
94 bool solve (Lit p, Lit q, Lit r); // Search for a model that respects three assumptions.
95 bool okay () const; // FALSE means solver is in a conflicting state
96
97 void toDimacs (FILE* f, const vec<Lit>& assumps); // Write CNF to file in DIMACS-format.
98 void toDimacs (const char *file, const vec<Lit>& assumps);
99 void toDimacs (FILE* f, Clause& c, vec<Var>& map, Var& max);
100 void printLit(Lit l);
101 void printClause(CRef c);
102 void printInitialClause(CRef c);
103 // Convenience versions of 'toDimacs()':
104 void toDimacs (const char* file);
105 void toDimacs (const char* file, Lit p);
106 void toDimacs (const char* file, Lit p, Lit q);
107 void toDimacs (const char* file, Lit p, Lit q, Lit r);
108
109 // Variable mode:
110 //
111 void setPolarity (Var v, bool b); // Declare which polarity the decision heuristic should use for a variable. Requires mode 'polarity_user'.
112 void setDecisionVar (Var v, bool b); // Declare if a variable should be eligible for selection in the decision heuristic.
113
114 // Read state:
115 //
116 lbool value (Var x) const; // The current value of a variable.
117 lbool value (Lit p) const; // The current value of a literal.
118 lbool modelValue (Var x) const; // The value of a variable in the last model. The last call to solve must have been satisfiable.
119 lbool modelValue (Lit p) const; // The value of a literal in the last model. The last call to solve must have been satisfiable.
120 int nAssigns () const; // The current number of assigned literals.
121 int nClauses () const; // The current number of original clauses.
122 int nLearnts () const; // The current number of learnt clauses.
123 int nVars () const; // The current number of variables.
124 int nFreeVars () const;
125 int * getCex () const;
126
127 // Incremental mode
128 void setIncrementalMode();
129 void initNbInitialVars(int nb);
131
132 // Resource contraints:
133 //
134 void setConfBudget(int64_t x);
135 void setPropBudget(int64_t x);
136 void budgetOff();
137 void interrupt(); // Trigger a (potentially asynchronous) interruption of the solver.
138 void clearInterrupt(); // Clear interrupt indicator flag.
139
140 // Memory managment:
141 //
142 virtual void reset();
143 virtual void garbageCollect(); // virtuality causes segfault for some reason
144 void checkGarbage(double gf);
145 void checkGarbage();
146
147
148
149
150 // Extra results: (read-only member variable)
151 //
152 vec<lbool> model; // If problem is satisfiable, this vector contains the model (if any).
153 vec<Lit> conflict; // If problem is unsatisfiable (possibly under assumptions),
154 // this vector represent the final conflict clause expressed in the assumptions.
155
156 // Mode of operation:
157 //
161 // Constants For restarts
162 double K;
163 double R;
166
167 // Constants for reduce DB
171 unsigned int lbLBDFrozenClause;
172
173 // Constant for reducing clause
176
177 double var_decay;
181 int ccmin_mode; // Controls conflict clause minimization (0=none, 1=basic, 2=deep).
182 int phase_saving; // Controls the level of phase saving (0=none, 1=limited, 2=full).
183 bool rnd_pol; // Use random polarities for branching heuristics.
184 bool rnd_init_act; // Initialize variable activities with a small random value.
185 double garbage_frac; // The fraction of wasted memory allowed before a garbage collection is triggered.
186
187 // Certified UNSAT ( Thanks to Marijn Heule)
190
191
192 // Statistics: (read-only member variable)
193 //
196
197protected:
199 // Helper structures:
200 //
201 struct VarData { CRef reason; int level; };
202 static inline VarData mkVarData(CRef cr, int l){ VarData d = {cr, l}; return d; }
203
204 struct Watcher {
207 Watcher(CRef cr, Lit p) : cref(cr), blocker(p) {}
208 bool operator==(const Watcher& w) const { return cref == w.cref; }
209 bool operator!=(const Watcher& w) const { return cref != w.cref; }
210 };
211
213 {
215 WatcherDeleted(const ClauseAllocator& _ca) : ca(_ca) {}
216 bool operator()(const Watcher& w) const { return ca[w.cref].mark() == 1; }
217 };
218
219 struct VarOrderLt {
221 bool operator () (Var x, Var y) const { return activity[x] > activity[y]; }
222 VarOrderLt(const vec<double>& act) : activity(act) { }
223 };
224
225
226 // Solver state:
227 //
229 bool ok; // If FALSE, the constraints are already unsatisfiable. No part of the solver state may be used!
230 double cla_inc; // Amount to bump next clause with.
231 vec<double> activity; // A heuristic measurement of the activity of a variable.
232 double var_inc; // Amount to bump next variable with.
234 watches; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true).
236 watchesBin; // 'watches[lit]' is a list of constraints watching 'lit' (will go there if literal becomes true).
237 vec<CRef> clauses; // List of problem clauses.
238 vec<CRef> learnts; // List of learnt clauses.
239
240 vec<lbool> assigns; // The current assignments.
241 vec<char> polarity; // The preferred polarity of each variable.
242 vec<char> decision; // Declares if a variable is eligible for selection in the decision heuristic.
243 vec<Lit> trail; // Assignment stack; stores all assigments made in the order they were made.
245 vec<int> trail_lim; // Separator indices for different decision levels in 'trail'.
246 vec<VarData> vardata; // Stores reason and level for each variable.
247 int qhead; // Head of queue (as index into the trail -- no more explicit propagation queue in MiniSat).
248 int simpDB_assigns; // Number of top-level assignments since last execution of 'simplify()'.
249 int64_t simpDB_props; // Remaining number of propagations that must be made before next execution of 'simplify()'.
250 vec<Lit> assumptions; // Current set of assumptions provided to solve by the user.
251 Heap<VarOrderLt> order_heap; // A priority queue of variables ordered with respect to the variable activity.
252 double progress_estimate;// Set by 'search()'.
253 bool remove_satisfied; // Indicates whether possibly inefficient linear scan for satisfied clauses should be performed in 'simplify'.
254 vec<unsigned int> permDiff; // permDiff[var] contains the current conflict number... Used to count the number of LBD
255
256#ifdef UPDATEVARACTIVITY
257 // UPDATEVARACTIVITY trick (see competition'09 companion paper)
258 vec<Lit> lastDecisionLevel;
259#endif
260
262
263 int nbclausesbeforereduce; // To know when it is time to reduce clause database
264
265 bqueue<unsigned int> trailQueue,lbdQueue; // Bounded queues for restarts.
266 float sumLBD; // used to compute the global average of LBD. Restarts...
268
269
270 // Temporaries (to reduce allocation overhead). Each variable is prefixed by the method in which it is
271 // used, exept 'seen' wich is used in several places.
272 //
277 unsigned int MYFLAG;
278
279
283
284 // Resource contraints:
285 //
286 int64_t conflict_budget; // -1 means no budget.
287 int64_t propagation_budget; // -1 means no budget.
289
290
291 // Variables added for incremental mode
292 int incremental; // Use incremental SAT Solver
293 int nbVarsInitialFormula; // nb VAR in formula without assumptions (incremental SAT)
297
298
299 // Main internal methods:
300 //
301 void insertVarOrder (Var x); // Insert a variable in the decision order priority queue.
302 Lit pickBranchLit (); // Return the next decision variable.
303 void newDecisionLevel (); // Begins a new decision level.
304 void uncheckedEnqueue (Lit p, CRef from = CRef_Undef); // Enqueue a literal. Assumes value of literal is undefined.
305 bool enqueue (Lit p, CRef from = CRef_Undef); // Test if fact 'p' contradicts current state, enqueue otherwise.
306 CRef propagate (); // Perform unit propagation. Returns possibly conflicting clause.
307 void cancelUntil (int level); // Backtrack until a certain level.
308 void analyze (CRef confl, vec<Lit>& out_learnt, vec<Lit> & selectors, int& out_btlevel,unsigned int &nblevels,unsigned int &szWithoutSelectors); // (bt = backtrack)
309 void analyzeFinal (Lit p, vec<Lit>& out_conflict); // COULD THIS BE IMPLEMENTED BY THE ORDINARIY "analyze" BY SOME REASONABLE GENERALIZATION?
310 bool litRedundant (Lit p, uint32_t abstract_levels); // (helper method for 'analyze()')
311 lbool search (int nof_conflicts); // Search for a given number of conflicts.
312 lbool solve_ (); // Main solve method (assumptions given in 'assumptions').
313 void reduceDB (); // Reduce the set of learnt clauses.
314 void removeSatisfied (vec<CRef>& cs); // Shrink 'cs' to contain only non-satisfied clauses.
315 void rebuildOrderHeap ();
316
317 // Maintaining Variable/Clause activity:
318 //
319 void varDecayActivity (); // Decay all variables with the specified factor. Implemented by increasing the 'bump' value instead.
320 void varBumpActivity (Var v, double inc); // Increase a variable with the current 'bump' value.
321 void varBumpActivity (Var v); // Increase a variable with the current 'bump' value.
322 void claDecayActivity (); // Decay all clauses with the specified factor. Implemented by increasing the 'bump' value instead.
323 void claBumpActivity (Clause& c); // Increase a clause with the current 'bump' value.
324
325 // Operations on clauses:
326 //
327 void attachClause (CRef cr); // Attach a clause to watcher lists.
328 void detachClause (CRef cr, bool strict = false); // Detach a clause to watcher lists.
329 void removeClause (CRef cr); // Detach and free a clause.
330 bool locked (const Clause& c) const; // Returns TRUE if a clause is a reason for some implication in the current state.
331 bool satisfied (const Clause& c) const; // Returns TRUE if a clause is satisfied in the current state.
332
333 unsigned int computeLBD(const vec<Lit> & lits,int end=-1);
334 unsigned int computeLBD(const Clause &c);
336
337 void relocAll (ClauseAllocator& to);
338
339 // Misc:
340 //
341 int decisionLevel () const; // Gives the current decisionlevel.
342 uint32_t abstractLevel (Var x) const; // Used to represent an abstraction of sets of decision levels.
343 CRef reason (Var x) const;
344 int level (Var x) const;
345 double progressEstimate () const; // DELETE THIS ?? IT'S NOT VERY USEFUL ...
346 bool withinBudget () const;
347 inline bool isSelector(Var v) {return (incremental && v>nbVarsInitialFormula);}
348
349 // Static helpers:
350 //
351
352 // Returns a random float 0 <= x < 1. Seed must never be 0.
353 static inline double drand(double& seed) {
354 seed *= 1389796;
355 int q = (int)(seed / 2147483647);
356 seed -= (double)q * 2147483647;
357 return seed / 2147483647; }
358
359 // Returns a random integer 0 <= x < size. Seed must never be 0.
360 static inline int irand(double& seed, int size) {
361 return (int)(drand(seed) * size); }
362};
363
364
365//=================================================================================================
366// Implementation of inline methods:
367
368inline CRef Solver::reason(Var x) const { return vardata[x].reason; }
369inline int Solver::level (Var x) const { return vardata[x].level; }
370
372 if (!order_heap.inHeap(x) && decision[x]) order_heap.insert(x); }
373
374inline void Solver::varDecayActivity() { var_inc *= (1 / var_decay); }
376inline void Solver::varBumpActivity(Var v, double inc) {
377 if ( (activity[v] += inc) > 1e100 ) {
378 // Rescale:
379 for (int i = 0; i < nVars(); i++)
380 activity[i] *= 1e-100;
381 var_inc *= 1e-100; }
382
383 // Update order_heap with respect to new activity:
384 if (order_heap.inHeap(v))
385 order_heap.decrease(v); }
386
389 if ( (c.activity() += cla_inc) > 1e20 ) {
390 // Rescale:
391 for (int i = 0; i < learnts.size(); i++)
392 ca[learnts[i]].activity() *= (float)1e-20;
393 cla_inc *= 1e-20; } }
394
396inline void Solver::checkGarbage(double gf){
397 if (ca.wasted() > ca.size() * gf)
399
400// NOTE: enqueue does not set the ok flag! (only public methods do)
401inline bool Solver::enqueue (Lit p, CRef from) { return value(p) != l_Undef ? value(p) != l_False : (uncheckedEnqueue(p, from), true); }
402inline bool Solver::addClause (const vec<Lit>& ps) { ps.copyTo(add_tmp); return addClause_(add_tmp); }
403inline bool Solver::addEmptyClause () { add_tmp.clear(); return addClause_(add_tmp); }
404inline bool Solver::addClause (Lit p) { add_tmp.clear(); add_tmp.push(p); return addClause_(add_tmp); }
405inline bool Solver::addClause (Lit p, Lit q) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); return addClause_(add_tmp); }
406inline bool Solver::addClause (Lit p, Lit q, Lit r) { add_tmp.clear(); add_tmp.push(p); add_tmp.push(q); add_tmp.push(r); return addClause_(add_tmp); }
407inline bool Solver::locked (const Clause& c) const {
408 if(c.size()>2)
409 return value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c;
410 return
411 (value(c[0]) == l_True && reason(var(c[0])) != CRef_Undef && ca.lea(reason(var(c[0]))) == &c)
412 ||
413 (value(c[1]) == l_True && reason(var(c[1])) != CRef_Undef && ca.lea(reason(var(c[1]))) == &c);
414 }
415inline void Solver::newDecisionLevel() { trail_lim.push(trail.size()); }
416
417inline int Solver::decisionLevel () const { return trail_lim.size(); }
418inline uint32_t Solver::abstractLevel (Var x) const { return 1 << (level(x) & 31); }
419inline lbool Solver::value (Var x) const { return assigns[x]; }
420inline lbool Solver::value (Lit p) const { return assigns[var(p)] ^ sign(p); }
421inline lbool Solver::modelValue (Var x) const { return model[x]; }
422inline lbool Solver::modelValue (Lit p) const { return model[var(p)] ^ sign(p); }
423inline int Solver::nAssigns () const { return trail.size(); }
424inline int Solver::nClauses () const { return clauses.size(); }
425inline int Solver::nLearnts () const { return learnts.size(); }
426inline int Solver::nVars () const { return vardata.size(); }
427inline int Solver::nFreeVars () const { return (int)dec_vars - (trail_lim.size() == 0 ? trail.size() : trail_lim[0]); }
428inline int * Solver::getCex () const { return NULL; }
429inline void Solver::setPolarity (Var v, bool b) { polarity[v] = b; }
430inline void Solver::setDecisionVar(Var v, bool b)
431{
432 if ( b && !decision[v]) dec_vars++;
433 else if (!b && decision[v]) dec_vars--;
434
435 decision[v] = b;
437}
438inline void Solver::setConfBudget(int64_t x){ conflict_budget = conflicts + x; }
440inline void Solver::interrupt(){ asynch_interrupt = true; }
443inline bool Solver::withinBudget() const {
444 return !asynch_interrupt &&
445 (conflict_budget < 0 || conflicts < (uint64_t)conflict_budget) &&
447
448// FIXME: after the introduction of asynchronous interrruptions the solve-versions that return a
449// pure bool do not give a safe interface. Either interrupts must be possible to turn off here, or
450// all calls to solve must return an 'lbool'. I'm not yet sure which I prefer.
451inline bool Solver::solve () { budgetOff(); assumptions.clear(); return solve_() == l_True; }
452inline bool Solver::solve (Lit p) { budgetOff(); assumptions.clear(); assumptions.push(p); return solve_() == l_True; }
453inline bool Solver::solve (Lit p, Lit q) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); return solve_() == l_True; }
454inline bool Solver::solve (Lit p, Lit q, Lit r) { budgetOff(); assumptions.clear(); assumptions.push(p); assumptions.push(q); assumptions.push(r); return solve_() == l_True; }
455inline bool Solver::solve (const vec<Lit>& assumps){ budgetOff(); assumps.copyTo(assumptions); return solve_() == l_True; }
456inline lbool Solver::solveLimited (const vec<Lit>& assumps){ assumps.copyTo(assumptions); return solve_(); }
457inline bool Solver::okay () const { return ok; }
458
459inline void Solver::toDimacs (const char* file){ vec<Lit> as; toDimacs(file, as); }
460inline void Solver::toDimacs (const char* file, Lit p){ vec<Lit> as; as.push(p); toDimacs(file, as); }
461inline void Solver::toDimacs (const char* file, Lit p, Lit q){ vec<Lit> as; as.push(p); as.push(q); toDimacs(file, as); }
462inline void Solver::toDimacs (const char* file, Lit p, Lit q, Lit r){ vec<Lit> as; as.push(p); as.push(q); as.push(r); toDimacs(file, as); }
463
464inline void Solver::addVar(Var v) { while (v >= nVars()) newVar(); }
465
466inline void Solver::sat_solver_set_var_fanin_lit(int var, int lit0, int lit1) {}
469
470//=================================================================================================
471// Debug etc:
472
473
474inline void Solver::printLit(Lit l)
475{
476 printf("%s%d:%c", sign(l) ? "-" : "", var(l)+1, value(l) == l_True ? '1' : (value(l) == l_False ? '0' : 'X'));
477}
478
479
481{
482 Clause &c = ca[cr];
483 for (int i = 0; i < c.size(); i++){
484 printLit(c[i]);
485 printf(" ");
486 }
487}
488
490{
491 Clause &c = ca[cr];
492 for (int i = 0; i < c.size(); i++){
493 if(!isSelector(var(c[i]))) {
494 printLit(c[i]);
495 printf(" ");
496 }
497 }
498}
499
500
501//=================================================================================================
502}
503
505
506#endif
unsigned int uint32_t
Definition Fxch.h:32
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
#define l_True
Definition bmcBmcS.c:35
#define l_Undef
Definition bmcBmcS.c:34
#define l_False
Definition bmcBmcS.c:36
ABC_NAMESPACE_IMPL_START typedef signed char value
#define sat_solver_mark_cone
Definition cecSatG2.c:52
#define sat_solver_set_var_fanin_lit
Definition cecSatG2.c:50
unsigned size
float & activity()
int64_t rnd_decisions
Definition Solver.h:194
int64_t starts
Definition Solver.h:194
int * getCex() const
Definition Solver.h:428
double progress_estimate
Definition Solver.h:252
FILE * certifiedOutput
Definition Solver.h:188
bool locked(const Clause &c) const
Definition Solver.h:407
int64_t nbReducedClauses
Definition Solver.h:194
int specialIncReduceDB
Definition Solver.h:170
Lit pickBranchLit()
Definition Glucose.cpp:490
double K
Definition Solver.h:162
int decisionLevel() const
Definition Solver.h:417
double var_decay
Definition Solver.h:177
static double drand(double &seed)
Definition Solver.h:353
bool addClause_(vec< Lit > &ps)
Definition Glucose.cpp:224
int64_t max_literals
Definition Solver.h:195
double sizeTrailQueue
Definition Solver.h:165
int nbUnsatCalls
Definition Solver.h:295
CRef propagate()
Definition Glucose.cpp:803
lbool search(int nof_conflicts)
Definition Glucose.cpp:1038
void toDimacs(FILE *f, const vec< Lit > &assumps)
Definition Glucose.cpp:1341
int64_t lastblockatrestart
Definition Solver.h:194
bool rnd_pol
Definition Solver.h:183
vec< int > assumptionPositions
Definition Solver.h:296
OccLists< Lit, vec< Watcher >, WatcherDeleted > watches
Definition Solver.h:234
void sat_solver_mark_cone(int)
Definition Solver.h:468
double var_inc
Definition Solver.h:232
double max_learnts
Definition Solver.h:280
double clause_decay
Definition Solver.h:178
vec< Lit > assumptions
Definition Solver.h:250
int nAssigns() const
Definition Solver.h:423
int SolverType
Definition Solver.h:50
vec< Lit > add_tmp
Definition Solver.h:276
vec< int > trail_lim
Definition Solver.h:245
double garbage_frac
Definition Solver.h:185
int64_t nbReduceDB
Definition Solver.h:194
void cancelUntil(int level)
Definition Glucose.cpp:471
bool isSelector(Var v)
Definition Solver.h:347
vec< VarData > vardata
Definition Solver.h:246
vec< lbool > assigns
Definition Solver.h:240
unsigned int computeLBD(const vec< Lit > &lits, int end=-1)
Definition Glucose.cpp:367
void addVar(Var v)
Definition Solver.h:464
int ccmin_mode
Definition Solver.h:181
bool litRedundant(Lit p, uint32_t abstract_levels)
Definition Glucose.cpp:706
vec< unsigned int > permDiff
Definition Solver.h:254
bool solve()
Definition Solver.h:451
float sumLBD
Definition Solver.h:266
void sat_solver_start_new_round()
Definition Solver.h:467
void clearInterrupt()
Definition Solver.h:441
double totalTime4Unsat
Definition Solver.h:294
int lastIndexRed
Definition Solver.h:228
lbool value(Var x) const
Definition Solver.h:419
int(* pCnfFunc)(void *p, int, int *)
Definition Solver.h:59
int nCallConfl
Definition Solver.h:60
int64_t conflictsRestarts
Definition Solver.h:194
static int irand(double &seed, int size)
Definition Solver.h:360
int64_t nbDL2
Definition Solver.h:194
bool addEmptyClause()
Definition Solver.h:403
void interrupt()
Definition Solver.h:440
int incReduceDB
Definition Solver.h:169
double R
Definition Solver.h:163
virtual void garbageCollect()
Definition Glucose.cpp:1427
double progressEstimate() const
Definition Glucose.cpp:1172
void relocAll(ClauseAllocator &to)
Definition Glucose.cpp:1386
int64_t solves
Definition Solver.h:194
vec< char > polarity
Definition Solver.h:241
int sumAssumptions
Definition Solver.h:267
bool certifiedUNSAT
Definition Solver.h:189
void removeClause(CRef cr)
Definition Glucose.cpp:333
void setConfBudget(int64_t x)
Definition Solver.h:438
vec< Lit > trail
Definition Solver.h:243
int simpDB_assigns
Definition Solver.h:248
int64_t propagations
Definition Solver.h:194
double sizeLBDQueue
Definition Solver.h:164
virtual void reset()
Definition Glucose.cpp:1440
vec< CRef > clauses
Definition Solver.h:237
int learntsize_adjust_cnt
Definition Solver.h:282
vec< double > activity
Definition Solver.h:231
void reduceDB()
Definition Glucose.cpp:935
vec< Lit > user_lits
Definition Solver.h:65
void detachClause(CRef cr, bool strict=false)
Definition Glucose.cpp:306
void checkGarbage()
Definition Solver.h:395
void rebuildOrderHeap()
Definition Glucose.cpp:981
int64_t nbstopsrestarts
Definition Solver.h:194
double random_var_freq
Definition Solver.h:179
void printClause(CRef c)
Definition Solver.h:480
void minimisationWithBinaryResolution(vec< Lit > &out_learnt)
Definition Glucose.cpp:429
int nbSatCalls
Definition Solver.h:295
vec< Lit > conflict
Definition Solver.h:153
vec< CRef > learnts
Definition Solver.h:238
void newDecisionLevel()
Definition Solver.h:415
void attachClause(CRef cr)
Definition Glucose.cpp:289
vec< char > decision
Definition Solver.h:242
int64_t learnts_literals
Definition Solver.h:195
int verbEveryConflicts
Definition Solver.h:159
void printInitialClause(CRef c)
Definition Solver.h:489
void removeSatisfied(vec< CRef > &cs)
Definition Glucose.cpp:967
bool okay() const
Definition Solver.h:457
void setPolarity(Var v, bool b)
Definition Solver.h:429
void analyzeFinal(Lit p, vec< Lit > &out_conflict)
Definition Glucose.cpp:749
ClauseAllocator ca
Definition Solver.h:261
void claDecayActivity()
Definition Solver.h:387
OccLists< Lit, vec< Watcher >, WatcherDeleted > watchesBin
Definition Solver.h:236
int nFreeVars() const
Definition Solver.h:427
int64_t conflict_budget
Definition Solver.h:286
int nVars() const
Definition Solver.h:426
uint64_t nRuntimeLimit
Definition Solver.h:63
uint32_t abstractLevel(Var x) const
Definition Solver.h:418
vec< int > nbpos
Definition Solver.h:244
static VarData mkVarData(CRef cr, int l)
Definition Solver.h:202
bool remove_satisfied
Definition Solver.h:253
int nbVarsInitialFormula
Definition Solver.h:293
double learntsize_adjust_confl
Definition Solver.h:281
int * pstop
Definition Solver.h:62
bool enqueue(Lit p, CRef from=CRef_Undef)
Definition Solver.h:401
bool asynch_interrupt
Definition Solver.h:288
int nbclausesbeforereduce
Definition Solver.h:263
int64_t simpDB_props
Definition Solver.h:249
void sat_solver_set_var_fanin_lit(int, int, int)
Definition Solver.h:466
vec< lbool > model
Definition Solver.h:152
bqueue< unsigned int > trailQueue
Definition Solver.h:265
int64_t clauses_literals
Definition Solver.h:195
void printLit(Lit l)
Definition Solver.h:474
void setPropBudget(int64_t x)
Definition Solver.h:439
void initNbInitialVars(int nb)
Definition Glucose.cpp:190
void insertVarOrder(Var x)
Definition Solver.h:371
bool withinBudget() const
Definition Solver.h:443
bool terminate_search_early
Definition Solver.h:61
int64_t decisions
Definition Solver.h:194
Heap< VarOrderLt > order_heap
Definition Solver.h:251
virtual ~Solver()
Definition Glucose.cpp:173
int firstReduceDB
Definition Solver.h:168
double totalTime4Sat
Definition Solver.h:294
int incremental
Definition Solver.h:292
void claBumpActivity(Clause &c)
Definition Solver.h:388
unsigned int lbLBDFrozenClause
Definition Solver.h:171
int64_t nbRemovedClauses
Definition Solver.h:194
int64_t tot_literals
Definition Solver.h:195
vec< int > initialPositions
Definition Solver.h:296
lbool solve_()
Definition Glucose.cpp:1209
int lbSizeMinimizingClause
Definition Solver.h:174
Var newVar(bool polarity=true, bool dvar=true)
Definition Glucose.cpp:202
int64_t dec_vars
Definition Solver.h:195
void varDecayActivity()
Definition Solver.h:374
void varBumpActivity(Var v, double inc)
Definition Solver.h:376
bool simplify()
Definition Glucose.cpp:999
int showModel
Definition Solver.h:160
vec< int > user_vec
Definition Solver.h:64
void * pCnfMan
Definition Solver.h:58
bool rnd_init_act
Definition Solver.h:184
int phase_saving
Definition Solver.h:182
int verbosity
Definition Solver.h:158
int64_t nbBin
Definition Solver.h:194
vec< char > seen
Definition Solver.h:273
int64_t propagation_budget
Definition Solver.h:287
void setDecisionVar(Var v, bool b)
Definition Solver.h:430
void printIncrementalStats()
Definition Glucose.cpp:1186
int64_t conflicts
Definition Solver.h:194
bqueue< unsigned int > lbdQueue
Definition Solver.h:265
void setIncrementalMode()
Definition Glucose.cpp:185
CRef reason(Var x) const
Definition Solver.h:368
vec< Lit > analyze_toclear
Definition Solver.h:275
void budgetOff()
Definition Solver.h:442
int level(Var x) const
Definition Solver.h:369
vec< Lit > analyze_stack
Definition Solver.h:274
void analyze(CRef confl, vec< Lit > &out_learnt, vec< Lit > &selectors, int &out_btlevel, unsigned int &nblevels, unsigned int &szWithoutSelectors)
Definition Glucose.cpp:529
bool addClause(const vec< Lit > &ps)
Definition Solver.h:402
double random_seed
Definition Solver.h:180
void uncheckedEnqueue(Lit p, CRef from=CRef_Undef)
Definition Glucose.cpp:783
lbool solveLimited(const vec< Lit > &assumps)
Definition Solver.h:456
lbool modelValue(Var x) const
Definition Solver.h:421
unsigned int lbLBDMinimizingClause
Definition Solver.h:175
int64_t nbstopsrestartssame
Definition Solver.h:194
int64_t nbUn
Definition Solver.h:194
bool satisfied(const Clause &c) const
Definition Glucose.cpp:352
double cla_inc
Definition Solver.h:230
unsigned int MYFLAG
Definition Solver.h:277
long curRestart
Definition Solver.h:198
int nClauses() const
Definition Solver.h:424
int nLearnts() const
Definition Solver.h:425
void copyTo(vec< T > &copy) const
Definition Vec.h:92
void push(void)
Definition Vec.h:75
void map()
Cube * p
Definition exorList.c:222
Definition Alg.h:28
RegionAllocator< uint32_t >::Ref CRef
int var(Lit p)
Definition SolverTypes.h:71
bool sign(Lit p)
Definition SolverTypes.h:70
int Var
Definition SolverTypes.h:52
const CRef CRef_Undef
VarOrderLt(const vec< double > &act)
Definition Solver.h:222
const vec< double > & activity
Definition Solver.h:220
bool operator()(Var x, Var y) const
Definition Solver.h:221
const ClauseAllocator & ca
Definition Solver.h:214
bool operator()(const Watcher &w) const
Definition Solver.h:216
WatcherDeleted(const ClauseAllocator &_ca)
Definition Solver.h:215
Watcher(CRef cr, Lit p)
Definition Solver.h:207
bool operator!=(const Watcher &w) const
Definition Solver.h:209
bool operator==(const Watcher &w) const
Definition Solver.h:208
Definition file.h:23