mirror of
https://github.com/Z3Prover/z3
synced 2025-04-24 09:35:32 +00:00
port more from hybridSMT
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
209366ba55
commit
1a5bddb4f0
10 changed files with 3061 additions and 4044 deletions
|
@ -23,6 +23,8 @@ Notes:
|
|||
#include "nlsat/tactic/qfnra_nlsat_tactic.h"
|
||||
#include "tactic/smtlogics/smt_tactic.h"
|
||||
|
||||
#include "tactic/smtlogics/qflra_tactic.h"
|
||||
|
||||
static tactic * mk_qfnra_sat_solver(ast_manager& m, params_ref const& p, unsigned bv_size) {
|
||||
params_ref nra2sat_p = p;
|
||||
nra2sat_p.set_uint("nla2bv_max_bv_size", p.get_uint("nla2bv_max_bv_size", bv_size));
|
||||
|
@ -32,24 +34,305 @@ static tactic * mk_qfnra_sat_solver(ast_manager& m, params_ref const& p, unsigne
|
|||
mk_fail_if_undecided_tactic());
|
||||
}
|
||||
|
||||
tactic * mk_multilinear_ls_tactic(ast_manager & m, params_ref const & p, unsigned ls_time = 60) {
|
||||
params_ref p_mls = p;
|
||||
p_mls.set_bool("use_ls", true);
|
||||
p_mls.set_uint("ls_time",ls_time);
|
||||
return using_params(mk_smt_tactic(m), p_mls);
|
||||
}
|
||||
|
||||
tactic * linxi_mk_qfnra_very_small_solver(ast_manager& m, params_ref const& p) {
|
||||
ptr_vector<tactic> ts;
|
||||
{
|
||||
params_ref p_sc = p;
|
||||
p_sc.set_bool("linxi_simple_check", true);
|
||||
// p_sc.set_uint("seed", 997);
|
||||
ts.push_back(try_for(and_then(mk_qfnra_nlsat_tactic(m, p_sc), mk_fail_if_undecided_tactic()), 10 * 1000));
|
||||
}
|
||||
{
|
||||
params_ref p_heuristic = p;
|
||||
// p_heuristic.set_uint("seed", 233);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_heuristic), 4 * 1000));
|
||||
|
||||
params_ref p_order_4 = p;
|
||||
p_order_4.set_uint("linxi_variable_ordering_strategy", 4);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_4), 4 * 1000));
|
||||
|
||||
params_ref p_order_3 = p;
|
||||
p_order_3.set_uint("linxi_variable_ordering_strategy", 3);
|
||||
// p_order_3.set_uint("seed", 17);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_3), 6 * 1000));
|
||||
|
||||
params_ref p_order_1 = p;
|
||||
p_order_1.set_uint("linxi_variable_ordering_strategy", 1);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_1), 8 * 1000));
|
||||
|
||||
params_ref p_order_5 = p;
|
||||
p_order_5.set_uint("linxi_variable_ordering_strategy", 5);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_5), 8 * 1000));
|
||||
|
||||
params_ref p_order_2 = p;
|
||||
p_order_2.set_uint("linxi_variable_ordering_strategy", 2);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_2), 10 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_multilinear_ls_tactic(m, p, 60));
|
||||
}
|
||||
{
|
||||
params_ref p_l = p;
|
||||
p_l.set_bool("arith.greatest_error_pivot", true);
|
||||
ts.push_back(and_then(try_for(using_params(mk_smt_tactic(m), p_l), 300 * 1000), mk_fail_if_undecided_tactic()));
|
||||
}
|
||||
for (unsigned i = 0; i < 200; ++i) { // 3s * 200 = 600s
|
||||
params_ref p_i = p;
|
||||
p_i.set_uint("seed", i);
|
||||
p_i.set_bool("shuffle_vars", true);
|
||||
// if ((i & 1) == 0)
|
||||
// p_i.set_bool("randomize", false);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_i), 3 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_qfnra_nlsat_tactic(m, p));
|
||||
}
|
||||
return or_else(ts.size(), ts.data());
|
||||
}
|
||||
|
||||
tactic * linxi_mk_qfnra_small_solver(ast_manager& m, params_ref const& p) {
|
||||
ptr_vector<tactic> ts;
|
||||
{
|
||||
params_ref p_sc = p;
|
||||
p_sc.set_bool("linxi_simple_check", true);
|
||||
// p_sc.set_uint("seed", 997);
|
||||
ts.push_back(try_for(and_then(mk_qfnra_nlsat_tactic(m, p_sc), mk_fail_if_undecided_tactic()), 20 * 1000));
|
||||
}
|
||||
{
|
||||
params_ref p_heuristic = p;
|
||||
// p_heuristic.set_uint("seed", 233);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_heuristic), 5 * 1000));
|
||||
|
||||
params_ref p_order_4 = p;
|
||||
p_order_4.set_uint("linxi_variable_ordering_strategy", 4);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_4), 5 * 1000));
|
||||
|
||||
params_ref p_order_3 = p;
|
||||
p_order_3.set_uint("linxi_variable_ordering_strategy", 3);
|
||||
// p_order_3.set_uint("seed", 17);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_3), 10 * 1000));
|
||||
|
||||
params_ref p_order_1 = p;
|
||||
p_order_1.set_uint("linxi_variable_ordering_strategy", 1);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_1), 15 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_5 = p;
|
||||
p_order_5.set_uint("linxi_variable_ordering_strategy", 5);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_5), 15 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_2 = p;
|
||||
p_order_2.set_uint("linxi_variable_ordering_strategy", 2);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_2), 20 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_multilinear_ls_tactic(m, p, 70));
|
||||
}
|
||||
{
|
||||
params_ref p_l = p;
|
||||
p_l.set_bool("arith.greatest_error_pivot", true);
|
||||
ts.push_back(and_then(try_for(using_params(mk_smt_tactic(m), p_l), 350 * 1000), mk_fail_if_undecided_tactic()));
|
||||
}
|
||||
for (unsigned i = 0; i < 100; ++i) { // 5s * 100 = 500s
|
||||
params_ref p_i = p;
|
||||
p_i.set_uint("seed", i);
|
||||
p_i.set_bool("shuffle_vars", true);
|
||||
// if ((i & 1) == 0)
|
||||
// p_i.set_bool("randomize", false);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_i), 5 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_qfnra_nlsat_tactic(m, p));
|
||||
}
|
||||
return or_else(ts.size(), ts.data());
|
||||
}
|
||||
|
||||
tactic * linxi_mk_qfnra_middle_solver(ast_manager& m, params_ref const& p) {
|
||||
ptr_vector<tactic> ts;
|
||||
{
|
||||
params_ref p_sc = p;
|
||||
p_sc.set_bool("linxi_simple_check", true);
|
||||
// p_sc.set_uint("seed", 997);
|
||||
ts.push_back(try_for(and_then(mk_qfnra_nlsat_tactic(m, p_sc), mk_fail_if_undecided_tactic()), 30 * 1000));
|
||||
}
|
||||
{
|
||||
params_ref p_heuristic = p;
|
||||
// p_heuristic.set_uint("seed", 233);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_heuristic), 10 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_4 = p;
|
||||
p_order_4.set_uint("linxi_variable_ordering_strategy", 4);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_4), 15 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_3 = p;
|
||||
p_order_3.set_uint("linxi_variable_ordering_strategy", 3);
|
||||
// p_order_3.set_uint("seed", 17);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_3), 15 * 1000));
|
||||
|
||||
params_ref p_order_1 = p;
|
||||
p_order_1.set_uint("linxi_variable_ordering_strategy", 1);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_1), 20 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_5 = p;
|
||||
p_order_5.set_uint("linxi_variable_ordering_strategy", 5);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_5), 20 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_2 = p;
|
||||
p_order_2.set_uint("linxi_variable_ordering_strategy", 2);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_2), 25 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_multilinear_ls_tactic(m, p, 80));
|
||||
}
|
||||
{
|
||||
params_ref p_l = p;
|
||||
p_l.set_bool("arith.greatest_error_pivot", true);
|
||||
ts.push_back(and_then(try_for(using_params(mk_smt_tactic(m), p_l), 375 * 1000), mk_fail_if_undecided_tactic()));
|
||||
}
|
||||
for (unsigned i = 0; i < 40; ++i) { // 10s * 40 = 400s
|
||||
params_ref p_i = p;
|
||||
p_i.set_uint("seed", i);
|
||||
p_i.set_bool("shuffle_vars", true);
|
||||
// if ((i & 1) == 0)
|
||||
// p_i.set_bool("randomize", false);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_i), 10 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_qfnra_nlsat_tactic(m, p));
|
||||
}
|
||||
return or_else(ts.size(), ts.data());
|
||||
}
|
||||
|
||||
tactic * linxi_mk_qfnra_large_solver(ast_manager& m, params_ref const& p) {
|
||||
ptr_vector<tactic> ts;
|
||||
{
|
||||
params_ref p_sc = p;
|
||||
p_sc.set_bool("linxi_simple_check", true);
|
||||
// p_sc.set_uint("seed", 997);
|
||||
ts.push_back(try_for(and_then(mk_qfnra_nlsat_tactic(m, p_sc), mk_fail_if_undecided_tactic()), 50 * 1000));
|
||||
}
|
||||
{
|
||||
|
||||
params_ref p_order_4 = p;
|
||||
p_order_4.set_uint("linxi_variable_ordering_strategy", 4);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_4), 15 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_3 = p;
|
||||
p_order_3.set_uint("linxi_variable_ordering_strategy", 3);
|
||||
// p_order_3.set_uint("seed", 17);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_3), 30 * 1000));
|
||||
|
||||
params_ref p_order_1 = p;
|
||||
p_order_1.set_uint("linxi_variable_ordering_strategy", 1);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_1), 40 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_5 = p;
|
||||
p_order_5.set_uint("linxi_variable_ordering_strategy", 5);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_5), 40 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_2 = p;
|
||||
p_order_2.set_uint("linxi_variable_ordering_strategy", 2);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_2), 50 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_multilinear_ls_tactic(m, p, 90));
|
||||
}
|
||||
{
|
||||
params_ref p_l = p;
|
||||
p_l.set_bool("arith.greatest_error_pivot", true);
|
||||
ts.push_back(and_then(try_for(using_params(mk_smt_tactic(m), p_l), 400 * 1000), mk_fail_if_undecided_tactic()));
|
||||
}
|
||||
for (unsigned i = 0; i < 10; ++i) { // 20s * 10 = 200s
|
||||
params_ref p_i = p;
|
||||
p_i.set_uint("seed", i);
|
||||
p_i.set_bool("shuffle_vars", true);
|
||||
// if ((i & 1) == 0)
|
||||
// p_i.set_bool("randomize", false);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_i), 20 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_qfnra_nlsat_tactic(m, p));
|
||||
}
|
||||
return or_else(ts.size(), ts.data());
|
||||
}
|
||||
|
||||
tactic * linxi_mk_qfnra_very_large_solver(ast_manager& m, params_ref const& p) {
|
||||
ptr_vector<tactic> ts;
|
||||
{
|
||||
params_ref p_sc = p;
|
||||
p_sc.set_bool("linxi_simple_check", true);
|
||||
// p_sc.set_uint("seed", 997);
|
||||
ts.push_back(try_for(and_then(mk_qfnra_nlsat_tactic(m, p_sc), mk_fail_if_undecided_tactic()), 100 * 1000));
|
||||
}
|
||||
{
|
||||
params_ref p_order_1 = p;
|
||||
p_order_1.set_uint("linxi_variable_ordering_strategy", 1);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_1), 80 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_5 = p;
|
||||
p_order_5.set_uint("linxi_variable_ordering_strategy", 5);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_5), 80 * 1000));
|
||||
|
||||
|
||||
params_ref p_order_2 = p;
|
||||
p_order_2.set_uint("linxi_variable_ordering_strategy", 2);
|
||||
ts.push_back(try_for(mk_qfnra_nlsat_tactic(m, p_order_2), 100 * 1000));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_multilinear_ls_tactic(m, p, 100));
|
||||
}
|
||||
{
|
||||
params_ref p_l = p;
|
||||
p_l.set_bool("arith.greatest_error_pivot", true);
|
||||
ts.push_back(and_then(try_for(using_params(mk_smt_tactic(m), p_l), 425 * 1000), mk_fail_if_undecided_tactic()));
|
||||
}
|
||||
{
|
||||
ts.push_back(mk_qfnra_nlsat_tactic(m, p));
|
||||
}
|
||||
return or_else(ts.size(), ts.data());
|
||||
}
|
||||
|
||||
const double VERY_SMALL_THRESHOLD = 30.0;
|
||||
const double SMALL_THRESHOLD = 80.0;
|
||||
const double MIDDLE_THRESHOLD = 300.0;
|
||||
const double LARGE_THRESHOLD = 600.0;
|
||||
tactic * linxi_mk_qfnra_mixed_solver(ast_manager& m, params_ref const& p) {
|
||||
return cond(mk_lt(mk_memory_probe(), mk_const_probe(VERY_SMALL_THRESHOLD)),
|
||||
linxi_mk_qfnra_very_small_solver(m, p),
|
||||
cond(mk_lt(mk_memory_probe(), mk_const_probe(SMALL_THRESHOLD)),
|
||||
linxi_mk_qfnra_small_solver(m, p),
|
||||
cond(mk_lt(mk_memory_probe(), mk_const_probe(MIDDLE_THRESHOLD)),
|
||||
linxi_mk_qfnra_middle_solver(m, p),
|
||||
cond(mk_lt(mk_memory_probe(), mk_const_probe(LARGE_THRESHOLD)),
|
||||
linxi_mk_qfnra_large_solver(m, p),
|
||||
linxi_mk_qfnra_very_large_solver(m, p)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
tactic * mk_qfnra_tactic(ast_manager & m, params_ref const& p) {
|
||||
params_ref p0 = p;
|
||||
p0.set_bool("inline_vars", true);
|
||||
params_ref p1 = p;
|
||||
p1.set_uint("seed", 11);
|
||||
p1.set_bool("factor", false);
|
||||
params_ref p2 = p;
|
||||
p2.set_uint("seed", 13);
|
||||
p2.set_bool("factor", false);
|
||||
|
||||
return and_then(mk_simplify_tactic(m, p),
|
||||
mk_propagate_values_tactic(m, p),
|
||||
or_else(try_for(mk_qfnra_nlsat_tactic(m, p0), 5000),
|
||||
try_for(mk_qfnra_nlsat_tactic(m, p1), 10000),
|
||||
mk_qfnra_sat_solver(m, p, 4),
|
||||
and_then(try_for(mk_smt_tactic(m), 5000), mk_fail_if_undecided_tactic()),
|
||||
mk_qfnra_sat_solver(m, p, 6),
|
||||
mk_qfnra_nlsat_tactic(m, p2)));
|
||||
// mk_multilinear_ls_tactic(m, p)
|
||||
linxi_mk_qfnra_mixed_solver(m, p)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue