mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
change pool solver to enable external control of pool allocation
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
ffdefa4f65
commit
b649cd93cb
5 changed files with 73 additions and 28 deletions
|
@ -102,6 +102,7 @@ add_executable(test-z3
|
|||
small_object_allocator.cpp
|
||||
smt2print_parse.cpp
|
||||
smt_context.cpp
|
||||
solver_pool.cpp
|
||||
sorting_network.cpp
|
||||
stack.cpp
|
||||
string_buffer.cpp
|
||||
|
|
|
@ -248,6 +248,7 @@ int main(int argc, char ** argv) {
|
|||
TST_ARGV(sat_local_search);
|
||||
TST_ARGV(cnf_backbones);
|
||||
TST(bdd);
|
||||
TST(solver_pool);
|
||||
//TST_ARGV(hs);
|
||||
}
|
||||
|
||||
|
|
34
src/test/solver_pool.cpp
Normal file
34
src/test/solver_pool.cpp
Normal file
|
@ -0,0 +1,34 @@
|
|||
#include "ast/reg_decl_plugins.h"
|
||||
#include "solver/solver_pool.h"
|
||||
#include "smt/smt_solver.h"
|
||||
|
||||
void tst_solver_pool() {
|
||||
ast_manager m;
|
||||
reg_decl_plugins(m);
|
||||
params_ref p;
|
||||
ref<solver> base = mk_smt_solver(m, p, symbol::null);
|
||||
solver_pool pool(base.get());
|
||||
|
||||
ref<solver> s1 = pool.mk_solver();
|
||||
ref<solver> s2 = pool.clone_solver(s1.get());
|
||||
ref<solver> s3 = pool.clone_solver(s1.get());
|
||||
|
||||
ref<solver> s4 = pool.mk_solver();
|
||||
ref<solver> s5 = pool.clone_solver(s4.get());
|
||||
ref<solver> s6 = pool.clone_solver(s4.get());
|
||||
|
||||
expr_ref a(m.mk_const(symbol("a"), m.mk_bool_sort()), m);
|
||||
expr_ref b(m.mk_const(symbol("b"), m.mk_bool_sort()), m);
|
||||
expr_ref c(m.mk_const(symbol("c"), m.mk_bool_sort()), m);
|
||||
expr_ref d(m.mk_const(symbol("d"), m.mk_bool_sort()), m);
|
||||
expr_ref fml(m);
|
||||
fml = m.mk_or(a, b);
|
||||
s1->assert_expr(fml);
|
||||
fml = m.mk_and(a,b);
|
||||
s2->assert_expr(fml);
|
||||
expr_ref_vector asms(m);
|
||||
asms.push_back(m.mk_not(a));
|
||||
std::cout << s1->check_sat(asms) << "\n";
|
||||
std::cout << s2->check_sat(asms) << "\n";
|
||||
std::cout << s3->check_sat(asms) << "\n";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue