From 78f458fd996e8e8e65063c86f470a34577d7577e Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Tue, 28 May 2019 00:04:21 +0200 Subject: [PATCH] add redundant constraint --- examples/python/bus_driver_scheduling_sat.py | 5 +++++ 1 file changed, 5 insertions(+) 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