如何在jsprit中添加时间限制? [英] How to add time constraints in jsprit?
问题描述
setTimeWindow(new TimeWindow(start_time,end_time))
setTimeWindow(new TimeWindow(start_time, end_time))
用于为任务/装运添加时间限制.但我想举一个完整的例子. 是否有按时装运的jsprit的完整示例?
Is used to add time constraints for a task/shipment. But I want to have a complete example. Is there any complete example of jsprit on time bound shipment?
推荐答案
您可以通过以下方式设置货物的取件和交货时间窗口:
You can set pickup and delivery time windows of shipments this way:
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();
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();
这篇关于如何在jsprit中添加时间限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!