mirror of
https://github.com/Z3Prover/z3
synced 2025-08-11 21:50:52 +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
|
@ -62,7 +62,7 @@ namespace sat {
|
|||
unsigned mask = 0, i = 0;
|
||||
for (literal l : c) {
|
||||
m_var_position[l.var()] = i;
|
||||
s.mark_visited(l.var());
|
||||
s.m_visited.mark_visited(l.var());
|
||||
parity ^= !l.sign();
|
||||
mask |= (!l.sign() << (i++));
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace sat {
|
|||
}
|
||||
// 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_xor(parity, c, ~l, w.get_literal())) {
|
||||
add_xor(parity, c);
|
||||
return;
|
||||
|
@ -93,7 +93,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_xor(parity, c, ~l, w.get_literal())) {
|
||||
add_xor(parity, c);
|
||||
return;
|
||||
|
@ -122,8 +122,8 @@ namespace sat {
|
|||
}
|
||||
|
||||
bool xor_finder::extract_xor(bool parity, clause& c, 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 < c.size(); ++i) {
|
||||
|
@ -144,7 +144,7 @@ namespace sat {
|
|||
bool xor_finder::extract_xor(bool parity, clause& c, clause& c2) {
|
||||
bool parity2 = false;
|
||||
for (literal l : c2) {
|
||||
if (!s.is_visited(l.var())) return false;
|
||||
if (!s.m_visited.is_visited(l.var())) return false;
|
||||
parity2 ^= !l.sign();
|
||||
}
|
||||
if (c2.size() == c.size() && parity2 != parity) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue