3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-03 05:46:08 +00:00

lp: add dio_calls_period_decrease parameter

Introduce the lp.dio_calls_period_decrease parameter (default 2) that
controls how fast dio_calls_period is decreased on each final_check()
call where the Diophantine handler is not triggered, gradually
re-enabling dio solving after it was backed off (its period doubled).

Replaces the previous placeholder that left the recovery amount
unparameterized.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Lev Nachmanson 2026-06-22 06:57:01 -07:00
parent aa86b62d41
commit 660ae575ea
4 changed files with 10 additions and 2 deletions

View file

@ -239,8 +239,11 @@ namespace lp {
bool should_solve_dioph_eq() { bool should_solve_dioph_eq() {
bool ret = lia.settings().dio() && hit_period(settings().dio_calls_period()); bool ret = lia.settings().dio() && hit_period(settings().dio_calls_period());
if (!ret && lia.settings().dio_calls_period() > m_initial_dio_calls_period) if (!ret && lia.settings().dio_calls_period() > m_initial_dio_calls_period) {
lia.settings().dio_calls_period() --; unsigned dec = settings().dio_calls_period_decrease();
unsigned& period = lia.settings().dio_calls_period();
period = period > m_initial_dio_calls_period + dec ? period - dec : m_initial_dio_calls_period;
}
return ret; return ret;
} }

View file

@ -8,6 +8,7 @@ def_module_params(module_name='lp',
('dio_cuts_enable_hnf', BOOL, True, 'enable hnf cuts together with Diophantine cuts, only relevant when dioph_eq is true'), ('dio_cuts_enable_hnf', BOOL, True, 'enable hnf cuts together with Diophantine cuts, only relevant when dioph_eq is true'),
('dio_ignore_big_nums', BOOL, True, 'Ignore the terms with big numbers in the Diophantine handler, only relevant when dioph_eq is true'), ('dio_ignore_big_nums', BOOL, True, 'Ignore the terms with big numbers in the Diophantine handler, only relevant when dioph_eq is true'),
('dio_calls_period', UINT, 1, 'Period of calling the Diophantine handler in the final_check()'), ('dio_calls_period', UINT, 1, 'Period of calling the Diophantine handler in the final_check()'),
('dio_calls_period_decrease', UINT, 2, 'Amount by which dio_calls_period is decreased on each final_check() call where the Diophantine handler is not triggered, until it returns to its initial value'),
('dio_run_gcd', BOOL, False, 'Run the GCD heuristic if dio is on, if dio is disabled the option is not used'), ('dio_run_gcd', BOOL, False, 'Run the GCD heuristic if dio is on, if dio is disabled the option is not used'),
('lcube', BOOL, True, 'use the largest cube test for integer feasibility'), ('lcube', BOOL, True, 'use the largest cube test for integer feasibility'),
('lcube_flips', UINT, 16, 'maximal number of coordinate flips when repairing the rounded largest cube center, only relevant when lcube is true'), ('lcube_flips', UINT, 16, 'maximal number of coordinate flips when repairing the rounded largest cube center, only relevant when lcube is true'),

View file

@ -42,6 +42,7 @@ void lp::lp_settings::updt_params(params_ref const& _p) {
m_dump_bound_lemmas = p.arith_dump_bound_lemmas(); m_dump_bound_lemmas = p.arith_dump_bound_lemmas();
m_dio_ignore_big_nums = lp_p.dio_ignore_big_nums(); m_dio_ignore_big_nums = lp_p.dio_ignore_big_nums();
m_dio_calls_period = lp_p.dio_calls_period(); m_dio_calls_period = lp_p.dio_calls_period();
m_dio_calls_period_decrease = lp_p.dio_calls_period_decrease();
m_dio_run_gcd = lp_p.dio_run_gcd(); m_dio_run_gcd = lp_p.dio_run_gcd();
m_random_hammers = lp_p.random_hammers(); m_random_hammers = lp_p.random_hammers();
m_lcube = lp_p.lcube(); m_lcube = lp_p.lcube();

View file

@ -263,6 +263,7 @@ private:
bool m_dump_bound_lemmas = false; bool m_dump_bound_lemmas = false;
bool m_dio_ignore_big_nums = false; bool m_dio_ignore_big_nums = false;
unsigned m_dio_calls_period = 4; unsigned m_dio_calls_period = 4;
unsigned m_dio_calls_period_decrease = 2;
bool m_dio_run_gcd = true; bool m_dio_run_gcd = true;
bool m_random_hammers = true; bool m_random_hammers = true;
bool m_lcube = true; bool m_lcube = true;
@ -272,6 +273,8 @@ public:
unsigned lcube_flips() const { return m_lcube_flips; } unsigned lcube_flips() const { return m_lcube_flips; }
unsigned dio_calls_period() const { return m_dio_calls_period; } unsigned dio_calls_period() const { return m_dio_calls_period; }
unsigned & dio_calls_period() { return m_dio_calls_period; } unsigned & dio_calls_period() { return m_dio_calls_period; }
unsigned dio_calls_period_decrease() const { return m_dio_calls_period_decrease; }
unsigned & dio_calls_period_decrease() { return m_dio_calls_period_decrease; }
bool random_hammers() const { return m_random_hammers; } bool random_hammers() const { return m_random_hammers; }
bool & random_hammers() { return m_random_hammers; } bool & random_hammers() { return m_random_hammers; }
bool print_external_var_name() const { return m_print_external_var_name; } bool print_external_var_name() const { return m_print_external_var_name; }