@@ -1476,26 +1476,33 @@ namespace lp {
1476
1476
const vector<std::pair<mpq, unsigned >>& inf_row,
1477
1477
int inf_sign) const {
1478
1478
1479
- #if 1
1480
1479
impq slack (0 );
1481
1480
1481
+ std_vector<unsigned > indices;
1482
1482
for (auto & [coeff, j] : inf_row) {
1483
1483
int adj_sign = coeff.is_pos () ? inf_sign : -inf_sign;
1484
1484
slack += coeff * (adj_sign < 0 ? get_upper_bound (j) : get_lower_bound (j));
1485
+ indices.push_back (indices.size ());
1485
1486
}
1486
1487
1487
1488
#define get_sign (_x_ ) (_x_.is_pos() ? 1 : (_x_.is_neg() ? -1 : 0 ))
1488
1489
int sign = get_sign (slack);
1489
1490
1490
- #endif
1491
+ for (unsigned j = indices.size (); j-- > 0 ; ) {
1492
+ unsigned k = m_imp->m_settings .random_next (j+1 );
1493
+ if (k != j)
1494
+ std::swap (indices[j], indices[k]);
1495
+ }
1491
1496
1492
- for (auto & [coeff, j] : inf_row) {
1497
+ for (unsigned k : indices) {
1498
+ const auto & p = inf_row[k];
1499
+ unsigned j = p.second ;
1500
+ const mpq& coeff = p.first ;
1493
1501
int adj_sign = coeff.is_pos () ? inf_sign : -inf_sign;
1494
1502
bool is_upper = adj_sign < 0 ;
1495
1503
const column& ul = m_imp->m_columns [j];
1496
1504
u_dependency* bound_constr_i = is_upper ? ul.upper_bound_witness () : ul.lower_bound_witness ();
1497
1505
1498
- #if 1
1499
1506
if (is_upper) {
1500
1507
if (ul.previous_upper () != UINT_MAX) {
1501
1508
auto const & [_is_upper, _j, _bound, _column] = m_imp->m_column_updates [ul.previous_upper ()];
@@ -1518,8 +1525,7 @@ namespace lp {
1518
1525
}
1519
1526
}
1520
1527
}
1521
- #endif
1522
-
1528
+
1523
1529
svector<constraint_index> deps;
1524
1530
dep_manager ().linearize (bound_constr_i, deps);
1525
1531
for (auto d : deps) {
0 commit comments