diff --git a/src/internal/partial_solution.rs b/src/internal/partial_solution.rs index ef2cb17e..1f605685 100644 --- a/src/internal/partial_solution.rs +++ b/src/internal/partial_solution.rs @@ -521,6 +521,18 @@ impl PartialSolution { pub(crate) fn current_decision_level(&self) -> DecisionLevel { self.current_decision_level } + + /// Retrieve the constraints on a package that will not change. + pub fn unchanging_term_for_package(&self, package: &DP::P) -> Option<&Term> { + let pa = self.package_assignments.get(package)?; + + let idx_newer = pa + .dated_derivations + .as_slice() + .partition_point(|dd| dd.decision_level <= DecisionLevel(1)); + let idx = idx_newer.checked_sub(1)?; + Some(&pa.dated_derivations[idx].accumulated_intersection) + } } impl PackageAssignments {