# Modeling Activity-Time to Build Realistic Plannings in Population Synthesis in a Suburban Area
## 4 Proposed Methodology to Set Time-Choices from Travel Survey
### Time-Choice Setting: Overview  
This section describes the process of setting start-time, end-time, and duration for each activity of an agent planning.  
For each activity of a plan, the following variables are calculated:  
* Potential current activity latest time: this references the latest time possible to end (leave) the current activity. This parameter depends on three components: -Maximum time is the latest simulation time, defined by the user. For example, for the generation of plan for a period of full day (starting at 00:00:00), the maximum time is 24:00:00. -Activity latest end-time: this is the latest possible time for the current activity, namely the activity closing-time. This value is extracted from the activity end-time distribution.  
Figure 4: Activity gap represents the time between the two visits (the red axis), and the agent can return and do the activity only after this gap time is passed (the green axis).  
Minimum latest remaining activities' start-time with travel time and duration: this is the latest possible time for an agent to leave the current activity while being able to reach (and participate in) all the remaining activities (Figure 5).
* Earliest next possible visit time: this is defined for the activities with a gap value. It represents the earliest time that an individual can start (or end) the current activity; this parameter depends the last visit time (that activity) and the gap value.
* Potential activity end-time range: this range is calculated based on the current activity attributes, namely (1) start-time, (2) duration and delay duration, (3) earliest next possible visit time, and (4) the current activity latest time.
* Selected end-time value: once the end-time range is calculated, an end-time is selected from this range and the selection process is based on the activity-distribution. The process is as follows:
* Select all possible end-time proportions from the activity-distribution which belong to the end-time range.
* Calculate the selection (normalized) probability for each proportion.
* Select an end-time proportion from the normalized distribution.
* Randomly select an end-time value from the selected proportion.
* Generate the travel time to the next activity: this parameter is calculated based on three components, namely Euclidean distance between current and next activity, the used transport mode travel-speed, and the generated travel time delay.  
The activity time-choice process is presented in Figure 6.  
Figure 5: Illustration of minimum latest remaining activities start-time with travel time and duration. The following case is proposed. A user starts the current activity \(Act\) at \(ST_{Act}\), and he must decide the end-time of this activity based on \(A\), \(B\) and \(C\). Each activity has a typical duration and a time-window (opening and closing time) \([OT-CT]\). The process is applied as follows: Firstly, the proposed value \(x_{A}\) (latest remaining activities start-time with travel time and duration of the activity \(A\)) is calculated, the value \(a\) references the sum of travel time from \(Act\) to \(A\) and the typical duration of \(A\); \(x_{A}\) references the subtraction of the travel time from latest start-time of \(A\). Secondly, \(x_{B}\) is calculated for the activity \(B\), the value \(b\) references the sum of travel time from \(A\) to \(B\), duration of \(B\), and the calculated \(a\). The same process is applied for \(x_{X}\) of the activity \(C\). Minimum latest remaining activities start-time with travel time and duration is then referenced to the minimum value \(x\) from the set: \(x_{A}\), \(x_{B}\), and \(x_{C}\).