Skip to content

Commit

Permalink
fix: prebooked drt with variable stop durations and group sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhoerl committed May 27, 2024
1 parent de96dbd commit 735413a
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,21 @@ private boolean updatePickupRequests(double now) {
}

var enterIterator = enterTimes.entrySet().iterator();
int availableCapacity = vehicle.getCapacity() - onboard;

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

var entry = enterIterator.next();

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 735413a

Please sign in to comment.