[CP-SAT] improve deterministic search code

This commit is contained in:
Laurent Perron
2022-11-04 19:57:21 +01:00
parent ab2fb2305a
commit 5bffac511e
2 changed files with 5 additions and 2 deletions

View File

@@ -393,6 +393,7 @@ void SharedResponseManager::Synchronize() {
IntegerValue(inner_objective_lower_bound_);
synchronized_inner_objective_upper_bound_ =
IntegerValue(inner_objective_upper_bound_);
synchronized_best_status_ = best_status_;
}
IntegerValue SharedResponseManager::SynchronizedInnerObjectiveLowerBound() {
@@ -693,8 +694,8 @@ void SharedResponseManager::NewSolution(
bool SharedResponseManager::ProblemIsSolved() const {
absl::MutexLock mutex_lock(&mutex_);
return best_status_ == CpSolverStatus::OPTIMAL ||
best_status_ == CpSolverStatus::INFEASIBLE;
return synchronized_best_status_ == CpSolverStatus::OPTIMAL ||
synchronized_best_status_ == CpSolverStatus::INFEASIBLE;
}
std::string ExtractSubSolverName(const std::string& improvement_info) {

View File

@@ -368,6 +368,8 @@ class SharedResponseManager {
double relative_gap_limit_ ABSL_GUARDED_BY(mutex_) = 0.0;
CpSolverStatus best_status_ ABSL_GUARDED_BY(mutex_) = CpSolverStatus::UNKNOWN;
CpSolverStatus synchronized_best_status_ ABSL_GUARDED_BY(mutex_) =
CpSolverStatus::UNKNOWN;
std::vector<int> unsat_cores_ ABSL_GUARDED_BY(mutex_);
SharedSolutionRepository<int64_t> solutions_ ABSL_GUARDED_BY(mutex_);