diff --git a/src/math/polysat/conflict.cpp b/src/math/polysat/conflict.cpp index 7826ff18e..f847c8938 100644 --- a/src/math/polysat/conflict.cpp +++ b/src/math/polysat/conflict.cpp @@ -162,7 +162,7 @@ namespace polysat { c_lemma.push(c.blit()); clause_ref lemma = c_lemma.build(); SASSERT(lemma); - cm().store(lemma.get(), s); + cm().store(lemma.get(), s, false); if (c.bvalue(s) == l_undef) s.assign_propagate(c.blit(), *lemma); } diff --git a/src/math/polysat/constraint.cpp b/src/math/polysat/constraint.cpp index c7657a443..67a357fd2 100644 --- a/src/math/polysat/constraint.cpp +++ b/src/math/polysat/constraint.cpp @@ -57,11 +57,16 @@ namespace polysat { m_constraints.push_back(c); } - void constraint_manager::store(clause* cl, solver& s) { + + void constraint_manager::register_clause(clause* cl, solver& s) { while (m_clauses.size() <= s.base_level()) m_clauses.push_back({}); m_clauses[s.base_level()].push_back(cl); - watch(*cl, s); + } + + void constraint_manager::store(clause* cl, solver& s, bool value_propagate) { + register_clause(cl, s); + watch(*cl, s, value_propagate); } // Release constraints at the given level and above. @@ -79,7 +84,7 @@ namespace polysat { // if clause is unsat then assign arbitrary // solver handles unsat clauses by creating a conflict. // solver also can propagate, but need to check that it does indeed. - void constraint_manager::watch(clause& cl, solver& s) { + void constraint_manager::watch(clause& cl, solver& s, bool value_propagate) { if (cl.empty()) return; @@ -88,7 +93,7 @@ namespace polysat { if (m_bvars.is_false(cl[i])) continue; signed_constraint sc = s.lit2cnstr(cl[i]); - if (sc.is_currently_false(s)) { + if (value_propagate && sc.is_currently_false(s)) { if (m_bvars.is_true(cl[i])) { s.set_conflict(sc); return; diff --git a/src/math/polysat/constraint.h b/src/math/polysat/constraint.h index 753a9054f..e4bbd1b69 100644 --- a/src/math/polysat/constraint.h +++ b/src/math/polysat/constraint.h @@ -67,9 +67,11 @@ namespace polysat { void gc_constraints(solver& s); void gc_clauses(solver& s); - void watch(clause& cl, solver& s); + void watch(clause& cl, solver& s, bool value_propagate); void unwatch(clause& cl); + void register_clause(clause* cl, solver& s); + public: constraint_manager(bool_var_manager& bvars): m_bvars(bvars) {} ~constraint_manager(); @@ -78,7 +80,7 @@ namespace polysat { void erase_bvar(constraint* c); // sat::literal get_or_assign_blit(signed_constraint& c); - void store(clause* cl, solver& s); + void store(clause* cl, solver& s, bool value_propagate); /// Release clauses at the given level and above. void release_level(unsigned lvl); diff --git a/src/math/polysat/solver.cpp b/src/math/polysat/solver.cpp index e44699a3f..e3d351d64 100644 --- a/src/math/polysat/solver.cpp +++ b/src/math/polysat/solver.cpp @@ -838,7 +838,7 @@ namespace polysat { // SASSERT(m_bvars.value(lit) != l_true); } SASSERT(!clause.empty()); - m_constraints.store(&clause, *this); + m_constraints.store(&clause, *this, true); } void solver::add_clause(unsigned n, signed_constraint* cs, bool is_redundant) {