3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

pass resource limits by reference

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-05-12 10:49:16 -07:00
parent bea0d45e6a
commit 32055a31db
5 changed files with 18 additions and 18 deletions

View file

@ -160,7 +160,7 @@ private:
mutable lp::u_set m_active_var_set; mutable lp::u_set m_active_var_set;
lp::u_set m_rows; lp::u_set m_rows;
public: public:
reslimit m_reslim; reslimit& m_reslim;
void insert_to_refine(lpvar j); void insert_to_refine(lpvar j);
void erase_from_to_refine(lpvar j); void erase_from_to_refine(lpvar j);

View file

@ -51,8 +51,9 @@ void solver::pop(unsigned n) {
m_core->pop(n); m_core->pop(n);
} }
solver::solver(lp::lar_solver& s): m_core(alloc(core, s, m_res_limit)), solver::solver(lp::lar_solver& s, reslimit& limit):
m_nra(s, m_res_limit, *m_core) { m_core(alloc(core, s, limit)),
m_nra(s, limit, *m_core) {
} }
bool solver::influences_nl_var(lpvar j) const { bool solver::influences_nl_var(lpvar j) const {

View file

@ -22,7 +22,6 @@ namespace nla {
class core; class core;
// nonlinear integer incremental linear solver // nonlinear integer incremental linear solver
class solver { class solver {
reslimit m_res_limit;
core* m_core; core* m_core;
nra::solver m_nra; nra::solver m_nra;
bool m_use_nra_model; bool m_use_nra_model;
@ -31,7 +30,7 @@ class solver {
public: public:
void add_monic(lpvar v, unsigned sz, lpvar const* vs); void add_monic(lpvar v, unsigned sz, lpvar const* vs);
solver(lp::lar_solver& s); solver(lp::lar_solver& s, reslimit& limit);
~solver(); ~solver();
nla_settings& settings(); nla_settings& settings();
void push(); void push();

View file

@ -387,7 +387,7 @@ class theory_lra::imp {
void ensure_nla() { void ensure_nla() {
if (!m_nla) { if (!m_nla) {
m_nla = alloc(nla::solver, *m_solver.get()); m_nla = alloc(nla::solver, *m_solver.get(), m.limit());
for (auto const& _s : m_scopes) { for (auto const& _s : m_scopes) {
(void)_s; (void)_s;
m_nla->push(); m_nla->push();

View file

@ -169,7 +169,7 @@ void test_basic_lemma_for_mon_neutral_from_factors_to_monomial_0() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
svector<lpvar> v; v.push_back(lp_b);v.push_back(lp_d);v.push_back(lp_e); svector<lpvar> v; v.push_back(lp_b);v.push_back(lp_d);v.push_back(lp_e);
nla.add_monic(lp_bde, v.size(), v.begin()); nla.add_monic(lp_bde, v.size(), v.begin());
v.clear(); v.clear();
@ -246,7 +246,7 @@ void test_basic_lemma_for_mon_neutral_from_factors_to_monomial_1() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
svector<lpvar> v; v.push_back(lp_b);v.push_back(lp_d);v.push_back(lp_e); svector<lpvar> v; v.push_back(lp_b);v.push_back(lp_d);v.push_back(lp_e);
nla.add_monic(lp_bde, v.size(), v.begin()); nla.add_monic(lp_bde, v.size(), v.begin());
@ -317,7 +317,7 @@ void test_basic_lemma_for_mon_zero_from_factors_to_monomial() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
create_abcde(nla, create_abcde(nla,
lp_a, lp_a,
@ -379,7 +379,7 @@ void test_basic_lemma_for_mon_zero_from_monomial_to_factors() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
// create monomial acd // create monomial acd
unsigned_vector vec; unsigned_vector vec;
@ -439,7 +439,7 @@ void test_basic_lemma_for_mon_neutral_from_monomial_to_factors() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
create_abcde(nla, create_abcde(nla,
lp_a, lp_a,
@ -514,7 +514,7 @@ void test_horner() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
vector<lpvar> v; vector<lpvar> v;
v.push_back(a); v.push_back(b); v.push_back(a); v.push_back(b);
nla.add_monic(lp_ab, v.size(), v.begin()); nla.add_monic(lp_ab, v.size(), v.begin());
@ -551,7 +551,7 @@ void test_basic_sign_lemma() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
// create monomial bde // create monomial bde
vector<unsigned> vec; vector<unsigned> vec;
@ -626,7 +626,7 @@ void test_order_lemma_params(bool var_equiv, int sign) {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s,l);
// create monomial ab // create monomial ab
vector<unsigned> vec; vector<unsigned> vec;
vec.push_back(lp_a); vec.push_back(lp_a);
@ -757,7 +757,7 @@ void test_monotone_lemma() {
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
// create monomial ab // create monomial ab
vector<unsigned> vec; vector<unsigned> vec;
vec.push_back(lp_a); vec.push_back(lp_a);
@ -814,7 +814,7 @@ void test_tangent_lemma_rat() {
s_set_column_value_test(s, lp_ab, v); s_set_column_value_test(s, lp_ab, v);
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
// create monomial ab // create monomial ab
vector<unsigned> vec; vector<unsigned> vec;
vec.push_back(lp_a); vec.push_back(lp_a);
@ -841,7 +841,7 @@ void test_tangent_lemma_reg() {
s_set_column_value_test(s, lp_ab, rational(11)); s_set_column_value_test(s, lp_ab, rational(11));
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
// create monomial ab // create monomial ab
vector<unsigned> vec; vector<unsigned> vec;
vec.push_back(lp_a); vec.push_back(lp_a);
@ -885,7 +885,7 @@ void test_tangent_lemma_equiv() {
s_set_column_value_test(s, lp_a, - s.get_column_value(lp_k)); s_set_column_value_test(s, lp_a, - s.get_column_value(lp_k));
reslimit l; reslimit l;
params_ref p; params_ref p;
solver nla(s); solver nla(s, l);
// create monomial ab // create monomial ab
vector<unsigned> vec; vector<unsigned> vec;
vec.push_back(lp_a); vec.push_back(lp_a);