Package jsprit.core.util

Examples of jsprit.core.util.Coordinate


    Locations locations;

    @Before
    public void doBefore(){
        final Coordinate from = Coordinate.newInstance(0,0);
        final Coordinate to = Coordinate.newInstance(100,0);

        locations = new Locations(){

            @Override
            public Coordinate getCoord(String id) {
View Full Code Here


        }
        vehiclesAtDepot.add(builders);
      }
      else if(counter <= (nOfCustomers+nOfDepots)){
        String id = tokens[0].trim();
        Coordinate customerCoord = makeCoord(tokens[1].trim(),tokens[2].trim());
        double serviceTime = Double.parseDouble(tokens[3].trim());
        int demand = Integer.parseInt(tokens[4].trim());
        Service service = Service.Builder.newInstance(id).addSizeDimension(0, demand).setServiceTime(serviceTime).setLocationId(id).setCoord(customerCoord).build();
        vrpBuilder.addJob(service);       
      }
      else if(counter <= (nOfCustomers+nOfDepots+nOfDepots)){
        Coordinate depotCoord = makeCoord(tokens[1].trim(),tokens[2].trim());
        List<Builder> vBuilders = vehiclesAtDepot.get(depotCounter);
//        int cap = 0;
        Capacity cap = Capacity.Builder.newInstance().build();
        double latestArrTime = 0.0;
        Coordinate coord = null;
        String typeId = null;
        for(Builder vBuilder : vBuilders){
          vBuilder.setStartLocationCoordinate(depotCoord);
          VehicleImpl vehicle = vBuilder.build();
          cap = vehicle.getType().getCapacityDimensions();
View Full Code Here

  }
 
  private Coordinate makeCoord(String xString, String yString) {
    double x = Double.parseDouble(xString);
    double y = Double.parseDouble(yString);
    return new Coordinate(x*coordProjectionFactor,y*coordProjectionFactor);
  }
 
View Full Code Here

      line = line.trim();
      String[] tokens = line.split(" +");
      counter++;
      if(counter > 9){
                if(tokens.length < 7) continue;
        Coordinate coord = makeCoord(tokens[1],tokens[2]);
        String customerId = tokens[0];
        int demand = Integer.parseInt(tokens[3]);
        double start = Double.parseDouble(tokens[4])*coordProjectionFactor ;
        double end = Double.parseDouble(tokens[5])*coordProjectionFactor;
        double serviceTime = Double.parseDouble(tokens[6])*coordProjectionFactor;
 
View Full Code Here

  }
 
  private Coordinate makeCoord(String xString, String yString) {
    double x = Double.parseDouble(xString);
    double y = Double.parseDouble(yString);
    return new Coordinate(x*coordProjectionFactor,y*coordProjectionFactor);
  }
 
View Full Code Here

        vehicleCapacity = Integer.parseInt(tokens[1]);
        continue;
      }
      if(counter > 9){
        if(tokens.length < 7) continue;
                Coordinate coord = makeCoord(tokens[1],tokens[2]);
        String customerId = tokens[0];
        int demand = Integer.parseInt(tokens[3]);
        double start = Double.parseDouble(tokens[4])*timeProjectionFactor;
        double end = Double.parseDouble(tokens[5])*timeProjectionFactor;
        double serviceTime = Double.parseDouble(tokens[6])*timeProjectionFactor;
 
View Full Code Here

  }
 
  private Coordinate makeCoord(String xString, String yString) {
    double x = Double.parseDouble(xString);
    double y = Double.parseDouble(yString);
    return new Coordinate(x*coordProjectionFactor,y*coordProjectionFactor);
  }
 
View Full Code Here

  public void whenReadingInstance_service1MustHaveCorrectCoordinate(){
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
      .read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
    VehicleRoutingProblem vrp = vrpBuilder.build();
    Coordinate coord = getCoord("1",vrp);
    assertEquals(22.0,coord.getX(),0.01);
    assertEquals(22.0,coord.getY(),0.01);
  }
View Full Code Here

  public void whenReadingInstance_service15MustHaveCorrectCoordinate(){
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
      .read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
    VehicleRoutingProblem vrp = vrpBuilder.build();
    Coordinate coord = getCoord("15",vrp);
    assertEquals(62.0,coord.getX(),0.01);
    assertEquals(24.0,coord.getY(),0.01);
  }
View Full Code Here

  public void whenReadingInstance_service50MustHaveCorrectCoordinate(){
    VehicleRoutingProblem.Builder vrpBuilder = VehicleRoutingProblem.Builder.newInstance();
    new VrphGoldenReader(vrpBuilder, VrphType.HVRPD)
      .read(this.getClass().getClassLoader().getResource("cn_13mix.txt").getPath());
    VehicleRoutingProblem vrp = vrpBuilder.build();
    Coordinate coord = getCoord("50",vrp);
    assertEquals(15.0,coord.getX(),0.01);
    assertEquals(56.0,coord.getY(),0.01);
  }
View Full Code Here

TOP

Related Classes of jsprit.core.util.Coordinate

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.