fix rare race in solution reporting

This commit is contained in:
Laurent Perron
2020-11-20 16:15:52 +01:00
parent 48efb8add6
commit c25be42578

View File

@@ -801,6 +801,12 @@ SatSolver::Status SolveIntegerProblem(Model* model) {
// No decision means that we reached a leave of the search tree and that
// we have a feasible solution.
//
// Tricky: If the time limit is reached during the final propagation when
// all variables are fixed, there is no guarantee that the propagation
// responsible for testing the validity of the solution was run to
// completion. So we cannot report a feasible solution.
if (time_limit->LimitReached()) return SatSolver::LIMIT_REACHED;
if (decision == kNoLiteralIndex) {
// Save the current polarity of all Booleans in the solution. It will be
// followed for the next SAT decisions. This is known to be a good policy