mirror of
https://github.com/Z3Prover/z3
synced 2025-06-28 00:48:45 +00:00
fix nlsat regression
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
397cdfc608
commit
21f685fa5a
2 changed files with 43 additions and 46 deletions
|
@ -741,10 +741,10 @@ namespace nlsat {
|
||||||
}
|
}
|
||||||
|
|
||||||
void undo_new_stage() {
|
void undo_new_stage() {
|
||||||
if (m_xk == 0 || m_xk == null_var) {
|
if (m_xk == 0) {
|
||||||
m_xk = null_var;
|
m_xk = null_var;
|
||||||
}
|
}
|
||||||
else {
|
else if (m_xk != null_var) {
|
||||||
m_xk--;
|
m_xk--;
|
||||||
m_assignment.reset(m_xk);
|
m_assignment.reset(m_xk);
|
||||||
}
|
}
|
||||||
|
@ -1241,33 +1241,33 @@ namespace nlsat {
|
||||||
while (true) {
|
while (true) {
|
||||||
r = search();
|
r = search();
|
||||||
if (r != l_true) break;
|
if (r != l_true) break;
|
||||||
random_gen r(++m_random_seed);
|
vector<rational> lows;
|
||||||
unsigned start = r(num_vars());
|
vector<var> vars;
|
||||||
for (var y = 0; y < num_vars(); y++) {
|
|
||||||
var x = (y + start) % num_vars();
|
|
||||||
if (m_is_int[x] && m_assignment.is_assigned(x) && !m_am.is_int(m_assignment.value(x))) {
|
|
||||||
scoped_anum v(m_am), vlo(m_am), vhi(m_am);
|
|
||||||
rational lo, hi;
|
|
||||||
bool is_even = false;
|
|
||||||
v = m_assignment.value(x);
|
|
||||||
init_search();
|
|
||||||
m_am.int_lt(v, vlo);
|
|
||||||
m_am.int_gt(v, vhi);
|
|
||||||
if (!m_am.is_int(vlo)) break;
|
|
||||||
if (!m_am.is_int(vhi)) break;
|
|
||||||
m_am.to_rational(vlo, lo);
|
|
||||||
m_am.to_rational(vhi, hi);
|
|
||||||
|
|
||||||
|
for (var x = 0; x < num_vars(); x++) {
|
||||||
|
if (m_is_int[x] && m_assignment.is_assigned(x) && !m_am.is_int(m_assignment.value(x))) {
|
||||||
|
scoped_anum v(m_am), vlo(m_am);
|
||||||
|
v = m_assignment.value(x);
|
||||||
|
rational lo;
|
||||||
|
m_am.int_lt(v, vlo);
|
||||||
|
if (!m_am.is_int(vlo)) continue;
|
||||||
// derive tight bounds.
|
// derive tight bounds.
|
||||||
while (true) {
|
while (true) {
|
||||||
lo++;
|
lo++;
|
||||||
if (!m_am.gt(v, lo.to_mpq())) { lo--; break; }
|
if (!m_am.gt(v, lo.to_mpq())) { lo--; break; }
|
||||||
}
|
}
|
||||||
while (true) {
|
lows.push_back(lo);
|
||||||
hi--;
|
vars.push_back(x);
|
||||||
if (!m_am.lt(v, hi.to_mpq())) { hi++; break; }
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (lows.empty()) break;
|
||||||
|
|
||||||
|
init_search();
|
||||||
|
for (unsigned i = 0; i < lows.size(); ++i) {
|
||||||
|
rational lo = lows[i];
|
||||||
|
rational hi = lo + rational::one();
|
||||||
|
var x = vars[i];
|
||||||
|
bool is_even = false;
|
||||||
polynomial_ref p(m_pm);
|
polynomial_ref p(m_pm);
|
||||||
rational one(1);
|
rational one(1);
|
||||||
m_lemma.reset();
|
m_lemma.reset();
|
||||||
|
@ -1283,9 +1283,6 @@ namespace nlsat {
|
||||||
if (cls) {
|
if (cls) {
|
||||||
TRACE("nlsat", display(tout << "conflict " << lo << " " << hi, *cls); tout << "\n";);
|
TRACE("nlsat", display(tout << "conflict " << lo << " " << hi, *cls); tout << "\n";);
|
||||||
}
|
}
|
||||||
r = l_undef;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -98,7 +98,7 @@ static tactic * mk_qfnia_nlsat_solver(ast_manager & m, params_ref const & p) {
|
||||||
|
|
||||||
|
|
||||||
return and_then(using_params(mk_simplify_tactic(m), simp_p),
|
return and_then(using_params(mk_simplify_tactic(m), simp_p),
|
||||||
try_for(mk_qfnra_nlsat_tactic(m, simp_p), 10000),
|
try_for(mk_qfnra_nlsat_tactic(m, simp_p), 3000),
|
||||||
mk_fail_if_undecided_tactic());
|
mk_fail_if_undecided_tactic());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue