Beispiel #1
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);
    }
Beispiel #2
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;
 }
Beispiel #3
0
 @Override
 public void finish() {
   sum_transport_time += route.getEnd().getArrTime() - prevActDeparture;
   sum_too_late +=
       Math.max(
           0,
           route.getEnd().getArrTime()
               - route.getEnd().getTheoreticalLatestOperationStartTime());
   stateManager.putRouteState(route, transport_time_id, sum_transport_time);
   stateManager.putRouteState(route, waiting_time_id, sum_waiting_time);
   stateManager.putRouteState(route, service_time_id, sum_service_time);
   stateManager.putRouteState(route, too_late_id, sum_too_late);
 }
Beispiel #4
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());
 }