Package jsprit.core.problem.job

Examples of jsprit.core.problem.job.Job


  }

  private void ruin(Collection<VehicleRoute> vehicleRoutes, int nOfJobs2BeRemoved, List<Job> unassignedJobs) {
    LinkedList<Job> availableJobs = new LinkedList<Job>(vrp.getJobs().values());
    for (int i = 0; i < nOfJobs2BeRemoved; i++) {
      Job job = pickRandomJob(availableJobs);
      unassignedJobs.add(job);
      availableJobs.remove(job);
      for (VehicleRoute route : vehicleRoutes) {
        boolean removed = route.getTourActivities().removeJob(job);
        if (removed) {
View Full Code Here


    }
    int nOfJobs2BeRemoved = getNuOfJobs2BeRemoved();
    if (nOfJobs2BeRemoved == 0) {
      return Collections.emptyList();
    }
    Job randomJob = pickRandomJob();
    Collection<Job> unassignedJobs = ruin(vehicleRoutes,randomJob,nOfJobs2BeRemoved);
    return unassignedJobs;
  }
View Full Code Here

    int nNeighbors = nOfJobs2BeRemoved - 1;
    removeJob(targetJob,vehicleRoutes);
    unassignedJobs.add(targetJob);
    Iterator<Job> neighborhoodIterator =  jobNeighborhoods.getNearestNeighborsIterator(nNeighbors, targetJob);
    while(neighborhoodIterator.hasNext()){
      Job job = neighborhoodIterator.next();
      removeJob(job,vehicleRoutes);
      unassignedJobs.add(job);
    }
    ruinListeners.ruinEnds(vehicleRoutes, unassignedJobs);
    return unassignedJobs;
View Full Code Here

  }

  private Job pickRandomJob() {
    int totNuOfJobs = vrp.getJobs().values().size();
    int randomIndex = random.nextInt(totNuOfJobs);
    Job job = new ArrayList<Job>(vrp.getJobs().values()).get(randomIndex);
    return job;
  }
View Full Code Here

    assertEquals(20.0,sol.getCost(),0.01);
  }

    @Test
    public void sizeOfBadJobsShouldBeCorrect(){
        Job badJob = mock(Job.class);
        List<Job> badJobs = new ArrayList<Job>();
        badJobs.add(badJob);
        VehicleRoutingProblemSolution sol = new VehicleRoutingProblemSolution(Collections.<VehicleRoute>emptyList(), badJobs, 10.0);
        assertEquals(1,sol.getUnassignedJobs().size());
    }
View Full Code Here

        assertEquals(1,sol.getUnassignedJobs().size());
    }

    @Test
    public void sizeOfBadJobsShouldBeCorrect_2(){
        Job badJob = mock(Job.class);
        List<Job> badJobs = new ArrayList<Job>();
        badJobs.add(badJob);
        VehicleRoutingProblemSolution sol = new VehicleRoutingProblemSolution(Collections.<VehicleRoute>emptyList(), 10.0);
        sol.getUnassignedJobs().addAll(badJobs);
        assertEquals(1, sol.getUnassignedJobs().size());
View Full Code Here

        assertEquals(1, sol.getUnassignedJobs().size());
    }

    @Test
    public void badJobsShouldBeCorrect(){
        Job badJob = mock(Job.class);
        List<Job> badJobs = new ArrayList<Job>();
        badJobs.add(badJob);
        VehicleRoutingProblemSolution sol = new VehicleRoutingProblemSolution(Collections.<VehicleRoute>emptyList(), badJobs, 10.0);
        assertEquals(badJob,sol.getUnassignedJobs().iterator().next());
    }
View Full Code Here

        assertEquals(badJob,sol.getUnassignedJobs().iterator().next());
    }

    @Test
    public void badJobsShouldBeCorrect_2() {
        Job badJob = mock(Job.class);
        List<Job> badJobs = new ArrayList<Job>();
        badJobs.add(badJob);
        VehicleRoutingProblemSolution sol = new VehicleRoutingProblemSolution(Collections.<VehicleRoute>emptyList(), 10.0);
        sol.getUnassignedJobs().addAll(badJobs);
        assertEquals(badJob, sol.getUnassignedJobs().iterator().next());
View Full Code Here

    if(label.equals(Label.ACTIVITY) || label.equals(Label.JOB_NAME)){
      Node n = g.getNode(prevIdentifier);
      n.addAttribute("ui.label", "start");
    }
    for(TourActivity act : route.getActivities()){
            Job job = ((JobActivity) act).getJob();
            String currIdentifier = makeId(job.getId(),act.getLocationId());
      if(label.equals(Label.ACTIVITY)){
        Node actNode = g.getNode(currIdentifier);
        actNode.addAttribute("ui.label", act.getName());
      }
            else if(label.equals(Label.JOB_NAME)){
                Node actNode = g.getNode(currIdentifier);
                actNode.addAttribute("ui.label", job.getName());
            }
            else if(label.equals(Label.ARRIVAL_TIME)){
                Node actNode = g.getNode(currIdentifier);
                actNode.addAttribute("ui.label", Time.parseSecondsToTime(act.getArrTime()));
            }
View Full Code Here

            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());
                    registerLocation(job);
                    registerJobAndActivity(abstractAct, job);
                }
            }
      initialRoutes.add(route);
View Full Code Here

TOP

Related Classes of jsprit.core.problem.job.Job

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.