Algorithm 2. Improved Viterbi algorithm. |
Input: |
The proposed HMM tuples
; HAR classification results ; PDR distance information ; Initial direction of magnetometer ; Initial pressure of barometer ; is the distance threshold. |
Output: |
Prediction trajectory. |
1: |
, /* Determine the initial orientation and floor |
2: |
for
from 1 to
do
|
3: |
for each path pass through to
do
|
4: |
if ((Distance(), )) - )<) and (>0) then /* Determine whether the distance between two landmark nodes coincides with the distance information estimated by PDR |
5: |
Obtain the subset data |
6: |
end if
|
7: |
end for
|
8: |
end for |
9: |
for
in
do
|
10: |
Obtain the landmark data set |
11: |
if
match with HAR data
then
|
12: |
Add this trajectory to the final trajectory data set |
13: |
end for |
14 |
return Max()/* Return the trajectory of the maximum probability |