3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-17 00:32:16 +00:00

comments, minor

This commit is contained in:
Jakob Rath 2023-03-29 15:53:22 +02:00
parent 1f58a906ed
commit 67a4480410

View file

@ -1054,7 +1054,7 @@ namespace polysat {
unsigned max_level = 0; // highest level in lemma unsigned max_level = 0; // highest level in lemma
unsigned lits_at_max_level = 0; // how many literals at the highest level in lemma unsigned lits_at_max_level = 0; // how many literals at the highest level in lemma
unsigned snd_level = 0; // second-highest level in lemma unsigned snd_level = 0; // second-highest level in lemma
unsigned num_undef = 0; // whether there is an unassigned literal (at most one) unsigned num_undef = 0; // number of unassigned literals
for (sat::literal lit : lemma) { for (sat::literal lit : lemma) {
switch (m_bvars.value(lit)) { switch (m_bvars.value(lit)) {
case l_true: case l_true:
@ -1062,6 +1062,8 @@ namespace polysat {
case l_false: case l_false:
break; break;
default: default:
// TODO: Entering this case means we used clause_builder::insert at some point where it should have been clause_builder::insert_eval?
// Maybe we should just get rid of the insert/insert_eval distinction and evaluate everything here.
switch (lit2cnstr(lit).eval(*this)) { switch (lit2cnstr(lit).eval(*this)) {
case l_true: case l_true:
return std::nullopt; return std::nullopt;
@ -1070,15 +1072,11 @@ namespace polysat {
break; break;
case l_undef: case l_undef:
++num_undef; ++num_undef;
// NSB: we used to not return null here.
// Lemmas that were not false under evaluation are now skipped
// with this change.
if (num_undef > 1) if (num_undef > 1)
return std::nullopt; return std::nullopt;
continue; continue;
} }
} }
unsigned const lit_level = m_bvars.level(lit); unsigned const lit_level = m_bvars.level(lit);
if (lit_level > max_level) { if (lit_level > max_level) {
snd_level = max_level; snd_level = max_level;
@ -1103,8 +1101,8 @@ namespace polysat {
// backjump to max_level so we can propagate // backjump to max_level so we can propagate
unsigned jump_level; unsigned jump_level;
unsigned branching_factor = lits_at_max_level; unsigned branching_factor = lits_at_max_level;
if (num_undef == 1) if (num_undef >= 1)
jump_level = max_level, branching_factor = 1; jump_level = max_level, branching_factor = num_undef;
else if (lits_at_max_level <= 1) else if (lits_at_max_level <= 1)
jump_level = snd_level; jump_level = snd_level;
else else
@ -1316,12 +1314,6 @@ namespace polysat {
return lit; return lit;
} }
/**
* Activate constraint immediately
* Activation and de-activation of constraints follows the scope controlled by push/pop.
* constraints activated within the linear solver are de-activated when the linear
* solver is popped.
*/
void solver::activate_constraint(signed_constraint c) { void solver::activate_constraint(signed_constraint c) {
SASSERT(c); SASSERT(c);
LOG("Activating constraint: " << c); LOG("Activating constraint: " << c);