mirror of
https://github.com/Z3Prover/z3
synced 2025-08-18 09:12:16 +00:00
Added limit to "visit" to allow detecting multiple visits (#6435)
* Memory leak in .NET user-propagator The user-propagator object has to be manually disposed (IDisposable), otherwise it stays in memory forever, as it cannot be garbage collected automatically * Throw an exception if variable passed to decide is already assigned instead of running in an assertion violation * Added limit to "visit" to allow detecting multiple visits * Putting visit in a separate class (Reason: We will probably need two of them in the sat::solver) * Bugfix
This commit is contained in:
parent
e0bbe8dfc0
commit
6790f18132
7 changed files with 68 additions and 52 deletions
|
@ -70,7 +70,7 @@ namespace sat {
|
|||
for (literal l : m_clause) {
|
||||
m_vars.push_back(l.var());
|
||||
m_var_position[l.var()] = i;
|
||||
s.mark_visited(l.var());
|
||||
s.m_visited.mark_visited(l.var());
|
||||
mask |= (l.sign() << (i++));
|
||||
}
|
||||
m_clauses_to_remove.reset();
|
||||
|
@ -91,7 +91,7 @@ namespace sat {
|
|||
// TBD: replace by BIG
|
||||
// loop over binary clauses in watch list
|
||||
for (watched const & w : s.get_wlist(l)) {
|
||||
if (w.is_binary_clause() && s.is_visited(w.get_literal().var()) && w.get_literal().index() < l.index()) {
|
||||
if (w.is_binary_clause() && s.m_visited.is_visited(w.get_literal().var()) && w.get_literal().index() < l.index()) {
|
||||
if (extract_lut(~l, w.get_literal())) {
|
||||
add_lut();
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ namespace sat {
|
|||
}
|
||||
l.neg();
|
||||
for (watched const & w : s.get_wlist(l)) {
|
||||
if (w.is_binary_clause() && s.is_visited(w.get_literal().var()) && w.get_literal().index() < l.index()) {
|
||||
if (w.is_binary_clause() && s.m_visited.is_visited(w.get_literal().var()) && w.get_literal().index() < l.index()) {
|
||||
if (extract_lut(~l, w.get_literal())) {
|
||||
add_lut();
|
||||
return;
|
||||
|
@ -124,8 +124,8 @@ namespace sat {
|
|||
}
|
||||
|
||||
bool lut_finder::extract_lut(literal l1, literal l2) {
|
||||
SASSERT(s.is_visited(l1.var()));
|
||||
SASSERT(s.is_visited(l2.var()));
|
||||
SASSERT(s.m_visited.is_visited(l1.var()));
|
||||
SASSERT(s.m_visited.is_visited(l2.var()));
|
||||
m_missing.reset();
|
||||
unsigned mask = 0;
|
||||
for (unsigned i = 0; i < m_vars.size(); ++i) {
|
||||
|
@ -144,7 +144,7 @@ namespace sat {
|
|||
|
||||
bool lut_finder::extract_lut(clause& c2) {
|
||||
for (literal l : c2) {
|
||||
if (!s.is_visited(l.var()))
|
||||
if (!s.m_visited.is_visited(l.var()))
|
||||
return false;
|
||||
}
|
||||
if (c2.size() == m_vars.size()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue