# A Predictive Vehicle Ride Sharing Recommendation System for Smart Cities Commuting
## 2 Materials and Methods
### AI-Enabled Weighted Pattern Matching Model  
The system's back-end intelligence is based on an AI-enabled weighted pattern matching model. Such a model can take as input the current location of a pivot user invoke the stochastic historic places (i.e., historic window size \(m\)) she has visited in the near past and predict the future location of the user (i.e., prediction window size \(l\)). Time is encoded implicitly with regards to the sequentially modeling of the represented ordered historic places the user has visited, thus a user cannot get to work early in the morning if she does not leave first her home.  
However, note that each user's movement is assigned to a certain day temporal information of movement activity. This consecutive representation of visited places forms a user's movement trajectory. Vehicle ride sharing is feasible since the model searches the knowledge base for other users located nearly to pivot user's location with similar historic visited behavior per certain day of week. In addition, per certain returned user the model is able to check the future location after the current location.  
If the future location of a user (i.e., predicted next location) is similar to the pivot user's next location then the user is a candidate to be added to the recommendation list. It holds that similarity between two separate users' trajectories is inferred taking into consideration the spatial historic similarity threshold, \(\mu\), which assesses the similarity of the historic locations except of the current location. In addition, the prediction similarity threshold, \(\theta\), assesses the similarity of the current and the future prediction locations. Historic similarity threshold, \(\mu\), is more relaxed compared with prediction similarity threshold, \(\theta\), since the history information of the trajectory may vary a little between two trajectories. However, this is not the case with the prediction similarity threshold, \(\theta\), which is less relaxed since it is required that the current and future prediction commute locations should be similar enough in order the model to be more accurate. So, generally, it holds that:  
\[\theta<\mu \tag{1}\]  
Figure 1: Proposed system’s architecture: (1) System contains user’s daily trips and provide movement profiling; (2) Subsequently, system implicitly annotates time per day of week and handles the system’s knowledge base; (3) Concretely, system provides prediction and recommendation of similar users’ trajectories to support a shared vehicle commute.  
Both similarity thresholds are set experimentally to assure that the compared trajectories are similar enough to considered as a match for the adopted model. When both similarity thresholds comparison holds for the whole examined trajectory of a user and the pivot user's trajectory, then that user's trajectory is finally added to the recommendation list. The proposed model returns a list of recommended users (i.e., number of returned recommendations in defined as \(k\)), where the pivot user can choose to have a ride sharing in the SC. The characteristic of the shared commute users is that they travel towards to the same direction of the predicted location. The algorithm of the proposed model is presented in Table 1.