# Exploring Hybrid-Multimodal Routing to Improve User Experience in Urban Trips
## 3 Evaluation Framework
### Route Combination  
The processes between Steps iii and vi (Section 3.2) are repeated for every flow inside its respective \(\left\langle\mathrm{hour,weekday}\right\rangle\) class. A flow is defined by an origin, a destination, and a weight based on the number of trips. For every flow, we obtain a list of alternative routes, including the traditional, and the hybrid options to be compared. Algorithm 1[7] shows how this list of alternatives is produced.  
Figure 3: Example of Multi-Layer Geographical Linkstream.  
```
1:Input: Origin and destination of a flow.
2:Output: List with the route alternatives for the flow.
3:\(drive\_way\leftarrow\) get_driving_way(\(origin\), \(destination\))
4:\(start\_transitions\gets new\ List()\)
5:\(end\_transitions\gets new\ List()\)
6:\(options\gets new\ List()\)
7:\(previous\_step\leftarrow\) none
8:
9:\(push\)(\(start\_transitions\), \(origin\))
10:push(\(end\_transitions\), \(destination\))
11:
12:for\(step\)in\(drive\_way\_steps\)do
13:if\(is\_\)congested(\(step\))then
14:if\(is\_\)congested(\(previous\_step\))then
15:pop(\(end\_transitions\))
16:push(\(end\_transitions\), \(step\_destination\))
17:else
18:push(\(start\_transitions\), \(step\_origin\))
19:push(\(end\_transitions\), \(step\_destination\))
20:endif
21:\(previous\_step\gets step\)
22:endif
23:endfor
24:for\(st\)in\(start\_transitions\)do
25:for\(et\)in\(end\_transitions\)do
26:\(opts\leftarrow\) get_options(\(origin\), \(st\), \(et\), \(destination\))
27:concat(\(options\), \(opts\))
28:endfor
```  
**Algorithm 1** Evaluate route alternatives for trip flows.  
Algorithm 1 starts (Line 1) by calling the get_driving_way function (Step iii), with the origin and destination as arguments. This function calls the TomTom Routing API ([[https://developer.tomtom.com/](https://developer.tomtom.com/)]([https://developer.tomtom.com/](https://developer.tomtom.com/)), accessed on 14 May 2021), which returns a list of steps to perform the trip and traffic data. In Lines 7 and 8, the algorithm appends the origin and destination to the list of transition starts and ends. They are added to create the possibility of full trips being performed in single modes (i.e., the traditional routes). The foreach command in Line 10 populates the transition lists according to the state of traffic (Step iv). This state is evaluated via the function is_congested, which indicates whether it has traffic or not. This binary classification is only used to produce the route options. When evaluating the Quality of Experience (QoE), we consider the time that would be spent on the congestion, which is assessed based on historical data using the TomTom API. Note that the steps with bad traffic conditions in a row are merged in the **if** command in Line 12 just by updating the end_transitions list.  
Lines 23 and 24 contain the foreaches that are responsible for combining the transition points (Step v). Inside these foreaches, a call to the get_options function evaluates all alternatives considering a tuple with an origin, destination, start transition, and end transition. This function uses the data populated in the MLGLS to identify the actual transition points, when considering mode characteristics (e.g., bus stops). Next, the function evaluates the possible options and saves data about traffic, waiting times, duration, and prices for every step and the mode used to compose it.  
The resulting list of options is concatenated to a list with all options (Line 26) to be saved, as described in Step vi. After evaluating all of the route alternatives, they are compared with the traditional routes using the metrics duration, price, and user experience (Step vii). Section 4 describes how to evaluate the user-experience model. The route combination and analysis code is open source, being distributed under the SMAFramework [30] on Github ([[https://github.com/diegposo/smaframework](https://github.com/diegposo/smaframework)]([https://github.com/diegposo/smaframework](https://github.com/diegposo/smaframework)), accessed on 12 May 2021).