Skip to content

Commit 17af18f

Browse files
committed
make gcd call in dio optional
Signed-off-by: Lev Nachmanson <[email protected]>
1 parent 436eefb commit 17af18f

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

src/math/lp/int_solver.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -185,19 +185,19 @@ namespace lp {
185185
}
186186

187187
bool should_gomory_cut() {
188-
bool dio_allows_gomory = !settings().dio_eqs() || settings().dio_enable_gomory_cuts() ||
188+
bool dio_allows_gomory = !settings().dio() || settings().dio_enable_gomory_cuts() ||
189189
m_dio.some_terms_are_ignored();
190190
return dio_allows_gomory && m_number_of_calls % settings().m_int_gomory_cut_period == 0;
191191
}
192192

193193
bool should_solve_dioph_eq() {
194-
return lia.settings().dio_eqs() && (m_number_of_calls % settings().dio_calls_period() == 0);
194+
return lia.settings().dio() && (m_number_of_calls % settings().dio_calls_period() == 0);
195195
}
196196

197197
// HNF
198198

199199
bool should_hnf_cut() {
200-
return (!settings().dio_eqs() || settings().dio_enable_hnf_cuts())
200+
return (!settings().dio() || settings().dio_enable_hnf_cuts())
201201
&& settings().enable_hnf() && m_number_of_calls % settings().hnf_cut_period() == 0;
202202
}
203203

