【发布时间】:2021-04-29 00:32:00
【问题描述】:
我正在尝试限制每辆车访问的最小位置,我已成功实施最大位置约束,但在确定最小位置时遇到问题。我的最大位置代码:
def counter_callback(from_index):
"""Returns 1 for any locations except depot."""
# Convert from routing variable Index to user NodeIndex.
from_node = manager.IndexToNode(from_index)
return 1 if (from_node != 0) else 0;
counter_callback_index = routing.RegisterUnaryTransitCallback(counter_callback)
routing.AddDimensionWithVehicleCapacity(
counter_callback_index,
0, # null slack
[16,16,16], # maximum locations per vehicle
True, # start cumul to zero
'Counter')
【问题讨论】:
标签: python constraint-programming or-tools vehicle-routing