sat: Update minimal jobshop sample

This commit is contained in:
Corentin Le Molgat
2021-10-18 14:23:50 +02:00
parent aa387f20fb
commit ab24ec1a62
3 changed files with 5 additions and 5 deletions

View File

@@ -205,7 +205,7 @@ public class MinimalJobshopSat {
System.out.printf("Optimal Schedule Length: %f%n", solver.objectiveValue());
System.out.printf(output);
} else {
System.out.println("No optimal solution found !");
System.out.println("No solution found.");
}
// [END print_solution]

View File

@@ -129,7 +129,7 @@ void MinimalJobshopSat() {
// [END solve]
// [START print_solution]
if (response.status() == CpSolverStatus::OPTIMAL) {
if (response.status() == CpSolverStatus::OPTIMAL || response.status() == CpSolverStatus::FEASIBLE) {
LOG(INFO) << "Solution:";
// create one list of assigned tasks per machine.
struct AssignedTaskType {
@@ -188,7 +188,7 @@ void MinimalJobshopSat() {
LOG(INFO) << "Optimal Schedule Length: " << response.objective_value();
LOG(INFO) << "\n" << output;
} else {
LOG(INFO) << "No optimal solution found !";
LOG(INFO) << "No solution found.";
}
// [END print_solution]

View File

@@ -95,7 +95,7 @@ def main():
# [END solve]
# [START print_solution]
if status == cp_model.OPTIMAL:
if status == cp_model.OPTIMAL or status == cp_model.FEASIBLE:
print('Solution:')
# Create one list of assigned tasks per machine.
assigned_jobs = collections.defaultdict(list)
@@ -138,7 +138,7 @@ def main():
print(f'Optimal Schedule Length: {solver.ObjectiveValue()}')
print(output)
else:
print('No optimal solution found !')
print('No solution found.')
# [END print_solution]
# Statistics.