Package jsprit.core.problem.vehicle.VehicleImpl

Examples of jsprit.core.problem.vehicle.VehicleImpl.Builder


     * this example employs two vehicles. one that has to return to its start-location (vehicle1) and one that has a different
     * end-location.
     *
     * play with these location to see which impact they have on customer-sequences.
     */
    Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("v1");
    vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder1.setType(vehicleType);
    VehicleImpl vehicle1 = vehicleBuilder1.build();
   
    Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("v2");
    vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
    vehicleBuilder2.setType(vehicleType);
    VehicleImpl vehicle2 = vehicleBuilder2.build();
 
   
    /*
     * build shipments at the required locations, each with a capacity-demand of 1.
     *
 
View Full Code Here


    VehicleType vehicleType = vehicleTypeBuilder.build();
   
    /*
     * get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
     */
    Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder.setType(vehicleType);
    VehicleImpl vehicle = vehicleBuilder.build();
   
    /*
     * build services at the required locations, each with a capacity-demand of 1.
     */
    Service service1 = Service.Builder.newInstance("1").addSizeDimension(WEIGHT_INDEX, 1).setCoord(Coordinate.newInstance(5, 7)).build();
View Full Code Here

     * this example employs two vehicles. one that has to return to its start-location (vehicle1) and one that has a different
     * end-location.
     *
     * play with these location to see which impact they have on customer-sequences.
     */
    Builder vehicleBuilder1 = VehicleImpl.Builder.newInstance("wheelchair_bus");
    vehicleBuilder1.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder1.setType(vehicleType_wheelchair);
    VehicleImpl vehicle1 = vehicleBuilder1.build();
   
    Builder vehicleBuilder1_2 = VehicleImpl.Builder.newInstance("wheelchair_bus_2");
    vehicleBuilder1_2.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder1_2.setType(vehicleType_wheelchair);
    VehicleImpl vehicle1_2 = vehicleBuilder1_2.build();
   
    Builder vehicleBuilder2 = VehicleImpl.Builder.newInstance("passenger_bus");
    vehicleBuilder2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
    vehicleBuilder2.setType(vehicleType_solelypassenger);
    VehicleImpl vehicle2 = vehicleBuilder2.build();
   
    Builder vehicleBuilder2_2 = VehicleImpl.Builder.newInstance("passenger_bus_2");
    vehicleBuilder2_2.setStartLocationCoordinate(Coordinate.newInstance(30, 30)).setEndLocationCoordinate(Coordinate.newInstance(30, 19));
    vehicleBuilder2_2.setType(vehicleType_solelypassenger);
    VehicleImpl vehicle2_2 = vehicleBuilder2_2.build();
 
   
    /*
     * build shipments at the required locations, each with a capacity-demand of 1.
     *
 
View Full Code Here

    VehicleType vehicleType = vehicleTypeBuilder.build();
   
    /*
     * get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
     */
    Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder.setType(vehicleType);
    VehicleImpl vehicle = vehicleBuilder.build();
   
    /*
     * build shipments at the required locations, each with a capacity-demand of 1.
     * 4 shipments
     * 1: (5,7)->(6,9)
View Full Code Here

    VehicleType vehicleType = vehicleTypeBuilder.build();

    /*
     * get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
     */
    Builder vehicleBuilder = Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder.setType(vehicleType);
    VehicleImpl vehicle = vehicleBuilder.build();

        Builder vehicle2Builder = Builder.newInstance("vehicle2");
        vehicle2Builder.setStartLocationCoordinate(Coordinate.newInstance(1, 1));
        vehicle2Builder.setType(vehicleType);
        vehicle2Builder.addSkill("drill");
        VehicleImpl vehicle2 = vehicle2Builder.build();
   
    /*
     * build services at the required locations, each with a capacity-demand of 1.
     */
    Service service1 = Service.Builder.newInstance("1").addSizeDimension(WEIGHT_INDEX, 1).setCoord(Coordinate.newInstance(5, 7)).build();
View Full Code Here

        int capacity = Integer.parseInt(tokens[1].trim());
        VehicleTypeImpl vehicleType = VehicleTypeImpl.Builder.newInstance(counter + "_cordeauType").addCapacityDimension(0, capacity).
            setCostPerDistance(1.0).setFixedCost(0).build();
        List<Builder> builders = new ArrayList<VehicleImpl.Builder>();
        for(int vehicleCounter=0;vehicleCounter<nOfVehiclesAtEachDepot;vehicleCounter++){
          Builder vBuilder = VehicleImpl.Builder.newInstance(depot+"_"+(vehicleCounter+1) + "_cordeauVehicle");
          vBuilder.setLatestArrival(duration).setType(vehicleType);
          builders.add(vBuilder);
        }
        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();
          typeId = vehicle.getType().getTypeId();
          latestArrTime = vehicle.getLatestArrival();
          coord = vehicle.getStartLocationCoordinate();
          vrpBuilder.addVehicle(vehicle);
