## 3 Agent-Based Model for Co-Traveling
### Problem Layer
#### 3.3.2 Negotiation  
The final decision to form a carpool group is taken in the negotiation process where the actual matching is applied using similarity constraints. The negotiation among agents is taken into account for the selection of departure times of the multiple trips (morning and evening) and also to select the driver of the carpool group. The schedule is adapted based on the preferences amongst the feasible schedules of the agents. The negotiation will become successful only when the driver is available and the preferred trip departure times for both the trips are commonly well-matched within the carpool group. Compatible indicators (described in more detail below) are used in the negotiation process. Driver and Vehicle Selection  
During the negotiation process, the agent's personal profile is used for the driver and vehicle selection. The agent having the car and the driving-license ownership may be selected as a driver when carpooling. The driver in the carpool is responsible for picking other carpool participants from their home-locations. Hence the first agent of the candidate sequence shall be the driver. The candidate sequence can be considered infeasible and dropped immediately, where the first agent cannot act as the driver. Time Intervals Similarity  
In this study, every moment or interval between the earliest and latest possible trip departure time in the time windows as indicated by the candidate carpoolers is supposed to be equal. The time preference function is the same for each participant over the time and supposed to be constant. For matching agents, time windows equipped with a constant preference function, i.e., \(\forall t\in I:P(t)=1\) are used. For each trip (either \(HW\) or \(WH\)) of an agent, two time windows (departure and arrival) are used. Let \(A\) be a set of all individuals or agents. For an agent \(a_{i}\), the earliest and latest departure time intervals for the trip are \(T^{b}_{a_{i}}\), \(T^{c}_{a_{i}}\) and the preferred trip start time of \(a_{i}\) is \(t_{a_{i}}\). The time windows of carpooling participants at the specific TAZ-location \(l_{i}\) are represented by \(T_{carpool,l_{i}}\). The departure and arrival time windows for the carpool trips are the intersection of the departure and arrival time windows of the particular participants. The earliest \(T^{b}_{carpool,\ l_{i}}\) and latest \(T^{c}_{carpool,\ l_{i}}\) intervals of the intersection of the time windows can be calculated as specified in Equation (1); the indices used for the maximum and minimum range are max() and min() functions, respectively, over the set of carpooling candidates. The available departure and arrival time intervals of trips for the carpool group are given by Equation (1), where \(j\) recognizes the candidate carpooler. \[T^{b}_{carpool,\ l_{i}}=\underset{j=1...N}{max}\left(T^{b}_{a_{j}}\right) \tag{1}\] \[T^{e}_{carpool,\ l_{i}}=\underset{j=1...N}{min}\left(T^{e}_{a_{j}}\right) =\bigcap_{j=1}^{N}T_{a_{j}\ l_{i}}\]  
For some \(l_{i}\), when the time windows \(T_{carpool,\ l_{i}}\) of the individuals participating in the negotiation process are empty (the \(T_{carpool,\ l_{i}}\) do not intersect), the case is considered as infeasible (given by the Equation (2)). Similarly when the time windows of the trip departure times intersect, then the case is feasible (given by the Equation (2)) and the negotiation among participants on the trip departure time succeeds. \[\forall_{h}:\ \ T_{carpool,\ l_{i}}=0\ \text{infeasible case} \tag{2}\] \[T_{carpool,\ l_{i}}\
eq 0\ \text{feasible case}\]  
Hence, a carpooling participant may join the carpool group if and only if the desired trip departure times are within the suitable intervals and can be achieved by Equation (3). \[\bigcap_{j=1}^{N}T_{HW,\ a_{j}\ l_{i}}\cdot\bigcap_{j=1}^{N}T_{WH,\ a_{j}\ l_{i}}\ \
eq\ 0 \tag{3}\]  
Detour or maximum excess time duration integrates the path similarity concepts which are assigned to each individual of the ordered pair that specifies the OD (Origin-Destination) pairs are involved in the particular trips.