Package jsprit.core.util

Examples of jsprit.core.util.Coordinate


      if(pickupLocationId != null){
        builder.setPickupLocationId(pickupLocationId);
      }
     
      //pickup-coord
      Coordinate pickupCoord = getCoord(shipmentConfig,"pickup.");
      if(pickupCoord != null){
        builder.setPickupCoord(pickupCoord);
        if(pickupLocationId != null){
//          vrpBuilder.addLocation(pickupLocationId,pickupCoord);
        }
        else{
//          vrpBuilder.addLocation(pickupCoord.toString(),pickupCoord);
          builder.setPickupLocationId(pickupCoord.toString());
        }
      }

      //pickup-serviceTime
      String pickupServiceTime = shipmentConfig.getString("pickup.duration");
      if(pickupServiceTime != null) builder.setPickupServiceTime(Double.parseDouble(pickupServiceTime));
     
      //pickup-tw
      String pickupTWStart = shipmentConfig.getString("pickup.timeWindows.timeWindow(0).start");
      String pickupTWEnd = shipmentConfig.getString("pickup.timeWindows.timeWindow(0).end");
      if(pickupTWStart != null && pickupTWEnd != null){
        TimeWindow pickupTW = TimeWindow.newInstance(Double.parseDouble(pickupTWStart), Double.parseDouble(pickupTWEnd));
        builder.setPickupTimeWindow(pickupTW);
      }

      //delivery-locationId
      String deliveryLocationId = shipmentConfig.getString("delivery.locationId");
      if(deliveryLocationId != null){
        builder.setDeliveryLocationId(deliveryLocationId);
      }
     
      //delivery-coord
      Coordinate deliveryCoord = getCoord(shipmentConfig,"delivery.");
      if(deliveryCoord != null){
        builder.setDeliveryCoord(deliveryCoord);
        if(deliveryLocationId != null){
//          vrpBuilder.addLocation(deliveryLocationId,deliveryCoord);
        }
        else{
//          vrpBuilder.addLocation(deliveryCoord.toString(),deliveryCoord);
          builder.setDeliveryLocationId(deliveryCoord.toString());
        }
      }

      //delivery-serviceTime
      String deliveryServiceTime = shipmentConfig.getString("delivery.duration");
View Full Code Here


      shipmentMap.put(shipment.getId(),shipment);
    }
  }

  private static Coordinate getCoord(HierarchicalConfiguration serviceConfig, String prefix) {
    Coordinate pickupCoord = null;
    if(serviceConfig.getString(prefix + "coord[@x]") != null && serviceConfig.getString(prefix + "coord[@y]") != null){
      double x = Double.parseDouble(serviceConfig.getString(prefix + "coord[@x]"));
      double y = Double.parseDouble(serviceConfig.getString(prefix + "coord[@y]"));
      pickupCoord = Coordinate.newInstance(x,y);
    }
View Full Code Here

            String name = serviceConfig.getString("name");
            if(name != null) builder.setName(name);

      String serviceLocationId = serviceConfig.getString("locationId");
      if(serviceLocationId != null) builder.setLocationId(serviceLocationId);
      Coordinate serviceCoord = getCoord(serviceConfig,"");
      if(serviceCoord != null){
        builder.setCoord(serviceCoord);
        if(serviceLocationId != null){
//          vrpBuilder.addLocation(serviceLocationId,serviceCoord);
        }
        else{
//          vrpBuilder.addLocation(serviceCoord.toString(),serviceCoord);
          builder.setLocationId(serviceCoord.toString());
        }
      }
      if(serviceConfig.containsKey("duration")){
        builder.setServiceTime(serviceConfig.getDouble("duration"));
      }
View Full Code Here

            logger.warn("location.coord is missing. will not warn you again.");
            doNotWarnAgain = true;
          }
      }
      else{
        Coordinate coordinate = Coordinate.newInstance(Double.parseDouble(coordX), Double.parseDouble(coordY));
        builder.setStartLocationCoordinate(coordinate);
       
      }

            //read endlocation
      String endLocationId = vehicleConfig.getString("endLocation.id");
      if(endLocationId != null) builder.setEndLocationId(endLocationId);
      String endCoordX = vehicleConfig.getString("endLocation.coord[@x]");
      String endCoordY = vehicleConfig.getString("endLocation.coord[@y]");
      if(endCoordX == null || endCoordY == null) {
        if(!doNotWarnAgain) {
          logger.warn("endLocation.coord is missing. will not warn you again.");
          doNotWarnAgain = true;
        }
      }
      else{
        Coordinate coordinate = Coordinate.newInstance(Double.parseDouble(endCoordX), Double.parseDouble(endCoordY));
        builder.setEndLocationCoordinate(coordinate);
      }
     
      //read timeSchedule
      String start = vehicleConfig.getString("timeSchedule.start");
View Full Code Here

     *
     * each with 4 vehicles each with a capacity of 80
     */
    int nuOfVehicles = 4;
    int capacity = 80;
    Coordinate firstDepotCoord = Coordinate.newInstance(20, 20);
    Coordinate second = Coordinate.newInstance(30, 40);
    Coordinate third = Coordinate.newInstance(50, 30);
    Coordinate fourth = Coordinate.newInstance(60, 50);
   
    int depotCounter = 1;
    for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second,third,fourth)){
      for(int i=0;i<nuOfVehicles;i++){
        VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type").addCapacityDimension(0, capacity).setCostPerDistance(1.0).build();
View Full Code Here

    private static VehicleRoutingTransportCostsMatrix createMatrix(VehicleRoutingProblem.Builder vrpBuilder) {
        VehicleRoutingTransportCostsMatrix.Builder matrixBuilder = VehicleRoutingTransportCostsMatrix.Builder.newInstance(true);
        for(String from : vrpBuilder.getLocationMap().keySet()){
            for(String to : vrpBuilder.getLocationMap().keySet()){
                Coordinate fromCoord = vrpBuilder.getLocationMap().get(from);
                Coordinate toCoord = vrpBuilder.getLocationMap().get(to);
                double distance = EuclideanDistanceCalculator.calculateDistance(fromCoord, toCoord);
                matrixBuilder.addTransportDistance(from,to,distance);
                matrixBuilder.addTransportTime(from,to,(distance / 2.));
            }
        }
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.