Skip to content

Commit

Permalink
fix(sat): Clause minimization was incorrect when dealing with entaile…
Browse files Browse the repository at this point in the history
…d literals.
  • Loading branch information
arbimo committed Nov 14, 2024
1 parent f8bb8c5 commit 08c38c4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions solver/src/core/state/domains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::core::state::event::Event;
use crate::core::state::int_domains::IntDomains;
use crate::core::state::{Cause, DomainsSnapshot, Explainer, Explanation, ExplanationQueue, InvalidUpdate, OptDomain};
use crate::core::*;
use std::collections::HashSet;
use std::fmt::{Debug, Formatter};

#[cfg(debug_assertions)]
Expand Down Expand Up @@ -515,7 +516,7 @@ impl Domains {
};
debug_assert!(!witness::pruned_by_clause(&clause), "Pre minimization: {clause:?}");
// minimize the learned clause (removal of redundant literals)
// let clause = self.minimize_clause(clause, explainer);
let clause = self.minimize_clause(clause, explainer);
debug_assert!(!witness::pruned_by_clause(&clause), "Post minimization: {clause:?}");

Conflict { clause, resolved }
Expand All @@ -525,9 +526,8 @@ impl Domains {
///
/// This corresponds to recursive clause minimization.
/// ref: Minimizing Learned Clauses, N. Sörensson1 and A. Biere (SAT 09)
#[allow(unused)]
fn minimize_clause(&mut self, clause: Disjunction, explainer: &mut impl Explainer) -> Disjunction {
let mut marked = LitSet::new();
let mut marked = HashSet::new();
for &l in clause.literals() {
marked.insert(!l);
}
Expand All @@ -545,11 +545,11 @@ impl Domains {
if let Some(antecedants) = self.implying_literals(next, explainer) {
// not a decision, all antecedants that are not marked
for ante in antecedants {
if !marked.contains(ante) {
if !marked.contains(&ante) {
if let Some(event) = self.implying_event(ante) {
self.queue.push(event, ante);
} else {
debug_assert_eq!(self.entailing_level(ante), DecLvl::ROOT)
debug_assert_eq!(self.entailing_level(ante), DecLvl::ROOT);
// this is a tautology (entailed at ROOT), just ignore
}
}
Expand Down

0 comments on commit 08c38c4

Please sign in to comment.