Skip to content

Commit 2b974a0

Browse files
committed
do not delay update for the polar case
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
1 parent 2ac866a commit 2b974a0

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/math/lp/gomory.cpp

+7-16
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,6 @@ struct create_cut {
400400
lia_move gomory::get_gomory_cuts(unsigned num_cuts) {
401401
struct cut_result {u_dependency *dep; lar_term t; mpq k; int polarity; lpvar j;};
402402
vector<cut_result> big_cuts;
403-
struct polar_info {lpvar j; int polarity; u_dependency *dep;};
404-
vector<polar_info> polar_vars;
405403
unsigned_vector columns_for_cuts = gomory_select_int_infeasible_vars(num_cuts);
406404
bool has_small_cut = false;
407405

@@ -437,10 +435,14 @@ struct create_cut {
437435
return lia_move::conflict;
438436
continue;
439437
}
438+
439+
if (cc.m_polarity == 1)
440+
lra.update_column_type_and_bound(j, lp::lconstraint_kind::LE, floor(lra.get_column_value(j).x), cc.m_dep);
441+
else if (cc.m_polarity == -1)
442+
lra.update_column_type_and_bound(j, lp::lconstraint_kind::GE, ceil(lra.get_column_value(j).x), cc.m_dep);
443+
444+
440445
cut_result cr = {cc.m_dep, lia.m_t, lia.m_k, cc.m_polarity, j};
441-
if (abs(cr.polarity) == 1) // need to delay the update of the bounds for j in a polar case, because simplify_inequality relies on the old bounds
442-
polar_vars.push_back( {j, cr.polarity, cc.m_dep} );
443-
444446
if (!is_small_cut(lia.m_t)) {
445447
big_cuts.push_back(cr);
446448
continue;
@@ -463,17 +465,6 @@ struct create_cut {
463465
add_cut(cut);
464466

465467
}
466-
467-
// this way we create bounds for the variables in polar cases even where the terms have big numbers
468-
for (auto const& p : polar_vars) {
469-
if (p.polarity == 1) {
470-
lra.update_column_type_and_bound(p.j, lp::lconstraint_kind::LE, floor(lra.get_column_value(p.j).x), p.dep);
471-
}
472-
else {
473-
SASSERT(p.polarity == -1);
474-
lra.update_column_type_and_bound(p.j, lp::lconstraint_kind::GE, ceil(lra.get_column_value(p.j).x), p.dep);
475-
}
476-
}
477468

478469
if (!_check_feasible())
479470
return lia_move::conflict;

0 commit comments

Comments
 (0)