# On the Impact of the Rules on Autonomous Drive Learning
## 3 Model
### Drivers
#### 3.3.1 Observation  
For the driver of a car \((p,x,y,v_{x},v_{y},s)\), the set of visible cars in the \(j\)th relative lane, with \(j\in\{-1,0,1\}\), is the union of the set \(V_{\text{same},j}\) of cars that are in the same segment and the same or adjacent lane and the set \(V_{\text{next}}\) of cars that are in one of the next segments \(p^{\prime}\in n(p)\), in both cases with a distance shorter than \(d_{\text{view}}\):  
\[V_{\text{same},j} =\Big{\{}(p^{\prime},x^{\prime},y^{\prime},v^{\prime}_{x},v^{ \prime}_{y},s^{\prime}):p^{\prime}=p\wedge 0<x^{\prime}-x\leq d_{\text{view}} \wedge y^{\prime}=y+j\Big{\}} \tag{8}\] \[V_{\text{next}} =\Big{\{}(p^{\prime},x^{\prime},y^{\prime},v^{\prime}_{x},v^{ \prime}_{y},s^{\prime}):p^{\prime}\in n(p)\wedge x_{\text{stop}}+x^{\prime} \leq d_{\text{view}}\Big{\}} \tag{9}\]  
We remark that the set of cars \(V_{j}=V_{\text{same},j}\cup V_{\text{next}}\) includes also the cars in the next segments: the current car is hence able to perceive cars in a intersection, when in a segment, or in the connected sections, when in an intersection, provided that they are closer than \(d_{\text{view}}\).  
The driver's observation is based on the concept of _jth lane closest car_\(c_{j}^{\text{closest}}\), based on the set \(V_{j}\) defined above. For each driver, \(c_{j}^{\text{closest}}\) is the closest one in \(V_{j}\):  
\[c_{j}^{\text{closest}}=\begin{cases}\operatorname*{arg\,min}_{(p^{\prime},x^ {\prime},y^{\prime},v^{\prime}_{x},v^{\prime}_{y},s^{\prime})\in V_{j}}\mathbb{1 }\left(p^{\prime}=p\right)(x^{\prime}-x)+\mathbb{1}\left(p^{\prime}\
eq p \right)(x_{\text{stop}}+x^{\prime})&\text{if }V_{j}\
eq\emptyset\\ \emptyset&\text{otherwise}\end{cases} \tag{10}\]  
where \(V_{j}=V_{\text{same},j}\cup V_{\text{next}}\) and \(\mathbb{1}:\{\text{false},\text{true}\}\to\{0,1\}\) is the indicator function. Figure 1 illustrates two different examples of \(j\)th lane closest car, with \(j=0\). We can see that the \(c_{j}^{\text{closest}}\) might not exist for some \(j\), either if there is no car closer than \(d_{\text{view}}\) or if there is no such \(j\)th lane.  
Figure 1: Distance between cars in different cases.  
We define the _closeness_ variables \(\delta_{x,j}\in[0,d_{\text{view}}]\), with \(j\in\{-1,0,1\}\), as the distances to the \(j\)th lane closest cars \(c_{j}^{\text{closest}}\), if any, or \(d_{\text{view}}\), otherwise. Similarly, we define the _relative speed_ variables \(\delta_{v,j}\in[-v_{\text{max}},v_{\text{max}}]\), with \(j\in\{-1,0,1\}\), as the speed difference of the current car with respect to the \(j\)th lane closest cars \(c_{j}^{\text{closest}}\), if any, or \(v_{\text{max}}\), otherwise.  
At each time step of the simulation, each driver observes the distance from its car to the next road element, indicated by \(x_{\text{stop}}\), the current lane \(y\), the current linear speed \(v_{x}\), the status of its vehicle \(s\), the road element type \(e=\mathbb{1}(p\in S)\) its car is currently on, the closeness variables \(\delta_{x,j}\), and the relative speed variable \(\delta_{v,j}\). We define each driver _observation_ as: \(o=\big{(}x_{\text{stop}},y,v_{x},s,e,\delta_{x,-1},\delta_{x,0},\delta_{x,1}, \delta_{v,-1},\delta_{v,0},\delta_{v,1}\big{)}\), therefore \(o\in O=[0,l_{\text{max}}]\times\{1,w_{\text{max}}\}\times[0,v_{\text{max}}] \times\{\text{alive},\text{dead}\}\times\{0,1\}\times[0,d_{\text{view}}]^{3} \times[-v_{\text{max}},v_{\text{max}}]^{3}\).