Hi
I have added scheduled breaks to my problem and while they do add ok and the breaks do finish at the right time (i.e start time + duration) they start at the wrong time - i.e. at the start of the shift.
Here is a short block of code used to set the break which is at 10am for 30minutes
Double breakStart = 36000; // 10am in seconds since start of day
Double breakDuration = 1800; // 30 minutes
Break sBreak = Break.Builder.newInstance(“Break-”+Double.toString(breakStart))
.setName(“Break”)
.addTimeWindow(breakStart, breakStart+180.0) // allow a 5 minute variance on start of break
.setServiceTime(breakDuration)
.build();
vehicleBuilder.setBreak(sBreak);
VehicleImpl vehicle = vehicleBuilder.build();
vrpBuilder.addVehicle(vehicle);
I also tried .setTimeWindow() in the code above but it made no difference.
Im sure it must be something simple I’m doing wrong but my hair is almost gone and I’m no further ahead
Here is the solution printout showing that the break finishes at the correct time but starts at the wrong time ala 08:30 which is the start of the shift.
| route | vehicle | activity | job | arrTime | endTime | costs
±--------±---------------------±----------------------±----------------±----------------±----------------±----------------+
| 1 | 352964050794131 | start | - | undef | 08:30 | 0 |
| 1 | 352964050794131 | break | Break-36000.0 | 08:30 | 10:30 | 0 |
| 1 | 352964050794131 | pickupShipment | 895_2 | 10:31 | 10:31 | 1466 |
| 1 | 352964050794131 | pickupShipment | 895_4 | 10:31 | 10:31 | 1466 |
| 1 | 352964050794131 | pickupShipment | 895_3 | 10:31 | 10:31 | 1466 |
| 1 | 352964050794131 | pickupShipment | 895_6 | 10:31 | 10:31 | 1466 |
| 1 | 352964050794131 | deliverShipment | 895_6 | 10:33 | 10:44 | 3487 |
| 1 | 352964050794131 | pickupShipment | 898_8 | 10:48 | 12:00 | 6117 |
| 1 | 352964050794131 | pickupShipment | 898_9 | 12:00 | 12:00 | 6117 |
| 1 | 352964050794131 | deliverShipment | 898_9 | 12:03 | 12:13 | 8778 |
| 1 | 352964050794131 | deliverShipment | 895_3 | 12:17 | 12:27 | 12529 |
| 1 | 352964050794131 | deliverShipment | 895_4 | 12:49 | 13:01 | 32493 |
| 1 | 352964050794131 | deliverShipment | 895_2 | 13:43 | 13:58 | 59691 |
| 1 | 352964050794131 | deliverShipment | 898_8 | 13:58 | 14:08 | 59691 |
| 1 | 352964050794131 | end | - | 14:08 | undef | 59691 |
±-------------------------------------------------------------------------------------------------------------------------------+