3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-12 22:20:54 +00:00

wip - local search - use dispatch model from bool local search instead of separate phases.

This commit is contained in:
Nikolaj Bjorner 2023-02-16 09:17:11 -08:00
parent ac068888e7
commit bd10ddf6ae
8 changed files with 31 additions and 248 deletions

View file

@ -32,9 +32,7 @@ namespace euf {
for (auto* th : m_solvers)
th->set_bool_search(&bool_search);
bool_search.rlimit().push(m_max_bool_steps);
lbool r = bool_search.check(0, nullptr, nullptr);
bool_search.rlimit().pop();
lbool r = bool_search.check(0, nullptr, nullptr);
auto const& mdl = bool_search.get_model();
for (unsigned i = 0; i < mdl.size(); ++i)
@ -42,40 +40,4 @@ namespace euf {
return bool_search.unsat_set().empty() ? l_true : l_undef;
}
bool solver::is_propositional(sat::literal lit) {
expr* e = m_bool_var2expr.get(lit.var(), nullptr);
return !e || is_uninterp_const(e) || !m_egraph.find(e);
}
void solver::setup_bounds(sat::ddfw& bool_search, bool_vector const& phase) {
unsigned num_literals = 0;
unsigned num_bool = 0;
for (auto* th : m_solvers)
th->set_bounds_begin();
auto count_literal = [&](sat::literal l) {
if (is_propositional(l)) {
++num_bool;
return;
}
euf::enode* n = m_egraph.find(m_bool_var2expr.get(l.var(), nullptr));
for (auto* s : m_solvers)
s->set_bounds(n);
};
for (auto cl : bool_search.unsat_set()) {
auto& c = *bool_search.get_clause_info(cl).m_clause;
num_literals += c.size();
for (auto l : c)
count_literal(l);
}
m_max_bool_steps = (m_ls_config.L * num_bool); // / num_literals;
m_max_bool_steps = std::max(10000u, m_max_bool_steps);
verbose_stream() << "num literals " << num_literals << " num bool " << num_bool << " max bool steps " << m_max_bool_steps << "\n";
for (auto* th : m_solvers)
th->set_bounds_end(num_literals);
}
}