# Attention Horizon as a Predictor for the Fuel Consumption Rate of Drivers
## 2 Materials and Methods
### Extraction of Red Light-Approaching Trajectories
```
ProcedureFindPaths(C, S, T) \(SP\leftarrow\{i\;i_{i}\in S\wedge s_{i}<1\}\)// All point indices with slow vehicle speed \(P\leftarrow\emptyset\)// P: The set of extracted traffic light paths For\(i\in SP\) If\(\
exists(R,D)\in P\) such that \(i\in R\) \(t\gets T(c_{i})\)// \(t\): coordinates of the closest traffic light \(j\gets i+1\) While\(j\leq N\wedge(dist(c_{i},t)<dist(c_{i-1},t)\wedge dist(c_{i},t)<50)\)// Distance unit is meters \(j\gets j+1\) End While If\(dist(c_{j}\gets 1,t)<5\)//Distance unit is meters \(j>1\wedge(j-1\in SP\lor j\
otin SP)\)//Go back to the last slowdown point \(j\gets j-1\) End While \(P\gets P\cup CreatePath(C,j,t,P)\) Break End If End If End For Return\(P\) End Procedure
```  
**Algorithm 1** Finding the set of paths before stopping at red traffic lights during a day for a vehicle  
```
ProcedureCreatePath(C, j, t, P) \(k\gets 1\) \(d_{k}\gets 0\)// \(d_{k}\): Traversed distance to the stopping point at the path's \(k\)-th index \(r_{k}\gets j\)// \(/r_{k}\): The data point index at the path's \(k\)-th index \(k\gets L_{p}\wedge r_{k}>1\wedge[\
exists(R,D)\in P\) such that \(r_{k-1}\in R]\) \(k\gets k+1\) \(r_{k}\gets r_{k-1}-1\) \(d_{k}\gets d_{k-1}+dist(c_{n},c_{n_{k-1}})\) End While \(R\leftarrow\langle r_{1},r_{2},...,r_{k}\rangle\) \(D\leftarrow\langle d_{1},d_{2},...,d_{k}\rangle\) If\(d_{k}\geq L_{p}\)// If the path's traversed distance is greater than \(L_{p}\) Return\(\langle(R,D)\rangle\) Else Return\(\emptyset\) End If End Procedure
```  
**Algorithm 2** Creating a path given its closest point to the traffic light  
``` ProcedureCreatePath(C, j, t, P) \(k\gets 1\) \(d_{k}\gets 0\)// \(d_{k}\): Traversed distance to the stopping point at the path's \(k\)-th index \(r_{k}\gets j\)// \(/r_{k}\): The data point index at the path's \(k\)-th index \(k\gets L_{p}\wedge r_{k}>1\wedge[\
exists(R,D)\in P\) such that \(r_{k-1}\in R]\) \(k\gets k+1\) \(



### Extraction of Attention Horizon

Let us assume that we have a sequence of timestamped data points for a vehicle as it is approaching a traffic light before stopping at it. At each point of the sequence we know the position (measured in percent, where 0% means fully released and 100% means fully pressed) for the accelerator and brake pedals. AH is an estimation of the point at which a driver starts to take action to stop when approaching a red traffic light. It is calculated in meters and can be in the range between 0 and \(L_{p}\) meters, i.e., the length of extracted paths. In general, it is of course difficult to precisely define what kind of indicators should be used to capture a driver's \"decision\" in this sense. There is a natural ebb and flow to a vehicle's speed in traffic, for example, based on the road topology and distances to other traffic participants. In this work, we have chosen to be conservative, and consider lack of acceleration to be an indication of stopping intention. Technically, we define AH as the last point where the acceleration pedal was pressed before starting to slow down, leading to a stop. This can be interpreted formally as

\[AH=\frac{L_{p}}{N_{p}}l\,\quad l= \begin{cases}\underset{i\in E}{\text{min}}\ i &\text{if }E\
eq\emptyset\\ N_{p}&\text{otherwise}\end{cases} ,\quad E=\{\ i\ |\ \ a_{i}\geq t_{A}\wedge[\ \exists\,k\leq i\ s.t.\ b_{k}<t_{B} \ ]\ \}. \tag{1}\]

Here, \(t_{A}\) and \(t_{B}\) are the minimal thresholds on the acceleration and brake pedal positions, respectively. We assume that the pedals are not pressed when their positions are below these thresholds. It is also important to note that we exclude from AH calculations those path sequences that have more than one stopping point before the traffic light position. Situations where that happens are usually difficult to interpret, and often indicate traffic conditions where the driver has limited freedom of action. In the end, it leads to significant decrease in the variance of the calculated AH, as explained by different path conditions.