diff --git a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java index edeaaacf..130c47b4 100644 --- a/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java +++ b/jsprit-core/src/main/java/jsprit/core/problem/VehicleRoutingProblem.java @@ -353,12 +353,12 @@ public class VehicleRoutingProblem { .setCapacityDimensions(v.getType().getCapacityDimensions()) .build(); PenaltyVehicleType penType = new PenaltyVehicleType(t,penaltyFactor); - String vehicleId = v.getId(); -// String vehicleId = "penaltyVehicle_" + new VehicleTypeKey(v.getType().getTypeId(),v.getStartLocationId(),v.getEndLocationId(),v.getEarliestDeparture(),v.getLatestArrival()).toString(); - Vehicle penVehicle = VehicleImpl.Builder.newInstance(vehicleId).setEarliestStart(v.getEarliestDeparture()) - .setLatestArrival(v.getLatestArrival()).setStartLocationCoordinate(v.getStartLocationCoordinate()).setStartLocationId(v.getStartLocationId()) - .setEndLocationId(v.getEndLocationId()).setEndLocationCoordinate(v.getEndLocationCoordinate()) - .setReturnToDepot(v.isReturnToDepot()).setType(penType).build(); + Vehicle penVehicle = VehicleImpl.copyAndCreateVehicleWithNewType(v, penType); +// String vehicleId = v.getId(); +// Vehicle penVehicle = VehicleImpl.Builder.newInstance(vehicleId).setEarliestStart(v.getEarliestDeparture()) +// .setLatestArrival(v.getLatestArrival()).setStartLocationCoordinate(v.getStartLocationCoordinate()).setStartLocationId(v.getStartLocationId()) +// .setEndLocationId(v.getEndLocationId()).setEndLocationCoordinate(v.getEndLocationCoordinate()) +// .setReturnToDepot(v.isReturnToDepot()).setType(penType).build(); addVehicle(penVehicle); } }