Combine soft Time windows with hard Time Windows in pickups and deliveries #2492
-
|
Hi everyone, I'm currently working in a pickup and deliveries problem with time windows, and I want to have hard time windows constraints for the pickups, so the vehicle doesn't visit the pickup node before the store opens, and soft time windows for the delivery nodes. I'm using this code to model this, but it seems to be not working, as the vehicles are visiting the pickups node before the time windows defined for the pickups. for location_idx, time_window in enumerate(time_windows):
if location_idx in [data['depot']]:
continue
elif location_idx in deliveries:
index = manager.NodeToIndex(location_idx)
print(index)
time_dimension.SetCumulVarSoftLowerBound(index, time_windows[index][0], 10000000)
time_dimension.SetCumulVarSoftUpperBound(index, time_windows[index][1], 10000000)
elif location_idx in pickups:
index = manager.NodeToIndex(location_idx)
time_dimension.CumulVar(index).SetRange(time_windows[index][0], time_windows[index][1])Any suggestions of how to model this? I would appreciate any help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
simply replace i.e. don't use |
Beta Was this translation helpful? Give feedback.
simply replace
time_windows[index]bytime_window(ed prefered) ORtime_windows[location_idx].i.e. don't use
indexfor your own time_windows object...