mirror of
https://github.com/Z3Prover/z3
synced 2025-10-11 10:18:06 +00:00
parent
5d06fa2347
commit
3c1c3d5987
12 changed files with 103 additions and 31 deletions
|
@ -68,6 +68,7 @@ namespace sat {
|
|||
m_simplifications = 0;
|
||||
m_ext = nullptr;
|
||||
m_cuber = nullptr;
|
||||
m_local_search = nullptr;
|
||||
m_mc.set_solver(this);
|
||||
}
|
||||
|
||||
|
@ -764,9 +765,9 @@ namespace sat {
|
|||
m_not_l = not_l;
|
||||
}
|
||||
|
||||
void solver::assign_core(literal l, justification j) {
|
||||
void solver::assign_core(literal l, unsigned lvl, justification j) {
|
||||
SASSERT(value(l) == l_undef);
|
||||
TRACE("sat_assign_core", tout << l << " " << j << " level: " << scope_lvl() << "\n";);
|
||||
TRACE("sat_assign_core", tout << l << " " << j << " level: " << lvl << "\n";);
|
||||
if (at_base_lvl()) {
|
||||
if (m_config.m_drat) m_drat.add(l, !j.is_none());
|
||||
j = justification(); // erase justification for level 0
|
||||
|
@ -774,7 +775,7 @@ namespace sat {
|
|||
m_assignment[l.index()] = l_true;
|
||||
m_assignment[(~l).index()] = l_false;
|
||||
bool_var v = l.var();
|
||||
m_level[v] = scope_lvl();
|
||||
m_level[v] = lvl;
|
||||
m_justification[v] = j;
|
||||
m_phase[v] = static_cast<phase>(l.sign());
|
||||
m_assigned_since_gc[v] = true;
|
||||
|
@ -882,7 +883,7 @@ namespace sat {
|
|||
return false;
|
||||
case l_undef:
|
||||
m_stats.m_bin_propagate++;
|
||||
assign_core(l1, justification(not_l));
|
||||
assign_core(l1, scope_lvl(), justification(not_l));
|
||||
break;
|
||||
case l_true:
|
||||
break; // skip
|
||||
|
@ -897,11 +898,11 @@ namespace sat {
|
|||
val2 = value(l2);
|
||||
if (val1 == l_false && val2 == l_undef) {
|
||||
m_stats.m_ter_propagate++;
|
||||
assign_core(l2, justification(l1, not_l));
|
||||
assign_core(l2, scope_lvl(), justification(l1, not_l));
|
||||
}
|
||||
else if (val1 == l_undef && val2 == l_false) {
|
||||
m_stats.m_ter_propagate++;
|
||||
assign_core(l1, justification(l2, not_l));
|
||||
assign_core(l1, scope_lvl(), justification(l2, not_l));
|
||||
}
|
||||
else if (val1 == l_false && val2 == l_false) {
|
||||
CONFLICT_CLEANUP();
|
||||
|
@ -964,7 +965,7 @@ namespace sat {
|
|||
it2++;
|
||||
m_stats.m_propagate++;
|
||||
c.mark_used();
|
||||
assign_core(c[0], justification(cls_off));
|
||||
assign_core(c[0], scope_lvl(), justification(cls_off));
|
||||
#ifdef UPDATE_GLUE
|
||||
if (update && c.is_learned() && c.glue() > 2) {
|
||||
unsigned glue;
|
||||
|
@ -1042,7 +1043,7 @@ namespace sat {
|
|||
literal l(v, false);
|
||||
if (mdl[v] != l_true) l.neg();
|
||||
push();
|
||||
assign_core(l, justification());
|
||||
assign_core(l, scope_lvl(), justification());
|
||||
}
|
||||
mk_model();
|
||||
break;
|
||||
|
@ -1160,13 +1161,16 @@ namespace sat {
|
|||
|
||||
lbool solver::do_local_search(unsigned num_lits, literal const* lits) {
|
||||
scoped_limits scoped_rl(rlimit());
|
||||
local_search srch;
|
||||
SASSERT(!m_local_search);
|
||||
m_local_search = alloc(local_search);
|
||||
local_search& srch = *m_local_search;
|
||||
srch.config().set_config(m_config);
|
||||
srch.import(*this, false);
|
||||
scoped_rl.push_child(&srch.rlimit());
|
||||
lbool r = srch.check(num_lits, lits, nullptr);
|
||||
m_model = srch.get_model();
|
||||
// srch.collect_statistics(m_aux_stats);
|
||||
m_local_search = nullptr;
|
||||
dealloc(&srch);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -3379,6 +3383,7 @@ namespace sat {
|
|||
m_asymm_branch.collect_statistics(st);
|
||||
m_probing.collect_statistics(st);
|
||||
if (m_ext) m_ext->collect_statistics(st);
|
||||
if (m_local_search) m_local_search->collect_statistics(st);
|
||||
st.copy(m_aux_stats);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue