Shipment shipment2 = Shipment.Builder.newInstance("s2").addSizeDimension(0,5).setPickupLocationId("pick").setDeliveryLocationId("del").build();
shipmentProblemBuilder.addJob(shipment1).addJob(shipment2).build();
final VehicleRoutingProblem shipmentProblem = shipmentProblemBuilder.build();
VehicleRoute.Builder serviceRouteBuilder = VehicleRoute.Builder.newInstance(vehicle);
serviceRouteBuilder.setJobActivityFactory(new JobActivityFactory() {
@Override
public List<AbstractActivity> createActivities(Job job) {
return serviceProblem.copyAndGetActivities(job);
}
});
serviceRoute = serviceRouteBuilder.addService(s1).addService(s2).build();
VehicleRoute.Builder pdRouteBuilder = VehicleRoute.Builder.newInstance(vehicle);
pdRouteBuilder.setJobActivityFactory(new JobActivityFactory() {
@Override
public List<AbstractActivity> createActivities(Job job) {
return pdProblem.copyAndGetActivities(job);
}
});
pickup_delivery_route = pdRouteBuilder.addService(pickup).addService(delivery).build();
VehicleRoute.Builder shipmentRouteBuilder = VehicleRoute.Builder.newInstance(vehicle);
shipmentRouteBuilder.setJobActivityFactory(new JobActivityFactory() {
@Override
public List<AbstractActivity> createActivities(Job job) {
return shipmentProblem.copyAndGetActivities(job);
}
});