I'm looking for a solution for VRPTW using google or- tools with vehicle working hours.
given any vehicle has it's own working hours. example: Vehicle A: 9am to 3pm Vehicle B: 8am to 4pm
I came up with below code
# times in seconds
data['working_time'] = [
(0, 600),
(0, 32400),
(0, 36000)
]
# add working times for each vehicle
for vehicle in range(duration_manager.GetNumberOfVehicles()):
start_index = duration_routing.Start(vehicle)
end_index = duration_routing.End(vehicle)
duration_dimension.CumulVar(start_index).SetRange(
data['working_time'][vehicle][0], data['working_time'][vehicle][1])
duration_dimension.CumulVar(end_index).SetRange(
data['working_time'][vehicle][0], data['working_time'][vehicle][1])
duration_routing.solver().Add(duration_dimension.CumulVar(end_index) - duration_dimension.CumulVar(start_index) <= duration_dimension.CumulVar(end_index))
this works fine but if I changed
data['working_time'] = [
(0, 600),
(0, 32400),
(3600, 36000) # start time change!!!
]
I'm getting
Exception: CP Solver fail
Please help