@@ -506,7 +506,7 @@ namespace lp {
506
506
507
507
unsigned m_conflict_index = UINT_MAX; // the row index of the conflict
508
508
void reset_conflict () { m_conflict_index = UINT_MAX; }
509
- bool has_conflict () const { return m_conflict_index != UINT_MAX; }
509
+ bool has_conflict_index () const { return m_conflict_index != UINT_MAX; }
510
510
void set_rewrite_conflict (unsigned idx) { SASSERT (idx != UINT_MAX); m_conflict_index = idx; lra.stats ().m_dio_rewrite_conflicts ++; }
511
511
unsigned m_max_of_branching_iterations = 0 ;
512
512
unsigned m_number_of_branching_calls;
@@ -1658,7 +1658,7 @@ namespace lp {
1658
1658
lia_move tighten_bounds_for_non_trivial_gcd (const mpq& g, unsigned j,
1659
1659
bool is_upper) {
1660
1660
mpq rs;
1661
- bool is_strict;
1661
+ bool is_strict = false ;
1662
1662
u_dependency* b_dep = nullptr ;
1663
1663
SASSERT (!g.is_zero ());
1664
1664
@@ -1679,10 +1679,14 @@ namespace lp {
1679
1679
return lia_move::undef;
1680
1680
}
1681
1681
1682
- // returns true only on a conflict
1682
+ // returns true only on a conflict
1683
1683
bool tighten_bound_kind (const mpq& g, unsigned j, const mpq& rs, const mpq& rs_mod_g, bool upper) {
1684
+ // Assume:
1685
+ // rs_mod_g := (rs - m_c) % g
1686
+ // rs_mod_g != 0
1687
+ //
1684
1688
// In case of an upper bound we have
1685
- // xj = t = g*t_+ m_c <= rs, also, by definition fo rs_mod_g, for some integer k holds rs - m_c = k*g + rs_mod_g.
1689
+ // xj = t = g*t_+ m_c <= rs, also, by definition of rs_mod_g, for some integer k holds rs - m_c = k*g + rs_mod_g.
1686
1690
// Then g*t_ <= rs - mc = k*g + rs_mod_g => g*t_ <= k*g = rs - m_c - rs_mod_g.
1687
1691
// Adding m_c to both parts gets us
1688
1692
// xj = g*t_ + m_c <= rs - rs_mod_g
@@ -1696,8 +1700,7 @@ namespace lp {
1696
1700
1697
1701
mpq bound = upper ? rs - rs_mod_g : rs + g - rs_mod_g;
1698
1702
TRACE (" dio" , tout << " is upper:" << upper << std::endl;
1699
- tout << " new " << (upper ? " upper" : " lower" )
1700
- << " bound:" << bound << std::endl;);
1703
+ tout << " new " << (upper ? " upper" : " lower" ) << " bound:" << bound << std::endl;);
1701
1704
1702
1705
SASSERT ((upper && bound < lra.get_upper_bound (j).x ) ||
1703
1706
(!upper && bound > lra.get_lower_bound (j).x ));
@@ -1710,8 +1713,8 @@ namespace lp {
1710
1713
for (const auto & p: fixed_part_of_the_term) {
1711
1714
SASSERT (is_fixed (p.var ()));
1712
1715
if ((p.coeff () % g).is_zero ()) {
1713
- // we can skip thise dependency,
1714
- // because the monomial p.coeff()*p.var() is null by modulo g, and it does not matter that p.var() is fixed.
1716
+ // we can skip this dependency
1717
+ // because the monomial p.coeff()*p.var() is 0 modulo g, and it does not matter that p.var() is fixed.
1715
1718
// We could have added p.coeff()*p.var() to t_, substructed the value of p.coeff()*p.var() from m_c and
1716
1719
// still get the same result.
1717
1720
TRACE (" dio" , tout << " skipped dep:\n " ; print_deps (tout, lra.get_bound_constraint_witnesses_for_column (p.var ())););
@@ -1767,7 +1770,7 @@ namespace lp {
1767
1770
}
1768
1771
1769
1772
lia_move process_f (std_vector<unsigned >& f_vector) {
1770
- if (has_conflict ())
1773
+ if (has_conflict_index ())
1771
1774
return lia_move::conflict;
1772
1775
lia_move r;
1773
1776
do {
@@ -2156,7 +2159,7 @@ namespace lp {
2156
2159
bool first = true ;
2157
2160
mpq ahk;
2158
2161
unsigned k = -1 ;
2159
- int k_sign;
2162
+ int k_sign = 0 ;
2160
2163
mpq t;
2161
2164
for (const auto & p : m_e_matrix.m_rows [ei]) {
2162
2165
t = abs (p.coeff ());
@@ -2586,19 +2589,17 @@ namespace lp {
2586
2589
}
2587
2590
2588
2591
public:
2592
+
2589
2593
void explain (explanation& ex) {
2590
- if (!has_conflict ()) {
2591
- for (auto ci : m_infeas_explanation) {
2592
- ex.push_back (ci.ci ());
2593
- }
2594
- TRACE (" dio" , lra.print_expl (tout, ex););
2595
- return ;
2596
- }
2597
2594
SASSERT (ex.empty ());
2598
- TRACE (" dio" , tout << " conflict:" ;
2599
- print_entry (m_conflict_index, tout, true ) << std::endl;);
2600
- for (auto ci : lra.flatten (explain_fixed_in_meta_term (m_l_matrix.m_rows [m_conflict_index]))) {
2601
- ex.push_back (ci);
2595
+ if (has_conflict_index ()) {
2596
+ TRACE (" dio" , print_entry (m_conflict_index, tout << " conflict:" , true ) << std::endl;);
2597
+ for (auto ci : lra.flatten (explain_fixed_in_meta_term (m_l_matrix.m_rows [m_conflict_index])))
2598
+ ex.push_back (ci);
2599
+ }
2600
+ else {
2601
+ for (auto ci : m_infeas_explanation)
2602
+ ex.push_back (ci.ci ());
2602
2603
}
2603
2604
TRACE (" dio" , lra.print_expl (tout, ex););
2604
2605
}
0 commit comments