private void setEndLocation(VehicleRoute route, Service service) { route.getEnd().setLocation(service.getLocation()); }
private void setEndLocation(VehicleRoute route, Shipment shipment) { route.getEnd().setLocation(shipment.getDeliveryLocation()); }
private void setRouteEndToLastActivity(VehicleRoute route) { if (!route.getActivities().isEmpty()) { TourActivity lastAct = route.getActivities().get(route.getActivities().size() - 1); route.getEnd().setLocation(lastAct.getLocation()); } }
/** * Builds the route. * * @return {@link VehicleRoute} * @throws IllegalArgumentException if there are still shipments that have been picked up though but not delivery. */ public VehicleRoute build() { if (!openShipments.isEmpty()) { throw new IllegalArgumentException("there are still shipments that have not been delivered yet."); } if (!vehicle.isReturnToDepot()) { if (!tourActivities.isEmpty()) { end.setLocation(tourActivities.getActivities().get(tourActivities.getActivities().size() - 1).getLocation()); } } return new VehicleRoute(this); }
@Override public void inform(Event event) { if (event instanceof InsertActivity) { InsertActivity insertActivity = (InsertActivity) event; if (!insertActivity.getNewVehicle().isReturnToDepot()) { if (insertActivity.getIndex() >= insertActivity.getVehicleRoute().getActivities().size()) { insertActivity.getVehicleRoute().getEnd().setLocation(insertActivity.getActivity().getLocation()); } } insertActivity.getVehicleRoute().getTourActivities().addActivity(insertActivity.getIndex(), ((InsertActivity) event).getActivity()); } }
private void setStartAndEnd(Vehicle vehicle, double vehicleDepTime) { if (!(vehicle instanceof VehicleImpl.NoVehicle)) { if (start == null && end == null) { start = new Start(vehicle.getStartLocation(), vehicle.getEarliestDeparture(), vehicle.getLatestArrival()); end = new End(vehicle.getEndLocation(), vehicle.getEarliestDeparture(), vehicle.getLatestArrival()); } start.setEndTime(Math.max(vehicleDepTime, vehicle.getEarliestDeparture())); start.setTheoreticalEarliestOperationStartTime(vehicle.getEarliestDeparture()); start.setTheoreticalLatestOperationStartTime(vehicle.getLatestArrival()); start.setLocation(vehicle.getStartLocation()); end.setLocation(vehicle.getEndLocation()); end.setTheoreticalEarliestOperationStartTime(vehicle.getEarliestDeparture()); end.setTheoreticalLatestOperationStartTime(vehicle.getLatestArrival()); } }
@Override public void inform(Event event) { if (event instanceof InsertBreak) { InsertBreak insertActivity = (InsertBreak) event; if (!insertActivity.getNewVehicle().isReturnToDepot()) { if (insertActivity.getIndex() >= insertActivity.getVehicleRoute().getActivities().size()) { insertActivity.getVehicleRoute().getEnd().setLocation(insertActivity.getActivity().getLocation()); } } VehicleRoute vehicleRoute = ((InsertBreak) event).getVehicleRoute(); if (!vehicleRoute.isEmpty()) { if (vehicleRoute.getVehicle() != ((InsertBreak) event).getNewVehicle()) { if (vehicleRoute.getVehicle().getBreak() != null) { boolean removed = vehicleRoute.getTourActivities().removeJob(vehicleRoute.getVehicle().getBreak()); if (removed) logger.trace("remove old break " + vehicleRoute.getVehicle().getBreak()); } } } insertActivity.getVehicleRoute().getTourActivities().addActivity(insertActivity.getIndex(), ((InsertBreak) event).getActivity()); } }
private void initialiseStartAndEnd(final Vehicle newVehicle, double newVehicleDepartureTime) { if (start == null) { start = new Start(newVehicle.getStartLocation(), newVehicle.getEarliestDeparture(), Double.MAX_VALUE); start.setEndTime(newVehicleDepartureTime); } else { start.setLocation(Location.newInstance(newVehicle.getStartLocation().getId())); start.setTheoreticalEarliestOperationStartTime(newVehicle.getEarliestDeparture()); start.setTheoreticalLatestOperationStartTime(Double.MAX_VALUE); start.setEndTime(newVehicleDepartureTime); } if (end == null) { end = new End(newVehicle.getEndLocation(), 0.0, newVehicle.getLatestArrival()); } else { end.setLocation(Location.newInstance(newVehicle.getEndLocation().getId())); end.setTheoreticalEarliestOperationStartTime(0.0); end.setTheoreticalLatestOperationStartTime(newVehicle.getLatestArrival()); } }
private void setEndLocation(VehicleRoute route, Shipment shipment) { route.getEnd().setLocation(shipment.getDeliveryLocation()); }
private void setEndLocation(VehicleRoute route, Service service) { route.getEnd().setLocation(service.getLocation()); }
private void setRouteEndToLastActivity(VehicleRoute route) { if (!route.getActivities().isEmpty()) { TourActivity lastAct = route.getActivities().get(route.getActivities().size() - 1); route.getEnd().setLocation(lastAct.getLocation()); } }
/** * Builds the route. * * @return {@link VehicleRoute} * @throws IllegalArgumentException if there are still shipments that have been picked up though but not delivery. */ public VehicleRoute build() { if (!openShipments.isEmpty()) { throw new IllegalArgumentException("there are still shipments that have not been delivered yet."); } if (!vehicle.isReturnToDepot()) { if (!tourActivities.isEmpty()) { end.setLocation(tourActivities.getActivities().get(tourActivities.getActivities().size() - 1).getLocation()); } } return new VehicleRoute(this); }
@Override public void inform(Event event) { if (event instanceof InsertActivity) { InsertActivity insertActivity = (InsertActivity) event; if (!insertActivity.getNewVehicle().isReturnToDepot()) { if (insertActivity.getIndex() >= insertActivity.getVehicleRoute().getActivities().size()) { insertActivity.getVehicleRoute().getEnd().setLocation(insertActivity.getActivity().getLocation()); } } insertActivity.getVehicleRoute().getTourActivities().addActivity(insertActivity.getIndex(), ((InsertActivity) event).getActivity()); } }
private void setStartAndEnd(Vehicle vehicle, double vehicleDepTime) { if (!(vehicle instanceof VehicleImpl.NoVehicle)) { if (start == null && end == null) { start = new Start(vehicle.getStartLocation(), vehicle.getEarliestDeparture(), vehicle.getLatestArrival()); end = new End(vehicle.getEndLocation(), vehicle.getEarliestDeparture(), vehicle.getLatestArrival()); } start.setEndTime(Math.max(vehicleDepTime, vehicle.getEarliestDeparture())); start.setTheoreticalEarliestOperationStartTime(vehicle.getEarliestDeparture()); start.setTheoreticalLatestOperationStartTime(vehicle.getLatestArrival()); start.setLocation(vehicle.getStartLocation()); end.setLocation(vehicle.getEndLocation()); end.setTheoreticalEarliestOperationStartTime(vehicle.getEarliestDeparture()); end.setTheoreticalLatestOperationStartTime(vehicle.getLatestArrival()); } }
@Override public void inform(Event event) { if (event instanceof InsertBreak) { InsertBreak insertActivity = (InsertBreak) event; if (!insertActivity.getNewVehicle().isReturnToDepot()) { if (insertActivity.getIndex() >= insertActivity.getVehicleRoute().getActivities().size()) { insertActivity.getVehicleRoute().getEnd().setLocation(insertActivity.getActivity().getLocation()); } } VehicleRoute vehicleRoute = ((InsertBreak) event).getVehicleRoute(); if (!vehicleRoute.isEmpty()) { if (vehicleRoute.getVehicle() != ((InsertBreak) event).getNewVehicle()) { if (vehicleRoute.getVehicle().getBreak() != null) { boolean removed = vehicleRoute.getTourActivities().removeJob(vehicleRoute.getVehicle().getBreak()); if (removed) logger.trace("remove old break " + vehicleRoute.getVehicle().getBreak()); } } } insertActivity.getVehicleRoute().getTourActivities().addActivity(insertActivity.getIndex(), ((InsertBreak) event).getActivity()); } }
private void initialiseStartAndEnd(final Vehicle newVehicle, double newVehicleDepartureTime) { if (start == null) { start = new Start(newVehicle.getStartLocation(), newVehicle.getEarliestDeparture(), Double.MAX_VALUE); start.setEndTime(newVehicleDepartureTime); } else { start.setLocation(Location.newInstance(newVehicle.getStartLocation().getId())); start.setTheoreticalEarliestOperationStartTime(newVehicle.getEarliestDeparture()); start.setTheoreticalLatestOperationStartTime(Double.MAX_VALUE); start.setEndTime(newVehicleDepartureTime); } if (end == null) { end = new End(newVehicle.getEndLocation(), 0.0, newVehicle.getLatestArrival()); } else { end.setLocation(Location.newInstance(newVehicle.getEndLocation().getId())); end.setTheoreticalEarliestOperationStartTime(0.0); end.setTheoreticalLatestOperationStartTime(newVehicle.getLatestArrival()); } }