diff --git a/src/math/lp/CMakeLists.txt b/src/math/lp/CMakeLists.txt index 39cb39985..f27815e34 100644 --- a/src/math/lp/CMakeLists.txt +++ b/src/math/lp/CMakeLists.txt @@ -51,8 +51,6 @@ z3_add_component(lp util polynomial nlsat - PYG_FILES - lp_params.pyg ) include_directories(${src_SOURCE_DIR}) diff --git a/src/math/lp/lp_params.pyg b/src/math/lp/lp_params.pyg deleted file mode 100644 index c1ebcada8..000000000 --- a/src/math/lp/lp_params.pyg +++ /dev/null @@ -1,14 +0,0 @@ -def_module_params('lp', - export=True, - description='Parameters for the LP arithmetic solver core', - params=( - ('rep_freq', UINT, 0, 'the report frequency, in how many iterations print the cost and other info '), - ('min', BOOL, False, 'minimize cost'), - ('print_stats', BOOL, False, 'print statistic'), - ('simplex_strategy', UINT, 0, 'simplex strategy for the solver'), - ('enable_hnf', BOOL, True, 'enable hnf (Hermite Normal Form) cuts'), - ('bprop_on_pivoted_rows', BOOL, True, 'propagate bounds on rows changed by the pivot operation'), - ('nla', BOOL, True, 'call nonlinear integer solver with incremental linearization'), - ('print_ext_var_names', BOOL, False, 'print external variable names') - )) - diff --git a/src/shell/lp_frontend.cpp b/src/shell/lp_frontend.cpp index 8704147c3..5fb490523 100644 --- a/src/shell/lp_frontend.cpp +++ b/src/shell/lp_frontend.cpp @@ -7,7 +7,6 @@ Author: --*/ -#include "math/lp/lp_params.hpp" #include "math/lp/lp_settings.h" #include "math/lp/mps_reader.h" #include "util/timeout.h" @@ -16,6 +15,7 @@ Author: #include "util/rlimit.h" #include "util/gparams.h" #include +#include "smt/params/smt_params_helper.hpp" namespace { static std::mutex *display_stats_mux = new std::mutex; @@ -50,7 +50,7 @@ struct front_end_resource_limit : public lp::lp_resource_limit { bool get_cancel_flag() override { return !m_reslim.inc(); } }; -void run_solver(lp_params & params, char const * mps_file_name) { +void run_solver(smt_params_helper & params, char const * mps_file_name) { reslimit rlim; unsigned timeout = gparams::get_ref().get_uint("timeout", 0); @@ -72,19 +72,19 @@ void run_solver(lp_params & params, char const * mps_file_name) { lp::lp_solver * solver = reader.create_solver(false); // false - to create the primal solver solver->settings().set_resource_limit(lp_limit); g_solver = solver; - if (params.min()) { + if (params.arith_min()) { solver->flip_costs(); } solver->settings().set_message_ostream(&std::cout); - solver->settings().report_frequency = params.rep_freq(); - solver->settings().print_statistics = params.print_stats(); + solver->settings().report_frequency = params.arith_rep_freq(); + solver->settings().print_statistics = params.arith_print_stats(); solver->settings().simplex_strategy() = lp:: simplex_strategy_enum::lu; solver->find_maximal_solution(); *(solver->settings().get_message_ostream()) << "status is " << lp_status_to_string(solver->get_status()) << std::endl; if (solver->get_status() == lp::lp_status::OPTIMAL) { - if (params.min()) { + if (params.arith_min()) { solver->flip_costs(); } solver->print_model(std::cout); @@ -99,7 +99,7 @@ void run_solver(lp_params & params, char const * mps_file_name) { unsigned read_mps_file(char const * mps_file_name) { signal(SIGINT, on_ctrl_c); register_on_timeout_proc(on_timeout); - lp_params p; + smt_params_helper p; param_descrs r; p.collect_param_descrs(r); run_solver(p, mps_file_name); diff --git a/src/smt/params/smt_params_helper.pyg b/src/smt/params/smt_params_helper.pyg index 0f9df8680..147fa5e59 100644 --- a/src/smt/params/smt_params_helper.pyg +++ b/src/smt/params/smt_params_helper.pyg @@ -70,6 +70,14 @@ def_module_params(module_name='smt', ('arith.greatest_error_pivot', BOOL, False, 'Pivoting strategy'), ('arith.eager_eq_axioms', BOOL, True, 'eager equality axioms'), ('arith.auto_config_simplex', BOOL, False, 'force simplex solver in auto_config'), + ('arith.rep_freq', UINT, 0, 'the report frequency, in how many iterations print the cost and other info'), + ('arith.min', BOOL, False, 'minimize cost'), + ('arith.print_stats', BOOL, False, 'print statistic'), + ('arith.simplex_strategy', UINT, 0, 'simplex strategy for the solver'), + ('arith.enable_hnf', BOOL, True, 'enable hnf (Hermite Normal Form) cuts'), + ('arith.bprop_on_pivoted_rows', BOOL, True, 'propagate bounds on rows changed by the pivot operation'), + ('arith.nla', BOOL, True, 'call nonlinear integer solver with incremental linearization'), + ('arith.print_ext_var_names', BOOL, False, 'print external variable names'), ('pb.conflict_frequency', UINT, 1000, 'conflict frequency for Pseudo-Boolean theory'), ('pb.learn_complements', BOOL, True, 'learn complement literals for Pseudo-Boolean theory'), ('array.weak', BOOL, False, 'weak array theory'), diff --git a/src/smt/tactic/smt_tactic.cpp b/src/smt/tactic/smt_tactic.cpp index 5e558ca37..2dcd19c0d 100644 --- a/src/smt/tactic/smt_tactic.cpp +++ b/src/smt/tactic/smt_tactic.cpp @@ -16,7 +16,7 @@ Author: Notes: --*/ -#include "math/lp/lp_params.hpp" +#include "util/debug.h" #include "ast/rewriter/rewriter_types.h" #include "ast/ast_util.h" #include "smt/smt_kernel.h" @@ -91,7 +91,6 @@ public: r.insert("candidate_models", CPK_BOOL, "(default: false) create candidate models even when quantifier or theory reasoning is incomplete."); r.insert("fail_if_inconclusive", CPK_BOOL, "(default: true) fail if found unsat (sat) for under (over) approximated goal."); smt_params_helper::collect_param_descrs(r); - lp_params::collect_param_descrs(r); } diff --git a/src/smt/theory_lra.cpp b/src/smt/theory_lra.cpp index 7957435ed..4d8019879 100644 --- a/src/smt/theory_lra.cpp +++ b/src/smt/theory_lra.cpp @@ -26,8 +26,6 @@ #include "math/lp/lar_solver.h" #include "util/nat_set.h" #include "util/optional.h" -#include "math/lp/lp_params.hpp" -#include "math/lp/nla_params.hpp" #include "util/inf_rational.h" #include "util/cancel_eh.h" #include "util/scoped_timer.h" @@ -390,15 +388,15 @@ class theory_lra::imp { get_zero(true); get_zero(false); - lp_params lpar(ctx().get_params()); + smt_params_helper lpar(ctx().get_params()); lp().settings().set_resource_limit(m_resource_limit); - lp().settings().simplex_strategy() = static_cast(lpar.simplex_strategy()); + lp().settings().simplex_strategy() = static_cast(lpar.arith_simplex_strategy()); lp().settings().bound_propagation() = BP_NONE != propagation_mode(); - lp().settings().m_enable_hnf = lpar.enable_hnf(); - lp().settings().m_print_external_var_name = lpar.print_ext_var_names(); - lp().set_track_pivoted_rows(lpar.bprop_on_pivoted_rows()); - lp().settings().report_frequency = lpar.rep_freq(); - lp().settings().print_statistics = lpar.print_stats(); + lp().settings().m_enable_hnf = lpar.arith_enable_hnf(); + lp().settings().m_print_external_var_name = lpar.arith_print_ext_var_names(); + lp().set_track_pivoted_rows(lpar.arith_bprop_on_pivoted_rows()); + lp().settings().report_frequency = lpar.arith_rep_freq(); + lp().settings().print_statistics = lpar.arith_print_stats(); // todo : do not use m_arith_branch_cut_ratio for deciding on cheap cuts unsigned branch_cut_ratio = ctx().get_fparams().m_arith_branch_cut_ratio; @@ -406,7 +404,7 @@ class theory_lra::imp { lp().settings().m_int_run_gcd_test = ctx().get_fparams().m_arith_gcd_test; lp().settings().set_random_seed(ctx().get_fparams().m_random_seed); - m_switcher.m_use_nla = m_use_nla = lpar.nla(); + m_switcher.m_use_nla = m_use_nla = lpar.arith_nla(); m_lia = alloc(lp::int_solver, *m_solver.get()); get_one(true); get_zero(true);