diff --git a/examples/dotnet/ShiftSchedulingSat.cs b/examples/dotnet/ShiftSchedulingSat.cs index 5068baf3ad..edf0926e6b 100644 --- a/examples/dotnet/ShiftSchedulingSat.cs +++ b/examples/dotnet/ShiftSchedulingSat.cs @@ -563,7 +563,7 @@ public class ObjectiveSolutionPrinter : CpSolverSolutionCallback var objectiveBound = BestObjectiveBound(); var time = currentTime - _startTime; - Console.WriteLine($"Solution {_solutionCount}, time = {time.TotalSeconds} s, objective = [{objective}, {objectiveBound}]"); + Console.WriteLine($"Solution {_solutionCount}, time = {time.TotalSeconds} s, objective = [{objectiveBound}, {objective}]"); _solutionCount++; } diff --git a/ortools/sat/python/cp_model.py b/ortools/sat/python/cp_model.py index fec3396d72..7fa39455a2 100644 --- a/ortools/sat/python/cp_model.py +++ b/ortools/sat/python/cp_model.py @@ -1556,7 +1556,10 @@ class ObjectiveSolutionPrinter(CpSolverSolutionCallback): """Called on each new solution.""" current_time = time.time() objective = self.ObjectiveValue() + best_bound = self.BestObjectiveBound() + obj_lb = min(objective, best_bound) + obj_ub = max(objective, best_bound) print('Solution %i, time = %f s, objective = [%i, %i]' % (self.__solution_count, current_time - self.__start_time, - objective, self.BestObjectiveBound())) + obj_lb, obj_ub)) self.__solution_count += 1