3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

saved params work

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2012-11-29 17:19:12 -08:00
parent c3055207ed
commit cf28cbab0a
130 changed files with 1469 additions and 948 deletions

View file

@ -57,12 +57,12 @@ namespace algebraic_numbers {
typedef upolynomial::factors factors;
void manager::get_param_descrs(param_descrs & r) {
r.insert(":algebraic-zero-accuracy", CPK_UINT, "(default: 0) one of the most time-consuming operations in the real algebraic number module is determining the sign of a polynomial evaluated at a sample point with non-rational algebraic number values. Let k be the value of this option. If k is 0, Z3 uses precise computation. Otherwise, the result of a polynomial evaluation is considered to be 0 if Z3 can show it is inside the interval (-1/2^k, 1/2^k).");
r.insert(":algebraic-min-mag", CPK_UINT, "(default: 16) Z3 represents algebraic numbers using a (square-free) polynomial p and an isolating interval (which contains one and only one root of p). This interval may be refined during the computations. This parameter specifies whether to cache the value of a refined interval or not. It says the minimal size of an interval for caching purposes is 1/2^16");
r.insert(":algebraic-factor", CPK_BOOL, "(default: true) use polynomial factorization to simplify polynomials representing algebraic numbers.");
r.insert(":algebraic-factor-max-prime", CPK_UINT, "(default: 31), parameter for the polynomial factorization procedure in the algebraic number module. Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter limits the maximum prime number p to be used in the first step.");
r.insert(":algebraic-factor-num-primes", CPK_UINT, "(default: 1), parameter for the polynomial factorization procedure in the algebraic number module. Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. The search space may be reduced by factoring the polynomial in different GF(p)'s. This parameter specify the maximum number of finite factorizations to be considered, before lifiting and searching.");
r.insert(":algebraic-factor-search-size", CPK_UINT, "(default: 5000), parameter for the polynomial factorization procedure in the algebraic number module. Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter can be used to limit the search space.");
r.insert("zero_accuracy", CPK_UINT, "(default: 0) one of the most time-consuming operations in the real algebraic number module is determining the sign of a polynomial evaluated at a sample point with non-rational algebraic number values. Let k be the value of this option. If k is 0, Z3 uses precise computation. Otherwise, the result of a polynomial evaluation is considered to be 0 if Z3 can show it is inside the interval (-1/2^k, 1/2^k).");
r.insert("min_mag", CPK_UINT, "(default: 16) Z3 represents algebraic numbers using a (square-free) polynomial p and an isolating interval (which contains one and only one root of p). This interval may be refined during the computations. This parameter specifies whether to cache the value of a refined interval or not. It says the minimal size of an interval for caching purposes is 1/2^16");
r.insert("factor", CPK_BOOL, "(default: true) use polynomial factorization to simplify polynomials representing algebraic numbers.");
r.insert("factor_max_prime", CPK_UINT, "(default: 31), parameter for the polynomial factorization procedure in the algebraic number module. Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter limits the maximum prime number p to be used in the first step.");
r.insert("factor_num_primes", CPK_UINT, "(default: 1), parameter for the polynomial factorization procedure in the algebraic number module. Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. The search space may be reduced by factoring the polynomial in different GF(p)'s. This parameter specify the maximum number of finite factorizations to be considered, before lifiting and searching.");
r.insert("factor_search_size", CPK_UINT, "(default: 5000), parameter for the polynomial factorization procedure in the algebraic number module. Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter can be used to limit the search space.");
}
struct manager::imp {
@ -157,12 +157,12 @@ namespace algebraic_numbers {
}
void updt_params(params_ref const & p) {
m_min_magnitude = -static_cast<int>(p.get_uint(":algebraic-min-mag", 16));
m_factor = p.get_bool(":algebraic-factor", true); // use polynomial factorization
m_factor_params.m_max_p = p.get_uint(":algebraic-factor-max-prime", 31);
m_factor_params.m_p_trials = p.get_uint(":algebraic-factor-num-primes", 1);
m_factor_params.m_max_search_size = p.get_uint(":algebraic-factor-max-search-size", 5000);
m_zero_accuracy = -static_cast<int>(p.get_uint(":algebraic-zero-accuracy", 0));
m_min_magnitude = -static_cast<int>(p.get_uint("min_mag", 16));
m_factor = p.get_bool("factor", true); // use polynomial factorization
m_factor_params.m_max_p = p.get_uint("factor_max_prime", 31);
m_factor_params.m_p_trials = p.get_uint("factor_num_primes", 1);
m_factor_params.m_max_search_size = p.get_uint("factor_max_search_size", 5000);
m_zero_accuracy = -static_cast<int>(p.get_uint("zero_accuracy", 0));
}
unsynch_mpq_manager & qm() {

View file

@ -60,6 +60,9 @@ namespace algebraic_numbers {
manager(unsynch_mpq_manager & m, params_ref const & p = params_ref(), small_object_allocator * a = 0);
~manager();
/*
REG_MODULE_PARAMS('algebraic', 'algebraic_numbers::manager::get_param_descrs')
*/
static void get_param_descrs(param_descrs & r);
static void collect_param_descrs(param_descrs & r) { get_param_descrs(r); }

View file

@ -50,15 +50,15 @@ namespace polynomial {
}
void factor_params::updt_params(params_ref const & p) {
m_max_p = p.get_uint(":factor-max-prime", UINT_MAX);
m_p_trials = p.get_uint(":factor-num-primes", 1);
m_max_search_size = p.get_uint(":factor-max-search-size", UINT_MAX);
m_max_p = p.get_uint("max_prime", UINT_MAX);
m_p_trials = p.get_uint("num_primes", 1);
m_max_search_size = p.get_uint("max_search_size", UINT_MAX);
}
void factor_params::get_param_descrs(param_descrs & r) {
r.insert(":factor-max-search-size", CPK_UINT, "(default: infty) Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter can be used to limit the search space.");
r.insert(":factor-max-prime", CPK_UINT, "(default: infty) Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter limits the maximum prime number p to be used in the first step.");
r.insert(":factor-num-primes", CPK_UINT, "(default: 1) Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. The search space may be reduced by factoring the polynomial in different GF(p)'s. This parameter specify the maximum number of finite factorizations to be considered, before lifiting and searching.");
r.insert("max_search_size", CPK_UINT, "(default: infty) Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter can be used to limit the search space.");
r.insert("max_prime", CPK_UINT, "(default: infty) Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. This parameter limits the maximum prime number p to be used in the first step.");
r.insert("num_primes", CPK_UINT, "(default: 1) Z3 polynomial factorization is composed of three steps: factorization in GF(p), lifting and search. The search space may be reduced by factoring the polynomial in different GF(p)'s. This parameter specify the maximum number of finite factorizations to be considered, before lifiting and searching.");
}
typedef ptr_vector<monomial> monomial_vector;

View file

@ -90,6 +90,9 @@ namespace polynomial {
factor_params();
factor_params(unsigned max_p, unsigned p_trials, unsigned max_search_size);
void updt_params(params_ref const & p);
/*
REG_MODULE_PARAMS('factor', polynomial::factor_params::get_param_descrs')
*/
static void get_param_descrs(param_descrs & r);
};

View file

@ -474,7 +474,7 @@ void context_t<C>::del(interval & a) {
template<typename C>
void context_t<C>::updt_params(params_ref const & p) {
unsigned epsilon = p.get_uint(":epsilon", 20);
unsigned epsilon = p.get_uint("epsilon", 20);
if (epsilon != 0) {
nm().set(m_epsilon, static_cast<int>(epsilon));
nm().inv(m_epsilon);
@ -485,18 +485,18 @@ void context_t<C>::updt_params(params_ref const & p) {
m_zero_epsilon = true;
}
unsigned max_power = p.get_uint(":max-bound", 10);
unsigned max_power = p.get_uint("max_bound", 10);
nm().set(m_max_bound, 10);
nm().power(m_max_bound, max_power, m_max_bound);
nm().set(m_minus_max_bound, m_max_bound);
nm().neg(m_minus_max_bound);
m_max_depth = p.get_uint(":max-depth", 128);
m_max_nodes = p.get_uint(":max-nodes", 8192);
m_max_depth = p.get_uint("max_depth", 128);
m_max_nodes = p.get_uint("max_nodes", 8192);
m_max_memory = megabytes_to_bytes(p.get_uint(":max-memory", UINT_MAX));
m_max_memory = megabytes_to_bytes(p.get_uint("max_memory", UINT_MAX));
unsigned prec = p.get_uint(":nth-root-precision", 8192);
unsigned prec = p.get_uint("nth_root_precision", 8192);
if (prec == 0)
prec = 1;
nm().set(m_nth_root_prec, static_cast<int>(prec));
@ -505,20 +505,20 @@ void context_t<C>::updt_params(params_ref const & p) {
template<typename C>
void context_t<C>::collect_param_descrs(param_descrs & d) {
d.insert(":max-nodes", CPK_UINT, "(default: 8192) maximum number of nodes in the subpaving tree.");
d.insert(":max-depth", CPK_UINT, "(default: 128) maximum depth of the subpaving tree.");
d.insert(":epsilon", CPK_UINT, "(default: 20) value k s.t. a new lower (upper) bound for x is propagated only new-lower(x) > lower(k) + 1/k * max(min(upper(x) - lower(x), |lower|), 1) (new-upper(x) < upper(x) - 1/k * max(min(upper(x) - lower(x), |lower|), 1)). If k = 0, then this restriction is ignored.");
d.insert(":max-bound", CPK_UINT, "(default 10) value k s.t. a new upper (lower) bound for x is propagated only if upper(x) > -10^k or lower(x) = -oo (lower(x) < 10^k or upper(x) = oo)");
d.insert(":nth-root-precision", CPK_UINT, "(default 8192) value k s.t. 1/k is the precision for computing the nth root in the subpaving module.");
d.insert("max_nodes", CPK_UINT, "(default: 8192) maximum number of nodes in the subpaving tree.");
d.insert("max_depth", CPK_UINT, "(default: 128) maximum depth of the subpaving tree.");
d.insert("epsilon", CPK_UINT, "(default: 20) value k s.t. a new lower (upper) bound for x is propagated only new-lower(x) > lower(k) + 1/k * max(min(upper(x) - lower(x), |lower|), 1) (new-upper(x) < upper(x) - 1/k * max(min(upper(x) - lower(x), |lower|), 1)). If k = 0, then this restriction is ignored.");
d.insert("max_bound", CPK_UINT, "(default 10) value k s.t. a new upper (lower) bound for x is propagated only if upper(x) > -10^k or lower(x) = -oo (lower(x) < 10^k or upper(x) = oo)");
d.insert("nth_root_precision", CPK_UINT, "(default 8192) value k s.t. 1/k is the precision for computing the nth root in the subpaving module.");
}
template<typename C>
void context_t<C>::display_params(std::ostream & out) const {
out << ":max-nodes " << m_max_nodes << "\n";
out << ":max-depth " << m_max_depth << "\n";
out << ":epsilon " << nm().to_rational_string(m_epsilon) << "\n";
out << ":max-bound " << nm().to_rational_string(m_max_bound) << "\n";
out << ":max-memory " << m_max_memory << "\n";
out << "max_nodes " << m_max_nodes << "\n";
out << "max_depth " << m_max_depth << "\n";
out << "epsilon " << nm().to_rational_string(m_epsilon) << "\n";
out << "max_bound " << nm().to_rational_string(m_max_bound) << "\n";
out << "max_memory " << m_max_memory << "\n";
}
template<typename C>

View file

@ -81,14 +81,14 @@ class subpaving_tactic : public tactic {
void collect_param_descrs(param_descrs & r) {
m_ctx->collect_param_descrs(r);
// #ifndef _EXTERNAL_RELEASE
r.insert(":numeral", CPK_SYMBOL, "(default: mpq) options: mpq, mpf, hwf, mpff, mpfx.");
r.insert(":print-nodes", CPK_BOOL, "(default: false) display subpaving tree leaves.");
r.insert("numeral", CPK_SYMBOL, "(default: mpq) options: mpq, mpf, hwf, mpff, mpfx.");
r.insert("print_nodes", CPK_BOOL, "(default: false) display subpaving tree leaves.");
// #endif
}
void updt_params(params_ref const & p) {
m_display = p.get_bool(":print-nodes", false);
symbol engine = p.get_sym(":numeral", symbol("mpq"));
m_display = p.get_bool("print_nodes", false);
symbol engine = p.get_sym("numeral", symbol("mpq"));
engine_kind new_kind;
if (engine == "mpq")
new_kind = MPQ;
@ -293,16 +293,16 @@ tactic * mk_subpaving_tactic_core(ast_manager & m, params_ref const & p) {
tactic * mk_subpaving_tactic(ast_manager & m, params_ref const & p) {
params_ref simp_p = p;
simp_p.set_bool(":arith-lhs", true);
simp_p.set_bool(":expand-power", true);
simp_p.set_uint(":max-power", UINT_MAX);
simp_p.set_bool(":som", true);
simp_p.set_bool(":eq2ineq", true);
simp_p.set_bool(":elim-and", true);
simp_p.set_bool(":blast-distinct", true);
simp_p.set_bool("arith_lhs", true);
simp_p.set_bool("expand_power", true);
simp_p.set_uint("max_power", UINT_MAX);
simp_p.set_bool("som", true);
simp_p.set_bool("eq2ineq", true);
simp_p.set_bool("elim_and", true);
simp_p.set_bool("blast_distinct", true);
params_ref simp2_p = p;
simp2_p.set_bool(":mul-to-power", true);
simp2_p.set_bool("mul_to_power", true);
return and_then(using_params(mk_simplify_tactic(m, p),
simp_p),