# System Proposal for Mass Transit Service Quality Control Based on GPS Data
## 5 System Overview
### The SQCM
#### 5.2.1 The Improved Transport Network Model
If the centroid of the cluster is not close to any bus stops and the scatter of the readings belonging to the cluster is low, then it is a set of readings associated with a singular point in the route, with the centroid being the position that represents the traffic signal being identified. The third set in Figure 4 is a case of this type along the sample route. * Unidentified cluster. If the cluster exhibits high scatter in the GPS readings, then it is a cluster with readings associated with more than one point at which the vehicle stops systematically (bus stop or traffic signal). In Figure 4, the fourth and fifth sets illustrate a case of this type, just like the last three sets. For each cluster of this type, a new iteration is performed, and each time, the K-means algorithm restricted to the points assigned to the cluster being studied is applied, taking as an initial approximation in the second and following iterations the points associated with bus stops that are known, that belong to the cluster and the centroid of the cluster obtained. Thus, the points will be grouped on the new centroids, each of which is located around the bus stops and traffic signal points of the cluster. The operation must be reiterated until a result is obtained for which the points are grouped at short distances from the centroids of their cluster. If the centroid of one of these clusters is very close (less than 25 m) to a bus stop point known, then the cluster represents readings of bus stop. In contrast, if the centroid is not close to a bus stops point known then the cluster is associated with a point of traffic signal that has been identified. The route to be analysed for quality of service is \(r\) and \(P_{r}\) is the ordered set of \(n\) stops on the line. \(RAVL_{r,T}\) is the set of GPS data obtained by all the vehicles that have completed route \(r\) during \(T\), the period of time to be analysed. The subset \(ZAVL_{r,T}\) is defined as the subset of \(RAVL_{r,T}\), consisting of only GPS stationary vehicle data. Thus:  
\[\forall RAVL\in ZAVL_{r,T}:RAVL\in RAVL_{r,T}\wedge RAVL_{vel}=0\]  
Figure 4: Cases of overlapping position data for stationary vehicles. Once the \(ZAVL_{r,T}\) set has been obtained, the first iteration of the \(k\)-means classifier is executed to split the \(ZAVL_{r,T}\) set into \(n\) classes, taking as an initial approximation \(n\) centroids associated with each stop on the route. As a result \(n\) subsets of \(ZAVL_{r,T}\) will be obtained, in which each subset \(i\) corresponds to the data belonging to class \(i\), where \(1\leq i\leq n\). Each subset \(i\) is represented by \(ZAVL_{r,T,i}\) and its centroid by \(C_{r,T,i}\). If all \(ZAVL_{r,T,i}\) clusters have only one stop and all GPS stationary data are at a distance from the centroid \(C_{r,T,i}\) that is less than the threshold \(U\), then the classification has converged in a solution in which we have reliably associated all stationary speed data with stops. Otherwise, if there is a cluster in which there is no stop, then that cluster contains GPS stationary data associated with unscheduled stops made by vehicles that have completed route \(r\) and there is at least one class with more than one stop. For each cluster with more than one stop the \(k\)-means classifier is only executed with the readings belonging to the class, and so on. Once all stationary data of a \(ZAVL_{r,T}\) set have been classified, \(m\) classes are obtained, where \(m\geq n\). The number of \(m\) classes is greater than \(n\) when at least one class has been obtained with GPS stationary data to which no stop belongs, and these readings are due to the vehicle stopping systematically at a point which is not a bus stop; we shall call these points unscheduled stop points on route \(r\). The centroids of this type of cluster are added to the geographic database of the transport network as points of interest, to be taken into account when calculating the journey times of the different routes that pass through these points.