Skip to content

Commit

Permalink
added more abort conditions within the candidate search
Browse files Browse the repository at this point in the history
  • Loading branch information
addy90 committed Dec 7, 2024
1 parent ca37eee commit 20ba56f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/library/include/matching/algorithm/candidate_search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ namespace map_matching_2::matching {
for (std::size_t i = 0; i < track.rich_line.size(); ++i) {
_candidate_search_individual(candidate_edge_sets[i], track, i, match_settings);

if(_time_helper.update_and_has_reached()) {
if (_time_helper.update_and_has_reached()) {
return {};
}
}
Expand Down Expand Up @@ -410,6 +410,10 @@ namespace map_matching_2::matching {
candidates_number++;
}
}

if (_time_helper.update_and_has_reached()) {
return {};
}
}

std::vector<index_value_type> candidates_index_values;
Expand All @@ -426,10 +430,18 @@ namespace map_matching_2::matching {
});
}
}

if (_time_helper.update_and_has_reached()) {
return {};
}
}

index_type candidates_index{std::move(candidates_index_values)};

if (_time_helper.update_and_has_reached()) {
return {};
}

// search in index for adopting nearby candidates not directly attached
for (std::size_t index = 0; index < candidate_edge_sets.size(); ++index) {
const point_type &point = track.rich_line.at(index);
Expand Down Expand Up @@ -467,6 +479,10 @@ namespace map_matching_2::matching {
}
}
}

if (_time_helper.update_and_has_reached()) {
return {};
}
}
}

Expand All @@ -493,6 +509,10 @@ namespace map_matching_2::matching {
}
}
}

if (_time_helper.update_and_has_reached()) {
return {};
}
}
}

Expand Down Expand Up @@ -551,6 +571,10 @@ namespace map_matching_2::matching {
candidate.nodes = std::move(nodes);
candidate.edges = std::move(edges);
}

if (_time_helper.update_and_has_reached()) {
return {};
}
}

return candidates;
Expand Down

0 comments on commit 20ba56f

Please sign in to comment.