Skip to content

Commit 7fb40e8

Browse files
NikolajBjornerlevnach
authored andcommitted
tidy
Signed-off-by: Nikolaj Bjorner <[email protected]>
1 parent a41bd38 commit 7fb40e8

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/math/lp/dioph_eq.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ namespace lp {
6363
class bijection {
6464
std::unordered_map<unsigned, unsigned> m_map;
6565
std::unordered_map<unsigned, unsigned> m_rev_map;
66-
public:
6766
auto map_begin() const { return m_map.begin(); }
6867
auto map_end() const { return m_map.end(); }
68+
public:
69+
6970

7071
// Iterator helper
7172
struct map_it {
@@ -1707,14 +1708,13 @@ namespace lp {
17071708
}
17081709
}
17091710

1710-
// m_espace contains the coefficients of the term
1711+
// m_espace contains the coefficients of the term
17111712
// m_c contains the fixed part of the term
17121713
// m_tmp_l is the linear combination of the equations that removes the
17131714
// substituted variables.
17141715
// g is the common gcd
17151716
// returns true iff the conflict is found
1716-
lia_move tighten_one_bound_for_common_gcd(const mpq& g, unsigned j,
1717-
bool is_upper) {
1717+
lia_move tighten_one_bound_for_common_gcd(const mpq& g, unsigned j, bool is_upper) {
17181718
mpq rs;
17191719
bool is_strict;
17201720
u_dependency* b_dep = nullptr;
@@ -1723,15 +1723,11 @@ namespace lp {
17231723
if (lra.has_bound_of_type(j, b_dep, rs, is_strict, is_upper)) {
17241724
TRACE("dio",
17251725
tout << "current " << (is_upper? "upper":"lower") << " bound for x" << j << ":"
1726-
<< rs << std::endl;);
1726+
<< rs << " rs/ g" << rs / g << std::endl;);
17271727
rs = rs / g;
1728-
TRACE("dio", tout << "rs / g:" << rs << std::endl;);
1729-
if (!rs.is_int()) {
1730-
if (tighten_bound_kind_for_common_gcd(g, j, rs, is_upper))
1731-
return lia_move::conflict;
1732-
} else {
1733-
TRACE("dio", tout << "no improvement in the bound\n";);
1734-
}
1728+
CTRACE("dio", rs.is_int(), tout << "no improvement in the bound\n";);
1729+
if (!rs.is_int() && tighten_bound_kind_for_common_gcd(g, j, rs, is_upper))
1730+
return lia_move::conflict;
17351731
}
17361732
return lia_move::undef;
17371733
}
@@ -1764,7 +1760,8 @@ namespace lp {
17641760
}
17651761
return lia_move::undef;
17661762
}
1767-
// returns true only on a conflict
1763+
1764+
// returns true only on a conflict
17681765
bool tighten_bound_kind_for_common_gcd(const mpq& g, unsigned j, const mpq& ub, bool upper) {
17691766
// ub = upper_bound(j)/g.
17701767
// we have xj = t = g*t_<= upper_bound(j), then
@@ -1802,10 +1799,10 @@ namespace lp {
18021799
lra.update_column_type_and_bound(j, kind, bound, dep);
18031800

18041801
lp_status st = lra.find_feasible_solution();
1805-
if ((int)st >= (int)lp::lp_status::FEASIBLE) {
1802+
if (st == lp_status::CANCELLED)
18061803
return false;
1807-
}
1808-
if (st == lp_status::CANCELLED) return false;
1804+
if ((int)st >= (int)lp::lp_status::FEASIBLE)
1805+
return false;
18091806
lra.get_infeasibility_explanation(m_infeas_explanation);
18101807
return true;
18111808
}

0 commit comments

Comments
 (0)