diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingStopActivity.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingStopActivity.java index 762c80500b1..fd81c1745f3 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingStopActivity.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingStopActivity.java @@ -73,14 +73,14 @@ public PrebookingStopActivity(PassengerHandler passengerHandler, DynAgent driver @Override protected boolean isLastStep(double now) { boolean dropoffsReady = updateDropoffRequests(now); - boolean pickupsReady = updatePickupRequests(now); + boolean pickupsReady = updatePickupRequests(now, false); return pickupsReady && dropoffsReady && now >= endTime.get(); } @Override protected void beforeFirstStep(double now) { initDropoffRequests(now); - updatePickupRequests(now); + updatePickupRequests(now, true); } private void initDropoffRequests(double now) { @@ -112,7 +112,7 @@ public int compareTo(QueuedRequest o) { } } - private boolean updatePickupRequests(double now) { + private boolean updatePickupRequests(double now, boolean isFirstStep) { var pickupIterator = pickupRequests.values().iterator(); while (pickupIterator.hasNext()) { @@ -125,7 +125,7 @@ private boolean updatePickupRequests(double now) { if (passengerHandler.notifyWaitForPassengers(this, this.driver, request.getId())) { // agent starts to enter queuePickup(request, now); - } else if (now > request.getEarliestStartTime()) { + } else if (now > request.getEarliestStartTime() && !isFirstStep) { if (abandonVoter.abandonRequest(now, vehicle, request)) { prebookingManager.abandon(request.getId()); }