# 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
The set of \(m\) centroids associated with route \(r\) is represented by \(C_{r,T}\), and \(C_{r,T,p}\) is a subset of this set and consists only of the centroids that represent the GPS stationary data associated with stops on the route. The subset \(C_{r,t,p}\) will be used to obtain arrival times when vehicles stop at every stop \(p\). Below, Algorithm 1, we algorithmically describe the technique used to obtain the points of interest on route \(r\), which as mentioned above are points where vehicles stop systematically without being stops on a route. The algorithm is recursive and uses three input parameters. The first parameter is a set of GPS coordinates for the route to be analysed, thus in the first invocation the \(AVL_{r,T}\) set is used as the initial set of GPS data, consisting of the coordinates obtained by the vehicles when operating route \(r\) for time period \(T\). The second parameter is the number of classes to be classified; in the first invocation the value of this parameter is the number of stops along the route. The third parameter corresponds to the initial approximations to each of the centroids of the classes; the input data in the first invocation are the GPS positions of the stops. As the output set, the \(C_{r,T}\) set of centroids is obtained, representing each of the classes into which all the stationary data have been clustered. Figure 5 illustrates a real-life result for this classification technique applied to the route studied in this article. It shows a map of part of the route with the position data, represented by blue and red dots, and the positions of two centroids of stationary data clusters, the red icons labelled with numbers 5 and 6, acquired during the analysed line services. Three stops on the route are identified by blue bus icons. The red dots represent GPS readings with zero horizontal velocity used by the classification technique to identify centroids of stationary data clusters. We can also see from the map that there is a section between two of these stops containing a roundabout, hence the classification technique applied to stationary data on this section produces three clusters; following the route, these correspond to the following: the first, to the first stop of the section, the second, to the point where vehicles stop to join the roundabout--the red icon labelled with the number 5--and the third, to the second stop. Therefore, to calculate the arrival time at each of these stops, only the data pertaining to each of their clusters are considered, and data pertaining to the clusters represented by the centroid labelled with the number 5 are ignored. A similar case occurs with the stationary vehicle points in the proximity of the point represented by the red icon labelled with the number 6, which corresponds to a point where there is a stop sign and to the bus stop closest to this point. The technique that we have described classifies these points into two clusters, using only stationary vehicle data belonging to the cluster associated with the stop to obtain the arrival time at this stop. ``` Procedure Classifier_Stationary_Data (\(Q_{r}\), \(N\), \(C_{r}\)) Input data: \(Q_{r}\): set of position data obtained by vehicles operating line services on route \(r\). \(N\): number of classes to be classified. \(C_{r}\): set of initial approximations to centroids. Output data: \(C_{r,T}\): centroids representing each of the classes of GPS stationary data. Initial values: \(Z_{r}=\O\); Step 1: Obtain \(Z_{r}\) which is the set of GPS stationary data on route \(r\): For each RAVL position reading belonging to \(Q_{r}\), if \(RAVL_{vel}=0\) then include \(RAVL\) in \(Z_{r}\). End if Done Step 2: Classifying by procedure \(K\_\)means_classifier (\(Z_{r}\), \(n\), \(P_{r}\), \(Z_{r}\), \(C_{r}\)) Input data: \(Z_{r}\): set of stationary data to be classified. \(n\): number of stops on the route. \(P_{r}\): positions of the \(n\) stops on route \(r\).