Ejemplo n.º 1
0
 private double transportCost(TourActivity activity) {
   return transportCost.getTransportCost(
       prevAct.getLocation(),
       activity.getLocation(),
       prevActDeparture,
       route.getDriver(),
       route.getVehicle());
 }
Ejemplo n.º 2
0
 @Override
 public void visit(TourActivity activity) {
   double distance =
       distanceCalculator.getDistance(prevAct.getLocation(), activity.getLocation());
   sum_distance += distance;
   stateManager.putActivityState(activity, distance_id, sum_distance);
   prevAct = activity;
 }
Ejemplo n.º 3
0
 private double c(TourActivity from, TourActivity to, Vehicle vehicle) {
   return vrp.getTransportCosts()
       .getTransportCost(
           from.getLocation(),
           to.getLocation(),
           from.getEndTime(),
           DriverImpl.noDriver(),
           vehicle);
 }
Ejemplo n.º 4
0
 /**
  * @param activity to get the waiting from
  * @param route where activity should be part of
  * @return waiting time at activity
  */
 public Double getWaitingTimeAtActivity(TourActivity activity, VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   if (activity == null) throw new IllegalArgumentException("activity is missing.");
   double waitingTime = 0.;
   if (activityPolicy.equals(ActivityTimeTracker.ActivityPolicy.AS_SOON_AS_TIME_WINDOW_OPENS)) {
     waitingTime =
         Math.max(0, activity.getTheoreticalEarliestOperationStartTime() - activity.getArrTime());
   }
   return waitingTime;
 }
Ejemplo n.º 5
0
 /**
  * @param activity to get the load from (before activity)
  * @return load just before the specified activity. If act is Start, it returns the load
  *     atBeginning of the specified route. If act is End, it returns the load atEnd of specified
  *     route.
  */
 public Capacity getLoadJustBeforeActivity(TourActivity activity, VehicleRoute route) {
   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;
 }
Ejemplo n.º 6
0
 @Override
 public void finish() {
   double distance =
       distanceCalculator.getDistance(prevAct.getLocation(), route.getEnd().getLocation());
   sum_distance += distance;
   stateManager.putRouteState(route, distance_id, sum_distance);
 }
Ejemplo n.º 7
0
    @Override
    public void visit(TourActivity activity) {
      // waiting time & toolate
      double waitAtAct = 0.;
      double tooLate = 0.;
      if (activityPolicy.equals(ActivityTimeTracker.ActivityPolicy.AS_SOON_AS_TIME_WINDOW_OPENS)) {
        waitAtAct =
            Math.max(
                0, activity.getTheoreticalEarliestOperationStartTime() - activity.getArrTime());
        tooLate =
            Math.max(0, activity.getArrTime() - activity.getTheoreticalLatestOperationStartTime());
      }
      sum_waiting_time += waitAtAct;
      sum_too_late += tooLate;
      // transport time
      double transportTime = activity.getArrTime() - prevActDeparture;
      sum_transport_time += transportTime;
      prevActDeparture = activity.getEndTime();
      // service time
      sum_service_time +=
          activityCosts.getActivityDuration(
              activity, activity.getArrTime(), route.getDriver(), route.getVehicle());

      stateManager.putActivityState(activity, transport_time_id, sum_transport_time);
    }
Ejemplo n.º 8
0
    @Override
    public void visit(TourActivity activity) {
      stateManager.putActivityState(activity, last_transport_distance_id, distance(activity));
      stateManager.putActivityState(activity, last_transport_time_id, transportTime(activity));
      stateManager.putActivityState(activity, last_transport_cost_id, transportCost(activity));

      prevAct = activity;
      prevActDeparture = activity.getEndTime();
    }
Ejemplo n.º 9
0
 /**
  * @param activity to get the time window violation from
  * @param route where activity needs to be part of
  * @return time violation of activity
  */
 public Double getTimeWindowViolationAtActivity(TourActivity activity, VehicleRoute route) {
   if (route == null) throw new IllegalArgumentException("route is missing.");
   if (activity == null) throw new IllegalArgumentException("activity is missing.");
   return Math.max(0, activity.getArrTime() - activity.getTheoreticalLatestOperationStartTime());
 }
Ejemplo n.º 10
0
 private double distance(TourActivity activity) {
   return distanceCalculator.getDistance(prevAct.getLocation(), activity.getLocation());
 }
Ejemplo n.º 11
0
 private double transportTime(TourActivity activity) {
   return activity.getArrTime() - prevActDeparture;
 }