3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-11 11:24:31 +00:00

prepare for new viable

This commit is contained in:
Nikolaj Bjorner 2021-11-21 06:18:35 +01:00
parent b0bf03457c
commit d86570ce75
8 changed files with 99 additions and 13 deletions

View file

@ -98,7 +98,9 @@ namespace polysat {
m_value.push_back(rational::zero());
m_justification.push_back(justification::unassigned());
m_viable.push(sz);
#if !NEW_VIABLE
m_cjust.push_back({});
#endif
m_pwatch.push_back({});
m_activity.push_back(0);
m_vars.push_back(sz2pdd(sz).mk_var(v));
@ -116,7 +118,9 @@ namespace polysat {
// TODO also remove v from all learned constraints.
pvar v = m_value.size() - 1;
m_viable.pop();
#if !NEW_VIABLE
m_cjust.pop_back();
#endif
m_value.pop_back();
m_justification.pop_back();
m_pwatch.pop_back();
@ -342,10 +346,12 @@ namespace polysat {
break;
}
case trail_instr_t::just_i: {
#if !NEW_VIABLE
auto v = m_cjust_trail.back();
LOG_V("Undo just_i");
m_cjust[v].pop_back();
m_cjust_trail.pop_back();
#endif
break;
}
default:
@ -474,8 +480,12 @@ namespace polysat {
LOG_H2("Resolve conflict");
LOG("\n" << *this);
LOG("search state: " << m_search);
#if NEW_VIABLE
m_viable.log();
#else
for (pvar v = 0; v < m_cjust.size(); ++v)
LOG("cjust[v" << v << "]: " << m_cjust[v]);
#endif
++m_stats.m_num_conflicts;
SASSERT(is_conflict());
@ -527,7 +537,7 @@ namespace polysat {
/** Conflict resolution case where propagation 'v := ...' is on top of the stack */
bool solver::resolve_value(pvar v) {
return m_conflict.resolve_value(v, m_cjust[v]);
return m_conflict.resolve_value(v);
}
/** Conflict resolution case where boolean literal 'lit' is on top of the stack
@ -762,6 +772,7 @@ namespace polysat {
void solver::narrow(pvar v) {
if (is_conflict())
return;
// TODO
}
// Add lemma to storage
@ -793,7 +804,7 @@ namespace polysat {
unsigned base_level = m_base_levels[m_base_levels.size() - num_scopes];
LOG("Pop " << num_scopes << " user scopes; lowest popped level = " << base_level << "; current level = " << m_level);
pop_levels(m_level - base_level + 1);
m_conflict.reset(); // TODO: maybe keep conflict if level of all constraints is lower than base_level?
m_conflict.reset();
}
bool solver::at_base_level() const {
@ -817,9 +828,11 @@ namespace polysat {
if (item.is_assignment()) {
pvar v = item.var();
auto const& j = m_justification[v];
out << "\t" << assignment_pp(*this, v, get_value(v)) << " @" << j.level();
out << "\t" << assignment_pp(*this, v, get_value(v)) << " @" << j.level();
#if !NEW_VIABLE
if (j.is_propagation())
out << " " << m_cjust[v];
#endif
out << "\n";
}
else {