## 4 Discussing Correlation between Bus Driving Cycles
For practical reasons, the vehicle speed and acceleration is discretized in intervals of 0.28 m/s and m/s\({}^{2}\) corresponding to the measuring sensibility of 1 km/h and the sampling rate of 1 s. Let \(N_{i,j}\) be the number of times the vehicle speed is \(v_{i}\) and acceleration is \(a_{j}\) during a cycle with duration \(N\), the probability of being in state \((v_{i},a_{j})\) in the previous time can be estimated as:  
\[P_{v_{i},a_{j}}=\frac{N_{i,j}}{N} \tag{18}\]  
where, since the sum of the probabilities of all outcomes must equal 1, then:  
\[N=\sum_{j}\sum_{i}N_{i,j} \tag{19}\]  
Note that the distribution of all the cycles share common characteristics as an attractor at \(v=0\), \(a=0\) due to the frequent stops of the vehicle, and a reduction in acceleration as speed increases due to vehicle power constraints or maximum velocities around 14 m/s due to urban speed limits (50 km/h). However, despite there being a clear relation between probability distributions shown in Figure 5, the quantification of how one of the cycles may be representative of the rest requires a deeper analysis beyond the visual inspection. The singular value decomposition (SVD) of a matrix \(X\) is a factori  
Figure 5: Representation of the vehicle speed–acceleration probability distribution (SAPD) for the 19 loops recorded. of three matrices (\(X=USV^{T}\)), such that \(U\) and \(V\) are orthogonal matrices and \(S\) is a diagonal matrix with decreasing, non-negative singular values (\(\sigma\)). The explanation of the method is beyond the scope of the present paper and can be found in general linear algebra or machine learning literature [40]. However it is interesting to recall that SVD provides the optimal (in the sense of minimum square error) low-rank approximation of a matrix, then providing the most dominant patterns in the data. Then, rearranging the velocity-acceleration distributions for every cycle in Figure 5 as columns of a matrix, and applying the SVD algorithm, it is possible to obtain the 19 linearly independent modes shown in Figure 6. Any of the vehicle SAPDs in Figure 5 are a linear combination of the modes in Figure 6 and provide a limited model order (consider only \(r<19\) modes); the first \(r\) modes provide the best estimation of the distribution. One can observe how the first mode certainly resembles any of the distributions in Figure 6 (and actually is their average) and, as the mode number increases, this resemblance progressively disappears. The singular values (\(\sigma\)), which are the elements in the diagonal of the \(S\) matrix, represent the weight of the modes on the description of the data in matrix \(X\), and as they are ranked in decreasing order, the first singular values (and corresponding modes) contain the leading information. The last plot in Figure 6 analyzes the percentage of signal contained as the number of considered modes increases. It can be observed that the first singular value (corresponding to the average) accounts for 88% of the data variance and that with three modes this figure increases above 90%. Both frequency and vehicle speed-acceleration analyses show that there is a close relation between the operating conditions reached by the bus in the different loops of the selected route. Consequently, an optimization of the vehicle energy management for one of the loops might offer useful information to apply in the rest. Proposed Algorithm: Dynamic Programming Optimization of a Reference Loop and One-Step Look-Ahead Rollout  
While the perfect knowledge of the driving conditions is not possible, the preceding section shows that there is a close relation between the different loops covered by the bus within the route. In this sense, this paper proposes to use an arbitrary loop to make a DP optimization and employ the result as a base policy for vehicle energy management. Of course, despite similarities, all the loops are not exactly the same and deviations may lead to undesired vehicle behavior, e.g., fully depleting the battery or exceeding its maximum charge.