Do not take the current route into account in alternatives_count parameter.

This commit is contained in:
Lev Dragunov 2017-02-06 13:40:41 +03:00 committed by Patrick Niklaus
parent 421d336b0f
commit 07221f5a48
3 changed files with 7 additions and 4 deletions

View File

@ -298,7 +298,7 @@ The area to search is chosen such that the correct candidate should be considere
Each `Waypoint` object has the following additional properties:
- `matchings_index`: Index to the `Route` object in `matchings` the sub-trace was matched to.
- `waypoint_index`: Index of the waypoint inside the matched route.
- `alternatives_count`: number of routes leading to the destination from this trace point. 1 means there are no other routes reaching destination. Greater values mean that there are different routes available and different route can be selected if you provide more coordinates.
- `alternatives_count`: number of alternative routes leading to the destination from this trace point. 0 means there are no other routes reaching destination. Greater values mean that there are different routes available and different route can be selected if you provide more coordinates.
- `matchings`: An array of `Route` objects that assemble the trace. Each `Route` object has the following additional properties:
- `confidence`: Confidence of the matching. `float` value between 0 and 1. 1 is very confident that the matching is correct.

View File

@ -277,7 +277,7 @@ Feature: Basic Map Matching
When I match I should get
| trace | matchings | alternatives |
| abcdef | abcde | 1,1,1,1,2,2 |
| abcdef | abcde | 0,0,0,0,1,1 |
Scenario: Testbot - Speed greater than speed threshhold
Given a grid size of 10 meters

View File

@ -371,10 +371,13 @@ operator()(const std::shared_ptr<const datafacade::BaseDataFacade> facade,
matching.indices.push_back(timestamp_index);
matching.nodes.push_back(candidates_list[timestamp_index][location_index].phantom_node);
matching.alternatives_count.push_back(
auto const routes_count =
std::accumulate(model.viterbi_reachable[timestamp_index].begin(),
model.viterbi_reachable[timestamp_index].end(),
0));
0);
BOOST_ASSERT(routes_count > 0);
// we don't count the current route in the "alternatives_count" parameter
matching.alternatives_count.push_back(routes_count - 1);
matching_distance += model.path_distances[timestamp_index][location_index];
}
util::for_each_pair(