private Builder addService(Service service) { // tentative_coordinates.put(service.getLocation().getId(), service.getLocation().getCoordinate()); addLocationToTentativeLocations(service); if (jobs.containsKey(service.getId())) { logger.warn("The service " + service + " has already been added to job list. This overrides existing job."); } jobs.put(service.getId(), service); return this; }
private void addJobsAndTheirLocationsToVrp() { for (Service service : serviceMap.values()) { if (!freezedJobIds.contains(service.getId())) { vrpBuilder.addJob(service); } } for (Shipment shipment : shipmentMap.values()) { if (!freezedJobIds.contains(shipment.getId())) { vrpBuilder.addJob(shipment); } } }
private void renderService(Graph g, Service service, Label label) { Node n = g.addNode(makeId(service.getId(), service.getLocation().getId())); if (label.equals(Label.ID)) n.addAttribute("ui.label", service.getId()); n.addAttribute("x", service.getLocation().getCoordinate().getX()); n.addAttribute("y", service.getLocation().getCoordinate().getY()); if (service.getType().equals("pickup")) n.setAttribute("ui.class", "pickup"); if (service.getType().equals("delivery")) n.setAttribute("ui.class", "delivery"); }
serviceMap.put(service.getId(), service);
private Builder addService(Service service) { // tentative_coordinates.put(service.getLocation().getId(), service.getLocation().getCoordinate()); addLocationToTentativeLocations(service); if (jobs.containsKey(service.getId())) { logger.warn("service " + service + " already in job list. overrides existing job."); } jobs.put(service.getId(), service); return this; }
private void addJob(Job job) { if (job instanceof Service) { Service service = (Service) job; addNode(service.getId(), service.getLocation().getCoordinate()); markService(service); } else if (job instanceof Shipment) { Shipment shipment = (Shipment) job; String fromNodeId = getFromNodeId(shipment); addNode(fromNodeId, shipment.getPickupLocation().getCoordinate()); String toNodeId = getToNodeId(shipment); addNode(toNodeId, shipment.getDeliveryLocation().getCoordinate()); markShipment(shipment); if (renderShipments) { Edge e = graph.addEdge("shipment_" + fromNodeId + "_" + toNodeId, fromNodeId, toNodeId, true); e.addAttribute("ui.class", "shipment"); } } }
private void addJobsAndTheirLocationsToVrp() { for (Service service : serviceMap.values()) { if (!freezedJobIds.contains(service.getId())) { vrpBuilder.addJob(service); } } for (Shipment shipment : shipmentMap.values()) { if (!freezedJobIds.contains(shipment.getId())) { vrpBuilder.addJob(shipment); } } }
Service.Builder skillServiceBuilder; if (service.getLocation().getCoordinate().getY() < 50.) { skillServiceBuilder = Service.Builder.newInstance(service.getId() + "_skill2").setServiceTime(service.getServiceDuration()) .setLocation(Location.Builder.newInstance().setId(service.getLocation().getId()) .setCoordinate(service.getLocation().getCoordinate()).build()).setTimeWindow(service.getTimeWindow()) skillServiceBuilder.addRequiredSkill("skill2"); } else { skillServiceBuilder = Service.Builder.newInstance(service.getId() + "_skill1").setServiceTime(service.getServiceDuration()) .setLocation( Location.Builder.newInstance().setId(service.getLocation().getId())
if (!(j instanceof Service)) continue; Service service = (Service) j; xmlConfig.setProperty(shipmentPathString + "(" + counter + ")[@id]", service.getId()); xmlConfig.setProperty(shipmentPathString + "(" + counter + ")[@type]", service.getType()); if (service.getLocation().getId() != null)
private void renderService(Graph g, Service service, Label label) { Node n = g.addNode(makeId(service.getId(), service.getLocation().getId())); if (label.equals(Label.ID)) n.addAttribute("ui.label", service.getId()); n.addAttribute("x", service.getLocation().getCoordinate().getX()); n.addAttribute("y", service.getLocation().getCoordinate().getY()); if (service.getType().equals("pickup")) n.setAttribute("ui.class", "pickup"); if (service.getType().equals("delivery")) n.setAttribute("ui.class", "delivery"); }
serviceMap.put(service.getId(), service);
static CarrierService createCarrierService(Service service) { CarrierService.Builder serviceBuilder = CarrierService.Builder.newInstance(Id.create(service.getId(), CarrierService.class), Id.create(service.getLocation().getId(), Link.class)); serviceBuilder.setCapacityDemand(service.getSize().get(0)); serviceBuilder.setServiceDuration(service.getServiceDuration()); serviceBuilder.setServiceStartTimeWindow(TimeWindow.newInstance(service.getTimeWindow().getStart(), service.getTimeWindow().getEnd())); return serviceBuilder.build(); }
/** * Creates (MATSim) CarrierShipment from a (jsprit) service * * @param service to be transformed to Shipment * @param depotLink as from-link for Shipment * @return CarrierShipment * @see CarrierShipment, Service */ static CarrierShipment createCarrierShipmentFromService(Service service, String depotLink){ return CarrierShipment.Builder.newInstance(Id.create(service.getId(), CarrierShipment.class), Id.create(depotLink, Link.class), Id.create(service.getLocation().getId(), Link.class), service.getSize().get(0)). setDeliveryServiceTime(service.getServiceDuration()). setDeliveryTimeWindow(TimeWindow.newInstance(service.getTimeWindow().getStart(),service.getTimeWindow().getEnd())).build(); }
private void addJob(Job job) { if (job instanceof Service) { Service service = (Service) job; addNode(service.getId(), service.getLocation().getCoordinate()); markService(service); } else if (job instanceof Shipment) { Shipment shipment = (Shipment) job; String fromNodeId = getFromNodeId(shipment); addNode(fromNodeId, shipment.getPickupLocation().getCoordinate()); String toNodeId = getToNodeId(shipment); addNode(toNodeId, shipment.getDeliveryLocation().getCoordinate()); markShipment(shipment); if (renderShipments) { Edge e = graph.addEdge("shipment_" + fromNodeId + "_" + toNodeId, fromNodeId, toNodeId, true); e.addAttribute("ui.class", "shipment"); } } }
if (!(j instanceof Service)) continue; Service service = (Service) j; xmlConfig.setProperty(shipmentPathString + "(" + counter + ")[@id]", service.getId()); xmlConfig.setProperty(shipmentPathString + "(" + counter + ")[@type]", service.getType()); if (service.getLocation().getId() != null)