Skip to content

Commit 7db63bf

Browse files
Refactor conflict analysis in Engine to improve handling of reason clauses
1 parent aede912 commit 7db63bf

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,9 @@ impl Engine {
252252
}
253253

254254
fn analyze_conflict(&mut self, mut clause: usize) {
255-
println!("Engine before conflict analysis:\n{}", self);
256-
257255
self.seen.fill(false);
258256
let mut counter: usize = 0;
259-
let mut p: Option<(Lit, usize)> = None;
257+
let mut p: Option<(Lit, Option<usize>)> = None;
260258
self.learnt.clear();
261259
self.learnt.push(Lit::default()); // Placeholder for the asserting literal
262260

@@ -286,7 +284,7 @@ impl Engine {
286284
let v = self.propagated_vars.pop().expect("There should be a variable to resolve away");
287285
if self.seen[v] {
288286
let sign = self.value(v) == &LBool::True;
289-
let reason = self.reason[v].expect("There should be a reason clause for this variable");
287+
let reason = self.reason[v];
290288
self.undo(v);
291289
break Some((Lit::new(v, sign), reason));
292290
}
@@ -302,7 +300,7 @@ impl Engine {
302300
}
303301

304302
// 4. Update clause to the reason of the variable we just resolved away
305-
clause = p.expect("There should be a reason clause for this variable").1;
303+
clause = p.expect("There should be a reason clause for this variable").1.expect("There should be a reason clause for this variable");
306304
}
307305

308306
// 5. Final cleanup - undo all assignments made at this level

0 commit comments

Comments
 (0)