-
Couldn't load subscription status.
- Fork 4
Improved algorithm for traffic lights #195
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
New algorithm from my thesis
modTime to keep track of how the algorithm changes the values of redTime and greenTime
Improved algorithm for traffic lights
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #195 +/- ##
==========================================
- Coverage 94.77% 94.32% -0.45%
==========================================
Files 17 17
Lines 3004 3472 +468
Branches 294 315 +21
==========================================
+ Hits 2847 3275 +428
- Misses 157 197 +40
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
I have moved changes to Node.hpp to another PR (see #199). |
| } | ||
| SUBCASE("Traffic Lights optimization algorithm") { | ||
| GIVEN("A dynamics object with a traffic light intersection") { | ||
| TrafficLight tl{1}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| GIVEN("A dynamics object with a traffic light intersection") { | ||
| TrafficLight tl{1}; | ||
| tl.setDelay(4); | ||
| double length{90.}, max_speed{15.}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| TrafficLight tl{1}; | ||
| tl.setDelay(4); | ||
| double length{90.}, max_speed{15.}; | ||
| Street s_01{1, 10, length, max_speed, std::make_pair(0, 1)}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| Street s_41{21, 10, length, max_speed, std::make_pair(4, 1)}; | ||
| tl.addStreetPriority(1); | ||
| tl.addStreetPriority(7); | ||
| Graph graph2; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| tl.addStreetPriority(1); | ||
| tl.addStreetPriority(7); | ||
| Graph graph2; | ||
| graph2.addNode(std::make_unique<TrafficLight>(tl)); |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| graph2.addNode(std::make_unique<TrafficLight>(tl)); | ||
| graph2.addStreets(s_01, s_10, s_12, s_21, s_13, s_31, s_14, s_41); | ||
| graph2.buildAdj(); | ||
| Dynamics dynamics{graph2}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| graph2.addStreets(s_01, s_10, s_12, s_21, s_13, s_31, s_14, s_41); | ||
| graph2.buildAdj(); | ||
| Dynamics dynamics{graph2}; | ||
| Itinerary it_0{0, 0}, it_1{1, 2}, it_2{2, 3}, it_3{3, 4}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| dynamics.optimizeTrafficLights(2, 0.1, 1.); | ||
| THEN("Green and red time are different") { | ||
| const auto timing = | ||
| dynamic_cast<TrafficLight&>(*dynamics.graph().nodeSet().at(1)) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| tl.setPhase(3); | ||
| double length{90.}, max_speed{15.}; | ||
| Street s_01{1, 10, length, max_speed, std::make_pair(0, 1)}; | ||
| Street s_10{5, 10, length, max_speed, std::make_pair(1, 0)}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| double length{90.}, max_speed{15.}; | ||
| Street s_01{1, 10, length, max_speed, std::make_pair(0, 1)}; | ||
| Street s_10{5, 10, length, max_speed, std::make_pair(1, 0)}; | ||
| Street s_12{7, 10, length, max_speed, std::make_pair(1, 2)}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| Street s_10{5, 10, length, max_speed, std::make_pair(1, 0)}; | ||
| Street s_12{7, 10, length, max_speed, std::make_pair(1, 2)}; | ||
| Street s_21{11, 10, length, max_speed, std::make_pair(2, 1)}; | ||
| Street s_13{8, 10, length, max_speed, std::make_pair(1, 3)}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| Street s_21{11, 10, length, max_speed, std::make_pair(2, 1)}; | ||
| Street s_13{8, 10, length, max_speed, std::make_pair(1, 3)}; | ||
| Street s_31{16, 10, length, max_speed, std::make_pair(3, 1)}; | ||
| Street s_14{9, 10, length, max_speed, std::make_pair(1, 4)}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| Street s_41{21, 10, length, max_speed, std::make_pair(4, 1)}; | ||
| tl.addStreetPriority(1); | ||
| tl.addStreetPriority(11); | ||
| Graph graph2; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| graph2.addNode(std::make_unique<TrafficLight>(tl)); | ||
| graph2.addStreets(s_01, s_10, s_12, s_21, s_13, s_31, s_14, s_41); | ||
| graph2.buildAdj(); | ||
| Dynamics dynamics{graph2}; |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
| dynamics.optimizeTrafficLights(2, 0.1, 0.); | ||
| THEN("Green and red time are equal") { | ||
| const auto timing = | ||
| dynamic_cast<TrafficLight&>(*dynamics.graph().nodeSet().at(1)) |
Check notice
Code scanning / Cppcheck (reported by Codacy)
MISRA 12.3 rule Note test
|
For me and @filippodll is ok, i don't know what's wrong with codecov |
No description provided.