Duplicate break ids

jsprit currently does not forbid duplicate break ids, i.e., it does not throw error when multiple vehicles have breaks with the same id.

however, if multiple vehicles have breaks with the same id but different break service times, they will get to have the same service time. see the example at the end of the post. both vehicles have a break with the same id, but different service time (1 for v1 break and 3 for v2 break). in the end, both breaks will have a service time of 3. on the other hand, break time windows will not become the same.

Best regards,
He

    VehicleTypeImpl type = VehicleTypeImpl.Builder.newInstance("type")
        .build();
    VehicleImpl v1 = VehicleImpl.Builder.newInstance("v1")
        .setType(type)
        .setReturnToDepot(false)
        .setStartLocation(Location.newInstance(0, 0))
        .setEarliestStart(10)
        .setLatestArrival(20)
        .setBreak(
            Break.Builder.newInstance("break")
                .setServiceTime(1)
                .addTimeWindow(10, 10)
                .build()
        )
        .build();
    VehicleImpl v2 = VehicleImpl.Builder.newInstance("v2")
        .setType(type)
        .setReturnToDepot(false)
        .setStartLocation(Location.newInstance(0, 0))
        .setEarliestStart(10)
        .setLatestArrival(20)
        .setBreak(
            Break.Builder.newInstance("break")
                .setServiceTime(3)
                .addTimeWindow(11, 11)
                .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).addVehicle(v2)
        .setFleetSize(VehicleRoutingProblem.FleetSize.FINITE)
        .build();

    VehicleRoutingAlgorithm algorithm = Jsprit.Builder.newInstance(vrp)
        .setProperty(Jsprit.Parameter.FAST_REGRET, "true")
        .buildAlgorithm();
    VehicleRoutingProblemSolution s = Solutions.bestOf(algorithm.searchSolutions());
    SolutionPrinter.print(vrp, s, SolutionPrinter.Print.VERBOSE);
1 Like