[MPSolver] Add better code to interrupt solve; rewrite thread management code when using the CP-SAT solver backend

This commit is contained in:
Laurent Perron
2021-09-23 14:30:01 +02:00
parent 604260959e
commit 778b1b3854
11 changed files with 158 additions and 66 deletions

View File

@@ -71,7 +71,6 @@ void IntegerProgrammingExample() {
// [END objective]
// [START solve]
solver->SetNumThreads(1);
const MPSolver::ResultStatus result_status = solver->Solve();
// Check that the problem has an optimal solution.
if (result_status != MPSolver::OPTIMAL) {

View File

@@ -64,7 +64,6 @@ def IntegerProgrammingExample():
# Solve the problem and print the solution.
# [START print_solution]
solver.SetNumThreads(1)
solver.Solve()
# Print the objective value of the solution.
print('Maximum objective function value = %d' % solver.Objective().Value())