src/math/lp/lp_params_helper.pyg

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ def_module_params(module_name='lp',
22
class_name='lp_params_helper',
33
description='linear programming parameters',
44
export=True,
5-
params=(('dio_eqs', BOOL, False, 'use Diophantine equalities'),
5+
params=(('dio', BOOL, False, 'use Diophantine equalities'),
66
('dio_branching_period', UINT, 100, 'Period of calling branching on undef in Diophantine handler'),
77
('dio_cuts_enable_gomory', BOOL, False, 'enable Gomory cuts together with Diophantine cuts, only relevant when dioph_eq is true'),
88
('dio_cuts_enable_hnf', BOOL, True, 'enable hnf cuts together with Diophantine cuts, only relevant when dioph_eq is true'),
99
('dio_ignore_big_nums', BOOL, True, 'Ignore the terms with big numbers in the Diophantine handler, only relevant when dioph_eq is true'),
1010
('dio_calls_period', UINT, 4, 'Period of calling the Diophantine handler in the final_check()'),
11+
('dio_run_gcd', BOOL, True, 'Run the GCD heuristic if dio is on, if dio is disabled the option is not used'),
1112
))
1213

src/math/lp/lp_settings.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ void lp::lp_settings::updt_params(params_ref const& _p) {
3434
report_frequency = p.arith_rep_freq();
3535
m_simplex_strategy = static_cast<lp::simplex_strategy_enum>(p.arith_simplex_strategy());
3636
m_nlsat_delay = p.arith_nl_delay();
37-
m_dio_eqs = lp_p.dio_eqs();
37+
m_dio = lp_p.dio();
3838
m_dio_enable_gomory_cuts = lp_p.dio_cuts_enable_gomory();
3939
m_dio_enable_hnf_cuts = lp_p.dio_cuts_enable_hnf();
4040
m_dio_branching_period = lp_p.dio_branching_period();
4141
m_dump_bound_lemmas = p.arith_dump_bound_lemmas();
4242
m_dio_ignore_big_nums = lp_p.dio_ignore_big_nums();
4343
m_dio_calls_period = lp_p.dio_calls_period();
44+
m_dio_run_gcd = lp_p.dio_run_gcd();
4445
}

src/math/lp/lp_settings.h

+12-7
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,12 @@ struct lp_settings {
218218
void updt_params(params_ref const& p);
219219
bool enable_hnf() const { return m_enable_hnf; }
220220
unsigned nlsat_delay() const { return m_nlsat_delay; }
221-
bool int_run_gcd_test() const { return m_int_run_gcd_test; }
222-
bool& int_run_gcd_test() { return m_int_run_gcd_test; }
221+
bool int_run_gcd_test() const {
222+
if (!m_dio)
223+
return m_int_run_gcd_test;
224+
return m_dio_run_gcd;
225+
}
226+
void set_run_gcd_test(bool v) { m_int_run_gcd_test = v; }
223227
unsigned reps_in_scaler = 20;
224228
int c_partial_pivoting = 10; // this is the constant c from page 410
225229
unsigned depth_of_rook_search = 4;
@@ -254,15 +258,15 @@ struct lp_settings {
254258
bool m_enable_hnf = true;
255259
bool m_print_external_var_name = false;
256260
bool m_propagate_eqs = false;
257-
bool m_dio_eqs = false;
261+
bool m_dio = false;
258262
bool m_dio_enable_gomory_cuts = false;
259263
bool m_dio_enable_hnf_cuts = true;
260264
unsigned m_dio_branching_period = 100; // do branching rarely
261265
unsigned m_dio_report_branch_with_term_tigthening_period = 10000000; // period of reporting the branch with term tigthening
262266
bool m_dump_bound_lemmas = false;
263267
bool m_dio_ignore_big_nums = false;
264268
unsigned m_dio_calls_period = 4;
265-
269+
bool m_dio_run_gcd = true;
266270
public:
267271
unsigned dio_calls_period() const { return m_dio_calls_period; }
268272
unsigned & dio_calls_period() { return m_dio_calls_period; }
@@ -272,9 +276,10 @@ struct lp_settings {
272276
void set_hnf_cut_period(unsigned period) { m_hnf_cut_period = period; }
273277
unsigned random_next() { return m_rand(); }
274278
unsigned random_next(unsigned u ) { return m_rand(u); }
275-
bool dio_eqs() { return m_dio_eqs; }
276-
bool dio_enable_gomory_cuts() const { return m_dio_eqs && m_dio_enable_gomory_cuts; }
277-
bool dio_enable_hnf_cuts() const { return m_dio_eqs && m_dio_enable_hnf_cuts; }
279+
bool dio() { return m_dio; }
280+
bool dio_enable_gomory_cuts() const { return m_dio && m_dio_enable_gomory_cuts; }
281+
bool dio_run_gcd() const { return m_dio && m_dio_run_gcd; }
282+
bool dio_enable_hnf_cuts() const { return m_dio && m_dio_enable_hnf_cuts; }
278283
unsigned dio_branching_period() const { return m_dio_branching_period; }
279284
bool dio_ignore_big_nums() const { return m_dio_ignore_big_nums; }
280285
void set_random_seed(unsigned s) { m_rand.set_seed(s); }

src/sat/smt/arith_solver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace arith {
3535
lp().updt_params(ctx.s().params());
3636
lp().settings().set_resource_limit(m_resource_limit);
3737
lp().settings().bound_propagation() = bound_prop_mode::BP_NONE != propagation_mode();
38-
lp().settings().int_run_gcd_test() = get_config().m_arith_gcd_test;
38+
lp().settings().set_run_gcd_test(get_config().m_arith_gcd_test);
3939
lp().settings().set_random_seed(get_config().m_random_seed);
4040

4141
m_lia = alloc(lp::int_solver, *m_solver.get());

src/smt/theory_lra.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ class theory_lra::imp {
871871
unsigned branch_cut_ratio = ctx().get_fparams().m_arith_branch_cut_ratio;
872872
lp().set_cut_strategy(branch_cut_ratio);
873873

874-
lp().settings().int_run_gcd_test() = ctx().get_fparams().m_arith_gcd_test;
874+
lp().settings().set_run_gcd_test(ctx().get_fparams().m_arith_gcd_test);
875875
lp().settings().set_random_seed(ctx().get_fparams().m_random_seed);
876876
m_lia = alloc(lp::int_solver, *m_solver.get());
877877
}

0 commit comments

Comments
 (0)