Skip computing viterbi if viterbi of previous state is lower than lower bound
This causes a speedup of 300%.
This commit is contained in:
parent
dc1405ffa8
commit
0637215b85
@ -377,9 +377,15 @@ template <class DataFacadeT> class MapMatching final
|
||||
|
||||
for (auto s_prime = 0u; s_prime < current_viterbi.size(); ++s_prime)
|
||||
{
|
||||
double new_value = prev_viterbi[s];
|
||||
if (current_viterbi[s_prime] > new_value)
|
||||
continue;
|
||||
|
||||
// how likely is candidate s_prime at time t to be emitted?
|
||||
const double emission_pr = log_emission_probability(timestamp_list[t][s_prime].second);
|
||||
new_value += emission_pr;
|
||||
if (current_viterbi[s_prime] > new_value)
|
||||
continue;
|
||||
|
||||
// get distance diff between loc1/2 and locs/s_prime
|
||||
const auto d_t = get_distance_difference(prev_coordinate,
|
||||
@ -387,9 +393,8 @@ template <class DataFacadeT> class MapMatching final
|
||||
prev_unbroken_timestamps_list[s].first,
|
||||
current_timestamps_list[s_prime].first);
|
||||
|
||||
// plug probabilities together
|
||||
const double transition_pr = log_transition_probability(d_t, beta);
|
||||
const double new_value = prev_viterbi[s] + emission_pr + transition_pr;
|
||||
new_value += transition_pr;
|
||||
|
||||
JSON::Array _debug_element = makeJSONArray(
|
||||
makeJSONSafe(prev_viterbi[s]),
|
||||
|
Loading…
Reference in New Issue
Block a user