3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-11 18:28:08 +00:00

Fixed bug in sat model converter. Fixes #1148.

This commit is contained in:
Christoph M. Wintersteiger 2017-07-15 20:25:13 +01:00
parent 8a57e081f7
commit da34de340d
4 changed files with 45 additions and 24 deletions

View file

@ -2628,7 +2628,7 @@ namespace sat {
unsigned j = 0;
for (unsigned i = 0; i < clauses.size(); ++i) {
clause & c = *(clauses[i]);
if (c.contains(lit)) {
if (c.contains(lit) || c.contains(~lit)) {
detach_clause(c);
del_clause(c);
}
@ -2684,6 +2684,7 @@ namespace sat {
w = max_var(m_clauses, w);
w = max_var(true, w);
w = max_var(false, w);
v = m_mc.max_var(w);
for (unsigned i = 0; i < m_trail.size(); ++i) {
if (m_trail[i].var() > w) w = m_trail[i].var();
}
@ -3150,9 +3151,9 @@ namespace sat {
}
}
}
// Algorithm 7: Corebased Algorithm with Chunking
static void back_remove(sat::literal_vector& lits, sat::literal l) {
for (unsigned i = lits.size(); i > 0; ) {
--i;
@ -3176,7 +3177,7 @@ namespace sat {
}
}
}
static lbool core_chunking(sat::solver& s, model const& m, sat::bool_var_vector const& vars, sat::literal_vector const& asms, vector<sat::literal_vector>& conseq, unsigned K) {
sat::literal_vector lambda;
for (unsigned i = 0; i < vars.size(); i++) {
@ -3375,7 +3376,7 @@ namespace sat {
if (check_inconsistent()) return l_false;
unsigned num_iterations = 0;
extract_fixed_consequences(unfixed_lits, assumptions, unfixed_vars, conseq);
extract_fixed_consequences(unfixed_lits, assumptions, unfixed_vars, conseq);
update_unfixed_literals(unfixed_lits, unfixed_vars);
while (!unfixed_lits.empty()) {
if (scope_lvl() > 1) {
@ -3390,7 +3391,7 @@ namespace sat {
unsigned num_assigned = 0;
lbool is_sat = l_true;
for (; it != end; ++it) {
literal lit = *it;
literal lit = *it;
if (value(lit) != l_undef) {
++num_fixed;
if (lvl(lit) <= 1 && value(lit) == l_true) {
@ -3445,8 +3446,8 @@ namespace sat {
<< " iterations: " << num_iterations
<< " variables: " << unfixed_lits.size()
<< " fixed: " << conseq.size()
<< " status: " << is_sat
<< " pre-assigned: " << num_fixed
<< " status: " << is_sat
<< " pre-assigned: " << num_fixed
<< " unfixed: " << lits.size() - conseq.size() - unfixed_lits.size()
<< ")\n";);