mirror of
https://github.com/Z3Prover/z3
synced 2025-04-06 17:44:08 +00:00
move nla stats to nla_core
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
82fd2a062d
commit
01279582ff
|
@ -1474,10 +1474,18 @@ lbool core::check(vector<lemma>& l_vec) {
|
||||||
m_tangents.tangent_lemma();
|
m_tangents.tangent_lemma();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l_vec.empty() && !done() && m_nla_settings.run_nra())
|
if (l_vec.empty() && !done() && m_nla_settings.run_nra()) {
|
||||||
ret = m_nra.check();
|
ret = m_nra.check();
|
||||||
|
m_stats.m_nra_calls ++;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == l_undef && !l_vec.empty() && m_reslim.inc())
|
if (ret == l_undef && !l_vec.empty() && m_reslim.inc())
|
||||||
ret = l_false;
|
ret = l_false;
|
||||||
|
|
||||||
|
m_stats.m_nla_lemmas += l_vec.size();
|
||||||
|
for (const auto& l : l_vec)
|
||||||
|
m_stats.m_nla_explanations += static_cast<unsigned>(l.expl().size());
|
||||||
|
|
||||||
|
|
||||||
TRACE("nla_solver", tout << "ret = " << ret << ", lemmas count = " << l_vec.size() << "\n";);
|
TRACE("nla_solver", tout << "ret = " << ret << ", lemmas count = " << l_vec.size() << "\n";);
|
||||||
IF_VERBOSE(2, if(ret == l_undef) {verbose_stream() << "Monomials\n"; print_monics(verbose_stream());});
|
IF_VERBOSE(2, if(ret == l_undef) {verbose_stream() << "Monomials\n"; print_monics(verbose_stream());});
|
||||||
|
@ -1861,4 +1869,11 @@ bool core::influences_nl_var(lpvar j) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void core::collect_statistics(::statistics & st) {
|
||||||
|
st.update("arith-nla-explanations", m_stats.m_nla_explanations);
|
||||||
|
st.update("arith-nla-lemmas", m_stats.m_nla_lemmas);
|
||||||
|
st.update("arith-nra-calls", m_stats.m_nra_calls);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // end of nla
|
} // end of nla
|
||||||
|
|
|
@ -139,6 +139,17 @@ struct pp_factorization {
|
||||||
};
|
};
|
||||||
|
|
||||||
class core {
|
class core {
|
||||||
|
struct stats {
|
||||||
|
unsigned m_nla_explanations;
|
||||||
|
unsigned m_nla_lemmas;
|
||||||
|
unsigned m_nra_calls;
|
||||||
|
unsigned m_assume_eqs;
|
||||||
|
stats() { reset(); }
|
||||||
|
void reset() {
|
||||||
|
memset(this, 0, sizeof(*this));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
stats m_stats;
|
||||||
friend class new_lemma;
|
friend class new_lemma;
|
||||||
public:
|
public:
|
||||||
var_eqs<emonics> m_evars;
|
var_eqs<emonics> m_evars;
|
||||||
|
@ -465,6 +476,7 @@ public:
|
||||||
bool has_real(const monic& m) const;
|
bool has_real(const monic& m) const;
|
||||||
void set_use_nra_model(bool m) { m_use_nra_model = m; }
|
void set_use_nra_model(bool m) { m_use_nra_model = m; }
|
||||||
bool use_nra_model() const { return m_use_nra_model; }
|
bool use_nra_model() const { return m_use_nra_model; }
|
||||||
|
void collect_statistics(::statistics&);
|
||||||
}; // end of core
|
}; // end of core
|
||||||
|
|
||||||
struct pp_mon {
|
struct pp_mon {
|
||||||
|
|
|
@ -68,4 +68,8 @@ nlsat::anum const& solver::am_value(lp::var_index v) const {
|
||||||
return m_core->m_nra.value(v);
|
return m_core->m_nra.value(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void solver::collect_statistics(::statistics & st) {
|
||||||
|
m_core->collect_statistics(st);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,6 @@ public:
|
||||||
core& get_core();
|
core& get_core();
|
||||||
nlsat::anum_manager& am();
|
nlsat::anum_manager& am();
|
||||||
nlsat::anum const& am_value(lp::var_index v) const;
|
nlsat::anum const& am_value(lp::var_index v) const;
|
||||||
|
void collect_statistics(::statistics & st);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,9 +123,6 @@ struct stats {
|
||||||
unsigned m_bound_propagations2;
|
unsigned m_bound_propagations2;
|
||||||
unsigned m_assert_diseq;
|
unsigned m_assert_diseq;
|
||||||
unsigned m_gomory_cuts;
|
unsigned m_gomory_cuts;
|
||||||
unsigned m_nla_explanations;
|
|
||||||
unsigned m_nla_lemmas;
|
|
||||||
unsigned m_nra_calls;
|
|
||||||
unsigned m_assume_eqs;
|
unsigned m_assume_eqs;
|
||||||
unsigned m_branch;
|
unsigned m_branch;
|
||||||
stats() { reset(); }
|
stats() { reset(); }
|
||||||
|
@ -2128,7 +2125,6 @@ public:
|
||||||
void false_case_of_check_nla(const nla::lemma & l) {
|
void false_case_of_check_nla(const nla::lemma & l) {
|
||||||
m_lemma = l; //todo avoid the copy
|
m_lemma = l; //todo avoid the copy
|
||||||
m_explanation = l.expl();
|
m_explanation = l.expl();
|
||||||
m_stats.m_nla_explanations += static_cast<unsigned>(l.expl().size());
|
|
||||||
literal_vector core;
|
literal_vector core;
|
||||||
for (auto const& ineq : m_lemma.ineqs()) {
|
for (auto const& ineq : m_lemma.ineqs()) {
|
||||||
bool is_lower = true, pos = true, is_eq = false;
|
bool is_lower = true, pos = true, is_eq = false;
|
||||||
|
@ -2161,11 +2157,8 @@ public:
|
||||||
lbool check_nla_continue() {
|
lbool check_nla_continue() {
|
||||||
m_a1 = nullptr; m_a2 = nullptr;
|
m_a1 = nullptr; m_a2 = nullptr;
|
||||||
lbool r = m_nla->check(m_nla_lemma_vector);
|
lbool r = m_nla->check(m_nla_lemma_vector);
|
||||||
if (use_nra_model()) m_stats.m_nra_calls ++;
|
|
||||||
|
|
||||||
switch (r) {
|
switch (r) {
|
||||||
case l_false: {
|
case l_false: {
|
||||||
m_stats.m_nla_lemmas += m_nla_lemma_vector.size();
|
|
||||||
for (const nla::lemma & l : m_nla_lemma_vector) {
|
for (const nla::lemma & l : m_nla_lemma_vector) {
|
||||||
false_case_of_check_nla(l);
|
false_case_of_check_nla(l);
|
||||||
}
|
}
|
||||||
|
@ -3856,9 +3849,7 @@ public:
|
||||||
st.update("arith-horner-cross-nested-forms", lp().settings().stats().m_cross_nested_forms);
|
st.update("arith-horner-cross-nested-forms", lp().settings().stats().m_cross_nested_forms);
|
||||||
st.update("arith-grobner-calls", lp().settings().stats().m_grobner_calls);
|
st.update("arith-grobner-calls", lp().settings().stats().m_grobner_calls);
|
||||||
st.update("arith-grobner-conflicts", lp().settings().stats().m_grobner_conflicts);
|
st.update("arith-grobner-conflicts", lp().settings().stats().m_grobner_conflicts);
|
||||||
st.update("arith-nla-explanations", m_stats.m_nla_explanations);
|
if (m_nla) m_nla->collect_statistics(st);
|
||||||
st.update("arith-nla-lemmas", m_stats.m_nla_lemmas);
|
|
||||||
st.update("arith-nra-calls", m_stats.m_nra_calls);
|
|
||||||
st.update("arith-gomory-cuts", m_stats.m_gomory_cuts);
|
st.update("arith-gomory-cuts", m_stats.m_gomory_cuts);
|
||||||
st.update("arith-assume-eqs", m_stats.m_assume_eqs);
|
st.update("arith-assume-eqs", m_stats.m_assume_eqs);
|
||||||
st.update("arith-branch", m_stats.m_branch);
|
st.update("arith-branch", m_stats.m_branch);
|
||||||
|
|
Loading…
Reference in a new issue