Package jsprit.core.problem

Examples of jsprit.core.problem.Capacity


        if(route == null) throw new IllegalArgumentException("route is missing.");
        if(activity == null) throw new IllegalArgumentException("activity is missing.");
        if(activity instanceof Start) return getLoadAtBeginning(route);
        if(activity instanceof End) return getLoadAtEnd(route);
        verifyThatRouteContainsAct(activity, route);
        Capacity afterAct = stateManager.getActivityState(activity, InternalStates.LOAD,Capacity.class);
        if(afterAct != null && activity.getSize() != null){
            return Capacity.subtract(afterAct, activity.getSize());
        }
        else if(afterAct != null) return afterAct;
        else return null;
View Full Code Here


     * @param route to get the capacity violation from
     * @return the capacity violation on this route, i.e. maxLoad - vehicleCapacity
     */
    public Capacity getCapacityViolation(VehicleRoute route){
        if(route == null) throw new IllegalArgumentException("route is missing.");
        Capacity maxLoad = getMaxLoad(route);
        return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(maxLoad,route.getVehicle().getType().getCapacityDimensions()));
    }
View Full Code Here

     * dimension with dimIndex=0 and dimIndex=1 and dimIndex=1 is violated by 4 units then this method returns
     * [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
     */
    public Capacity getCapacityViolationAtBeginning(VehicleRoute route){
        if(route == null) throw new IllegalArgumentException("route is missing.");
        Capacity atBeginning = getLoadAtBeginning(route);
        return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(atBeginning,route.getVehicle().getType().getCapacityDimensions()));
    }
View Full Code Here

     * dimension with dimIndex=0 and dimIndex=1 and dimIndex=1 is violated by 4 units then this method returns
     * [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
     */
    public Capacity getCapacityViolationAtEnd(VehicleRoute route){
        if(route == null) throw new IllegalArgumentException("route is missing.");
        Capacity atEnd = getLoadAtEnd(route);
        return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(atEnd,route.getVehicle().getType().getCapacityDimensions()));
    }
View Full Code Here

     * [[dimIndex=0][dimValue=0][dimIndex=1][dimValue=4]]
     */
    public Capacity getCapacityViolationAfterActivity(TourActivity activity, VehicleRoute route){
        if(route == null) throw new IllegalArgumentException("route is missing.");
        if(activity == null) throw new IllegalArgumentException("activity is missing.");
        Capacity afterAct = getLoadRightAfterActivity(activity,route);
        return Capacity.max(Capacity.Builder.newInstance().build(),Capacity.subtract(afterAct,route.getVehicle().getType().getCapacityDimensions()));
    }
View Full Code Here

  public void finish() {
        currentLoad = Capacity.Builder.newInstance().build();
  }
 
  void insertionStarts(VehicleRoute route) {
    Capacity loadAtDepot = Capacity.Builder.newInstance().build();
    Capacity loadAtEnd = Capacity.Builder.newInstance().build();
    for(Job j : route.getTourActivities().getJobs()){
      if(j instanceof Delivery){
        loadAtDepot = Capacity.addup(loadAtDepot, j.getSize());
      }
      else if(j instanceof Pickup || j instanceof Service){
View Full Code Here

  }
 
  @Override
  public void informJobInserted(Job job2insert, VehicleRoute inRoute, double additionalCosts, double additionalTime) {
    if(job2insert instanceof Delivery){
      Capacity loadAtDepot = stateManager.getRouteState(inRoute, InternalStates.LOAD_AT_BEGINNING, Capacity.class);
            if(loadAtDepot == null) loadAtDepot = defaultValue;
      stateManager.putTypedInternalRouteState(inRoute, InternalStates.LOAD_AT_BEGINNING, Capacity.addup(loadAtDepot, job2insert.getSize()));
    }
    else if(job2insert instanceof Pickup || job2insert instanceof Service){
      Capacity loadAtEnd = stateManager.getRouteState(inRoute, InternalStates.LOAD_AT_END, Capacity.class);
            if(loadAtEnd == null) loadAtEnd = defaultValue;
      stateManager.putTypedInternalRouteState(inRoute, InternalStates.LOAD_AT_END, Capacity.addup(loadAtEnd, job2insert.getSize()));
    }
  }
View Full Code Here

  public void setSolutionCompletenessRatio(double ratio){
    solution_completeness_ratio = ratio;
  }

  private double getDeltaAbsoluteFixCost(VehicleRoute route, Vehicle newVehicle, Job job) {
    Capacity load = Capacity.addup(getCurrentMaxLoadInRoute(route), job.getSize());
//    double load = getCurrentMaxLoadInRoute(route) + job.getCapacityDemand();
    double currentFix = 0.0;
    if(route.getVehicle() != null){
      if(!(route.getVehicle() instanceof NoVehicle)){
        currentFix += route.getVehicle().getType().getVehicleCostParams().fix;
View Full Code Here

    }
    return newVehicle.getType().getVehicleCostParams().fix - currentFix;
  }

  private double getDeltaRelativeFixCost(VehicleRoute route, Vehicle newVehicle, Job job) {
    Capacity currentLoad = getCurrentMaxLoadInRoute(route);
//    int currentLoad = getCurrentMaxLoadInRoute(route);
    Capacity load = Capacity.addup(currentLoad, job.getSize());
//    double load = currentLoad + job.getCapacityDemand();
    double currentRelFix = 0.0;
    if(route.getVehicle() != null){
      if(!(route.getVehicle() instanceof NoVehicle)){
        currentRelFix += route.getVehicle().getType().getVehicleCostParams().fix * Capacity.divide(currentLoad, route.getVehicle().getType().getCapacityDimensions());
View Full Code Here

    double relativeFixCost = newVehicle.getType().getVehicleCostParams().fix* (Capacity.divide(load, newVehicle.getType().getCapacityDimensions())) - currentRelFix;
    return relativeFixCost;
  }

  private Capacity getCurrentMaxLoadInRoute(VehicleRoute route) {
        Capacity maxLoad = stateGetter.getRouteState(route, InternalStates.MAXLOAD, Capacity.class);
        if(maxLoad == null) maxLoad = Capacity.Builder.newInstance().build();
        return  maxLoad;
  }
View Full Code Here

TOP

Related Classes of jsprit.core.problem.Capacity

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.