Skip to content

Commit 5ebee24

Browse files
committed
revert the term sorting
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
1 parent f2c1fd4 commit 5ebee24

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

src/math/lp/dioph_eq.cpp

+14-30
Original file line numberDiff line numberDiff line change
@@ -1354,41 +1354,25 @@ namespace lp {
13541354
}
13551355

13561356
lia_move tighten_terms_with_S() {
1357-
// Copy changed terms to another vector for sorting
1358-
std_vector<unsigned> sorted_changed_terms;
13591357
std_vector<unsigned> cleanup;
1358+
lia_move ret = lia_move::undef;
13601359
for (unsigned j : m_changed_terms) {
1361-
if (
1362-
j >= lra.column_count() ||
1363-
!lra.column_has_term(j) ||
1364-
lra.column_is_free(j) ||
1360+
cleanup.push_back(j);
1361+
if (j >= lra.column_count()) continue;
1362+
if (!lra.column_has_term(j) || lra.column_is_free(j) ||
13651363
is_fixed(j) || !lia.column_is_int(j)) {
1366-
cleanup.push_back(j);
1367-
continue;
1368-
}
1369-
sorted_changed_terms.push_back(j);
1370-
}
1371-
// Sort by term_weight descending
1372-
std::sort(sorted_changed_terms.begin(), sorted_changed_terms.end(),
1373-
[this](unsigned j1, unsigned j2) {
1374-
return term_weight(lra.get_term(j1)) > term_weight(lra.get_term(j2) );
1375-
});
1376-
1377-
lia_move r = lia_move::undef;
1378-
// Process sorted terms
1379-
for (unsigned j : sorted_changed_terms) {
1380-
m_changed_terms.remove(j);
1381-
1382-
1383-
if (tighten_bounds_for_term_column(j)) {
1384-
r = lia_move::conflict;
1364+
continue;
1365+
}
1366+
1367+
if (tighten_bounds_for_term_column(j)) {
1368+
ret = lia_move::conflict;
13851369
break;
13861370
}
13871371
}
1388-
for (unsigned j : cleanup) {
1372+
for (unsigned j: cleanup) {
13891373
m_changed_terms.remove(j);
13901374
}
1391-
return r;
1375+
return ret;
13921376
}
13931377

13941378
std::ostream& print_queue(std::queue<unsigned> q, std::ostream& out) {
@@ -1999,8 +1983,8 @@ namespace lp {
19991983
}
20001984
}
20011985

2002-
unsigned find_markovich_number(unsigned k, unsigned h) {
2003-
return m_e_matrix.m_columns[k].size() * m_e_matrix.m_rows[h].size();
1986+
unsigned markovich_number(unsigned k, unsigned h) {
1987+
return (unsigned) m_e_matrix.m_columns[k].size() * m_e_matrix.m_rows[h].size();
20041988
}
20051989

20061990
std::tuple<mpq, unsigned, int, unsigned> find_minimal_abs_coeff(unsigned ei) {
@@ -2021,7 +2005,7 @@ namespace lp {
20212005
}
20222006
}
20232007

2024-
return std::make_tuple(ahk, k, k_sign, find_markovich_number(k, ei));
2008+
return std::make_tuple(ahk, k, k_sign, markovich_number(k, ei));
20252009
}
20262010

20272011

0 commit comments

Comments
 (0)