3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 01:25:31 +00:00

Extract usolver

This commit is contained in:
Jakob Rath 2022-12-16 10:46:57 +01:00
parent 5d7833e65e
commit 44cb528300
2 changed files with 13 additions and 4 deletions

View file

@ -947,15 +947,15 @@ namespace polysat {
return {};
}
find_t viable_fallback::find_viable(pvar v, rational& out_val) {
unsigned bit_width = s.m_size[v];
univariate_solver* viable_fallback::usolver(unsigned bit_width) {
univariate_solver* us;
auto it = m_usolver.find_iterator(bit_width);
if (it != m_usolver.end()) {
us = it->m_value.get();
us->pop(1);
} else {
}
else {
auto& mk_solver = *m_usolver_factory;
m_usolver.insert(bit_width, mk_solver(bit_width));
us = m_usolver[bit_width].get();
@ -964,6 +964,13 @@ namespace polysat {
// push once on the empty solver so we can reset it before the next use
us->push();
return us;
}
find_t viable_fallback::find_viable(pvar v, rational& out_val) {
unsigned const bit_width = s.m_size[v];
univariate_solver* us = usolver(bit_width);
auto const& cs = m_constraints[v];
for (unsigned i = cs.size(); i-- > 0; ) {
LOG("Univariate constraint: " << cs[i]);

View file

@ -258,6 +258,8 @@ namespace polysat {
vector<signed_constraints> m_constraints;
svector<unsigned> m_constraints_trail;
univariate_solver* usolver(unsigned bit_width);
public:
viable_fallback(solver& s);