Skip to content

Commit

Permalink
tba: update to the calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
kaligrafy committed Feb 19, 2017
1 parent ab7c544 commit 16e2759
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions trip_based_algorithm/src/trip_based_algorithm_calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace TrRouting
tgtStopIs = std::vector<int>(1,stopsIndexById[params.endingStopId]);
}


// calculate for each stop index in the target stop indexes vector:
for(const auto & tgtStopI : tgtStopIs)
{
Expand All @@ -49,7 +48,6 @@ namespace TrRouting
int stopToTargetI; // q
int travelTimeToTarget;


// fetch footpaths to target stop:
for (auto it = footpathsByTarget.begin() + footpathsIndex[tgtStopI][0]; it != footpathsByTarget.begin() + footpathsIndex[tgtStopI][1] + 1; ++it) // (line 5)
{
Expand All @@ -72,26 +70,22 @@ namespace TrRouting
int stopSeq;
int arrivalTimeAtNextStop;


// fetch footpaths from source stop:
for (auto it = footpathsBySource.begin() + footpathsIndex[srcStopI][0]; it != footpathsBySource.begin() + footpathsIndex[srcStopI][1] + 1; ++it) // (line 9)
{
footpathFromSource = *it;
stopFromSourceI = footpathFromSource.srcI;
readyTimeFromSource = footpathFromSource.tt + params.minWaitingTimeMinutes * 60; // (line 10)


for (const auto & routePathIndexAndStopSeq : routePathsIndexByStop[stopFromSourceI]) // (line 11)
{
routePathIndex = routePathIndexAndStopSeq[0];
stopSeq = routePathIndexAndStopSeq[1];


if (tripsIndex[params.weekdayIndex][routePathIndex][0] != -1)
{
foundEarliestTrip = false;


for (auto it = trips[params.weekdayIndex].begin() + tripsIndex[params.weekdayIndex][routePathIndex][0]; it != trips[params.weekdayIndex].begin() + tripsIndex[params.weekdayIndex][routePathIndex][1] + 1; ++it)
{
trip = *it;
Expand Down Expand Up @@ -136,7 +130,6 @@ namespace TrRouting
Trip transferTrip;
Transfer transfer;


for(auto & reachableRoutePath : reachableRoutePaths) // (line 18)
{
if(reachableRoutePath.rpI == routeIndex && firstStopSeq < reachableRoutePath.stopSeq)
Expand All @@ -150,7 +143,6 @@ namespace TrRouting
}
}


nextStopSeqArrivalTimeIndex = arrivalTimesIndex[params.weekdayIndex][tripI][0] + firstStopSeq + 1;
if (nextStopSeqArrivalTimeIndex <= arrivalTimesIndex[params.weekdayIndex][tripI][1])
{
Expand Down Expand Up @@ -184,6 +176,7 @@ namespace TrRouting
}
}

// add target stop results to json:
int minArrivalTimeSecondForStop = infinite;
for(int n = 0; n <= nMax; n++)
{
Expand Down

0 comments on commit 16e2759

Please sign in to comment.