From 358f5bca718c3675635a04ef3b46636b5e3023d7 Mon Sep 17 00:00:00 2001 From: nkuehnel Date: Tue, 3 Sep 2024 18:50:44 +0200 Subject: [PATCH] prebooking stop: check for expected pickups to prevent pickup and abandonment in the same second --- .../contrib/drt/prebooking/PrebookingStopActivity.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 3c04ba985a3..e55af9e76a5 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 @@ -206,8 +206,10 @@ protected void simStep(double now) { @Override public void notifyPassengersAreReadyForDeparture(List passengers, double now) { var request = getRequestForPassengers(passengers.stream().map(Identifiable::getId).toList()); - queuePickup(request, now); - expectedPickups.remove(request.getId()); + if(expectedPickups.containsKey(request.getId())) { + queuePickup(request, now); + expectedPickups.remove(request.getId()); + } } private AcceptedDrtRequest getRequestForPassengers(List> passengerIds) {