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

Try to keep conflict alive for longer

This commit is contained in:
Jakob Rath 2023-03-23 07:18:36 +01:00
parent e433951e27
commit 5b3f500900
3 changed files with 35 additions and 9 deletions

View file

@ -171,6 +171,7 @@ namespace polysat {
}
void conflict::reset() {
LOG("Reset conflict");
m_literals.reset();
m_vars.reset();
m_var_occurrences.reset();
@ -190,6 +191,22 @@ namespace polysat {
return contains(lit) || contains(~lit);
}
unsigned conflict::effective_level() const {
// If m_dep is set, the corresponding constraint was asserted at m_level and is not valid earlier.
if (m_dep != null_dependency)
return m_level;
// In other cases, m_level just tracks the level at which the conflict appeared.
// Find the minimal level at which the conflict is still valid.
unsigned lvl = 0;
for (unsigned lit_idx : m_literals) {
sat::literal const lit = sat::to_literal(lit_idx);
lvl = std::max(lvl, s.m_bvars.level(lit));
}
for (pvar v : m_vars)
lvl = std::max(lvl, s.get_level(v));
return lvl;
}
void conflict::init_at_base_level(dependency dep) {
SASSERT(empty());
SASSERT(s.at_base_level());
@ -396,7 +413,6 @@ namespace polysat {
SASSERT(contains(lit));
SASSERT(!contains(~lit));
unsigned const lvl = s.m_bvars.level(lit);
signed_constraint c = s.lit2cnstr(lit);
unsigned const eval_idx = s.m_search.get_bool_index(lit);