[CP-SAT] fix scheduling bug

This commit is contained in:
Laurent Perron
2022-05-31 16:25:10 +02:00
parent 1deadc71d7
commit 1ae8b9891b

View File

@@ -168,6 +168,15 @@ std::function<void(Model*)> Cumulative(
// precedence graph, not just task in direct precedence. Make sure not to
// create to many such constraints though.
if (parameters.use_hard_precedences_in_cumulative_constraint()) {
// The CumulativeIsAfterSubsetConstraint() always reset the helper to the
// forward time direction, so it is important to also precompute the
// precedence relation using the same direction! This is needed in case
// the helper has already been used and set in the other direction.
if (!helper->SynchronizeAndSetTimeDirection(true)) {
model->GetOrCreate<SatSolver>()->NotifyThatModelIsUnsat();
return;
}
std::vector<IntegerVariable> index_to_end_vars;
std::vector<int> index_to_task;
std::vector<PrecedencesPropagator::IntegerPrecedences> before;