Skip to content

Commit 623b322

Browse files
committed
when deleting the last row from m_e_matrix go over fresh variables defined for this row and mark the rows depending on them as changed
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
1 parent 918722d commit 623b322

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

src/math/lp/dioph_eq.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
-- m_fresh_k2xt_terms: when a fresh definitions is created for a variable k in row s then the triple
2727
(k,xt,(t,s)) is added to m_fresh_k2xt_terms, where xt is the fresh variable, and t it the term defining the substitution: something like k - xt + 5z + 6y = 0.
2828
The set of pairs (k, xt) is a one to one mapping
29-
m_row2fresh_defs[i]: is the list of all xt that were defined for row m_e_matrix[i].
29+
m_row2fresh_defs[i]: is the list of all fresh xt that were defined for row m_e_matrix[i].
3030
Invariant: Every xt in m_row2fresh[i] must have a corresponding entry in m_fresh_k2xt_terms
3131
3232
The mapping between the columns of lar_solver and m_e_matrix is controlled by m_var_register.
@@ -733,12 +733,20 @@ namespace lp {
733733
eliminate_last_term_column();
734734
remove_last_row_in_matrix(m_l_matrix);
735735
remove_last_row_in_matrix(m_e_matrix);
736-
while (m_l_matrix.column_count() && m_l_matrix.m_columns.back().size() == 0) {
736+
// Recalculate rows that still reference fresh vars defined by the removed row.
737+
auto it = m_row2fresh_defs.find(i);
738+
if (it != m_row2fresh_defs.end())
739+
for (unsigned xt : it->second)
740+
if (xt < m_e_matrix.column_count())
741+
for (const auto& p : m_e_matrix.m_columns[xt])
742+
m_changed_rows.insert(p.var());
743+
744+
while (m_l_matrix.column_count() && m_l_matrix.m_columns.back().size() == 0)
737745
m_l_matrix.m_columns.pop_back();
738-
}
739-
while (m_e_matrix.column_count() && m_e_matrix.m_columns.back().size() == 0) {
746+
747+
while (m_e_matrix.column_count() && m_e_matrix.m_columns.back().size() == 0)
740748
m_e_matrix.m_columns.pop_back();
741-
}
749+
742750
m_var_register.shrink(m_e_matrix.column_count());
743751

744752
remove_irrelevant_fresh_defs_for_row(i);

0 commit comments

Comments
 (0)