Research Article

A Spatial-Contextual Indoor Trajectory Prediction Approach via Hidden Markov Models

Algorithm 2

Viterbi algorithm.
input: Observations of length n, indoor trajectory HMM
output: best path that generates the observations
1: // initialization
2: for each state in hidden states do
3:  
4:  
5: end for
6: //recursion
7: for each time step t from 2 to n do
8:  for each state in hidden states do
9:   
10:   
11:  end for
12: end for
13: //termination
14:
15:
16: // backtracking
17: Return