View Full Code Here

    VehicleType vehicleType = vehicleTypeBuilder.build();
   
    /*
     * get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
     */
    Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder.setType(vehicleType);
    VehicleImpl vehicle = vehicleBuilder.build();
   
    /*
     * build shipments at the required locations, each with a capacity-demand of 1.
     * 4 shipments
     * 1: (5,7)->(6,9)
View Full Code Here

    VehicleType vehicleType = vehicleTypeBuilder.build();
   
    /*
     * get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
     */
    Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder.setType(vehicleType);
    VehicleImpl vehicle = vehicleBuilder.build();
   
    /*
     * build shipments at the required locations, each with a capacity-demand of 1.
     * 4 shipments
     * 1: (5,7)->(6,9)
View Full Code Here

    List<HierarchicalConfiguration> vehicleConfigs = vrpProblem.configurationsAt("vehicles.vehicle");
    boolean doNotWarnAgain = false;
    for(HierarchicalConfiguration vehicleConfig : vehicleConfigs){
      String vehicleId = vehicleConfig.getString("id");
      if(vehicleId == null) throw new IllegalStateException("vehicleId is missing.");
      Builder builder = VehicleImpl.Builder.newInstance(vehicleId);
      String typeId = vehicleConfig.getString("typeId");
      if(typeId == null) throw new IllegalStateException("typeId is missing.");
      String vType = vehicleConfig.getString("[@type]");
      if(vType!=null){
        if(vType.equals("penalty")){
          typeId+="_penalty";
        }
      }
      VehicleType type = types.get(typeId);
      if(type == null) throw new IllegalStateException("vehicleType with typeId " + typeId + " is missing.");
      builder.setType(type);

            //read startlocation
            String locationId = vehicleConfig.getString("location.id");
      if(locationId == null) {
        locationId = vehicleConfig.getString("startLocation.id");
      }
      if(locationId == null) throw new IllegalStateException("location.id is missing.");
      builder.setStartLocationId(locationId);
      String coordX = vehicleConfig.getString("location.coord[@x]");
      String coordY = vehicleConfig.getString("location.coord[@y]");
      if(coordX == null || coordY == null) {
        coordX = vehicleConfig.getString("startLocation.coord[@x]");
        coordY = vehicleConfig.getString("startLocation.coord[@y]");
      }
      if(coordX == null || coordY == null) {
          if(!doNotWarnAgain) {
            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");
      String end = vehicleConfig.getString("timeSchedule.end");
      if(start != null) builder.setEarliestStart(Double.parseDouble(start));
      if(end != null) builder.setLatestArrival(Double.parseDouble(end));

      //read return2depot
            String returnToDepot = vehicleConfig.getString("returnToDepot");
      if(returnToDepot != null){
        builder.setReturnToDepot(vehicleConfig.getBoolean("returnToDepot"));
      }

            //read skills
            String skillString = vehicleConfig.getString("skills");
            if(skillString != null){
                String cleaned = skillString.replaceAll("\\s", "");
                String[] skillTokens = cleaned.split("[,;]");
                for(String skill : skillTokens) builder.addSkill(skill.toLowerCase());
            }

            //build vehicle
      VehicleImpl vehicle = builder.build();
      vrpBuilder.addVehicle(vehicle);
      vehicleMap.put(vehicleId, vehicle);
    }

  }
View Full Code Here

    VehicleType vehicleType = vehicleTypeBuilder.build();
   
    /*
     * get a vehicle-builder and build a vehicle located at (10,10) with type "vehicleType"
     */
    Builder vehicleBuilder = VehicleImpl.Builder.newInstance("vehicle");
    vehicleBuilder.setStartLocationCoordinate(Coordinate.newInstance(10, 10));
    vehicleBuilder.setType(vehicleType);
    VehicleImpl vehicle = vehicleBuilder.build();
   
    /*
     * build pickups and deliveries at the required locations, each with a capacity-demand of 1.
     */
    Pickup pickup1 = (Pickup) Pickup.Builder.newInstance("1").addSizeDimension(0, 1).setCoord(Coordinate.newInstance(5, 7)).build();
View Full Code Here

TOP

Related Classes of jsprit.core.problem.vehicle.VehicleImpl.Builder

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.