Skip to content

Commit

Permalink
some canceling cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhoerl committed Nov 13, 2023
1 parent 6ff998e commit d37fdd7
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,11 @@ public void addPickupRequest(AcceptedDrtRequest request) {

@Override
public void removePickupRequest(Id<Request> requestId) {
// TODO Auto-generated method stub

delegate.removePickupRequest(requestId);
}

@Override
public void removeDropoffRequest(Id<Request> requestId) {
// TODO Auto-generated method stub

delegate.removeDropoffRequest(requestId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ public void addPickupRequest(AcceptedDrtRequest request) {

@Override
public void removePickupRequest(Id<Request> requestId) {
// TODO Auto-generated method stub

delegate.removePickupRequest(requestId);
}

@Override
public void removeDropoffRequest(Id<Request> requestId) {
// TODO Auto-generated method stub

delegate.removeDropoffRequest(requestId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,12 @@ public void addPickupRequest(AcceptedDrtRequest request) {

@Override
public void removePickupRequest(Id<Request> requestId) {
// TODO Auto-generated method stub

delegate.removePickupRequest(requestId);
}

@Override
public void removeDropoffRequest(Id<Request> requestId) {
// TODO Auto-generated method stub

delegate.removeDropoffRequest(requestId);
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

import javax.annotation.Nullable;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.matsim.api.core.v01.Id;
import org.matsim.api.core.v01.events.PersonDepartureEvent;
import org.matsim.api.core.v01.events.PersonMoneyEvent;
Expand Down Expand Up @@ -85,7 +83,7 @@ public class DrtEventSequenceCollector
implements PassengerRequestRejectedEventHandler, PassengerRequestScheduledEventHandler,
DrtRequestSubmittedEventHandler, PassengerWaitingEventHandler, PassengerPickedUpEventHandler, PassengerDroppedOffEventHandler,
PersonMoneyEventHandler, PersonDepartureEventHandler {

public static class EventSequence {
private final DrtRequestSubmittedEvent submitted;

Expand Down Expand Up @@ -199,12 +197,12 @@ public void handleEvent(DrtRequestSubmittedEvent event) {
if (event.getMode().equals(mode)) {
EventSequence sequence = new EventSequence(event);
sequences.put(event.getRequestId(), sequence);

// if we already have a departure
sequence.departure = waitingForSubmission.remove(event.getRequestId());
}
}

@Override
public void handleEvent(PersonDepartureEvent event) {
if (event.getLegMode().equals(mode)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ public class DefaultUnplannedRequestInserter implements UnplannedRequestInserter
private final DrtInsertionSearch insertionSearch;
private final DrtRequestInsertionRetryQueue insertionRetryQueue;
private final DrtOfferAcceptor drtOfferAcceptor;
private final ForkJoinPool forkJoinPool;

private final ForkJoinPool forkJoinPool;
private final PassengerStopDurationProvider stopDurationProvider;

public DefaultUnplannedRequestInserter(DrtConfigGroup drtCfg, Fleet fleet, MobsimTimer mobsimTimer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.matsim.api.core.v01.network.Network;
import org.matsim.api.core.v01.population.Population;
import org.matsim.contrib.drt.optimizer.VehicleEntry;
import org.matsim.contrib.drt.prebooking.PrebookingParams.UnschedulingMode;
import org.matsim.contrib.drt.prebooking.abandon.AbandonVoter;
import org.matsim.contrib.drt.prebooking.abandon.MaximumDelayAbandonVoter;
import org.matsim.contrib.drt.prebooking.logic.helpers.PopulationIterator.PopulationIteratorFactory;
Expand Down Expand Up @@ -94,6 +95,12 @@ protected void configureQSim() {
timingUpdater, prebookingParams.scheduleWaitBeforeDrive);
})).in(Singleton.class);

bindModal(RequestUnscheduler.class).to(modalKey(SimpleRequestUnscheduler.class));
if (prebookingParams.unschedulingMode.equals(UnschedulingMode.StopBased)) {
bindModal(RequestUnscheduler.class).to(modalKey(SimpleRequestUnscheduler.class));
} else if (prebookingParams.unschedulingMode.equals(UnschedulingMode.Routing)) {
bindModal(RequestUnscheduler.class).to(modalKey(ComplexRequestUnscheduler.class));
} else {
throw new IllegalStateException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public PrebookingParams() {

@Parameter
@Comment("Defines whether vehicles drive immediately to the next"
+ "(prebooked) future task and wait for the planned stop to begin, or wait at the current"
+ "position and depart to arrive on time at the following stop. The latter behavior (not"
+ "the default) may lead to larger ucnertainty in highly congested scenarios.")
+ " (prebooked) future task and wait for the planned stop to begin, or wait at the current"
+ " position and depart to arrive on time at the following stop. The latter behavior (not"
+ " the default) may lead to larger ucnertainty in highly congested scenarios.")
public boolean scheduleWaitBeforeDrive = false; // in the future, this could also become a double value indicating
// how many minutes before the next stop the vehicle should plan to
// be there
Expand All @@ -26,4 +26,16 @@ public PrebookingParams() {
@NotNull
@Positive
public double maximumPassengerDelay = Double.POSITIVE_INFINITY;

public enum UnschedulingMode {
StopBased, Routing
}

@Parameter
@Comment("When unscheduling requests because they have been canceled,"
+ " we either simply remove the requests from the planned stops"
+ " along the vehicle's schedule or we adaptively reconfigure and reroute the vehicle's schedule.")
@NotNull
public UnschedulingMode unschedulingMode = UnschedulingMode.StopBased;

}
30 changes: 0 additions & 30 deletions deploy.sh

This file was deleted.

0 comments on commit d37fdd7

Please sign in to comment.