From d37fdd78929762704c3d956d3a1f9cbfa12782e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20H=C3=B6rl?= Date: Mon, 13 Nov 2023 14:28:25 +0100 Subject: [PATCH] some canceling cleanup --- .../schedule/EDrtShiftChangeoverTaskImpl.java | 6 ++-- .../shifts/schedule/ShiftBreakTaskImpl.java | 6 ++-- .../schedule/ShiftChangeoverTaskImpl.java | 6 ++-- .../analysis/DrtEventSequenceCollector.java | 8 ++--- .../DefaultUnplannedRequestInserter.java | 3 +- .../prebooking/PrebookingModeQSimModule.java | 9 +++++- .../drt/prebooking/PrebookingParams.java | 18 +++++++++-- deploy.sh | 30 ------------------- 8 files changed, 33 insertions(+), 53 deletions(-) delete mode 100644 deploy.sh diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/eshifts/schedule/EDrtShiftChangeoverTaskImpl.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/eshifts/schedule/EDrtShiftChangeoverTaskImpl.java index eea5e837258..007a9f2fe3f 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/eshifts/schedule/EDrtShiftChangeoverTaskImpl.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/eshifts/schedule/EDrtShiftChangeoverTaskImpl.java @@ -85,13 +85,11 @@ public void addPickupRequest(AcceptedDrtRequest request) { @Override public void removePickupRequest(Id requestId) { - // TODO Auto-generated method stub - + delegate.removePickupRequest(requestId); } @Override public void removeDropoffRequest(Id requestId) { - // TODO Auto-generated method stub - + delegate.removeDropoffRequest(requestId); } } diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftBreakTaskImpl.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftBreakTaskImpl.java index a1a64a880f5..b718954da1b 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftBreakTaskImpl.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftBreakTaskImpl.java @@ -66,13 +66,11 @@ public void addPickupRequest(AcceptedDrtRequest request) { @Override public void removePickupRequest(Id requestId) { - // TODO Auto-generated method stub - + delegate.removePickupRequest(requestId); } @Override public void removeDropoffRequest(Id requestId) { - // TODO Auto-generated method stub - + delegate.removeDropoffRequest(requestId); } } diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftChangeoverTaskImpl.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftChangeoverTaskImpl.java index f53a9c5742d..0af9ed0b7bf 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftChangeoverTaskImpl.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/schedule/ShiftChangeoverTaskImpl.java @@ -67,14 +67,12 @@ public void addPickupRequest(AcceptedDrtRequest request) { @Override public void removePickupRequest(Id requestId) { - // TODO Auto-generated method stub - + delegate.removePickupRequest(requestId); } @Override public void removeDropoffRequest(Id requestId) { - // TODO Auto-generated method stub - + delegate.removeDropoffRequest(requestId); } } diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtEventSequenceCollector.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtEventSequenceCollector.java index 9af78ecf0ea..04a89f30c36 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtEventSequenceCollector.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/analysis/DrtEventSequenceCollector.java @@ -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; @@ -85,7 +83,7 @@ public class DrtEventSequenceCollector implements PassengerRequestRejectedEventHandler, PassengerRequestScheduledEventHandler, DrtRequestSubmittedEventHandler, PassengerWaitingEventHandler, PassengerPickedUpEventHandler, PassengerDroppedOffEventHandler, PersonMoneyEventHandler, PersonDepartureEventHandler { - + public static class EventSequence { private final DrtRequestSubmittedEvent submitted; @@ -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)) { diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/insertion/DefaultUnplannedRequestInserter.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/insertion/DefaultUnplannedRequestInserter.java index 7e99df5c5f0..34503207f82 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/insertion/DefaultUnplannedRequestInserter.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/insertion/DefaultUnplannedRequestInserter.java @@ -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, diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingModeQSimModule.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingModeQSimModule.java index 4b6c3a4b548..0a24ed1f7fa 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingModeQSimModule.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingModeQSimModule.java @@ -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; @@ -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(); + } } } diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingParams.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingParams.java index b5654767a42..fdf678bb272 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingParams.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/prebooking/PrebookingParams.java @@ -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 @@ -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; + } \ No newline at end of file diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index e2c94df72f3..00000000000 --- a/deploy.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -set -e - -### -### This script rewrites the version of MATSim and deploys it to the Volkswagen Artifactory. Only SNAPSHOT versions are supported. -### - -projects="contribs/drt,contribs/drt-extensions" -version="16.0-irt-prebooking-oct16-SNAPSHOT" -settings="/home/shoerl/.m2/settings-vwa.xml" - -if [ -z "$(git status --untracked-files=no --porcelain)" ]; then - # Update distribution management - sed -i -e 's/https:\/\/repo.matsim.org\/repository\/matsim-snapshots\/<\/url>/https:\/\/jfrog.devstack.vwgroup.com\/artifactory\/sma-snapshots<\/url>/g' pom.xml - sed -i -e 's/matsim-snapshots<\/id>/sma-snapshots<\/id>/g' pom.xml - - # Set version - mvn versions:set -DnewVersion=${version} - - # Deploy package - mvn --settings ${settings} deploy --projects ${projects} --also-make -DskipTests=true - - # Reset version - mvn versions:revert - - # Reset distribution management - git checkout pom.xml -else - echo "Repository must be in clean state" -fi