Hi,
I am testing with the break feature and have encountered the following issue:
The small vrp is defined at the end of the post. Basically what I am trying to test is that, when both travel distance and waiting time impose cost, the vehicle with the break (v2) should take the route because the service time for the break does not have any cost and the total cost is 15. However the solution is that the other vehicle (v1) takes the route and the total cost is 20.
Interesting thing is that, if I change the start location of v1 from (6, 8) to (0, 0), it will not change the cost if v1 takes the route, but the solution will be that v2 takes the route.
Why is that? Am I missing something? Thanks in advance.
Best regards,
He
VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type")
.setCostPerWaitingTime(1)
.build();
VehicleImpl v1 = VehicleImpl.Builder.newInstance("v1")
.setType(type)
.setReturnToDepot(false)
.setStartLocation(Location.newInstance(6, 8))
.build();
VehicleImpl v2 = VehicleImpl.Builder.newInstance("v2")
.setType(type)
.setReturnToDepot(false)
.setStartLocation(Location.newInstance(0, 0))
.setBreak(
Break.Builder.newInstance("break")
.setServiceTime(5)
.addTimeWindow(10, 15)
.build()
)
.build();
Service s1 = Service.Builder.newInstance("s1").setLocation(Location.newInstance(6, 8)).build();
Service s2 = Service.Builder.newInstance("s2").setLocation(Location.newInstance(8, 6))
.addTimeWindow(20, 100)
.build();
VehicleRoutingProblem problem = VehicleRoutingProblem.Builder.newInstance()
.addJob(s1).addJob(s2)
.addVehicle(v1)
.addVehicle(v2)
.setFleetSize(VehicleRoutingProblem.FleetSize.FINITE)
.build();
Collection<VehicleRoutingProblemSolution> allSolutions = Jsprit.createAlgorithm(problem).searchSolutions();
VehicleRoutingProblemSolution solution = Solutions.bestOf(allSolutions);
SolutionPrinter.print(problem, solution, SolutionPrinter.Print.VERBOSE);