Skip to content

Commit e2db2b8

Browse files
add hook for in-processing simplification for NLA
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
1 parent 6ba1515 commit e2db2b8

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

src/math/lp/nla_core.cpp

+4-25
Original file line numberDiff line numberDiff line change
@@ -1556,9 +1556,6 @@ lbool core::check() {
15561556

15571557
if (no_effect())
15581558
m_monomial_bounds.propagate();
1559-
1560-
if (no_effect() && improve_bounds())
1561-
return l_false;
15621559

15631560
{
15641561
std::function<void(void)> check1 = [&]() { if (no_effect() && run_horner) m_horner.horner_lemmas(); };
@@ -1793,35 +1790,17 @@ void core::set_use_nra_model(bool m) {
17931790

17941791
void core::collect_statistics(::statistics & st) {
17951792
}
1796-
1797-
bool core::improve_bounds() {
1798-
return false;
1799-
1800-
uint_set seen;
1801-
bool bounds_improved = false;
1802-
auto insert = [&](lpvar v) {
1803-
if (seen.contains(v))
1804-
return;
1805-
seen.insert(v);
1806-
if (lra.improve_bound(v, false))
1807-
bounds_improved = true, lp_settings().stats().m_nla_bounds_improvements++;
1808-
if (lra.improve_bound(v, true))
1809-
bounds_improved = true, lp_settings().stats().m_nla_bounds_improvements++;
1810-
};
1811-
for (auto & m : m_emons) {
1812-
insert(m.var());
1813-
for (auto v : m.vars())
1814-
insert(v);
1815-
}
1816-
return bounds_improved;
1817-
}
18181793

18191794
void core::propagate() {
18201795
clear();
18211796
m_monomial_bounds.unit_propagate();
18221797
m_monics_with_changed_bounds.reset();
18231798
}
18241799

1800+
void core::simplify() {
1801+
// in-processing simplifiation can go here, such as bounds improvements.
1802+
}
1803+
18251804

18261805

18271806
} // end of nla

src/math/lp/nla_core.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ class core {
104104

105105
void check_weighted(unsigned sz, std::pair<unsigned, std::function<void(void)>>* checks);
106106
void add_bounds();
107-
// try to improve bounds for variables in monomials.
108-
bool improve_bounds();
109107

110108
public:
111109
// constructor
@@ -386,6 +384,8 @@ class core {
386384
bool no_lemmas_hold() const;
387385

388386
void propagate();
387+
388+
void simplify();
389389

390390
lbool test_check();
391391
lpvar map_to_root(lpvar) const;

src/math/lp/nla_solver.h

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace nla {
3838
bool need_check();
3939
lbool check();
4040
void propagate();
41+
void simplify() { m_core->simplify(); }
4142
lbool check_power(lpvar r, lpvar x, lpvar y);
4243
bool is_monic_var(lpvar) const;
4344
bool influences_nl_var(lpvar) const;

src/smt/theory_lra.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,8 @@ class theory_lra::imp {
10911091

10921092
void restart_eh() {
10931093
m_arith_eq_adapter.restart_eh();
1094+
if (m_nla)
1095+
m_nla->simplify();
10941096
}
10951097

10961098
void relevant_eh(app* n) {

0 commit comments

Comments
 (0)