Skip to content

Commit

Permalink
Merge pull request #3405 from moia-oss/fixDrtInsertionBug
Browse files Browse the repository at this point in the history
fix DRT: insertion scheduler bug in prebooking scenarios
  • Loading branch information
nkuehnel authored Aug 12, 2024
2 parents 9948285 + c316aa5 commit b705f05
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ private void verifyConstraints(InsertionWithDetourData insertion) {
Schedule schedule = insertion.insertion.vehicleEntry.vehicle.getSchedule();

for (Task task : schedule.getTasks()) {
if (task instanceof DrtStopTask) {
DrtStopTask stopTask = (DrtStopTask) task;
if (task instanceof DrtStopTask stopTask) {

for (AcceptedDrtRequest request : stopTask.getPickupRequests().values()) {
Verify.verify(stopTask.getEndTime() <= request.getLatestStartTime());
Expand Down Expand Up @@ -211,12 +210,16 @@ private DrtStopTask insertPickup(AcceptedDrtRequest request, InsertionWithDetour
beforePickupTask = insertWait(vehicleEntry.vehicle, currentTask, dropoffIdx);
}
}
if(!stops.isEmpty() && stops.size() + 1 > pickupIdx) {
//there is an existing stop which was scheduled earlier and was not the destination of the already diverted drive task
removeBetween(schedule, beforePickupTask, stops.get(pickupIdx).task);
}
} else { // insert pickup after an existing stop/stay task
StayTask stayTask = null;
DrtStopTask stopTask = null;
if (pickupIdx == 0) {
if (scheduleStatus == ScheduleStatus.PLANNED) {// PLANNED schedule
stayTask = (StayTask)schedule.getTasks().get(0);
stayTask = (StayTask)schedule.getTasks().getFirst();
stayTask.setEndTime(stayTask.getBeginTime());// could get later removed with ScheduleTimingUpdater
} else if (STAY.isBaseTypeOf(currentTask)) {
stayTask = (StayTask)currentTask; // ongoing stay task
Expand Down

0 comments on commit b705f05

Please sign in to comment.