public Builder addDeliveryTimeWindow(double earliest, double latest) { addDeliveryTimeWindow(TimeWindow.newInstance(earliest, latest)); return this; }
public Builder<T> addTimeWindow(double earliest, double latest) { return addTimeWindow(TimeWindow.newInstance(earliest, latest)); }
public Builder addPickupTimeWindow(double earliest, double latest) { return addPickupTimeWindow(TimeWindow.newInstance(earliest, latest)); }
Builder(String id) { if (id == null) throw new IllegalArgumentException("id must not be null"); this.id = id; pickupTimeWindows = new TimeWindowsImpl(); pickupTimeWindows.add(TimeWindow.newInstance(0.0, Double.MAX_VALUE)); deliveryTimeWindows = new TimeWindowsImpl(); deliveryTimeWindows.add(TimeWindow.newInstance(0.0, Double.MAX_VALUE)); }
Builder(String id){ this.id = id; timeWindows = new TimeWindowsImpl(); timeWindows.add(TimeWindow.newInstance(0.0, Double.MAX_VALUE)); }
private void buildShipments() { Integer counter = 0; for (Relation rel : relations) { counter++; String from = rel.from; String to = rel.to; int demand = rel.demand; Shipment s = Shipment.Builder.newInstance(counter.toString()).addSizeDimension(0, demand) .setPickupLocation(Location.Builder.newInstance().setCoordinate(customers.get(from).coord).build()).setPickupServiceTime(customers.get(from).serviceTime) .setPickupTimeWindow(TimeWindow.newInstance(customers.get(from).start, customers.get(from).end)) .setDeliveryLocation(Location.Builder.newInstance().setCoordinate(customers.get(to).coord).build()).setDeliveryServiceTime(customers.get(to).serviceTime) .setDeliveryTimeWindow(TimeWindow.newInstance(customers.get(to).start, customers.get(to).end)).build(); vrpBuilder.addJob(s); } }
} else { Service s = Service.Builder.newInstance("" + nodeIndex).setLocation(Location.newInstance(nodeIndex)) .setTimeWindow(TimeWindow.newInstance(Double.parseDouble(twTokens[0]), Double.parseDouble(twTokens[1]))).build(); builder.addJob(s);
Service service = Service.Builder.newInstance("" + (counter - 10)).addSizeDimension(0, demand) .setLocation(Location.Builder.newInstance().setCoordinate(coord).setId(customerId).build()).setServiceTime(serviceTime) .setTimeWindow(TimeWindow.newInstance(start, end)).build(); vrpBuilder.addJob(service);
Service service = Service.Builder.newInstance(customerId).addSizeDimension(0, demand) .setLocation(Location.Builder.newInstance().setCoordinate(coord).setId(customerId).build()).setServiceTime(serviceTime) .setTimeWindow(TimeWindow.newInstance(start, end)).build(); vrpBuilder.addJob(service);
if (!deliveryTWConfigs.isEmpty()) { for (HierarchicalConfiguration twConfig : deliveryTWConfigs) { builder.addTimeWindow(TimeWindow.newInstance(twConfig.getDouble("start"), twConfig.getDouble("end")));
if (!pickupTWConfigs.isEmpty()) { for (HierarchicalConfiguration pu_twConfig : pickupTWConfigs) { builder.addPickupTimeWindow(TimeWindow.newInstance(pu_twConfig.getDouble("start"), pu_twConfig.getDouble("end"))); if (!deliveryTWConfigs.isEmpty()) { for (HierarchicalConfiguration dl_twConfig : deliveryTWConfigs) { builder.addDeliveryTimeWindow(TimeWindow.newInstance(dl_twConfig.getDouble("start"), dl_twConfig.getDouble("end")));
current_break.setServiceTime(Double.parseDouble(breakDurationString)); for (HierarchicalConfiguration twConfig : breakTWConfigs) { current_break.addTimeWindow(TimeWindow.newInstance(twConfig.getDouble("start"), twConfig.getDouble("end")));
public Builder addDeliveryTimeWindow(double earliest, double latest) { addDeliveryTimeWindow(TimeWindow.newInstance(earliest, latest)); return this; }
public Builder<T> addTimeWindow(double earliest, double latest) { return addTimeWindow(TimeWindow.newInstance(earliest, latest)); }
public Builder addPickupTimeWindow(double earliest, double latest) { return addPickupTimeWindow(TimeWindow.newInstance(earliest, latest)); }
vehicleBuilder.setStartLocation(Location.newInstance(10, 10)); Break myFirstBreak = Break.Builder.newInstance("myFirstBreak") .setTimeWindow(TimeWindow.newInstance(10, 15)).setServiceTime(100).build(); vehicleBuilder.setBreak(myFirstBreak); vehicleBuilder.setType(vehicleType); .setBreak((Break) Break.Builder.newInstance("mySecondBreak").setTimeWindow(TimeWindow.newInstance(5, 10)).setServiceTime(10).build()).build();
/** * Creates (jsprit) {@link Shipment} from a (MATSim) {@link CarrierShipment} * * @param carrierShipment to be transformed to jsprit * @return Shipment * @see CarrierShipment, Shipment */ static Shipment createShipment (CarrierShipment carrierShipment) { return Shipment.Builder.newInstance(carrierShipment.getId().toString()) .setDeliveryLocation(Location.newInstance(carrierShipment.getTo().toString())) .setDeliveryServiceTime(carrierShipment.getDeliveryServiceTime()) .setDeliveryTimeWindow(com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow.newInstance(carrierShipment.getDeliveryTimeWindow().getStart(), carrierShipment.getDeliveryTimeWindow().getEnd())) .setPickupServiceTime(carrierShipment.getPickupServiceTime()) .setPickupLocation(Location.newInstance(carrierShipment.getFrom().toString())) .setPickupTimeWindow(com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow.newInstance(carrierShipment.getPickupTimeWindow().getStart(), carrierShipment.getPickupTimeWindow().getEnd())) .addSizeDimension(0, carrierShipment.getSize()) .build(); }
static Service createService(CarrierService carrierService, Coord locationCoord) { Location.Builder locationBuilder = Location.Builder.newInstance(); locationBuilder.setId(carrierService.getLocationLinkId().toString()); if(locationCoord != null) { locationBuilder.setCoordinate(Coordinate.newInstance(locationCoord.getX(), locationCoord.getY())); } Location location = locationBuilder.build(); Builder serviceBuilder = Service.Builder.newInstance(carrierService.getId().toString()); serviceBuilder.addSizeDimension(0, carrierService.getCapacityDemand()); serviceBuilder.setLocation(location).setServiceTime(carrierService.getServiceDuration()) .setTimeWindow(com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow.newInstance(carrierService.getServiceStartTimeWindow().getStart(), carrierService.getServiceStartTimeWindow().getEnd())); return serviceBuilder.build(); }
if (!deliveryTWConfigs.isEmpty()) { for (HierarchicalConfiguration twConfig : deliveryTWConfigs) { builder.addTimeWindow(TimeWindow.newInstance(twConfig.getDouble("start"), twConfig.getDouble("end")));
static Shipment createShipment(CarrierShipment carrierShipment, Coord fromCoord, Coord toCoord) { Location.Builder fromLocationBuilder = Location.Builder.newInstance(); fromLocationBuilder.setId(carrierShipment.getFrom().toString()); if(fromCoord != null) { fromLocationBuilder.setCoordinate(Coordinate.newInstance(fromCoord.getX(), fromCoord.getY())); } Location fromLocation = fromLocationBuilder.build(); Location.Builder toLocationBuilder = Location.Builder.newInstance(); toLocationBuilder.setId(carrierShipment.getTo().toString()); if(toCoord != null) { toLocationBuilder.setCoordinate(Coordinate.newInstance(toCoord.getX(), toCoord.getY())); } Location toLocation = toLocationBuilder.build(); return Shipment.Builder.newInstance(carrierShipment.getId().toString()) .setDeliveryLocation(toLocation) .setDeliveryServiceTime(carrierShipment.getDeliveryServiceTime()) .setDeliveryTimeWindow(com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow.newInstance(carrierShipment.getDeliveryTimeWindow().getStart(), carrierShipment.getDeliveryTimeWindow().getEnd())) .setPickupServiceTime(carrierShipment.getPickupServiceTime()) .setPickupLocation(fromLocation) .setPickupTimeWindow(com.graphhopper.jsprit.core.problem.solution.route.activity.TimeWindow.newInstance(carrierShipment.getPickupTimeWindow().getStart(), carrierShipment.getPickupTimeWindow().getEnd())) .addSizeDimension(0, carrierShipment.getSize()) .build(); }