congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TourActivity$JobActivity
Code IndexAdd Tabnine to your IDE (free)

How to use
TourActivity$JobActivity
in
com.graphhopper.jsprit.core.problem.solution.route.activity

Best Java code snippets using com.graphhopper.jsprit.core.problem.solution.route.activity.TourActivity$JobActivity (Showing top 20 results out of 315)

origin: graphhopper/jsprit

TourActivity act = seedRoute.getActivities().get(i);
if (act instanceof TourActivity.JobActivity) {
  Job job = ((TourActivity.JobActivity) act).getJob();
  if (vrp.getJobs().containsKey(job.getId())) {
    jobs2Remove.add(job);
origin: PGWelch/com.opendoorlogistics

if (JobActivity.class.isInstance(activity)) {
  JobActivity ja = (JobActivity) activity;
  List<StopDetail> stops = stopDetailsByJobId.get(ja.getJob().getId());
  if (stops != null) {
    for (StopDetail sd : stops) {
origin: PGWelch/com.opendoorlogistics

if (builtStop == null) {
  throw new RuntimeException("Could not identify stop with JSPRIT job id "
      + ((JobActivity) activity).getJob().getId());
origin: com.graphhopper/jsprit-core

TourActivity act = seedRoute.getActivities().get(i);
if (act instanceof TourActivity.JobActivity) {
  Job job = ((TourActivity.JobActivity) act).getJob();
  if (vrp.getJobs().containsKey(job.getId())) {
    jobs2Remove.add(job);
origin: com.graphhopper/jsprit-core

String jobId;
if (act instanceof TourActivity.JobActivity) {
  jobId = ((TourActivity.JobActivity) act).getJob().getId();
} else {
  jobId = "-";
origin: matsim-org/matsim

if(act instanceof ServiceActivity || act instanceof PickupService){
  log.debug("Found ServiceActivity or PickupService : " + act.getName() + " at location " +  act.getLocation().getId() + " : " + act.getLocation().getCoordinate() );
  Service job = (Service) ((JobActivity) act).getJob();				 
  CarrierService carrierService = createCarrierService(job);
  tourBuilder.addLeg(new Leg());
  Shipment job = (Shipment) ((JobActivity) act).getJob();
  CarrierShipment carrierShipment = createCarrierShipment(job); 
  tourBuilder.addLeg(new Leg());
  Shipment job = (Shipment) ((JobActivity) act).getJob();
  CarrierShipment carrierShipment = createCarrierShipment(job);
  tourBuilder.addLeg(new Leg());
origin: com.graphhopper/jsprit-core

  Job job = ((TourActivity.JobActivity) actToEval).getJob();
  if (!savingsMap.containsKey(job)) {
    savingsMap.put(job, savings);
Job job = ((TourActivity.JobActivity) actToEval).getJob();
if (!savingsMap.containsKey(job)) {
  savingsMap.put(job, savings);
origin: com.graphhopper/jsprit-io

xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ")[@type]", act.getName());
if (act instanceof TourActivity.JobActivity) {
  Job job = ((TourActivity.JobActivity) act).getJob();
  if (job instanceof Break) {
    xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act(" + actCounter + ").breakId", job.getId());
origin: com.graphhopper/jsprit-analysis

Job job = ((JobActivity) act).getJob();
String currIdentifier = makeId(job.getId(), act.getLocation().getId());
if (label.equals(Label.ACTIVITY)) {
origin: com.graphhopper/jsprit-core

TourActivity act = seedRoute.getActivities().get(i);
if (act instanceof TourActivity.JobActivity) {
  Job job = ((TourActivity.JobActivity) act).getJob();
  if (vrp.getJobs().containsKey(job.getId())) {
    jobs2Remove.add(job);
origin: com.graphhopper/jsprit-core

/**
 * Removes job AND belonging activity from tour. Note that if job is a Service, it is assumed that there is only one belonging activity,
 * thus, it stops trying to remove activities once the first is found.
 * If you want to always look for belonging activities to be removed in the entire route, use removeJob(Job job, boolean enforceEntireRoute)
 *
 * @param job to be removed
 * @return true if job has been removed, otherwise false.
 */
public boolean removeJob(Job job) {
  boolean jobRemoved = false;
  if (!jobs.contains(job)) {
    return false;
  } else {
    jobRemoved = jobs.remove(job);
  }
  boolean activityRemoved = false;
  Iterator<TourActivity> iterator = tourActivities.iterator();
  while (iterator.hasNext()) {
    TourActivity c = iterator.next();
    if (c instanceof JobActivity) {
      Job underlyingJob = ((JobActivity) c).getJob();
      if (job.equals(underlyingJob)) {
        iterator.remove();
        activityRemoved = true;
      }
    }
  }
  assert jobRemoved == activityRemoved : "job removed, but belonging activity not.";
  return activityRemoved;
}
origin: com.graphhopper/jsprit-core

Job job = null;
if (activity instanceof JobActivity) {
  job = ((JobActivity) activity).getJob();
  } else {
    if (act instanceof JobActivity && job != null) {
      if (((JobActivity) act).getJob().equals(job)) {
        jobIsAlsoAssociateToOtherActs = true;
origin: com.graphhopper/jsprit-io

xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ")[@type]", act.getName());
if (act instanceof TourActivity.JobActivity) {
  Job job = ((TourActivity.JobActivity) act).getJob();
  if (job instanceof Service) {
    xmlConfig.setProperty(path + "(" + routeCounter + ").act(" + actCounter + ").serviceId", job.getId());
origin: com.graphhopper/jsprit-core

/**
 * Adds an initial vehicle route.
 *
 * @param route initial route
 * @return the builder
 */
public Builder addInitialVehicleRoute(VehicleRoute route) {
  if(!addedVehicleIds.contains(route.getVehicle().getId())){
    addVehicle((AbstractVehicle) route.getVehicle());
    addedVehicleIds.add(route.getVehicle().getId());
  }
  for (TourActivity act : route.getActivities()) {
    AbstractActivity abstractAct = (AbstractActivity) act;
    abstractAct.setIndex(activityIndexCounter);
    incActivityIndexCounter();
    if (act instanceof TourActivity.JobActivity) {
      Job job = ((TourActivity.JobActivity) act).getJob();
      jobsInInitialRoutes.add(job.getId());
      addLocationToTentativeLocations(job);
      registerJobAndActivity(abstractAct, job);
    }
  }
  initialRoutes.add(route);
  return this;
}
origin: com.graphhopper/jsprit-analysis

private void handleVehicleSwitch(InsertionData data, VehicleRoute route) {
  boolean vehicleSwitch = false;
  if (!(route.getVehicle() instanceof VehicleImpl.NoVehicle)) {
    if (!route.getVehicle().getId().equals(data.getSelectedVehicle().getId())) {
      vehicleSwitch = true;
    }
  }
  if (vehicleSwitch && !route.getActivities().isEmpty()) {
    String oldStart = makeStartId(route.getVehicle());
    String firstAct = ((TourActivity.JobActivity) route.getActivities().get(0)).getJob().getId();
    String oldEnd = makeEndId(route.getVehicle());
    String lastAct = ((TourActivity.JobActivity) route.getActivities().get(route.getActivities().size() - 1)).getJob().getId();
    removeEdge(oldStart + "_" + firstAct);
    if (route.getVehicle().isReturnToDepot()) {
      removeEdge(lastAct + "_" + oldEnd);
    }
    String newStart = makeStartId(data.getSelectedVehicle());
    String newEnd = makeEndId(data.getSelectedVehicle());
    addEdge(newStart + "_" + firstAct, newStart, firstAct);
    if (data.getSelectedVehicle().isReturnToDepot()) {
      addEdge(lastAct + "_" + newEnd, lastAct, newEnd);
    }
  }
}
origin: com.graphhopper/jsprit-core

private void log(VehicleRoutingProblemSolution solution) {
  logger.trace("solution costs: {}", solution.getCost());
  for (VehicleRoute r : solution.getRoutes()) {
    StringBuilder b = new StringBuilder();
    b.append(r.getVehicle().getId()).append(" : ").append("[ ");
    for (TourActivity act : r.getActivities()) {
      if (act instanceof TourActivity.JobActivity) {
        b.append(((TourActivity.JobActivity) act).getJob().getId()).append(" ");
      }
    }
    b.append("]");
    logger.trace(b.toString());
  }
  StringBuilder b = new StringBuilder();
  b.append("unassigned : [ ");
  for (Job j : solution.getUnassignedJobs()) {
    b.append(j.getId()).append(" ");
  }
  b.append("]");
  logger.trace(b.toString());
}
origin: com.graphhopper/jsprit-core

private List<LocationWrapper> getLocationWrappers(VehicleRoute route) {
  List<LocationWrapper> locations = new ArrayList<LocationWrapper>(route.getTourActivities().getJobs().size());
  Map<Job, List<Location>> jobs2locations = new HashMap<Job, List<Location>>();
  for (TourActivity act : route.getActivities()) {
    if (act instanceof TourActivity.JobActivity) {
      Job job = ((TourActivity.JobActivity) act).getJob();
      if (!jobs2locations.containsKey(job)) {
        jobs2locations.put(job, new ArrayList<Location>());
      }
      jobs2locations.get(job).add(act.getLocation());
    }
  }
  for (Job j : jobs2locations.keySet()) {
    locations.add(new LocationWrapper(j, jobs2locations.get(j)));
  }
  return locations;
}
origin: PGWelch/com.opendoorlogistics

BuiltStopRec getBuiltStop(JobActivity jobActivity){
  List<BuiltStopRec> rows = jspritJobIdToStopRecords.get(jobActivity.getJob().getId());
  if(rows==null){
    throw new RuntimeException("Unknown " + PredefinedTags.STOP_ID + " or " + PredefinedTags.JOB_ID + ": " + jobActivity.getJob().getId());
  }
  
  if(rows.size()==1){
    return rows.get(0);
  }
  
  if(rows.size()>1 && PickupActivity.class.isInstance(jobActivity)){
    return rows.get(0);
  }
  if(rows.size()>1 && DeliveryActivity.class.isInstance(jobActivity)){
    return rows.get(1);
  }
  return null;
}

origin: com.graphhopper/jsprit-core

@Override
public void visit(TourActivity activity) {
  boolean violatedAtActivity = false;
  if (activity instanceof TourActivity.JobActivity) {
    Set<String> requiredForActivity = ((TourActivity.JobActivity) activity).getJob().getRequiredSkills().values();
    for (String skill : requiredForActivity) {
      if (!route.getVehicle().getSkills().containsSkill(skill)) {
        violatedAtActivity = true;
        skillConstraintViolatedOnRoute = true;
      }
    }
  }
  stateManager.putActivityState(activity, skill_id, violatedAtActivity);
}
origin: com.graphhopper/jsprit-core

@Override
public double[] getPoint() {
  return new double[]{jobActivity.getLocation().getCoordinate().getX(), jobActivity.getLocation().getCoordinate().getY()};
}
com.graphhopper.jsprit.core.problem.solution.route.activityTourActivity$JobActivity

Javadoc

Basic interface of job-activies.

A job activity is related to a Job.

Most used methods

  • getJob
    Returns the job that is involved with this activity.
  • getLocation

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now