From 5c712d471f11d93fb88fd4e83b674dbd1ecf1a94 Mon Sep 17 00:00:00 2001 From: Lev Nachmanson Date: Sat, 7 Jul 2018 16:18:42 -0700 Subject: [PATCH] create hnf cuts too, when gomory_cut_period is 2 Signed-off-by: Lev Nachmanson --- src/smt/params/smt_params_helper.pyg | 2 +- src/util/lp/int_solver.cpp | 2 +- src/util/lp/lar_solver.cpp | 12 ++++++------ src/util/lp/lp_settings.h | 5 +++++ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/smt/params/smt_params_helper.pyg b/src/smt/params/smt_params_helper.pyg index c39b74722..3f4105c34 100644 --- a/src/smt/params/smt_params_helper.pyg +++ b/src/smt/params/smt_params_helper.pyg @@ -40,7 +40,7 @@ def_module_params(module_name='smt', ('bv.reflect', BOOL, True, 'create enode for every bit-vector term'), ('bv.enable_int2bv', BOOL, True, 'enable support for int2bv and bv2int operators'), ('arith.random_initial_value', BOOL, False, 'use random initial values in the simplex-based procedure for linear arithmetic'), - ('arith.solver', UINT, 6, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination 4 - utvpi, 5 - infinitary lra, 6 - lra solver'), + ('arith.solver', UINT, 2, 'arithmetic solver: 0 - no solver, 1 - bellman-ford based solver (diff. logic only), 2 - simplex based solver, 3 - floyd-warshall based solver (diff. logic only) and no theory combination 4 - utvpi, 5 - infinitary lra, 6 - lra solver'), ('arith.nl', BOOL, True, '(incomplete) nonlinear arithmetic support based on Groebner basis and interval propagation'), ('arith.nl.gb', BOOL, True, 'groebner Basis computation, this option is ignored when arith.nl=false'), ('arith.nl.branching', BOOL, True, 'branching on integer variables in non linear clusters'), diff --git a/src/util/lp/int_solver.cpp b/src/util/lp/int_solver.cpp index 0691b5887..f49ecabfd 100644 --- a/src/util/lp/int_solver.cpp +++ b/src/util/lp/int_solver.cpp @@ -599,7 +599,7 @@ lia_move int_solver::make_hnf_cut() { } lia_move int_solver::hnf_cut() { - if ((m_number_of_calls) % settings().m_hnf_cut_period == 0) { + if ((m_number_of_calls) % settings().hnf_cut_period() == 0) { return make_hnf_cut(); } return lia_move::undef; diff --git a/src/util/lp/lar_solver.cpp b/src/util/lp/lar_solver.cpp index 6fec5b329..2cf0c214d 100644 --- a/src/util/lp/lar_solver.cpp +++ b/src/util/lp/lar_solver.cpp @@ -2263,16 +2263,16 @@ bool lar_solver::get_equality_and_right_side_for_term_on_current_x(unsigned term } void lar_solver::set_cut_strategy(unsigned cut_frequency) { - if (cut_frequency < 4) { // enable only gomory cut - settings().m_int_gomory_cut_period = 2; - settings().m_hnf_cut_period = 100000000; + if (cut_frequency < 4) { + settings().m_int_gomory_cut_period = 2; // do it often + settings().set_hnf_cut_period(4); // also create hnf cuts } else if (cut_frequency == 4) { // enable all cuts and cube equally settings().m_int_gomory_cut_period = 4; - settings().m_hnf_cut_period = 4; + settings().set_hnf_cut_period(4); } else { - // disable all heuristics + // disable all heuristics except cube settings().m_int_gomory_cut_period = 10000000; - settings().m_hnf_cut_period = 100000000; + settings().set_hnf_cut_period(100000000); } } diff --git a/src/util/lp/lp_settings.h b/src/util/lp/lp_settings.h index b2e785064..4e99ecc82 100644 --- a/src/util/lp/lp_settings.h +++ b/src/util/lp/lp_settings.h @@ -189,13 +189,18 @@ public: unsigned column_number_threshold_for_using_lu_in_lar_solver; unsigned m_int_gomory_cut_period; unsigned m_int_find_cube_period; +private: unsigned m_hnf_cut_period; +public: bool m_int_run_gcd_test; bool m_int_pivot_fixed_vars_from_basis; bool m_int_patch_only_integer_values; unsigned limit_on_rows_for_hnf_cutter; unsigned limit_on_columns_for_hnf_cutter; + + unsigned hnf_cut_period() const { return m_hnf_cut_period; } + void set_hnf_cut_period(unsigned period) { m_hnf_cut_period = period; } unsigned random_next() { return m_rand(); } void set_random_seed(unsigned s) { m_rand.set_seed(s); }