mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 09:05:31 +00:00
extract stats with finalize for parallel mode
This commit is contained in:
parent
b4295620b3
commit
538f74d64c
5 changed files with 18 additions and 30 deletions
|
@ -80,12 +80,10 @@ namespace smt {
|
|||
m_init_search = true;
|
||||
}
|
||||
|
||||
void theory_sls::finalize() {
|
||||
void theory_sls::finalize() const {
|
||||
if (!m_smt_plugin)
|
||||
return;
|
||||
|
||||
m_smt_plugin->collect_statistics(m_st);
|
||||
m_smt_plugin->finalize(m_model);
|
||||
m_smt_plugin->finalize(m_model, m_st);
|
||||
m_model = nullptr;
|
||||
m_smt_plugin = nullptr;
|
||||
m_init_search = false;
|
||||
|
@ -108,8 +106,7 @@ namespace smt {
|
|||
else if (!m_parallel_mode)
|
||||
propagate_local_search();
|
||||
else if (m_smt_plugin->completed()) {
|
||||
m_smt_plugin->collect_statistics(m_st);
|
||||
m_smt_plugin->finalize(m_model);
|
||||
m_smt_plugin->finalize(m_model, m_st);
|
||||
m_smt_plugin = nullptr;
|
||||
m_init_search = false;
|
||||
}
|
||||
|
@ -197,10 +194,8 @@ namespace smt {
|
|||
}
|
||||
|
||||
void theory_sls::collect_statistics(::statistics& st) const {
|
||||
if (m_smt_plugin)
|
||||
m_smt_plugin->collect_statistics(st);
|
||||
else
|
||||
st.copy(m_st);
|
||||
finalize();
|
||||
st.copy(m_st);
|
||||
st.update("sls-num-guided-search", m_stats.m_num_guided_sls);
|
||||
st.update("sls-num-restart-search", m_stats.m_num_restart_sls);
|
||||
}
|
||||
|
@ -222,8 +217,7 @@ namespace smt {
|
|||
void theory_sls::bounded_run(unsigned num_steps) {
|
||||
m_smt_plugin->bounded_run(num_steps);
|
||||
if (m_smt_plugin->result() == l_true) {
|
||||
m_smt_plugin->collect_statistics(m_st);
|
||||
m_smt_plugin->finalize(m_model);
|
||||
m_smt_plugin->finalize(m_model, m_st);
|
||||
m_smt_plugin = nullptr;
|
||||
m_init_search = false;
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ namespace smt {
|
|||
unsigned m_num_restart_sls = 0;
|
||||
};
|
||||
stats m_stats;
|
||||
model_ref m_model;
|
||||
sls::smt_plugin* m_smt_plugin = nullptr;
|
||||
mutable model_ref m_model;
|
||||
mutable sls::smt_plugin* m_smt_plugin = nullptr;
|
||||
unsigned m_trail_lim = 0;
|
||||
bool m_checking = false;
|
||||
bool m_parallel_mode = true;
|
||||
|
@ -72,11 +72,11 @@ namespace smt {
|
|||
unsigned m_after_resolve_decide_count = 0;
|
||||
unsigned m_resolve_count = 0;
|
||||
unsigned m_resolve_gap = 0;
|
||||
bool m_init_search = false;
|
||||
::statistics m_st;
|
||||
mutable bool m_init_search = false;
|
||||
mutable ::statistics m_st;
|
||||
vector<sat::literal_vector> m_shared_clauses;
|
||||
|
||||
void finalize();
|
||||
|
||||
void bounded_run(unsigned num_steps);
|
||||
void inc_restart_ls_steps() {
|
||||
if (m_restart_ls_steps < m_restart_ls_steps_max)
|
||||
|
@ -92,10 +92,12 @@ namespace smt {
|
|||
void propagate_local_search();
|
||||
|
||||
void run_guided_sls();
|
||||
void finalize() const;
|
||||
|
||||
public:
|
||||
theory_sls(context& ctx);
|
||||
~theory_sls() override;
|
||||
|
||||
model_ref get_model() { return m_model; }
|
||||
|
||||
// smt::theory interface
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue