Exemplo n.º 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);
    }
Exemplo n.º 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;
 }