mirror of
https://github.com/Z3Prover/z3
synced 2025-05-08 16:25:48 +00:00
adding watches on Booleans
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
c25fd71bf4
commit
f01da40e49
7 changed files with 130 additions and 54 deletions
|
@ -19,14 +19,17 @@ namespace polysat {
|
|||
class clause;
|
||||
|
||||
class bool_var_manager {
|
||||
svector<sat::bool_var> m_unused; // previously deleted variables that can be reused by new_var();
|
||||
svector<lbool> m_value; // current value (indexed by literal)
|
||||
svector<unsigned> m_level; // level of assignment (indexed by variable)
|
||||
svector<clause*> m_reason; // propagation reason, NULL for decisions (indexed by variable)
|
||||
svector<sat::bool_var> m_unused; // previously deleted variables that can be reused by new_var();
|
||||
svector<lbool> m_value; // current value (indexed by literal)
|
||||
svector<unsigned> m_level; // level of assignment (indexed by variable)
|
||||
unsigned_vector m_activity; //
|
||||
svector<clause*> m_reason; // propagation reason, NULL for decisions (indexed by variable)
|
||||
|
||||
// For enumerative backtracking we store the lemma we're handling with a certain decision
|
||||
svector<clause*> m_lemma;
|
||||
|
||||
vector<ptr_vector<clause>> m_watch; // watch list for literals into clauses
|
||||
|
||||
public:
|
||||
// allocated size (not the number of active variables)
|
||||
unsigned size() const { return m_level.size(); }
|
||||
|
@ -41,12 +44,17 @@ namespace polysat {
|
|||
bool is_propagation(sat::bool_var var) const { return is_assigned(var) && reason(var); }
|
||||
lbool value(sat::bool_var var) const { return value(sat::literal(var)); }
|
||||
lbool value(sat::literal lit) const { return m_value[lit.index()]; }
|
||||
bool is_true(sat::literal lit) const { return value(lit) == l_true; }
|
||||
bool is_false(sat::literal lit) const { return value(lit) == l_false; }
|
||||
unsigned level(sat::bool_var var) const { SASSERT(is_assigned(var)); return m_level[var]; }
|
||||
unsigned level(sat::literal lit) const { return level(lit.var()); }
|
||||
clause* reason(sat::bool_var var) const { SASSERT(is_assigned(var)); return m_reason[var]; }
|
||||
|
||||
clause* lemma(sat::bool_var var) const { SASSERT(is_decision(var)); return m_lemma[var]; }
|
||||
|
||||
ptr_vector<clause>& watch(sat::literal lit) { return m_watch[lit.index()]; }
|
||||
unsigned_vector& activity() { return m_activity; }
|
||||
|
||||
/// Set the given literal to true
|
||||
void assign(sat::literal lit, unsigned lvl, clause* reason, clause* lemma);
|
||||
void unassign(sat::literal lit);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue