Skip to content

Commit

Permalink
Initialize Clause::{rank|rank_old} correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
shnarazk committed Sep 21, 2024
1 parent a9744ff commit 5ebd423
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions src/cdb/clause.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ impl Default for Clause {
],
lits: vec![Lit::default(), Lit::default()],
flags: FlagClause::empty(),
rank: 0,
rank_old: 0,
rank: u32::MAX,
rank_old: u32::MAX,
search_from: 2,

#[cfg(any(feature = "boundary_check", feature = "clause_rewarding"))]
Expand Down Expand Up @@ -327,7 +327,10 @@ impl Clause {
cnt += 1;
}
}
self.rank = cnt;
cnt
if cnt < self.rank {
self.rank_old = self.rank;
self.rank = cnt;
}
self.rank
}
}
6 changes: 4 additions & 2 deletions src/cdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ impl ClauseDBIF for ClauseDB {
debug_assert_eq!(l1, self[ci].lits[1]);
}
self.clause[ci].search_from = 0;
self.clause[ci].rank_old = self[ci].rank;
self.lbd.update(self[ci].rank);
self.num_clause += 1;
if learnt {
Expand Down Expand Up @@ -1157,7 +1156,10 @@ impl ClauseWeaverIF for ClauseDB {
);
debug_assert_ne!(next, self.watch[FREE_LIT].next);
debug_assert_ne!(0, next.as_ci());
next.as_ci()
let ci = next.as_ci();
self.clause[ci].rank = u32::MAX;
self.clause[ci].rank_old = u32::MAX;
ci
}
}
// Check whether a zombi exists
Expand Down

0 comments on commit 5ebd423

Please sign in to comment.