mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 22:03:39 +00:00
Extract usolver
This commit is contained in:
parent
5d7833e65e
commit
44cb528300
2 changed files with 13 additions and 4 deletions
|
@ -947,15 +947,15 @@ namespace polysat {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
find_t viable_fallback::find_viable(pvar v, rational& out_val) {
|
univariate_solver* viable_fallback::usolver(unsigned bit_width) {
|
||||||
unsigned bit_width = s.m_size[v];
|
|
||||||
|
|
||||||
univariate_solver* us;
|
univariate_solver* us;
|
||||||
|
|
||||||
auto it = m_usolver.find_iterator(bit_width);
|
auto it = m_usolver.find_iterator(bit_width);
|
||||||
if (it != m_usolver.end()) {
|
if (it != m_usolver.end()) {
|
||||||
us = it->m_value.get();
|
us = it->m_value.get();
|
||||||
us->pop(1);
|
us->pop(1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
auto& mk_solver = *m_usolver_factory;
|
auto& mk_solver = *m_usolver_factory;
|
||||||
m_usolver.insert(bit_width, mk_solver(bit_width));
|
m_usolver.insert(bit_width, mk_solver(bit_width));
|
||||||
us = m_usolver[bit_width].get();
|
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
|
// push once on the empty solver so we can reset it before the next use
|
||||||
us->push();
|
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];
|
auto const& cs = m_constraints[v];
|
||||||
for (unsigned i = cs.size(); i-- > 0; ) {
|
for (unsigned i = cs.size(); i-- > 0; ) {
|
||||||
LOG("Univariate constraint: " << cs[i]);
|
LOG("Univariate constraint: " << cs[i]);
|
||||||
|
|
|
@ -258,6 +258,8 @@ namespace polysat {
|
||||||
vector<signed_constraints> m_constraints;
|
vector<signed_constraints> m_constraints;
|
||||||
svector<unsigned> m_constraints_trail;
|
svector<unsigned> m_constraints_trail;
|
||||||
|
|
||||||
|
univariate_solver* usolver(unsigned bit_width);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
viable_fallback(solver& s);
|
viable_fallback(solver& s);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue