How to add time constraints in jsprit?

534 views Asked by At

setTimeWindow(new TimeWindow(start_time, end_time))

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?

1

There are 1 answers

1
Stefan Schröder On BEST ANSWER

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();