3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 02:15:19 +00:00

update backoff for bounded_nla

This commit is contained in:
Nikolaj Bjorner 2023-10-21 19:57:06 -07:00
parent 97058b0d5d
commit 53ce18ef34
2 changed files with 16 additions and 14 deletions

View file

@ -40,7 +40,7 @@ core::core(lp::lar_solver& s, params_ref const& p, reslimit & lim) :
m_use_nra_model(false),
m_nra(s, m_nra_lim, *this)
{
m_nlsat_delay = lp_settings().nlsat_delay();
// m_nlsat_delay_bound = lp_settings().nlsat_delay();
lra.m_find_monics_with_changed_bounds_func = [&](const indexed_uint_set& columns_with_changed_bounds) {
for (lpvar j : columns_with_changed_bounds) {
if (is_monic_var(j))
@ -1550,7 +1550,7 @@ lbool core::check() {
bool run_grobner = need_run_grobner();
bool run_horner = need_run_horner();
bool run_bounded_nlsat = should_run_bounded_nlsat();
bool run_bounds = params().arith_nl_branching();
bool run_bounds = params().arith_nl_branching();
auto no_effect = [&]() { return !done() && m_lemmas.empty() && m_literals.empty() && !m_check_feasible; };
@ -1574,6 +1574,9 @@ lbool core::check() {
if (!m_lemmas.empty() || !m_literals.empty())
return l_false;
}
if (no_effect() && run_bounded_nlsat)
ret = bounded_nlsat();
if (no_effect())
m_basics.basic_lemma(true);
@ -1584,8 +1587,6 @@ lbool core::check() {
if (no_effect())
m_divisions.check();
if (no_effect() && run_bounded_nlsat)
ret = bounded_nlsat();
if (no_effect() && ret == l_undef) {
std::function<void(void)> check1 = [&]() { m_order.order_lemma(); };
@ -1623,9 +1624,9 @@ lbool core::check() {
bool core::should_run_bounded_nlsat() {
if (!params().arith_nl_nra())
return false;
if (m_nlsat_delay > m_nlsat_fails)
++m_nlsat_fails;
return m_nlsat_delay <= m_nlsat_fails;
if (m_nlsat_delay > 0)
--m_nlsat_delay;
return m_nlsat_delay < 5;
}
lbool core::bounded_nlsat() {
@ -1643,11 +1644,12 @@ lbool core::bounded_nlsat() {
m_nra.updt_params(p);
lp_settings().stats().m_nra_calls++;
if (ret == l_undef)
++m_nlsat_delay;
else {
m_nlsat_fails = 0;
m_nlsat_delay /= 2;
}
++m_nlsat_delay_bound;
else if (m_nlsat_delay_bound > 0)
m_nlsat_delay_bound /= 2;
m_nlsat_delay = m_nlsat_delay_bound;
if (ret == l_true)
clear();
return ret;

View file

@ -60,8 +60,8 @@ class core {
friend class nra::solver;
friend class divisions;
unsigned m_nlsat_delay = 50;
unsigned m_nlsat_fails = 0;
unsigned m_nlsat_delay = 0;
unsigned m_nlsat_delay_bound = 0;
bool should_run_bounded_nlsat();
lbool bounded_nlsat();