Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
nkuehnel committed May 27, 2024
1 parent 532d7e0 commit 3799804
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,31 @@ public double calculate(DrtRequest drtRequest, Insertion insertion, DetourTimeIn

// all stops after the new (potential) pickup but before the new dropoff
// are delayed by pickupDetourTimeLoss
double detour = detourTimeInfo.pickupDetourInfo.pickupTimeLoss;
double timeLoss = detourTimeInfo.pickupDetourInfo.pickupTimeLoss;
if(vEntry.stops != null) {
for (int s = insertion.pickup.index; s < vEntry.stops.size(); s++) {
if(timeLoss == 0) {
continue;
}
Waypoint.Stop stop = vEntry.stops.get(s);
// passengers are being dropped off == may be close to arrival
if (!stop.task.getDropoffRequests().isEmpty()) {
double nextArrival = stop.getArrivalTime();
double departureTime = insertion.vehicleEntry.start.getDepartureTime();
//arrival is very soon
if (nextArrival - departureTime < constraintsSet.allowDetourBeforeArrivalThreshold &&
detour > 0) {
if (nextArrival - departureTime < constraintsSet.allowDetourBeforeArrivalThreshold) {
//arrival is too soon to allow further diversion
return INFEASIBLE_SOLUTION_COST;
} else {
} else if (nextArrival - departureTime >= constraintsSet.allowDetourBeforeArrivalThreshold) {
// all following stops are above the threshold
break;
}
}
if (s == insertion.dropoff.index) {
// all stops after the new (potential) dropoff are delayed by totalTimeLoss
detour = detourTimeInfo.getTotalTimeLoss();
timeLoss = detourTimeInfo.getTotalTimeLoss();
if(timeLoss == 0) {
break;
}
}
}
}
Expand Down

0 comments on commit 3799804

Please sign in to comment.