@@ -541,10 +541,10 @@ namespace lp {
541
541
TRACE (" d_undo" , tout << " t:" << t << " , t->j():" << t->j () << std::endl;);
542
542
TRACE (" dioph_eq" , lra.print_term (*t, tout); tout << " , t->j() =" << t->j () << std::endl;);
543
543
if (!contains (m_active_terms, t)) {
544
- for (int i = static_cast < int >( m_added_terms.size () - 1 ) ; i >= 0 ; --i ) {
545
- if (m_added_terms[i] != t) continue ;
546
- if (( unsigned )i != m_added_terms. size () - 1 )
547
- m_added_terms[i] = m_added_terms.back ();
544
+ for (auto i = m_added_terms.size (); i-- > 0 ; ) {
545
+ if (m_added_terms[i] != t)
546
+ continue ;
547
+ m_added_terms[i] = m_added_terms.back ();
548
548
m_added_terms.pop_back ();
549
549
break ; // all is done since the term has not made it to m_active_terms
550
550
}
@@ -679,15 +679,13 @@ namespace lp {
679
679
void make_sure_j_is_in_the_last_row_of_l_matrix () {
680
680
unsigned j = m_l_matrix.column_count () - 1 ;
681
681
const auto & last_e_row = m_l_matrix.m_rows .back ();
682
- mpq alpha;
683
- for (const auto & p : last_e_row) {
684
- if (p.var () == j) {
685
- return ;
686
- }
687
- }
688
- SASSERT (m_l_matrix.m_columns .back ().size ());
682
+ if (any_of (last_e_row, [j](auto const & p) { return p.var () == j; }))
683
+ return ;
684
+ SASSERT (m_l_matrix.m_columns .back ().size () > 0 );
689
685
unsigned i = m_l_matrix.m_columns [j][0 ].var ();
690
686
m_l_matrix.add_rows (mpq (1 ), i, m_l_matrix.row_count () - 1 );
687
+ // what is the post-condition? Is 'j' used in the post-condition or is it 'i'?
688
+ // SASSERT(any_of(m_l_matrix.m_rows.back(), [i](auto const& p) { return p.var() == i; }));
691
689
}
692
690
693
691
void shrink_matrices () {
@@ -705,9 +703,8 @@ namespace lp {
705
703
706
704
remove_irrelevant_fresh_defs_for_row (i);
707
705
708
- if (m_k2s.has_val (i)) {
706
+ if (m_k2s.has_val (i))
709
707
remove_from_S (i);
710
- }
711
708
712
709
m_sum_of_fixed.pop_back ();
713
710
}
@@ -760,7 +757,7 @@ namespace lp {
760
757
TRACE (" dio" , tout << " marked term change j:" << j << std::endl;);
761
758
m_changed_terms.insert (j);
762
759
}
763
-
760
+
764
761
void update_column_bound_callback (unsigned j) {
765
762
if (!lra.column_is_int (j) || !lra.column_is_fixed (j))
766
763
return ;
@@ -1158,12 +1155,9 @@ namespace lp {
1158
1155
1159
1156
template <typename T>
1160
1157
bool has_fresh_var (const T& t) const {
1161
- for (const auto & p : t) {
1162
- if (var_is_fresh (p.var ()))
1163
- return true ;
1164
- }
1165
- return false ;
1158
+ return any_of (t, [&](auto const & p) { return var_is_fresh (p.var ()); });
1166
1159
}
1160
+
1167
1161
bool has_fresh_var (unsigned row_index) const {
1168
1162
return has_fresh_var (m_e_matrix[row_index]);
1169
1163
}
@@ -1417,6 +1411,7 @@ namespace lp {
1417
1411
TRACE (" dio" ,
1418
1412
tout << " changed terms:" ; for (auto j : sorted_changed_terms) tout << j << " " ; tout << std::endl;
1419
1413
print_S (tout);
1414
+ // lra.display(tout);
1420
1415
// print_bounds(tout);
1421
1416
);
1422
1417
for (unsigned j : sorted_changed_terms) {
0 commit comments