# Generating Activity-Based Mobility Plans from Trip-Based Models and Mobility Surveys
## 3 Materials and Methods
### Approach
#### Step 1: Determining One Anchor Time per Day
In case both the activity start time and duration are available, the duration and the end time of that activity are already inserted into the mobility plan. In the case of work activities, the provided duration is the total daily duration of all work activities. Therefore, the provided work duration is distributed randomly to all of the day's work and work-related activities. **Step 2: Drawing the Activity Durations**  
The activity duration distributions model the durations of activities. For each activity type \(p\), including the activity of being at home, one PDF \(f_{p}^{T}(\Delta t,parameters_{p})\) of activity durations \(\Delta t\) over a continuous random time variable \(T\) is created. The distribution fitting process is the same as for driving willingness. While the durations of the main and secondary activities might not exactly follow the same distributions, there is no differentiation between the main and secondary activities, as this differentiation would have to be made for the activity chains as well. This in turn would increase the number of unique activity chains and, at the same time, reduce the number of samples per unique activity chain. The probability \(\Pi_{\text{bin}_{i}}\) of \(bin_{i}\) is  
\[\Pi_{\text{bin}_{i}}~{}=~{}\int\limits_{\Delta t^{\prime}\in bin_{i}}f_{p}^{T} (\Delta t^{\prime},parameters_{p})\text{d}\Delta t^{\prime}. \tag{16}\]  
where \(f_{p}^{T}\) is the PDF of the duration distribution and \(T\) is the random continuous time variable. The distribution type is specific to the activity type \(p\) which, along with the fitting parameters \(parameters_{p}\), resulted from the distribution fitting process. The activity duration distributions have \(len_{bin,dur}~{}=~{}5\) min, which is the implicit resolution of the survey data. Out of the 15,815 trips for which duration information was provided, 90.2% or 14,260 trips had a reported duration of a multiple of 5 min, making it the most common multiple aside from the trivial multiple of 1 min. Due to most distributions being strongly skewed toward short durations, the bin size was chosen to be equal to the lower bound (i.e., the implicit resolution). Using the bin probability, a bin was drawn, and the lower edge of the drawn bin was used as the duration. The choice of the lower edge over the bin's center was made to not underrepresent the bin containing the value 0. If the bin's center were used, half of the bin containing 0 would be in the negative space and have a probability of 0. This choice would, however lead to a systematic underestimation of values, further motivating a small bin size to reduce the error. The durations were drawn for all but the day's last activities to not over-determine the schedule. Since there is one anchor time per day, \(n-1\) out of \(n\) activities between two anchor times can have an independent duration. Furthermore, given that most mobility surveys cover 24 h starting at midnight, the duration of the last activity ending the following day is not known, (i.e., no duration distribution can be derived). The activity of being home was considered an activity like any other when it was encompassed by two non-home activities during the day. For this purpose, the duration distribution for this activity type was generated as well. **Steps 3 & 4: Calculating the Activity End Times for All Activities and Calculating the Day's Last Activity's Duration**  
The durations are iteratively inserted into the mobility plan, originating from the anchor time and calculating the drive times to or from the activities in each iteration. By calculating the drive times in each iteration, the algorithm is prepared for calculating time-of-day-dependent drive times, as the departure or arrival times are known when calculating the drive time. As stated above, the duration of the day's last activity cannot be drawn, but it is calculated in the fourth step from the penultimate activity's end time, drive time to get there, and its own end time, which is on the following day.