Package jsprit.core.util

Examples of jsprit.core.util.Coordinate


    int counter = 1;
    for(VehicleRoute route : routes){
      if(route.isEmpty()) continue;
      XYSeries series = new XYSeries(counter, false, true);
     
      Coordinate startCoord = locations.getCoord(route.getStart().getLocationId());
      series.add(startCoord.getX()*scalingFactor, startCoord.getY()*scalingFactor);
     
      for(TourActivity act : route.getTourActivities().getActivities()){
        Coordinate coord = locations.getCoord(act.getLocationId());
        series.add(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
      }
     
      Coordinate endCoord = locations.getCoord(route.getEnd().getLocationId());
      series.add(endCoord.getX()*scalingFactor, endCoord.getY()*scalingFactor);
     
      coll.addSeries(series);
      counter++;
    }
    return coll;
View Full Code Here


      markItem(dataItem2,Activity.DELIVERY, job);
      containsDeliveryAct = true;
    }
    else if(job instanceof Pickup){
      Pickup service = (Pickup)job;
      Coordinate coord = service.getCoord();
      XYDataItem dataItem = new XYDataItem(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
      activities.add(dataItem);
      addLabel(service, dataItem);
      markItem(dataItem, Activity.PICKUP, job);
      containsPickupAct = true;
    }
    else if(job instanceof Delivery){
      Delivery service = (Delivery)job;
      Coordinate coord = service.getCoord();
      XYDataItem dataItem = new XYDataItem(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
      activities.add(dataItem);
      addLabel(service, dataItem);
      markItem(dataItem, Activity.DELIVERY, job);
      containsDeliveryAct = true;
    }
    else if(job instanceof Service){
      Service service = (Service)job;
      Coordinate coord = service.getCoord();
      XYDataItem dataItem = new XYDataItem(coord.getX()*scalingFactor, coord.getY()*scalingFactor);
      activities.add(dataItem);
      addLabel(service, dataItem);
      markItem(dataItem, Activity.SERVICE, job);
      containsServiceAct = true;
    }
View Full Code Here

  }

  private void retrieveActivities(VehicleRoutingProblem vrp) throws NoLocationFoundException{
    activities = new XYSeries("activities", false, true);
    for(Vehicle v : vrp.getVehicles()){
      Coordinate startCoord = v.getStartLocationCoordinate();
      if(startCoord == null) throw new NoLocationFoundException();
      XYDataItem item = new XYDataItem(startCoord.getX()*scalingFactor, startCoord.getY()*scalingFactor);
      markItem(item,Activity.START, null);
      activities.add(item);
     
      if(!v.getStartLocationId().equals(v.getEndLocationId())){
        Coordinate endCoord = v.getEndLocationCoordinate();
        if(endCoord == null) throw new NoLocationFoundException();
                XYDataItem enditem = new XYDataItem(endCoord.getX()*scalingFactor,endCoord.getY()*scalingFactor);
                markItem(enditem,Activity.END, null);
                activities.add(enditem);
      }
    }
    for(Job job : vrp.getJobs().values()){
View Full Code Here

     * each with 14 vehicles each with a capacity of 500 and a maximum duration of 310
     */
    int nuOfVehicles = 13;
    int capacity = 500;
    double maxDuration = 310;
    Coordinate firstDepotCoord = Coordinate.newInstance(-33, 33);
    Coordinate second = Coordinate.newInstance(33, -33);
   
    int depotCounter = 1;
    for(Coordinate depotCoord : Arrays.asList(firstDepotCoord,second)){
      for(int i=0;i<nuOfVehicles;i++){
        VehicleType vehicleType = VehicleTypeImpl.Builder.newInstance(depotCounter + "_type")
View Full Code Here

        vehicleCapacity = Integer.parseInt(tokens[1].trim());
        endTime = Double.parseDouble(tokens[2].trim());
        serviceTime = Double.parseDouble(tokens[3].trim());
      }
      else if(counter == 1){
        Coordinate depotCoord = makeCoord(tokens[0].trim(),tokens[1].trim());
        VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance("christophidesType").addCapacityDimension(0, vehicleCapacity).
            setCostPerDistance(1.0).build();
        Vehicle vehicle = VehicleImpl.Builder.newInstance("christophidesVehicle").setLatestArrival(endTime).setStartLocationCoordinate(depotCoord).
            setType(vehicleType).build();
        vrpBuilder.addVehicle(vehicle);
      }
      else{
        Coordinate customerCoord = makeCoord(tokens[0].trim(),tokens[1].trim());
        int demand = Integer.parseInt(tokens[2].trim());
        String customer = Integer.valueOf(counter-1).toString();
        Service service = Service.Builder.newInstance(customer).addSizeDimension(0, demand).setServiceTime(serviceTime).setCoord(customerCoord).build();
        vrpBuilder.addJob(service);
      }
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 read(String filename){
    BufferedReader reader = getReader(filename);
    String line = null;
    boolean firstline = true;
    Coordinate depotCoord = null;
    int customerCount=0;
    Integer nuOfCustomer = 0;
    while((line=readLine(reader))!=null){
      String trimedLine = line.trim();
      if(trimedLine.startsWith("//")) continue;
View Full Code Here

     * @see Coordinate
     */
    @SuppressWarnings("UnusedDeclaration")
        @Deprecated
    public String createLocation(double x, double y){
      Coordinate coordinate = new Coordinate(x, y);
      String id = coordinate.toString();
      if(!tentative_coordinates.containsKey(id)){
        tentative_coordinates.put(id, coordinate);
      }
      return id;
    }
View Full Code Here

          firstLine = false;
          continue;
        }
        else{
          String customerId = tokens[0];
          Coordinate coord = makeCoord(tokens[1], tokens[2]);
          int demand = getInt(tokens[3]);
          double startTimeWindow = getDouble(tokens[4]);
          double endTimeWindow = getDouble(tokens[5]);
          double serviceTime = getDouble(tokens[6]);
//          vrpBuilder.addLocation(customerId, coord);
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,y);
  }
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.