diff --git a/examples/python/bus_driver_scheduling_sat.py b/examples/python/bus_driver_scheduling_sat.py index df097d8c0d..390656d229 100644 --- a/examples/python/bus_driver_scheduling_sat.py +++ b/examples/python/bus_driver_scheduling_sat.py @@ -300,6 +300,11 @@ def bus_driver_scheduling(minimize_drivers, max_num_drivers): # Redundant constraints: sum of driving times = sum of shift driving times model.Add(sum(driving_times) == total_driving_time) + if not minimize_drivers: + model.Add( + sum(working_times) == total_driving_time + + num_drivers * (setup_time + cleanup_time) + + cp_model.LinearExpr.ScalProd(delay_literals, delay_weights)) if minimize_drivers: # Minimize the number of working drivers