Skip to content
Snippets Groups Projects
Commit f8e64516 authored by Romain BERNARD's avatar Romain BERNARD
Browse files

fix max condition application for entries and exits

parent bfc0dbbd
No related branches found
No related tags found
1 merge request!1Multimodal Insertion Heuristic prototype
...@@ -20,7 +20,7 @@ std::vector<TransitAccess> MultimodalModularHeuristic::getBestTransitEntriesList ...@@ -20,7 +20,7 @@ std::vector<TransitAccess> MultimodalModularHeuristic::getBestTransitEntriesList
const auto& lineStop : bestStationNode.getPTLinesSet()) { const auto& lineStop : bestStationNode.getPTLinesSet()) {
//Find the next passage lower or equal to our max entry time constraint //Find the next passage lower or equal to our max entry time constraint
auto iterator = lineStop.findNextScheduledPassage(getMaxEntryConstraint(baseRequest, bestStationNodeIdx)); auto iterator = lineStop.findNextScheduledPassage(getMaxEntryConstraint(baseRequest, bestStationNodeIdx));
if(iterator != lineStop.getSchedule().cbegin() && iterator != lineStop.getSchedule().cend()) { //Iterator is invalid if it points to schedule end (no result) or begin (no result lower than our constraint) if(iterator != lineStop.getSchedule().cbegin()) { //Iterator is invalid if it points to schedule beginning (no result lower than our constraint)
--iterator; //Move iterator to the value that's under our max entry constraint --iterator; //Move iterator to the value that's under our max entry constraint
if(*iterator > maxDepartureTime //If we've found a valid time that's superior to our current max time if(*iterator > maxDepartureTime //If we've found a valid time that's superior to our current max time
&& *iterator > getMinEntryConstraint(baseRequest, bestStationNodeIdx)) { //and respects min entry time, replace old value && *iterator > getMinEntryConstraint(baseRequest, bestStationNodeIdx)) { //and respects min entry time, replace old value
...@@ -221,7 +221,7 @@ MultimodalModularHeuristic::getBestTransitExitsList(size_t baseRequestId, const ...@@ -221,7 +221,7 @@ MultimodalModularHeuristic::getBestTransitExitsList(size_t baseRequestId, const
for(const auto& shortestTransitPath : shortestTransitPaths) { for(const auto& shortestTransitPath : shortestTransitPaths) {
//Check valid transit path + arrival node != starting point //Check valid transit path + arrival node != starting point
if(shortestTransitPath.getArrivalTime() >= 0 && shortestTransitPath.getArrivalNode() != entryNodeIdx if(shortestTransitPath.getArrivalTime() >= 0 && shortestTransitPath.getArrivalNode() != entryNodeIdx
&& shortestTransitPath.getArrivalTime() < getMaxExitConstraint(baseRequestId, entrySubRequestOriginKP, shortestTransitPath.getArrivalNode())) { && shortestTransitPath.getArrivalTime() <= getMaxExitConstraint(baseRequestId, entrySubRequestOriginKP, shortestTransitPath.getArrivalNode())) {
TransitAccess exit{shortestTransitPath.getArrivalNode(), (uint) shortestTransitPath.getArrivalTime()}; TransitAccess exit{shortestTransitPath.getArrivalNode(), (uint) shortestTransitPath.getArrivalTime()};
scoredTransitExits.emplace_back(exit, getTransitExitScore(baseRequest, exit)); scoredTransitExits.emplace_back(exit, getTransitExitScore(baseRequest, exit));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment