3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-06 06:03:23 +00:00

port Grobner

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-10-21 10:18:01 -07:00
parent 8aed753340
commit 426f9b3e80
2 changed files with 5 additions and 6 deletions

View file

@ -50,15 +50,15 @@ bool nla_grobner::internalize_gb_eq(equation* ) {
} }
void nla_grobner::add_var_and_its_factors_to_q_and_collect_new_rows(lpvar j, std::queue<lpvar> & q) { void nla_grobner::add_var_and_its_factors_to_q_and_collect_new_rows(lpvar j, std::queue<lpvar> & q) {
SASSERT(m_active_vars.contains(j) == false); SASSERT(!c().active_var_set_contains(j));
const auto& matrix = c().m_lar_solver.A_r(); const auto& matrix = c().m_lar_solver.A_r();
m_active_vars.insert(j); c().insert_to_active_var_set(j);
for (auto & s : matrix.m_columns[j]) { for (auto & s : matrix.m_columns[j]) {
unsigned row = s.var(); unsigned row = s.var();
if (m_rows.contains(row)) continue; if (m_rows.contains(row)) continue;
m_rows.insert(row); m_rows.insert(row);
for (auto& rc : matrix.m_rows[row]) { for (auto& rc : matrix.m_rows[row]) {
if (m_active_vars.contains(rc.var())) if (c().active_var_set_contains(rc.var()))
continue; continue;
q.push(rc.var()); q.push(rc.var());
} }
@ -71,7 +71,7 @@ void nla_grobner::add_var_and_its_factors_to_q_and_collect_new_rows(lpvar j, std
for (auto fcn : factorization_factory_imp(m, c())) { for (auto fcn : factorization_factory_imp(m, c())) {
for (const factor& fc: fcn) { for (const factor& fc: fcn) {
lpvar j = var(fc); lpvar j = var(fc);
if (! m_active_vars.contains(j)) if (! c().active_var_set_contains(j))
add_var_and_its_factors_to_q_and_collect_new_rows(j, q); add_var_and_its_factors_to_q_and_collect_new_rows(j, q);
} }
} }
@ -88,7 +88,7 @@ void nla_grobner::find_nl_cluster() {
while (!q.empty()) { while (!q.empty()) {
unsigned j = q.front(); unsigned j = q.front();
q.pop(); q.pop();
if (m_active_vars.contains(j)) if (c().active_var_set_contains(j))
continue; continue;
add_var_and_its_factors_to_q_and_collect_new_rows(j, q); add_var_and_its_factors_to_q_and_collect_new_rows(j, q);
} }

View file

@ -82,7 +82,6 @@ class nla_grobner : common {
equation_vector m_equations_to_unfreeze; equation_vector m_equations_to_unfreeze;
equation_vector m_equations_to_delete; equation_vector m_equations_to_delete;
lp::int_set m_rows; lp::int_set m_rows;
lp::int_set m_active_vars;
unsigned m_num_of_equations; unsigned m_num_of_equations;
grobner_stats m_stats; grobner_stats m_stats;
equation_set m_processed; equation_set m_processed;