From 435a75cfd567aebe186d81e5705f2b1e48386347 Mon Sep 17 00:00:00 2001 From: Mizux Seiha Date: Tue, 6 Apr 2021 15:50:52 +0200 Subject: [PATCH] bazel: Fix rabbits and pheasants test --- .../constraint_solver/samples/rabbits_and_pheasants_cp.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ortools/constraint_solver/samples/rabbits_and_pheasants_cp.cc b/ortools/constraint_solver/samples/rabbits_and_pheasants_cp.cc index d0c6ade9ea..e559b9e555 100644 --- a/ortools/constraint_solver/samples/rabbits_and_pheasants_cp.cc +++ b/ortools/constraint_solver/samples/rabbits_and_pheasants_cp.cc @@ -40,18 +40,15 @@ void RunConstraintProgrammingExample() { solver.MakePhase(rabbits, pheasants, Solver::CHOOSE_FIRST_UNBOUND, Solver::ASSIGN_MIN_VALUE); - bool has_result = solver.Solve(db); - // Check that the problem has a solution. - if (has_result != true) { - LOG(FATAL) << "The problem does not have a solution!"; - } int count = 0; + solver.NewSearch(db); while (solver.NextSolution()) { count++; LOG(INFO) << "Solution " << count << ":"; LOG(INFO) << "rabbits = " << rabbits->Value(); LOG(INFO) << "pheasants = " << rabbits->Value(); } + solver.EndSearch(); LOG(INFO) << "Number of solutions: " << count; LOG(INFO) << ""; LOG(INFO) << "Advanced usage:";