mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 12:08:18 +00:00
fixes
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
88048901f0
commit
ccbe6c33ae
|
@ -106,6 +106,7 @@ namespace sls {
|
||||||
m_rewards[v] = m_ddfw->get_reward_avg(w);
|
m_rewards[v] = m_ddfw->get_reward_avg(w);
|
||||||
}
|
}
|
||||||
m_completed = true;
|
m_completed = true;
|
||||||
|
m_min_unsat_size = UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void smt_plugin::bounded_run(unsigned max_iterations) {
|
void smt_plugin::bounded_run(unsigned max_iterations) {
|
||||||
|
@ -174,6 +175,7 @@ namespace sls {
|
||||||
}
|
}
|
||||||
|
|
||||||
void smt_plugin::add_unit(sat::literal lit) {
|
void smt_plugin::add_unit(sat::literal lit) {
|
||||||
|
verbose_stream() << "add unit " << lit << " " << is_shared(lit) << "\n";
|
||||||
if (!is_shared(lit))
|
if (!is_shared(lit))
|
||||||
return;
|
return;
|
||||||
std::lock_guard<std::mutex> lock(m_mutex);
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
@ -194,27 +196,29 @@ namespace sls {
|
||||||
|
|
||||||
bool smt_plugin::export_to_sls() {
|
bool smt_plugin::export_to_sls() {
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
if (export_units_to_sls())
|
if (m_has_units) {
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
smt_units_to_sls();
|
||||||
|
m_has_units = false;
|
||||||
updated = true;
|
updated = true;
|
||||||
if (export_phase_to_sls())
|
}
|
||||||
|
if (m_has_new_sat_phase) {
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
export_phase_to_sls();
|
||||||
|
m_has_new_sat_phase = false;
|
||||||
updated = true;
|
updated = true;
|
||||||
|
}
|
||||||
return updated;
|
return updated;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool smt_plugin::export_phase_to_sls() {
|
void smt_plugin::export_phase_to_sls() {
|
||||||
if (!m_has_new_sat_phase)
|
IF_VERBOSE(2, verbose_stream() << "SMT -> SLS phase\n");
|
||||||
return false;
|
|
||||||
std::lock_guard<std::mutex> lock(m_mutex);
|
|
||||||
IF_VERBOSE(3, verbose_stream() << "SMT -> SLS phase\n");
|
|
||||||
for (auto v : m_shared_bool_vars) {
|
for (auto v : m_shared_bool_vars) {
|
||||||
auto w = m_smt_bool_var2sls_bool_var[v];
|
auto w = m_smt_bool_var2sls_bool_var[v];
|
||||||
if (m_sat_phase[v] != is_true(sat::literal(w, false)))
|
if (m_sat_phase[v] != is_true(sat::literal(w, false)))
|
||||||
flip(w);
|
flip(w);
|
||||||
m_ddfw->bias(w) = m_sat_phase[v] ? 1 : -1;
|
m_ddfw->bias(w) = m_sat_phase[v] ? 1 : -1;
|
||||||
}
|
}
|
||||||
smt_phase_to_sls();
|
|
||||||
m_has_new_sat_phase = false;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void smt_plugin::smt_phase_to_sls() {
|
void smt_plugin::smt_phase_to_sls() {
|
||||||
|
@ -250,27 +254,22 @@ namespace sls {
|
||||||
ctx.inc_activity(v, 200 * m_rewards[v]);
|
ctx.inc_activity(v, 200 * m_rewards[v]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool smt_plugin::export_units_to_sls() {
|
void smt_plugin::smt_units_to_sls() {
|
||||||
if (!m_has_units)
|
IF_VERBOSE(2, if (!m_units.empty()) verbose_stream() << "SMT -> SLS units " << m_units << "\n");
|
||||||
return false;
|
|
||||||
std::lock_guard<std::mutex> lock(m_mutex);
|
|
||||||
IF_VERBOSE(2, verbose_stream() << "SMT -> SLS units " << m_units << "\n");
|
|
||||||
for (auto lit : m_units) {
|
for (auto lit : m_units) {
|
||||||
auto v = lit.var();
|
auto v = lit.var();
|
||||||
if (m_shared_bool_vars.contains(v)) {
|
if (m_shared_bool_vars.contains(v)) {
|
||||||
auto w = m_smt_bool_var2sls_bool_var[v];
|
auto w = m_smt_bool_var2sls_bool_var[v];
|
||||||
sat::literal sls_lit(w, lit.sign());
|
sat::literal sls_lit(w, lit.sign());
|
||||||
IF_VERBOSE(10, verbose_stream() << "unit " << sls_lit << "\n");
|
IF_VERBOSE(2, verbose_stream() << "unit " << sls_lit << "\n");
|
||||||
m_ddfw->add(1, &sls_lit);
|
m_ddfw->add(1, &sls_lit);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
IF_VERBOSE(0, verbose_stream() << "value restriction " << lit << " "
|
IF_VERBOSE(0, verbose_stream() << "value restriction " << lit << " "
|
||||||
<< mk_bounded_pp(ctx.bool_var2expr(lit.var()), m) << "\n");
|
<< mk_bounded_pp(ctx.bool_var2expr(lit.var()), m) << "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_has_units = false;
|
|
||||||
m_units.reset();
|
m_units.reset();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void smt_plugin::export_from_sls() {
|
void smt_plugin::export_from_sls() {
|
||||||
|
|
|
@ -92,8 +92,7 @@ namespace sls {
|
||||||
void export_values_from_sls();
|
void export_values_from_sls();
|
||||||
void export_phase_from_sls();
|
void export_phase_from_sls();
|
||||||
void import_activity_from_sls();
|
void import_activity_from_sls();
|
||||||
bool export_phase_to_sls();
|
void export_phase_to_sls();
|
||||||
bool export_units_to_sls();
|
|
||||||
void export_values_to_smt();
|
void export_values_to_smt();
|
||||||
void export_activity_to_smt();
|
void export_activity_to_smt();
|
||||||
|
|
||||||
|
@ -136,6 +135,7 @@ namespace sls {
|
||||||
|
|
||||||
void smt_phase_to_sls();
|
void smt_phase_to_sls();
|
||||||
void smt_values_to_sls();
|
void smt_values_to_sls();
|
||||||
|
void smt_units_to_sls();
|
||||||
void sls_phase_to_smt();
|
void sls_phase_to_smt();
|
||||||
void sls_values_to_smt();
|
void sls_values_to_smt();
|
||||||
void sls_activity_to_smt();
|
void sls_activity_to_smt();
|
||||||
|
|
|
@ -139,6 +139,7 @@ namespace smt {
|
||||||
|
|
||||||
if (ctx.m_stats.m_num_restarts >= m_threshold + 5) {
|
if (ctx.m_stats.m_num_restarts >= m_threshold + 5) {
|
||||||
m_threshold *= 2;
|
m_threshold *= 2;
|
||||||
|
m_smt_plugin->smt_units_to_sls();
|
||||||
bounded_run(m_restart_ls_steps);
|
bounded_run(m_restart_ls_steps);
|
||||||
m_smt_plugin->sls_activity_to_smt();
|
m_smt_plugin->sls_activity_to_smt();
|
||||||
}
|
}
|
||||||
|
@ -165,6 +166,7 @@ namespace smt {
|
||||||
++m_num_guided_sls;
|
++m_num_guided_sls;
|
||||||
|
|
||||||
m_smt_plugin->smt_phase_to_sls();
|
m_smt_plugin->smt_phase_to_sls();
|
||||||
|
m_smt_plugin->smt_units_to_sls();
|
||||||
m_smt_plugin->smt_values_to_sls();
|
m_smt_plugin->smt_values_to_sls();
|
||||||
bounded_run(m_final_check_ls_steps);
|
bounded_run(m_final_check_ls_steps);
|
||||||
dec_final_check_ls_steps();
|
dec_final_check_ls_steps();
|
||||||
|
|
Loading…
Reference in a new issue