Hi,
I am testing with the break feature again and have encountered the following issue.
The small vrp is defined at the end of the post. Basically I have one vehicle with time window 0~10 and two services with no time window and each with service time 5. The vehicle has a break with time window 5~5 and service time 1. Thus, obviously the vehicle is not able to do both services and take the break because that will break the time window constraint of the vehicle. What I expect is that the vehicle does one service and stops with no break. However, to my surprise, the solution is that the vehicle does two services and stops with no break.
Is this a bug, or do I have any misunderstanding with break?
Best regards,
He
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type")
.build();
VehicleImpl v1 = VehicleImpl.Builder.newInstance("v1")
.setType(type)
.setReturnToDepot(true)
.setStartLocation(Location.newInstance(0, 0))
.setEarliestStart(0)
.setLatestArrival(10)
.setBreak(
Break.Builder.newInstance("break")
.setServiceTime(1)
.addTimeWindow(5, 5)
.build()
)
.build();
Service s1 = Service.Builder.newInstance("s1").setLocation(Location.newInstance(0, 0))
.setServiceTime(5)
.build();
Service s2 = Service.Builder.newInstance("s2").setLocation(Location.newInstance(0, 0))
.setServiceTime(5)
.build();
VehicleRoutingProblem vrp = VehicleRoutingProblem.Builder.newInstance()
.addJob(s1).addJob(s2)
.addVehicle(v1)
.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE)
.build();
VehicleRoutingAlgorithm algorithm = Jsprit.Builder.newInstance(vrp).buildAlgorithm();
VehicleRoutingProblemSolution s = Solutions.bestOf(algorithm.searchSolutions());
SolutionPrinter.print(vrp, s, SolutionPrinter.Print.VERBOSE);