Package jsprit.core.problem.job

Examples of jsprit.core.problem.job.Job


        VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
        new VrpXMLReader(vrpBuilder).read("src/test/resources/simpleProblem_inclShipments_iniRoutes.xml");
        VehicleRoutingProblem vrp = vrpBuilder.build();

        Job job = vrp.getJobs().get("4");
        List<AbstractActivity> activities = vrp.getActivities(job);

        assertEquals(2, activities.size());
    }
View Full Code Here


  public void whenReadingInstance_service1MustHaveCorrectDemand(){
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
      .read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
    VehicleRoutingProblem vrp = vrpBuilder.build();
    Job job = getJob("1",vrp);
    assertEquals(18,job.getSize().get(0));
  }
View Full Code Here

    assertEquals(15.0,coord.getX(),0.01);
    assertEquals(56.0,coord.getY(),0.01);
  }
 
  private Coordinate getCoord(String string, VehicleRoutingProblem vrp) {
    Job j = getJob(string,vrp);
    return ((Service)j).getCoord();
  }
View Full Code Here

  public void whenReadingInstance_service4MustHaveCorrectDemand(){
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
      .read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
    VehicleRoutingProblem vrp = vrpBuilder.build();
    Job job = getJob("4",vrp);
    assertEquals(30,job.getSize().get(0));
  }
View Full Code Here

  public void whenReadingInstance_service50MustHaveCorrectDemand(){
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
      .read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
    VehicleRoutingProblem vrp = vrpBuilder.build();
    Job job = getJob("50",vrp);
    assertEquals(22,job.getSize().get(0));
  }
View Full Code Here

      xmlConfig.setProperty(path + "(" + routeCounter + ").start", route.getStart().getEndTime());
      int actCounter = 0;
      for(TourActivity act : route.getTourActivities().getActivities()){
        xmlConfig.setProperty(path + "(" + routeCounter + ").act("+actCounter+")[@type]", act.getName());
        if(act instanceof JobActivity){
          Job job = ((JobActivity) act).getJob();
          if(job instanceof Service){
            xmlConfig.setProperty(path + "(" + routeCounter + ").act("+actCounter+").serviceId", job.getId());
          }
          else if(job instanceof Shipment){
            xmlConfig.setProperty(path + "(" + routeCounter + ").act("+actCounter+").shipmentId", job.getId());
          }
          else{
            throw new IllegalStateException("cannot write solution correctly since job-type is not know. make sure you use either service or shipment, or another writer");
          }
        }
View Full Code Here

        xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").start", route.getStart().getEndTime());
        int actCounter = 0;
        for(TourActivity act : route.getTourActivities().getActivities()){
          xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act("+actCounter+")[@type]", act.getName());
          if(act instanceof JobActivity){
            Job job = ((JobActivity) act).getJob();
            if(job instanceof Service){
              xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act("+actCounter+").serviceId", job.getId());
            }
            else if(job instanceof Shipment){
              xmlConfig.setProperty(solutionPath + "(" + counter + ").routes.route(" + routeCounter + ").act("+actCounter+").shipmentId", job.getId());
            }
            else{
              throw new IllegalStateException("cannot write solution correctly since job-type is not know. make sure you use either service or shipment, or another writer");
            }
          }
View Full Code Here

 
  @Test
  public void whenInsertingJobAndCurrRouteIsEmpty_accessEggressCalcShouldReturnZero(){
    VehicleRoute route = VehicleRoute.Builder.newInstance(VehicleImpl.createNoVehicle(), DriverImpl.noDriver()).build();
    AdditionalAccessEgressCalculator accessEgressCalc = new AdditionalAccessEgressCalculator(costs);
    Job job = Service.Builder.newInstance("1").addSizeDimension(0, 0).setLocationId("1").setTimeWindow(TimeWindow.newInstance(0.0, 100.0)).build();
    JobInsertionContext iContex = new JobInsertionContext(route, job, newVehicle, mock(Driver.class), 0.0);
    assertEquals(0.0, accessEgressCalc.getCosts(iContex),0.01);
  }
View Full Code Here

        .build();
   
    Vehicle newVehicle = VehicleImpl.Builder.newInstance("newV").setStartLocationId("newV").build();
   
    AdditionalAccessEgressCalculator accessEgressCalc = new AdditionalAccessEgressCalculator(routingCosts);
    Job job = Service.Builder.newInstance("service2").addSizeDimension(0, 0).setLocationId("service").build();
    JobInsertionContext iContex = new JobInsertionContext(route, job, newVehicle, mock(Driver.class), 0.0);
    assertEquals(8.0, accessEgressCalc.getCosts(iContex),0.01);
  }
View Full Code Here

     *
     * @param activity to be removed
     * @return true if activity has been removed, false otherwise
     */
    public boolean removeActivity(TourActivity activity) {
        Job job = null;
        if(activity instanceof JobActivity){
            job = ((JobActivity) activity).getJob();
        }
        boolean jobIsAlsoAssociateToOtherActs = false;
        boolean actRemoved = false;
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.