mirror of
https://github.com/Z3Prover/z3
synced 2025-06-27 08:28:44 +00:00
Merge branch 'opt' of https://github.com/nikolajbjorner/z3 into opt
This commit is contained in:
commit
42749e7b22
2 changed files with 30 additions and 5 deletions
|
@ -340,6 +340,13 @@ namespace sat {
|
|||
}
|
||||
|
||||
bool lookahead::is_unsat() const {
|
||||
for (unsigned idx = 0; idx < m_binary.size(); ++idx) {
|
||||
literal l = to_literal(idx);
|
||||
for (literal lit : m_binary[idx]) {
|
||||
if (is_true(l) && is_false(lit))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// check if there is a clause whose literals are false.
|
||||
// every clause is terminated by a null-literal.
|
||||
for (nary* n : m_nary_clauses) {
|
||||
|
@ -440,8 +447,21 @@ namespace sat {
|
|||
|
||||
bool lookahead::missed_conflict() const {
|
||||
if (inconsistent()) return false;
|
||||
for (literal l1 : m_trail) {
|
||||
for (literal l2 : m_binary[l1.index()]) {
|
||||
if (is_false(l2))
|
||||
return true;
|
||||
}
|
||||
unsigned sz = m_ternary_count[(~l1).index()];
|
||||
for (binary b : m_ternary[(~l1).index()]) {
|
||||
if (sz-- == 0) break;
|
||||
if ((is_false(b.m_u) && is_false(b.m_v)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (nary * n : m_nary_clauses) {
|
||||
if (n->size() == 0) return true;
|
||||
if (n->size() == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1464,7 +1484,7 @@ namespace sat {
|
|||
sz = m_nary_count[l.index()];
|
||||
for (nary* n : m_nary[l.index()]) {
|
||||
if (sz-- == 0) break;
|
||||
if (m_stamp[l.var()] > m_stamp[n->get_head().var()]) {
|
||||
if (get_level(l) > get_level(n->get_head())) {
|
||||
n->set_head(l);
|
||||
}
|
||||
}
|
||||
|
@ -1660,6 +1680,7 @@ namespace sat {
|
|||
num_units += do_double(lit, dl_lvl);
|
||||
if (dl_lvl > level) {
|
||||
base = dl_lvl;
|
||||
SASSERT(get_level(m_trail.back()) == base + m_lookahead[i].m_offset);
|
||||
}
|
||||
unsat = inconsistent();
|
||||
pop_lookahead1(lit, num_units);
|
||||
|
@ -1785,11 +1806,12 @@ namespace sat {
|
|||
base += m_lookahead.size();
|
||||
unsigned dl_truth = base + m_lookahead.size() * m_config.m_dl_max_iterations;
|
||||
scoped_level _sl(*this, dl_truth);
|
||||
SASSERT(get_level(m_trail.back()) == dl_truth);
|
||||
SASSERT(is_fixed(l));
|
||||
IF_VERBOSE(2, verbose_stream() << "double: " << l << " depth: " << m_trail_lim.size() << "\n";);
|
||||
lookahead_backtrack();
|
||||
assign(l);
|
||||
propagate();
|
||||
//SASSERT(!inconsistent());
|
||||
unsigned old_sz = m_trail.size();
|
||||
bool change = true;
|
||||
literal last_changed = null_literal;
|
||||
|
@ -1830,6 +1852,8 @@ namespace sat {
|
|||
base += 2 * m_lookahead.size();
|
||||
SASSERT(dl_truth >= base);
|
||||
}
|
||||
lookahead_backtrack();
|
||||
SASSERT(get_level(m_trail.back()) == dl_truth);
|
||||
SASSERT(m_level == dl_truth);
|
||||
base = dl_truth;
|
||||
return m_trail.size() - old_sz;
|
||||
|
@ -1848,6 +1872,7 @@ namespace sat {
|
|||
if (is_undef(l)) {
|
||||
TRACE("sat", tout << "assign: " << l << " @ " << m_level << " " << m_trail_lim.size() << " " << m_search_mode << "\n";);
|
||||
set_true(l);
|
||||
SASSERT(m_trail.empty() || get_level(m_trail.back()) >= get_level(l));
|
||||
m_trail.push_back(l);
|
||||
if (m_search_mode == lookahead_mode::searching) {
|
||||
m_stats.m_propagations++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue