Skip to content

Commit

Permalink
Workaround an issue where Cadical might backtrack to an unknown level
Browse files Browse the repository at this point in the history
This happens when Cadical uses the vivify in-processing techniques
  • Loading branch information
Dekker1 committed Aug 6, 2024
1 parent 38bb407 commit 7d64824
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/huub/src/solver/engine/trail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

use index_vec::IndexVec;
use pindakaas::{Lit as RawLit, Var as RawVar};
use tracing::{debug, trace};
use tracing::{debug, trace, warn};

use crate::{actions::trailing::TrailingActions, IntVal};

Expand Down Expand Up @@ -163,6 +163,16 @@ impl Trail {
self.prev_len.push(self.trail.len());
}
pub(crate) fn notify_backtrack(&mut self, level: usize) {
// TODO: this is a fix for an issue in the Cadical implementation of the IPASIR UP interface: https://github.com/arminbiere/cadical/issues/92
if level >= self.prev_len.len() {
warn!(
current = self.prev_len.len(),
requested = level,
"backtrack to unknown level"
);
return;
}

let len = self.prev_len[level];
self.prev_len.truncate(level);
debug_assert!(
Expand Down

0 comments on commit 7d64824

Please sign in to comment.