fix comment; add a bit more propagation

This commit is contained in:
Laurent Perron
2019-05-27 17:48:41 +02:00
parent 49365c4f4b
commit a3ce68b41d

View File

@@ -93,7 +93,8 @@ SAMPLE_SHIFTS = [
def bus_driver_scheduling(minimize_drivers, max_num_drivers):
"""Optimize the bus driver scheduling problem.
This model has to modes.
This model has two modes.
If minimize_drivers == True, the objective will be to find the minimal
number of drivers, independently of the working times of each drivers.
@@ -214,6 +215,12 @@ def bus_driver_scheduling(minimize_drivers, max_num_drivers):
visit_node.Not())
arcs.append([s + 1, s + 1, visit_node.Not()])
# Node performed:
# - add upper bound on start_time
# - add lower bound on end_times
model.Add(start_times[d] <= shift[3]).OnlyEnforceIf(visit_node)
model.Add(end_times[d] >= shift[4]).OnlyEnforceIf(visit_node)
for o in range(num_shifts):
other = SAMPLE_SHIFTS[o]
delay = other[3] - shift[4]