Skip to content

Commit

Permalink
Merge pull request #3452 from moia-oss/preplannedHubReturn
Browse files Browse the repository at this point in the history
drt: allow final stay task without requests in preplanned scenarios (e.g. for hub returns)
  • Loading branch information
nkuehnel authored Sep 11, 2024
2 parents 9049669 + 72eead0 commit eb688d4
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,17 +174,22 @@ public void nextTask(DvrpVehicle vehicle) {
} else {
nonVisitedPreplannedStops.poll();//remove this stop from queue

var stopTask = taskFactory.createStopTask(vehicle, currentTime, currentTime + stopDuration, currentLink);
if (nextStop.pickup) {
var request = Preconditions.checkNotNull(openRequests.get(nextStop.preplannedRequest.key),
"Request (%s) has not been yet submitted", nextStop.preplannedRequest);
stopTask.addPickupRequest(AcceptedDrtRequest.createFromOriginalRequest(request));
if(nextStop.preplannedRequest.key.passengerIds.isEmpty() && nonVisitedPreplannedStops.isEmpty()) {
var stayTask = taskFactory.createStayTask(vehicle, currentTime, vehicle.getServiceEndTime(), currentLink);
schedule.addTask(stayTask);
} else {
var request = Preconditions.checkNotNull(openRequests.remove(nextStop.preplannedRequest.key),
"Request (%s) has not been yet submitted", nextStop.preplannedRequest);
stopTask.addDropoffRequest(AcceptedDrtRequest.createFromOriginalRequest(request));
var stopTask = taskFactory.createStopTask(vehicle, currentTime, currentTime + stopDuration, currentLink);
if (nextStop.pickup) {
var request = Preconditions.checkNotNull(openRequests.get(nextStop.preplannedRequest.key),
"Request (%s) has not been yet submitted", nextStop.preplannedRequest);
stopTask.addPickupRequest(AcceptedDrtRequest.createFromOriginalRequest(request));
} else {
var request = Preconditions.checkNotNull(openRequests.remove(nextStop.preplannedRequest.key),
"Request (%s) has not been yet submitted", nextStop.preplannedRequest);
stopTask.addDropoffRequest(AcceptedDrtRequest.createFromOriginalRequest(request));
}
schedule.addTask(stopTask);
}
schedule.addTask(stopTask);
}

// switch to the next task and update currentTasks
Expand Down

0 comments on commit eb688d4

Please sign in to comment.