public void visit(TourActivity activity) {
   for (Vehicle vehicle : vehicles) {
     double latestArrTimeAtPrevAct =
         latest_arrTimes_at_prevAct[vehicle.getVehicleTypeIdentifier().getIndex()];
     Location prevLocation = location_of_prevAct[vehicle.getVehicleTypeIdentifier().getIndex()];
     double potentialLatestArrivalTimeAtCurrAct =
         latestArrTimeAtPrevAct
             - transportCosts.getBackwardTransportTime(
                 activity.getLocation(),
                 prevLocation,
                 latestArrTimeAtPrevAct,
                 route.getDriver(),
                 vehicle)
             - activity.getOperationTime();
     double latestArrivalTime =
         Math.min(
             activity.getTheoreticalLatestOperationStartTime(),
             potentialLatestArrivalTimeAtCurrAct);
     if (latestArrivalTime < activity.getTheoreticalEarliestOperationStartTime()) {
       stateManager.putTypedInternalRouteState(
           route, vehicle, InternalStates.SWITCH_NOT_FEASIBLE, true);
     }
     stateManager.putInternalTypedActivityState(
         activity, vehicle, InternalStates.LATEST_OPERATION_START_TIME, latestArrivalTime);
     latest_arrTimes_at_prevAct[vehicle.getVehicleTypeIdentifier().getIndex()] = latestArrivalTime;
     location_of_prevAct[vehicle.getVehicleTypeIdentifier().getIndex()] = activity.getLocation();
   }
 }
 /**
  * Calculates actEndTime assuming that activity can at earliest start at
  * act.getTheoreticalEarliestOperationStartTime().
  *
  * @param actArrTime
  * @param act
  * @return
  */
 public static double getActivityEndTime(double actArrTime, TourActivity act) {
   return Math.max(actArrTime, act.getTheoreticalEarliestOperationStartTime())
       + act.getOperationTime();
 }