Skip to content

Commit

Permalink
fix: prebooked drt with variable stop durations and group sizes (mats…
Browse files Browse the repository at this point in the history
…im-org#3290)

* fix: prebooked drt with variable stop durations and group sizes

* fix logic
  • Loading branch information
sebhoerl authored May 27, 2024
1 parent 9b101a0 commit 4796104
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,19 @@ private boolean updatePickupRequests(double now) {
var enterIterator = enterTimes.entrySet().iterator();

while (enterIterator.hasNext()) {
if (onboard >= vehicle.getCapacity()) {
// only let people enter if there is currently free capacity
break;
}

var entry = enterIterator.next();
int availableCapacity = vehicle.getCapacity() - onboard;

if (entry.getValue() <= now) {
// let agent enter now
Verify.verify(passengerHandler.tryPickUpPassengers(this, driver, entry.getKey(), now));
enteredRequests.add(entry.getKey());
onboard += pickupRequests.get(entry.getKey()).getPassengerCount();
enterIterator.remove();
int requiredCapacity = pickupRequests.get(entry.getKey()).getPassengerCount();

if (requiredCapacity <= availableCapacity) {
// let agent enter now
Verify.verify(passengerHandler.tryPickUpPassengers(this, driver, entry.getKey(), now));
enteredRequests.add(entry.getKey());
onboard += requiredCapacity;
enterIterator.remove();
}
}
}

Expand Down

0 comments on commit 4796104

Please sign in to comment.