我是“车辆路线问题”的新手。我正在浏览https://developers.google.com/optimization/routing/cvrptw上的教程。对于我的用例,我创建了以下数据模型
def create_data_model():
"""Stores the data for the problem."""
data = {}
#Obtained from Google Maps Distance Matrix API - Duration Value in Mins
data['time_matrix'] = [
[0, 15, 22, 16, 14],
[14, 0, 15, 7, 7],
[23, 17, 0, 14, 19],
[14, 7, 14, 0, 10],
[13, 7, 17, 10, 0]
]
#Dummy Data
data['time_windows'] = [
(0, 100), #Depot
(25, 70), #Loc1
(25, 60), #Loc2
(80, 120),#Loc3
(0, 60), #Loc4
]
data['num_vehicles'] = 1
data['depot'] = 0
return data
我的时间维度是:
time = 'Time'
routing.AddDimension(
transit_callback_index,
30, # allow waiting time
100, # maximum time per vehicle
False, # Don't force start cumul to zero.
time)
运行上面的程序时,我得到以下输出:
Route for vehicle 0: 0 Time(0,0) -> 4 Time(14,38) -> 1 Time(25,45) -> 2 Time(40,60) -> 3 Time(80,80) -> 0 Time(94,94) Time of the route: 94min
Total time of all routes: 94min
这里我有三个问题:
软件仓库-时间窗口(上午4:30至9:30)
Loc1-时间窗口(5:00 AM至9:00 AM)
Loc2-时间窗口(5:00 AM至7:00 AM)
Loc2-时间窗口(5:00 AM至7:00 AM)
Loc4-时间窗口(5:00 AM至6:00 AM)
谢谢!