如何在jsprit中添加时间限制?

How to add time constraints in jsprit?

setTimeWindow(new TimeWindow(start_time, end_time))

用于为task/shipment添加时间约束。但我想有一个完整的例子。 有jsprit on time bound shipment的完整例子吗?

您可以这样设置货件的取件和送货时间windows:

Shipment shipment = Shipment.Builder.newInstance("1") .addSizeDimension(0,1) .setPickupLocation(Location.newInstance(5,7)) .setPickupTimeWindow(TimeWindow.newInstance(0,1200)) .setDeliveryLocation(Location.newInstance(6,9)) .setDeliveryTimeWindow(TimeWindow.newInstance(2000,4000)) .build();