Skip to content

Commit dcaa223

Browse files
committed
don't lookup step ids when the full proof is not being logged
1 parent 07e17c9 commit dcaa223

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pumpkin-solver/src/engine/conflict_analysis/resolvers/resolution_resolver.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ impl ResolutionResolver {
307307

308308
// Log all non-initial bounds to the proof.
309309
if dec_level == 0 && !is_completing_proof {
310-
if !assignments.is_initial_bound(predicate) {
310+
if !assignments.is_initial_bound(predicate) && proof_log.is_logging_inferences() {
311311
let trail_index = assignments
312312
.get_trail_position(&predicate)
313313
.expect("all predicates in reason are true");
@@ -317,7 +317,12 @@ impl ResolutionResolver {
317317
let step_id = unit_nogood_step_ids
318318
.get(&trail_entry.predicate)
319319
.copied()
320-
.unwrap();
320+
.unwrap_or_else(|| {
321+
panic!(
322+
"Failed to get step id for unit clause {:?}. Available steps: {:?}",
323+
trail_entry.predicate, unit_nogood_step_ids
324+
)
325+
});
321326
proof_log.add_propagation(step_id);
322327
}
323328

pumpkin-solver/src/engine/constraint_satisfaction_solver.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,10 @@ impl ConstraintSatisfactionSolver {
13391339
if let Some(step_id) = self.unit_nogood_step_ids.get(&trail_entry.predicate) {
13401340
self.internal_parameters.proof_log.add_propagation(*step_id);
13411341
} else {
1342-
unreachable!()
1342+
panic!(
1343+
"Failed to obtain step id for predicate {:?}. Available step ids: {:?}",
1344+
trail_entry.predicate, self.unit_nogood_step_ids,
1345+
);
13431346
}
13441347
}
13451348

@@ -1464,8 +1467,8 @@ impl ConstraintSatisfactionSolver {
14641467
)
14651468
.is_err()
14661469
{
1467-
self.log_root_propagation_to_proof(num_trail_entries, None);
14681470
self.prepare_for_conflict_resolution();
1471+
self.log_root_propagation_to_proof(num_trail_entries, None);
14691472
self.complete_proof();
14701473
return Err(ConstraintOperationError::InfeasibleNogood);
14711474
}

0 commit comments

Comments
 (0)