\begin{algorithm}[t]
	\footnotesize
        \caption{T-Activity}
        \label{alg:t_activity}
		\begin{algorithmic}[1]
        \Require
	    	\Statex $S$ // semantic trajectory
            \Statex $K$ // set of POI Type Profiles
	        \Statex $radius$ // radius to intersect sub-stop centroids
            \Statex $ratio, minTime$ // ESD parameters
%           \Statex $scoreThreshold$ // similarity threshold for multi-activity inference

\State $T$ = $computeSubStops(S, ratio, minTime)$;
\ForEach {$stop$ in $T$}
\ForEach {$sub$ in $stop$}
\State $area$ = $buffer(sub.x, sub.y, radius);$
\State $near\_substops$ = $intersect(area, stop);$
\State $duration$ = $sum(near\_substops.getDuration());$
\State $freq$ = $getFrequency(K, sub.s.poi.type)$;
\State $score\_time$ = $getSimTime(K, sub.s.poi.type, sub.st)$;
\State $score\_duration$ = $getSimDuration(K, sub.s.poi.type, duration)$;
\State $ranked\_activities$ = $getRankedActivities(freq, score\_time, score\_duration)$;
\State $sub\_act$ = $max(ranked\_activities)$;
\State $stop.A.append(sub\_act)$;
\EndFor
%\State $sub.act\_dist$ = $K.getActDist(sub.s.poi.type, sub.day, sub.st.hour, duration);$
	        \EndFor
            \\
		\Return $T$
\end{algorithmic}
\end{algorithm}