Skip to content

Commit 62435b1

Browse files
committed
detect non integral terms in dio
Signed-off-by: Lev Nachmanson <[email protected]>
1 parent 0c24536 commit 62435b1

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/math/lp/dioph_eq.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ namespace lp {
331331
return out;
332332
}
333333

334+
bool m_has_non_integral_term = false;
334335
std_vector<mpq> m_sum_of_fixed;
335336
var_register m_var_register;
336337
// the terms are stored in m_A and m_c
@@ -740,6 +741,7 @@ namespace lp {
740741
TRACE("dio", tout << "term column t->j():" << j << std::endl; lra.print_term(*t, tout) << std::endl;);
741742
if (!lra.column_is_int(j)) {
742743
TRACE("dio", tout << "ignored a non-integral column" << std::endl;);
744+
m_has_non_integral_term = true;
743745
return;
744746
}
745747

@@ -2622,7 +2624,9 @@ namespace lp {
26222624
// needed for the template bound_analyzer_on_row.h
26232625
const lar_solver& lp() const { return lra; }
26242626
lar_solver& lp() {return lra;}
2625-
2627+
bool has_non_integral_term() const {
2628+
return m_has_non_integral_term;
2629+
}
26262630
};
26272631
// Constructor definition
26282632
dioph_eq::dioph_eq(int_solver& lia) {
@@ -2640,4 +2644,9 @@ namespace lp {
26402644
m_imp->explain(ex);
26412645
}
26422646

2647+
bool dioph_eq::has_non_integral_term() const {
2648+
return m_imp->has_non_integral_term();
2649+
}
2650+
2651+
26432652
} // namespace lp

src/math/lp/dioph_eq.h

+1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@ namespace lp {
3030
~dioph_eq();
3131
lia_move check();
3232
void explain(lp::explanation&);
33+
bool has_non_integral_term() const;
3334
};
3435
}

src/math/lp/int_solver.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,10 @@ namespace lp {
189189
}
190190

191191
bool should_gomory_cut() {
192-
return (!all_columns_are_integral() ||(!settings().dio_eqs() || settings().dio_enable_gomory_cuts()))
193-
&& m_number_of_calls % settings().m_int_gomory_cut_period == 0;
192+
bool dio_allows_gomory = !settings().dio_eqs() || settings().dio_enable_gomory_cuts() ||
193+
m_dio.has_non_integral_term();
194+
195+
return dio_allows_gomory && m_number_of_calls % settings().m_int_gomory_cut_period == 0;
194196
}
195197

196198
bool should_solve_dioph_eq() {

0 commit comments

Comments
 (0)