Research Article

Discovering Travel Spatiotemporal Pattern Based on Sequential Events Similarity

Algorithm 1

Travel sequence similarity algorithm (TSSA).
Input: Travel sequence L1 and L2
Output: Similarity of L1 and L2
Initialization: Set score matrix M to 0
(1)for i ⟵ 0 to |L1| do
(2)M[i][0] ⟵ id2;
(3)end for
(4)for j ⟵ 0 to |L2| do
(5)M[0][j] ⟵ jd2;
(6)end for
(7)for i ⟵ 1 to |L1| do
(8)for j ⟵ 1 to |L2| do
(9)  if Overlap (L1[i].p.type, L2[j].p.type) then, //Overlap (a, b) means the attraction type labels of POI a and POI b overlap
(10)   Spoi ⟵ PSA (L1[i].p, L2[j].p);
(11)   Stime ⟵ TSA (L1[i].t, L2[j].t);
(12)   sim ⟵ uSpoi + (1 − u) Stime;
(13)   M[i][j] ⟵ max(M[i − 1][j − 1] + sim, M[i − 1][j] + d2, M[i][j − 1] + d2);
(14)  else
(15)   M[i][j] ⟵ max(M[i − 1][j − 1] + d1, M[i − 1][j] + d2, M[i][j − 1] + d2);
(16)  end if
(17)end for
(18)end for
(19)return M[|L1| − 1][|L2| − 1];