Package jsprit.instance.reader

Examples of jsprit.instance.reader.ChristofidesReader


public class ChristophidesReaderTest {
 
  @Test
  public void whenReadingInstance_nuOfCustomersIsCorrect(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
    VehicleRoutingProblem vrp = builder.build();
    assertEquals(50,vrp.getJobs().values().size());
  }
View Full Code Here


  }
 
  @Test
  public void whenReadingInstance_fleetSizeIsInfinite(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
    VehicleRoutingProblem vrp = builder.build();
    assertEquals(FleetSize.INFINITE,vrp.getFleetSize());
  }
View Full Code Here

  }
 
  @Test
  public void whenReadingInstance_vehicleCapacitiesAreCorrect(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
    VehicleRoutingProblem vrp = builder.build();
    for(Vehicle v : vrp.getVehicles()){
      assertEquals(160,v.getType().getCapacityDimensions().get(0));
    }
  }
View Full Code Here

  }
 
  @Test
  public void whenReadingInstance_vehicleLocationsAreCorrect_and_correspondToDepotLocation(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
    VehicleRoutingProblem vrp = builder.build();
    for(Vehicle v : vrp.getVehicles()){
      assertEquals(30.0,v.getStartLocationCoordinate().getX(),0.01);
      assertEquals(40.0,v.getStartLocationCoordinate().getY(),0.01);
    }
View Full Code Here

  }
 
  @Test
  public void whenReadingInstance_vehicleDurationsAreCorrect(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc13.txt").getPath());
    VehicleRoutingProblem vrp = builder.build();
    for(Vehicle v : vrp.getVehicles()){
      assertEquals(0.0,v.getEarliestDeparture(),0.01);
      assertEquals(720.0,v.getLatestArrival()-v.getEarliestDeparture(),0.01);
    }
View Full Code Here

  }
 
  @Test
  public void whenReadingInstance_demandOfCustomerOneIsCorrect(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc1.txt").getPath());
    VehicleRoutingProblem vrp = builder.build();
    assertEquals(7,vrp.getJobs().get("1").getSize().get(0));
  }
View Full Code Here

  }
 
  @Test
  public void whenReadingInstance_serviceDurationOfCustomerTwoIsCorrect(){
    VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
    new ChristofidesReader(builder).read(this.getClass().getClassLoader().getResource("vrpnc13.txt").getPath());
    VehicleRoutingProblem vrp = builder.build();
    assertEquals(50.0,((Service)vrp.getJobs().get("2")).getServiceDuration(),0.1);
  }
View Full Code Here

    List<Double> bestKnown = Arrays.asList(524.61,835.26,826.14,1028.42,1291.29,555.43,909.68,865.49,1162.55,1395.85,1042.11,819.56,1541.14,866.37);
    Collection<BenchmarkInstance> instances = new ArrayList<BenchmarkInstance>();
    for(int i=0;i<14;i++){
      VehicleRoutingProblem.Builder builder = VehicleRoutingProblem.Builder.newInstance();
      String file = inputFolder + "/vrpnc"+ (i+1) + ".txt";
      new ChristofidesReader(builder).read(file);
      VehicleRoutingProblem p = builder.build();
      instances.add(new BenchmarkInstance("vrpnc" + getInstanceNu(i+1), p, bestKnown.get(i).doubleValue(), null));
    }
    return instances;
  }
View Full Code Here

TOP

Related Classes of jsprit.instance.reader.ChristofidesReader

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.