如何在Google或工具vrptw中设置时间窗口?

时间:2020-06-11 06:03:41

标签: or-tools

我正在用Python解决VRPTW

这是从我的坐标获得的我的时间矩阵:

SELECT COUNT(DISTINCT users2.hwid) 
  FROM users AS users2
       INNER JOIN
       ips AS ips3 ON ips3.hwid = users2.hwid
 WHERE ips3.character_name = (
                                 SELECT ips.character_name
                                   FROM users,
                                        ips AS ips2
                                        INNER JOIN
                                        ips ON ips.hwid = users.hwid
                                  WHERE ips.character_name != '' AND 
                                        ips.locale = ips2.locale AND 
                                        (ips.hwid = '$HWID' OR 
                                         ips.ip = '$IP') 
                             )
OR 
       (ips3.hwid = '$HWID' AND 
        users2.daysToUse = 3) OR 
       (ips3.ip = '$IP' AND 
        users2.daysToUse = 3);

0 0 1130 1206 635 1072 977 1 1142 0 242 537 608 253 2 1225 156 0 658 645 409 3808781856 0 1014 588 4 1248 686 703 1012 0 720 5990441545545618426 0

如何为我的客户设置时间窗口。例如

软件仓库-时间窗口(4:30 AM至9:30 AM) 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)

  0     1     2     3     4    5

1 个答案:

答案 0 :(得分:0)

欢迎堆栈溢出! time_matrixtime_windows中的时间均未绑定到某个时间单位(例如分钟或小时)。因此,如果time_matrix中的值具有特定单位,则time_windows中的值应具有相同的值。

在您的示例中,您可以将挂钟时间缩放为time_matrix中相同的时间单位,从可能在仓库出发的第一个时间开始。请注意,求解器也希望该仓库也有时间限制。

我想您已经读过this OR-tools example,其中的示例误导性地将时间单位表示为“单位”和“分钟”。

我希望这会有所帮助!