mirror of
https://github.com/Z3Prover/z3
synced 2026-07-05 23:06:12 +00:00
refactor
This commit is contained in:
parent
5aa06b6333
commit
49d725f477
4 changed files with 11 additions and 24 deletions
|
|
@ -658,9 +658,7 @@ namespace sat {
|
||||||
return;
|
return;
|
||||||
bool value = !l.sign();
|
bool value = !l.sign();
|
||||||
set_phase(l.var(), value);
|
set_phase(l.var(), value);
|
||||||
if (m_best_phase[l.var()] != value)
|
set_best_phase(l.var(), value);
|
||||||
m_best_phase_birthdate[l.var()] = m_stats.m_conflicts;
|
|
||||||
m_best_phase[l.var()] = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void solver::set_phase(bool_var v, bool value) {
|
void solver::set_phase(bool_var v, bool value) {
|
||||||
|
|
@ -669,6 +667,12 @@ namespace sat {
|
||||||
m_phase[v] = value;
|
m_phase[v] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void solver::set_best_phase(bool_var v, bool value) {
|
||||||
|
if (m_best_phase[v] != value)
|
||||||
|
m_best_phase_birthdate[v] = m_stats.m_conflicts;
|
||||||
|
m_best_phase[v] = value;
|
||||||
|
}
|
||||||
|
|
||||||
struct solver::cmp_activity {
|
struct solver::cmp_activity {
|
||||||
solver& s;
|
solver& s;
|
||||||
cmp_activity(solver& s):s(s) {}
|
cmp_activity(solver& s):s(s) {}
|
||||||
|
|
@ -1404,9 +1408,7 @@ namespace sat {
|
||||||
if (mdl.size() == m_best_phase.size()) {
|
if (mdl.size() == m_best_phase.size()) {
|
||||||
for (unsigned i = 0; i < m_best_phase.size(); ++i) {
|
for (unsigned i = 0; i < m_best_phase.size(); ++i) {
|
||||||
bool is_true = l_true == mdl[i];
|
bool is_true = l_true == mdl[i];
|
||||||
if (m_best_phase[i] != is_true)
|
set_best_phase(i, is_true);
|
||||||
m_best_phase_birthdate[i] = m_stats.m_conflicts;
|
|
||||||
m_best_phase[i] = is_true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r == l_true) {
|
if (r == l_true) {
|
||||||
|
|
@ -2201,9 +2203,7 @@ namespace sat {
|
||||||
m_model[v] = value(v);
|
m_model[v] = value(v);
|
||||||
bool is_true = value(v) == l_true;
|
bool is_true = value(v) == l_true;
|
||||||
set_phase(v, is_true);
|
set_phase(v, is_true);
|
||||||
if (m_best_phase[v] != is_true)
|
set_best_phase(v, is_true);
|
||||||
m_best_phase_birthdate[v] = m_stats.m_conflicts;
|
|
||||||
m_best_phase[v] = is_true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TRACE(sat_mc_bug, m_mc.display(tout););
|
TRACE(sat_mc_bug, m_mc.display(tout););
|
||||||
|
|
@ -2980,9 +2980,7 @@ namespace sat {
|
||||||
IF_VERBOSE(12, verbose_stream() << "sticky trail: " << head << "\n");
|
IF_VERBOSE(12, verbose_stream() << "sticky trail: " << head << "\n");
|
||||||
for (unsigned i = 0; i < head; ++i) {
|
for (unsigned i = 0; i < head; ++i) {
|
||||||
bool_var v = m_trail[i].var();
|
bool_var v = m_trail[i].var();
|
||||||
if (m_best_phase[v] != m_phase[v])
|
set_best_phase(v, m_phase[v]);
|
||||||
m_best_phase_birthdate[v] = m_stats.m_conflicts;
|
|
||||||
m_best_phase[v] = m_phase[v];
|
|
||||||
}
|
}
|
||||||
set_has_new_best_phase(true);
|
set_has_new_best_phase(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -377,6 +377,7 @@ namespace sat {
|
||||||
bool was_eliminated(literal l) const { return was_eliminated(l.var()); }
|
bool was_eliminated(literal l) const { return was_eliminated(l.var()); }
|
||||||
void set_phase(literal l) override;
|
void set_phase(literal l) override;
|
||||||
void set_phase(bool_var v, bool value);
|
void set_phase(bool_var v, bool value);
|
||||||
|
void set_best_phase(bool_var v, bool value);
|
||||||
bool get_phase(bool_var b) { return m_phase.get(b, false); }
|
bool get_phase(bool_var b) { return m_phase.get(b, false); }
|
||||||
bool get_best_phase(bool_var b) { return m_best_phase.get(b, false); }
|
bool get_best_phase(bool_var b) { return m_best_phase.get(b, false); }
|
||||||
uint64_t get_phase_birthdate(bool_var b) const { return m_phase_birthdate.get(b, 0); }
|
uint64_t get_phase_birthdate(bool_var b) const { return m_phase_birthdate.get(b, 0); }
|
||||||
|
|
|
||||||
|
|
@ -288,14 +288,6 @@ namespace smt {
|
||||||
m_imp->m_kernel.get_fparams().m_preprocess = f;
|
m_imp->m_kernel.get_fparams().m_preprocess = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void kernel::reset_aux_statistics() {
|
|
||||||
m_imp->m_kernel.m_aux_stats.reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void kernel::add_aux_statistics(::statistics const& st) {
|
|
||||||
m_imp->m_kernel.m_aux_stats.copy(st);
|
|
||||||
}
|
|
||||||
|
|
||||||
context & kernel::get_context() {
|
context & kernel::get_context() {
|
||||||
return m_imp->m_kernel;
|
return m_imp->m_kernel;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -304,10 +304,6 @@ namespace smt {
|
||||||
|
|
||||||
void set_preprocess(bool f);
|
void set_preprocess(bool f);
|
||||||
|
|
||||||
void reset_aux_statistics();
|
|
||||||
|
|
||||||
void add_aux_statistics(::statistics const& st);
|
|
||||||
|
|
||||||
void register_on_clause(void* ctx, user_propagator::on_clause_eh_t& on_clause);
|
void register_on_clause(void* ctx, user_propagator::on_clause_eh_t& on_clause);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue