z3-z3-4.13.0.src.test.solver_pool.cpp Maven / Gradle / Ivy
The newest version!
#include "ast/reg_decl_plugins.h"
#include "solver/solver_pool.h"
#include "smt/smt_solver.h"
#include
void tst_solver_pool() {
ast_manager m;
reg_decl_plugins(m);
params_ref p;
ref base = mk_smt_solver(m, p, symbol::null);
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);
base->assert_expr(fml);
solver_pool pool(base.get(), 3);
// base solver is cloned so any assertions
// added to base after mk_solver() are ignored.
ref s1 = pool.mk_solver();
ref s2 = pool.mk_solver();
ref s3 = pool.mk_solver();
ref s4 = pool.mk_solver();
fml = m.mk_and(b, c);
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 << base->check_sat(asms) << "\n";
std::cout << s1->check_sat(asms) << "\n";
std::cout << s2->check_sat(asms) << "\n";
std::cout << s3->check_sat(asms) << "\n";
std::cout << *s1;
std::cout << *s2;
std::cout << *base;
}