mirror of
https://github.com/Z3Prover/z3
synced 2025-04-15 13:28:47 +00:00
move parallel-tactic to solver level
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
cd35caff52
commit
a37303a045
|
@ -24,6 +24,8 @@ Notes:
|
||||||
#include "ast/ast_util.h"
|
#include "ast/ast_util.h"
|
||||||
#include "solver/solver.h"
|
#include "solver/solver.h"
|
||||||
#include "solver/tactic2solver.h"
|
#include "solver/tactic2solver.h"
|
||||||
|
#include "solver/parallel_params.hpp"
|
||||||
|
#include "solver/parallel_tactic.h"
|
||||||
#include "tactic/tactical.h"
|
#include "tactic/tactical.h"
|
||||||
#include "tactic/aig/aig_tactic.h"
|
#include "tactic/aig/aig_tactic.h"
|
||||||
#include "tactic/core/propagate_values_tactic.h"
|
#include "tactic/core/propagate_values_tactic.h"
|
||||||
|
@ -39,6 +41,7 @@ Notes:
|
||||||
#include "sat/sat_solver.h"
|
#include "sat/sat_solver.h"
|
||||||
#include "sat/sat_params.hpp"
|
#include "sat/sat_params.hpp"
|
||||||
#include "sat/tactic/goal2sat.h"
|
#include "sat/tactic/goal2sat.h"
|
||||||
|
#include "sat/tactic/sat_tactic.h"
|
||||||
#include "sat/sat_simplifier_params.hpp"
|
#include "sat/sat_simplifier_params.hpp"
|
||||||
|
|
||||||
// incremental SAT solver.
|
// incremental SAT solver.
|
||||||
|
@ -865,3 +868,9 @@ void inc_sat_display(std::ostream& out, solver& _s, unsigned sz, expr*const* sof
|
||||||
s.display_weighted(out, sz, soft, weights.c_ptr());
|
s.display_weighted(out, sz, soft, weights.c_ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tactic * mk_psat_tactic(ast_manager& m, params_ref const& p) {
|
||||||
|
parallel_params pp(p);
|
||||||
|
bool use_parallel = pp.enable();
|
||||||
|
return pp.enable() ? mk_parallel_tactic(mk_inc_sat_solver(m, p, false), p) : mk_sat_tactic(m);
|
||||||
|
}
|
||||||
|
|
|
@ -22,8 +22,12 @@ Notes:
|
||||||
|
|
||||||
#include "solver/solver.h"
|
#include "solver/solver.h"
|
||||||
|
|
||||||
|
class tactic;
|
||||||
|
|
||||||
solver* mk_inc_sat_solver(ast_manager& m, params_ref const& p, bool incremental_mode = true);
|
solver* mk_inc_sat_solver(ast_manager& m, params_ref const& p, bool incremental_mode = true);
|
||||||
|
|
||||||
|
tactic* mk_psat_tactic(ast_manager& m, params_ref const& p);
|
||||||
|
|
||||||
|
|
||||||
void inc_sat_display(std::ostream& out, solver& s, unsigned sz, expr*const* soft, rational const* _weights);
|
void inc_sat_display(std::ostream& out, solver& s, unsigned sz, expr*const* soft, rational const* _weights);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ Notes:
|
||||||
#include "tactic/tactical.h"
|
#include "tactic/tactical.h"
|
||||||
#include "sat/tactic/goal2sat.h"
|
#include "sat/tactic/goal2sat.h"
|
||||||
#include "sat/sat_solver.h"
|
#include "sat/sat_solver.h"
|
||||||
|
#include "solver/parallel_tactic.h"
|
||||||
|
#include "solver/parallel_params.hpp"
|
||||||
#include "model/model_v2_pp.h"
|
#include "model/model_v2_pp.h"
|
||||||
|
|
||||||
class sat_tactic : public tactic {
|
class sat_tactic : public tactic {
|
||||||
|
@ -215,3 +217,4 @@ tactic * mk_sat_preprocessor_tactic(ast_manager & m, params_ref const & p) {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,19 +16,21 @@ Author:
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
--*/
|
--*/
|
||||||
#include "tactic/tactic.h"
|
#include "util/lp/lp_params.hpp"
|
||||||
#include "tactic/tactical.h"
|
#include "ast/rewriter/rewriter_types.h"
|
||||||
|
#include "ast/ast_util.h"
|
||||||
#include "smt/smt_kernel.h"
|
#include "smt/smt_kernel.h"
|
||||||
#include "smt/params/smt_params.h"
|
#include "smt/params/smt_params.h"
|
||||||
#include "smt/params/smt_params_helper.hpp"
|
#include "smt/params/smt_params_helper.hpp"
|
||||||
#include "util/lp/lp_params.hpp"
|
|
||||||
#include "ast/rewriter/rewriter_types.h"
|
|
||||||
#include "tactic/generic_model_converter.h"
|
|
||||||
#include "ast/ast_util.h"
|
|
||||||
#include "solver/solver2tactic.h"
|
|
||||||
#include "smt/smt_solver.h"
|
#include "smt/smt_solver.h"
|
||||||
|
#include "tactic/tactic.h"
|
||||||
|
#include "tactic/tactical.h"
|
||||||
|
#include "tactic/generic_model_converter.h"
|
||||||
|
#include "solver/solver2tactic.h"
|
||||||
#include "solver/solver.h"
|
#include "solver/solver.h"
|
||||||
#include "solver/mus.h"
|
#include "solver/mus.h"
|
||||||
|
#include "solver/parallel_tactic.h"
|
||||||
|
#include "solver/parallel_params.hpp"
|
||||||
|
|
||||||
typedef obj_map<expr, expr *> expr2expr_map;
|
typedef obj_map<expr, expr *> expr2expr_map;
|
||||||
|
|
||||||
|
@ -301,3 +303,20 @@ tactic * mk_smt_tactic_using(bool auto_config, params_ref const & _p) {
|
||||||
return using_params(r, p);
|
return using_params(r, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tactic * mk_psmt_tactic(ast_manager& m, params_ref const& p, symbol const& logic) {
|
||||||
|
parallel_params pp(p);
|
||||||
|
bool use_parallel = pp.enable();
|
||||||
|
return pp.enable() ? mk_parallel_tactic(mk_smt_solver(m, p, logic), p) : mk_smt_tactic(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
tactic * mk_psmt_tactic_using(ast_manager& m, bool auto_config, params_ref const& _p, symbol const& logic) {
|
||||||
|
parallel_params pp(_p);
|
||||||
|
bool use_parallel = pp.enable();
|
||||||
|
params_ref p = _p;
|
||||||
|
p.set_bool("auto_config", auto_config);
|
||||||
|
return using_params(pp.enable() ? mk_parallel_tactic(mk_smt_solver(m, p, logic), p) : mk_smt_tactic(p), p);
|
||||||
|
}
|
||||||
|
|
||||||
|
tactic * mk_parallel_smt_tactic(ast_manager& m, params_ref const& p) {
|
||||||
|
return mk_parallel_tactic(mk_smt_solver(m, p, symbol::null), p);
|
||||||
|
}
|
||||||
|
|
|
@ -31,8 +31,13 @@ tactic * mk_smt_tactic(params_ref const & p = params_ref());
|
||||||
// syntax sugar for using_params(mk_smt_tactic(), p) where p = (:auto_config, auto_config)
|
// syntax sugar for using_params(mk_smt_tactic(), p) where p = (:auto_config, auto_config)
|
||||||
tactic * mk_smt_tactic_using(bool auto_config = true, params_ref const & p = params_ref());
|
tactic * mk_smt_tactic_using(bool auto_config = true, params_ref const & p = params_ref());
|
||||||
|
|
||||||
|
tactic * mk_psmt_tactic(ast_manager& m, params_ref const& p, symbol const& logic = symbol::null);
|
||||||
|
tactic * mk_psmt_tactic_using(ast_manager& m, bool auto_config, params_ref const& p, symbol const& logic = symbol::null);
|
||||||
|
tactic * mk_parallel_smt_tactic(ast_manager& m, params_ref const& p);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ADD_TACTIC("smt", "apply a SAT based SMT solver.", "mk_smt_tactic(p)")
|
ADD_TACTIC("smt", "apply a SAT based SMT solver.", "mk_smt_tactic(p)")
|
||||||
|
ADD_TACTIC("psmt", "builtin strategy for SMT tactic in parallel.", "mk_parallel_smt_tactic(m, p)")
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,6 +3,7 @@ z3_add_component(solver
|
||||||
check_sat_result.cpp
|
check_sat_result.cpp
|
||||||
combined_solver.cpp
|
combined_solver.cpp
|
||||||
mus.cpp
|
mus.cpp
|
||||||
|
parallel_tactic.cpp
|
||||||
smt_logics.cpp
|
smt_logics.cpp
|
||||||
solver.cpp
|
solver.cpp
|
||||||
solver_na2as.cpp
|
solver_na2as.cpp
|
||||||
|
@ -14,4 +15,6 @@ z3_add_component(solver
|
||||||
tactic
|
tactic
|
||||||
PYG_FILES
|
PYG_FILES
|
||||||
combined_solver_params.pyg
|
combined_solver_params.pyg
|
||||||
|
parallel_params.pyg
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,7 +39,8 @@ Notes:
|
||||||
#include "tactic/tactic.h"
|
#include "tactic/tactic.h"
|
||||||
#include "tactic/tactical.h"
|
#include "tactic/tactical.h"
|
||||||
#include "tactic/portfolio/fd_solver.h"
|
#include "tactic/portfolio/fd_solver.h"
|
||||||
#include "tactic/smtlogics/parallel_params.hpp"
|
#include "solver/parallel_tactic.h"
|
||||||
|
#include "solver/parallel_params.hpp"
|
||||||
#include "smt/tactic/smt_tactic.h"
|
#include "smt/tactic/smt_tactic.h"
|
||||||
#include "smt/smt_solver.h"
|
#include "smt/smt_solver.h"
|
||||||
#include "sat/sat_solver/inc_sat_solver.h"
|
#include "sat/sat_solver/inc_sat_solver.h"
|
||||||
|
@ -710,37 +711,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tactic * mk_parallel_qffd_tactic(ast_manager& m, params_ref const& p) {
|
|
||||||
solver* s = mk_fd_solver(m, p);
|
|
||||||
return alloc(parallel_tactic, s, p);
|
|
||||||
}
|
|
||||||
|
|
||||||
tactic * mk_parallel_tactic(solver* s, params_ref const& p) {
|
tactic * mk_parallel_tactic(solver* s, params_ref const& p) {
|
||||||
return alloc(parallel_tactic, s, p);
|
return alloc(parallel_tactic, s, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tactic * mk_psat_tactic(ast_manager& m, params_ref const& p) {
|
|
||||||
parallel_params pp(p);
|
|
||||||
bool use_parallel = pp.enable();
|
|
||||||
return pp.enable() ? mk_parallel_tactic(mk_inc_sat_solver(m, p), p) : mk_sat_tactic(m);
|
|
||||||
}
|
|
||||||
|
|
||||||
tactic * mk_psmt_tactic(ast_manager& m, params_ref const& p, symbol const& logic) {
|
|
||||||
parallel_params pp(p);
|
|
||||||
bool use_parallel = pp.enable();
|
|
||||||
return pp.enable() ? mk_parallel_tactic(mk_smt_solver(m, p, logic), p) : mk_smt_tactic(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
tactic * mk_psmt_tactic_using(ast_manager& m, bool auto_config, params_ref const& _p, symbol const& logic) {
|
|
||||||
parallel_params pp(_p);
|
|
||||||
bool use_parallel = pp.enable();
|
|
||||||
params_ref p = _p;
|
|
||||||
p.set_bool("auto_config", auto_config);
|
|
||||||
return using_params(pp.enable() ? mk_parallel_tactic(mk_smt_solver(m, p, logic), p) : mk_smt_tactic(p), p);
|
|
||||||
}
|
|
||||||
|
|
||||||
tactic * mk_parallel_smt_tactic(ast_manager& m, params_ref const& p) {
|
|
||||||
return mk_parallel_tactic(mk_smt_solver(m, p, symbol::null), p);
|
|
||||||
}
|
|
27
src/solver/parallel_tactic.h
Normal file
27
src/solver/parallel_tactic.h
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*++
|
||||||
|
Copyright (c) 2017 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
parallel_tactic.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Parallel tactic in the style of Treengeling.
|
||||||
|
|
||||||
|
Author:
|
||||||
|
|
||||||
|
Nikolaj Bjorner (nbjorner) 2017-10-9
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef PARALLEL_TACTIC_H_
|
||||||
|
#define PARALLEL_TACTIC_H_
|
||||||
|
|
||||||
|
class tactic;
|
||||||
|
class solver;
|
||||||
|
|
||||||
|
tactic * mk_parallel_tactic(solver* s, params_ref const& p);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,6 @@
|
||||||
def_module_params('parallel',
|
def_module_params('parallel',
|
||||||
description='parameters for parallel solver',
|
description='parameters for parallel solver',
|
||||||
class_name='parallel_params',
|
class_name='parallel_tactic_params',
|
||||||
export=True,
|
export=True,
|
||||||
params=(
|
params=(
|
||||||
('enable', BOOL, False, 'enable parallel solver by default on selected tactics (for QF_BV)'),
|
('enable', BOOL, False, 'enable parallel solver by default on selected tactics (for QF_BV)'),
|
|
@ -4,11 +4,9 @@ z3_add_component(portfolio
|
||||||
default_tactic.cpp
|
default_tactic.cpp
|
||||||
enum2bv_solver.cpp
|
enum2bv_solver.cpp
|
||||||
fd_solver.cpp
|
fd_solver.cpp
|
||||||
parallel_tactic.cpp
|
|
||||||
pb2bv_solver.cpp
|
pb2bv_solver.cpp
|
||||||
smt_strategic_solver.cpp
|
smt_strategic_solver.cpp
|
||||||
solver2lookahead.cpp
|
solver2lookahead.cpp
|
||||||
solver_sat_extension.cpp
|
|
||||||
COMPONENT_DEPENDENCIES
|
COMPONENT_DEPENDENCIES
|
||||||
aig_tactic
|
aig_tactic
|
||||||
fp
|
fp
|
||||||
|
@ -22,5 +20,4 @@ z3_add_component(portfolio
|
||||||
TACTIC_HEADERS
|
TACTIC_HEADERS
|
||||||
default_tactic.h
|
default_tactic.h
|
||||||
fd_solver.h
|
fd_solver.h
|
||||||
parallel_tactic.h
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -24,6 +24,8 @@ Notes:
|
||||||
#include "tactic/portfolio/pb2bv_solver.h"
|
#include "tactic/portfolio/pb2bv_solver.h"
|
||||||
#include "tactic/portfolio/bounded_int2bv_solver.h"
|
#include "tactic/portfolio/bounded_int2bv_solver.h"
|
||||||
#include "solver/solver2tactic.h"
|
#include "solver/solver2tactic.h"
|
||||||
|
#include "solver/parallel_tactic.h"
|
||||||
|
#include "solver/parallel_params.hpp"
|
||||||
|
|
||||||
solver * mk_fd_solver(ast_manager & m, params_ref const & p, bool incremental_mode) {
|
solver * mk_fd_solver(ast_manager & m, params_ref const & p, bool incremental_mode) {
|
||||||
solver* s = mk_inc_sat_solver(m, p, incremental_mode);
|
solver* s = mk_inc_sat_solver(m, p, incremental_mode);
|
||||||
|
@ -36,3 +38,8 @@ solver * mk_fd_solver(ast_manager & m, params_ref const & p, bool incremental_mo
|
||||||
tactic * mk_fd_tactic(ast_manager & m, params_ref const& p) {
|
tactic * mk_fd_tactic(ast_manager & m, params_ref const& p) {
|
||||||
return mk_solver2tactic(mk_fd_solver(m, p, false));
|
return mk_solver2tactic(mk_fd_solver(m, p, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tactic * mk_parallel_qffd_tactic(ast_manager& m, params_ref const& p) {
|
||||||
|
solver* s = mk_fd_solver(m, p);
|
||||||
|
return mk_parallel_tactic(s, p);
|
||||||
|
}
|
||||||
|
|
|
@ -27,9 +27,11 @@ class tactic;
|
||||||
|
|
||||||
solver * mk_fd_solver(ast_manager & m, params_ref const & p, bool incremental_mode = true);
|
solver * mk_fd_solver(ast_manager & m, params_ref const & p, bool incremental_mode = true);
|
||||||
tactic * mk_fd_tactic(ast_manager & m, params_ref const & p);
|
tactic * mk_fd_tactic(ast_manager & m, params_ref const & p);
|
||||||
|
tactic * mk_parallel_qffd_tactic(ast_manager& m, params_ref const& p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ADD_TACTIC("qffd", "builtin strategy for solving QF_FD problems.", "mk_fd_tactic(m, p)")
|
ADD_TACTIC("qffd", "builtin strategy for solving QF_FD problems.", "mk_fd_tactic(m, p)")
|
||||||
|
ADD_TACTIC("pqffd", "builtin strategy for solving QF_FD problems in parallel.", "mk_parallel_qffd_tactic(m, p)")
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
/*++
|
|
||||||
Copyright (c) 2017 Microsoft Corporation
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
parallel_tactic.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Parallel tactic in the style of Treengeling.
|
|
||||||
|
|
||||||
Author:
|
|
||||||
|
|
||||||
Nikolaj Bjorner (nbjorner) 2017-10-9
|
|
||||||
|
|
||||||
Notes:
|
|
||||||
|
|
||||||
--*/
|
|
||||||
#ifndef PARALLEL_TACTIC_H_
|
|
||||||
#define PARALLEL_TACTIC_H_
|
|
||||||
|
|
||||||
class solver;
|
|
||||||
class tactic;
|
|
||||||
class solver;
|
|
||||||
|
|
||||||
tactic * mk_parallel_tactic(solver* s, params_ref const& p);
|
|
||||||
tactic * mk_parallel_qffd_tactic(ast_manager& m, params_ref const& p);
|
|
||||||
tactic * mk_parallel_smt_tactic(ast_manager& m, params_ref const& p);
|
|
||||||
|
|
||||||
// create parallel sat/smt tactics if parallel.enable=true, otherwise return sequential versions.
|
|
||||||
tactic * mk_psat_tactic(ast_manager& m, params_ref const& p);
|
|
||||||
tactic * mk_psmt_tactic(ast_manager& m, params_ref const& p, symbol const& logic = symbol::null);
|
|
||||||
tactic * mk_psmt_tactic_using(ast_manager& m, bool auto_config, params_ref const& p, symbol const& logic = symbol::null);
|
|
||||||
|
|
||||||
/*
|
|
||||||
ADD_TACTIC("pqffd", "builtin strategy for solving QF_FD problems in parallel.", "mk_parallel_qffd_tactic(m, p)")
|
|
||||||
ADD_TACTIC("psmt", "builtin strategy for SMT tactic in parallel.", "mk_parallel_smt_tactic(m, p)")
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -26,7 +26,6 @@ z3_add_component(smtlogic_tactics
|
||||||
smt_tactic
|
smt_tactic
|
||||||
PYG_FILES
|
PYG_FILES
|
||||||
qfufbv_tactic_params.pyg
|
qfufbv_tactic_params.pyg
|
||||||
parallel_params.pyg
|
|
||||||
TACTIC_HEADERS
|
TACTIC_HEADERS
|
||||||
nra_tactic.h
|
nra_tactic.h
|
||||||
qfaufbv_tactic.h
|
qfaufbv_tactic.h
|
||||||
|
|
|
@ -29,8 +29,6 @@ Notes:
|
||||||
#include "tactic/aig/aig_tactic.h"
|
#include "tactic/aig/aig_tactic.h"
|
||||||
#include "sat/tactic/sat_tactic.h"
|
#include "sat/tactic/sat_tactic.h"
|
||||||
#include "sat/sat_solver/inc_sat_solver.h"
|
#include "sat/sat_solver/inc_sat_solver.h"
|
||||||
#include "tactic/portfolio/parallel_tactic.h"
|
|
||||||
#include "tactic/smtlogics/parallel_params.hpp"
|
|
||||||
#include "ackermannization/ackermannize_bv_tactic.h"
|
#include "ackermannization/ackermannize_bv_tactic.h"
|
||||||
|
|
||||||
#define MEMLIMIT 300
|
#define MEMLIMIT 300
|
||||||
|
|
|
@ -34,7 +34,6 @@ Notes:
|
||||||
#include "sat/tactic/sat_tactic.h"
|
#include "sat/tactic/sat_tactic.h"
|
||||||
#include "tactic/arith/bound_manager.h"
|
#include "tactic/arith/bound_manager.h"
|
||||||
#include "tactic/arith/probe_arith.h"
|
#include "tactic/arith/probe_arith.h"
|
||||||
#include "tactic/portfolio/parallel_tactic.h"
|
|
||||||
|
|
||||||
struct quasi_pb_probe : public probe {
|
struct quasi_pb_probe : public probe {
|
||||||
virtual result operator()(goal const & g) {
|
virtual result operator()(goal const & g) {
|
||||||
|
|
Loading…
Reference in a new issue