-
Notifications
You must be signed in to change notification settings - Fork 4
Use transition probabilities #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #375 +/- ##
==========================================
- Coverage 83.27% 83.11% -0.17%
==========================================
Files 53 53
Lines 5275 5331 +56
Branches 606 614 +8
==========================================
+ Hits 4393 4431 +38
- Misses 871 889 +18
Partials 11 11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // Get current street information | ||
| std::optional<Id> previousNodeId = std::nullopt; | ||
| std::set<Id> forbiddenTurns; | ||
| std::unordered_map<Id, double> baseTransitionProbabilities; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| if (!edge_properties.at_key("transition_probabilities").error() && | ||
| edge_properties["transition_probabilities"].has_value()) { | ||
| auto const& tp = edge_properties["transition_probabilities"]; | ||
| std::unordered_map<Id, double> transitionProbabilities; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| edge_properties["transition_probabilities"].has_value()) { | ||
| auto const& tp = edge_properties["transition_probabilities"]; | ||
| std::unordered_map<Id, double> transitionProbabilities; | ||
| for (auto const& [key, value] : tp.get_object()) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| transitionProbabilities) { | ||
| std::for_each(DSF_EXECUTION m_edges.cbegin(), | ||
| m_edges.cend(), | ||
| [&transitionProbabilities](auto const& pair) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 13.1 rule Note
| // Ensure normalization | ||
| if (transitionProbabilities.empty()) { | ||
| m_transitionProbabilities.clear(); | ||
| return; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
| return; | ||
| } | ||
| double sumProbabilities{0.}; | ||
| for (auto const& [_, probability] : transitionProbabilities) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| } | ||
| if (std::abs(sumProbabilities - 1.) > 1e-6) { | ||
| auto tp = transitionProbabilities; | ||
| for (auto& [_, probability] : tp) { |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note
| probability /= sumProbabilities; | ||
| } | ||
| m_transitionProbabilities = tp; | ||
| return; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 15.5 rule Note
No description provided.