diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java index 2194784123d..81816220500 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/edrt/run/EDrtModeOptimizerQSimModule.java @@ -44,7 +44,6 @@ import org.matsim.contrib.drt.optimizer.insertion.UnplannedRequestInserter; import org.matsim.contrib.drt.optimizer.rebalancing.RebalancingStrategy; import org.matsim.contrib.drt.passenger.DrtOfferAcceptor; -import org.matsim.contrib.drt.passenger.DrtRequest; import org.matsim.contrib.drt.run.DrtConfigGroup; import org.matsim.contrib.drt.schedule.DrtTaskFactory; import org.matsim.contrib.drt.scheduler.DefaultRequestInsertionScheduler; @@ -55,9 +54,7 @@ import org.matsim.contrib.drt.stops.StopTimeCalculator; import org.matsim.contrib.dvrp.fleet.Fleet; import org.matsim.contrib.dvrp.optimizer.VrpOptimizer; -import org.matsim.contrib.dvrp.passenger.DefaultRequestQueue; import org.matsim.contrib.dvrp.passenger.PassengerHandler; -import org.matsim.contrib.dvrp.passenger.RequestQueue; import org.matsim.contrib.dvrp.run.AbstractDvrpModeQSimModule; import org.matsim.contrib.dvrp.run.DvrpConfigGroup; import org.matsim.contrib.dvrp.run.DvrpModes; @@ -93,13 +90,11 @@ protected void configureQSim() { bindModal(DefaultDrtOptimizer.class).toProvider(modalProvider( getter -> { - RequestQueue requestQueue = DefaultRequestQueue.withLimitedAdvanceRequestPlanningHorizon(drtCfg.advanceRequestPlanningHorizon); - return new DefaultDrtOptimizer(drtCfg, getter.getModal(Fleet.class), getter.get(MobsimTimer.class), getter.getModal(DepotFinder.class), getter.getModal(RebalancingStrategy.class), getter.getModal(DrtScheduleInquiry.class), getter.getModal(ScheduleTimingUpdater.class), getter.getModal(EmptyVehicleRelocator.class), getter.getModal(UnplannedRequestInserter.class), - getter.getModal(DrtRequestInsertionRetryQueue.class), requestQueue); + getter.getModal(DrtRequestInsertionRetryQueue.class)); })).asEagerSingleton(); bindModal(ChargingInfrastructure.class).toProvider(modalProvider( diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/run/ShiftDrtModeOptimizerQSimModule.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/run/ShiftDrtModeOptimizerQSimModule.java index 3f2bae05b65..1e3e8e1f485 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/run/ShiftDrtModeOptimizerQSimModule.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/operations/shifts/run/ShiftDrtModeOptimizerQSimModule.java @@ -40,7 +40,6 @@ import org.matsim.contrib.drt.optimizer.insertion.InsertionCostCalculator; import org.matsim.contrib.drt.optimizer.insertion.UnplannedRequestInserter; import org.matsim.contrib.drt.optimizer.rebalancing.RebalancingStrategy; -import org.matsim.contrib.drt.passenger.DrtRequest; import org.matsim.contrib.drt.run.DrtConfigGroup; import org.matsim.contrib.drt.schedule.DrtStayTaskEndTimeCalculator; import org.matsim.contrib.drt.schedule.DrtTaskFactory; @@ -54,9 +53,7 @@ import org.matsim.contrib.dvrp.fleet.Fleet; import org.matsim.contrib.dvrp.fleet.FleetSpecification; import org.matsim.contrib.dvrp.fleet.Fleets; -import org.matsim.contrib.dvrp.passenger.DefaultRequestQueue; import org.matsim.contrib.dvrp.passenger.PassengerHandler; -import org.matsim.contrib.dvrp.passenger.RequestQueue; import org.matsim.contrib.dvrp.run.AbstractDvrpModeQSimModule; import org.matsim.contrib.dvrp.run.DvrpConfigGroup; import org.matsim.contrib.dvrp.run.DvrpModes; @@ -112,14 +109,12 @@ public DrtShifts get() { addModalComponent(DrtOptimizer.class, modalProvider( getter -> { - RequestQueue requestQueue = DefaultRequestQueue.withLimitedAdvanceRequestPlanningHorizon(drtCfg.advanceRequestPlanningHorizon); - return new ShiftDrtOptimizer( new DefaultDrtOptimizer(drtCfg, getter.getModal(Fleet.class), getter.get(MobsimTimer.class), getter.getModal(DepotFinder.class), getter.getModal(RebalancingStrategy.class), getter.getModal(DrtScheduleInquiry.class), getter.getModal(ScheduleTimingUpdater.class), getter.getModal(EmptyVehicleRelocator.class), getter.getModal(UnplannedRequestInserter.class), - getter.getModal(DrtRequestInsertionRetryQueue.class), requestQueue + getter.getModal(DrtRequestInsertionRetryQueue.class) ), getter.getModal(DrtShiftDispatcher.class), getter.getModal(ScheduleTimingUpdater.class)); diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/prebooking/dvrp/PrebookingModeQSimModule.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/prebooking/dvrp/PrebookingModeQSimModule.java index 594431ebc41..859ab385c75 100644 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/prebooking/dvrp/PrebookingModeQSimModule.java +++ b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/prebooking/dvrp/PrebookingModeQSimModule.java @@ -3,24 +3,20 @@ import org.matsim.api.core.v01.network.Network; import org.matsim.contrib.drt.extension.edrt.EDrtActionCreator; import org.matsim.contrib.drt.extension.prebooking.electric.ElectricPrebookingActionCreator; -import org.matsim.contrib.drt.passenger.DrtRequest; import org.matsim.contrib.drt.run.DrtConfigGroup; import org.matsim.contrib.drt.stops.PassengerStopDurationProvider; import org.matsim.contrib.drt.vrpagent.DrtActionCreator; import org.matsim.contrib.dvrp.optimizer.VrpOptimizer; -import org.matsim.contrib.dvrp.passenger.DefaultRequestQueue; import org.matsim.contrib.dvrp.passenger.PassengerEngine; import org.matsim.contrib.dvrp.passenger.PassengerHandler; import org.matsim.contrib.dvrp.passenger.PassengerRequestCreator; import org.matsim.contrib.dvrp.passenger.PassengerRequestValidator; -import org.matsim.contrib.dvrp.passenger.RequestQueue; import org.matsim.contrib.dvrp.run.AbstractDvrpModeQSimModule; import org.matsim.contrib.dvrp.vrpagent.VrpAgentLogic; import org.matsim.core.api.experimental.events.EventsManager; import org.matsim.core.mobsim.framework.MobsimTimer; import com.google.inject.Singleton; -import com.google.inject.TypeLiteral; class PrebookingModeQSimModule extends AbstractDvrpModeQSimModule { private final boolean isElectric; @@ -93,15 +89,5 @@ protected void configureQSim() { eventsManager); })).in(Singleton.class); addModalQSimComponentBinding().to(modalKey(PrebookingManager.class)); - - bindModal(new TypeLiteral>() { - }).toProvider(modalProvider(getter -> { - PrebookingManager prebookingManager = getter.getModal(PrebookingManager.class); - RequestQueue delegate = DefaultRequestQueue - .withLimitedAdvanceRequestPlanningHorizon(drtConfig.advanceRequestPlanningHorizon); - - return new PrebookingRequestQueue<>(prebookingManager, delegate); - })).in(Singleton.class); - } } diff --git a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/prebooking/dvrp/PrebookingRequestQueue.java b/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/prebooking/dvrp/PrebookingRequestQueue.java deleted file mode 100644 index d1af9223859..00000000000 --- a/contribs/drt-extensions/src/main/java/org/matsim/contrib/drt/extension/prebooking/dvrp/PrebookingRequestQueue.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.matsim.contrib.drt.extension.prebooking.dvrp; - -import java.util.Collection; -import java.util.LinkedList; -import java.util.List; - -import org.matsim.contrib.dvrp.passenger.PassengerRequest; -import org.matsim.contrib.dvrp.passenger.RequestQueue; - -/** - * @author Michal Maciejewski (michalm) - * @author Sebastian Hörl (sebhoerl), IRT SystemX - */ -public final class PrebookingRequestQueue implements RequestQueue { - private final PrebookingManager prebookingManager; - private final RequestQueue delegate; - - private final List schedulableRequests = new LinkedList<>(); - - public PrebookingRequestQueue(PrebookingManager prebookingManager, RequestQueue delegate) { - this.prebookingManager = prebookingManager; - this.delegate = delegate; - } - - @Override - public void updateQueuesOnNextTimeSteps(double currentTime) { - delegate.updateQueuesOnNextTimeSteps(currentTime); - } - - @Override - public void addRequest(R request) { - if (prebookingManager.isPrebookedRequest(request.getId())) { - // add to queue in the order of submission - schedulableRequests.add(request); - } else { - delegate.addRequest(request); - } - } - - @Override - public Collection getSchedulableRequests() { - schedulableRequests.addAll(delegate.getSchedulableRequests()); - delegate.getSchedulableRequests().clear(); - return schedulableRequests; - } -} diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DefaultDrtOptimizer.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DefaultDrtOptimizer.java index 53a2b59b6bf..436601c82d2 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DefaultDrtOptimizer.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DefaultDrtOptimizer.java @@ -19,7 +19,11 @@ package org.matsim.contrib.drt.optimizer; +import static org.matsim.contrib.drt.schedule.DrtTaskBaseType.STAY; + +import java.util.LinkedList; import java.util.List; +import java.util.Queue; import java.util.stream.Stream; import org.apache.logging.log4j.LogManager; @@ -37,13 +41,10 @@ import org.matsim.contrib.dvrp.fleet.DvrpVehicle; import org.matsim.contrib.dvrp.fleet.Fleet; import org.matsim.contrib.dvrp.optimizer.Request; -import org.matsim.contrib.dvrp.passenger.RequestQueue; import org.matsim.contrib.dvrp.schedule.ScheduleTimingUpdater; import org.matsim.core.mobsim.framework.MobsimTimer; import org.matsim.core.mobsim.framework.events.MobsimBeforeSimStepEvent; -import static org.matsim.contrib.drt.schedule.DrtTaskBaseType.STAY; - /** * @author michalm */ @@ -62,12 +63,11 @@ public class DefaultDrtOptimizer implements DrtOptimizer { private final UnplannedRequestInserter requestInserter; private final DrtRequestInsertionRetryQueue insertionRetryQueue; - private final RequestQueue unplannedRequests; + private final Queue unplannedRequests = new LinkedList<>(); public DefaultDrtOptimizer(DrtConfigGroup drtCfg, Fleet fleet, MobsimTimer mobsimTimer, DepotFinder depotFinder, RebalancingStrategy rebalancingStrategy, DrtScheduleInquiry scheduleInquiry, ScheduleTimingUpdater scheduleTimingUpdater, - EmptyVehicleRelocator relocator, UnplannedRequestInserter requestInserter, DrtRequestInsertionRetryQueue insertionRetryQueue, - RequestQueue requestQueue) { + EmptyVehicleRelocator relocator, UnplannedRequestInserter requestInserter, DrtRequestInsertionRetryQueue insertionRetryQueue) { this.drtCfg = drtCfg; this.fleet = fleet; this.mobsimTimer = mobsimTimer; @@ -78,23 +78,20 @@ public DefaultDrtOptimizer(DrtConfigGroup drtCfg, Fleet fleet, MobsimTimer mobsi this.relocator = relocator; this.requestInserter = requestInserter; this.insertionRetryQueue = insertionRetryQueue; - this.unplannedRequests = requestQueue; rebalancingInterval = drtCfg.getRebalancingParams().map(rebalancingParams -> rebalancingParams.interval).orElse(null); } @Override public void notifyMobsimBeforeSimStep(@SuppressWarnings("rawtypes") MobsimBeforeSimStepEvent e) { - unplannedRequests.updateQueuesOnNextTimeSteps(e.getSimulationTime()); - boolean scheduleTimingUpdated = false; - if (!unplannedRequests.getSchedulableRequests().isEmpty() || insertionRetryQueue.hasRequestsToRetryNow(e.getSimulationTime())) { + if (!unplannedRequests.isEmpty() || insertionRetryQueue.hasRequestsToRetryNow(e.getSimulationTime())) { for (DvrpVehicle v : fleet.getVehicles().values()) { scheduleTimingUpdater.updateTimings(v); } scheduleTimingUpdated = true; - requestInserter.scheduleUnplannedRequests(unplannedRequests.getSchedulableRequests()); + requestInserter.scheduleUnplannedRequests(unplannedRequests); } relocateVehiclesToDepot(drtCfg.returnToDepotEvaluationInterval, drtCfg.returnToDepotTimeout); @@ -127,7 +124,7 @@ private void rebalanceFleet() { @Override public void requestSubmitted(Request request) { - unplannedRequests.addRequest((DrtRequest)request); + unplannedRequests.add((DrtRequest)request); } @Override diff --git a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DrtModeOptimizerQSimModule.java b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DrtModeOptimizerQSimModule.java index 92ba3a2376b..026ff7dbd55 100644 --- a/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DrtModeOptimizerQSimModule.java +++ b/contribs/drt/src/main/java/org/matsim/contrib/drt/optimizer/DrtModeOptimizerQSimModule.java @@ -37,7 +37,6 @@ import org.matsim.contrib.drt.optimizer.insertion.selective.SelectiveInsertionSearchQSimModule; import org.matsim.contrib.drt.optimizer.rebalancing.RebalancingStrategy; import org.matsim.contrib.drt.passenger.DrtOfferAcceptor; -import org.matsim.contrib.drt.passenger.DrtRequest; import org.matsim.contrib.drt.run.DrtConfigGroup; import org.matsim.contrib.drt.schedule.DrtStayTaskEndTimeCalculator; import org.matsim.contrib.drt.schedule.DrtTaskFactory; @@ -51,9 +50,7 @@ import org.matsim.contrib.drt.vrpagent.DrtActionCreator; import org.matsim.contrib.dvrp.fleet.Fleet; import org.matsim.contrib.dvrp.optimizer.VrpOptimizer; -import org.matsim.contrib.dvrp.passenger.DefaultRequestQueue; import org.matsim.contrib.dvrp.passenger.PassengerHandler; -import org.matsim.contrib.dvrp.passenger.RequestQueue; import org.matsim.contrib.dvrp.run.AbstractDvrpModeQSimModule; import org.matsim.contrib.dvrp.run.DvrpConfigGroup; import org.matsim.contrib.dvrp.run.DvrpModes; @@ -67,7 +64,6 @@ import org.matsim.core.router.util.TravelTime; import com.google.inject.Inject; -import com.google.inject.TypeLiteral; /** * @author Michal Maciejewski (michalm) @@ -88,13 +84,8 @@ protected void configureQSim() { getter.getModal(DepotFinder.class), getter.getModal(RebalancingStrategy.class), getter.getModal(DrtScheduleInquiry.class), getter.getModal(ScheduleTimingUpdater.class), getter.getModal(EmptyVehicleRelocator.class), getter.getModal(UnplannedRequestInserter.class), - getter.getModal(DrtRequestInsertionRetryQueue.class), - getter.getModal(new TypeLiteral>() {})); + getter.getModal(DrtRequestInsertionRetryQueue.class)); })); - - bindModal(new TypeLiteral>() {}).toProvider(modalProvider(getter -> { - return DefaultRequestQueue.withLimitedAdvanceRequestPlanningHorizon(drtCfg.advanceRequestPlanningHorizon); - })); bindModal(DepotFinder.class).toProvider( modalProvider(getter -> new NearestStartLinkAsDepot(getter.getModal(Fleet.class)))).asEagerSingleton(); diff --git a/contribs/dvrp/src/main/java/org/matsim/contrib/dvrp/passenger/DefaultRequestQueue.java b/contribs/dvrp/src/main/java/org/matsim/contrib/dvrp/passenger/DefaultRequestQueue.java deleted file mode 100644 index c34b6ceec36..00000000000 --- a/contribs/dvrp/src/main/java/org/matsim/contrib/dvrp/passenger/DefaultRequestQueue.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2020 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** * - */ - -package org.matsim.contrib.dvrp.passenger; - -import java.util.Collection; -import java.util.Comparator; -import java.util.PriorityQueue; -import java.util.Queue; -import java.util.TreeSet; - -import org.matsim.contrib.dvrp.optimizer.Request; - -/** - * @author Michal Maciejewski (michalm) - * @author Sebastian Hörl (sebhoerl), IRT SystemX - */ -public final class DefaultRequestQueue implements RequestQueue { - public static RequestQueue withLimitedAdvanceRequestPlanningHorizon( - double planningHorizon) { - //all immediate and selected advance (i.e. starting within the planning horizon) requests are scheduled - return new DefaultRequestQueue<>(planningHorizon); - } - - public static RequestQueue withInfiniteAdvanceRequestPlanningHorizon() { - return new DefaultRequestQueue<>(Double.POSITIVE_INFINITY);//all immediate and advance requests are scheduled - } - - public static RequestQueue withNoAdvanceRequestPlanningHorizon() { - return new DefaultRequestQueue<>(0);//immediate requests only - } - - private static final Comparator ABSOLUTE_COMPARATOR = Comparator.comparing( - PassengerRequest::getEarliestStartTime) - .thenComparing(PassengerRequest::getLatestStartTime) - .thenComparing(Request::getSubmissionTime) - .thenComparing(Request::getId); - - //all requests in the planning horizon (also includes old requests: never scheduled or unscheduled) - private final Collection schedulableRequests = new TreeSet<>(ABSOLUTE_COMPARATOR); - - //advance requests that are not in the planning horizon - private final Queue postponedRequests = new PriorityQueue<>(ABSOLUTE_COMPARATOR); - - private final double planningHorizon; - - private double lastTimeStep = -Double.MAX_VALUE; - - private DefaultRequestQueue(double planningHorizon) { - this.planningHorizon = planningHorizon; - } - - public void updateQueuesOnNextTimeSteps(double currentTime) { - lastTimeStep = currentTime; - while (!postponedRequests.isEmpty() && isSchedulable(postponedRequests.peek())) { - schedulableRequests.add(postponedRequests.poll()); - } - } - - public void addRequest(R request) { - (isSchedulable(request) ? schedulableRequests : postponedRequests).add(request); - } - - private boolean isSchedulable(R request) { - return request.getEarliestStartTime() <= lastTimeStep + planningHorizon; - } - - /** - * Assumes external code can modify schedulableRequests (e.g. remove scheduled requests and add unscheduled ones) - * - * @return requests to be inserted into vehicle schedules - */ - public Collection getSchedulableRequests() { - return schedulableRequests; - } -} diff --git a/contribs/dvrp/src/main/java/org/matsim/contrib/dvrp/passenger/RequestQueue.java b/contribs/dvrp/src/main/java/org/matsim/contrib/dvrp/passenger/RequestQueue.java deleted file mode 100644 index 0f6e14f6dda..00000000000 --- a/contribs/dvrp/src/main/java/org/matsim/contrib/dvrp/passenger/RequestQueue.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * *********************************************************************** * - * project: org.matsim.* - * *********************************************************************** * - * * - * copyright : (C) 2020 by the members listed in the COPYING, * - * LICENSE and WARRANTY file. * - * email : info at matsim dot org * - * * - * *********************************************************************** * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * See also COPYING, LICENSE and WARRANTY file * - * * - * *********************************************************************** * - */ - -package org.matsim.contrib.dvrp.passenger; - -import java.util.Collection; - -/** - * @author Michal Maciejewski (michalm) - * @author Sebastian Hörl (sebhoerl), IRT SystemX - */ -public interface RequestQueue { - void updateQueuesOnNextTimeSteps(double currentTime); - - void addRequest(R request); - - /** - * Assumes external code can modify schedulableRequests (e.g. remove scheduled - * requests and add unscheduled ones) - * - * @return requests to be inserted into vehicle schedules - */ - public Collection getSchedulableRequests(); -} diff --git a/contribs/taxi/src/main/java/org/matsim/contrib/taxi/optimizer/DefaultTaxiOptimizer.java b/contribs/taxi/src/main/java/org/matsim/contrib/taxi/optimizer/DefaultTaxiOptimizer.java index 86a31fa869e..5c6c35b3e8a 100644 --- a/contribs/taxi/src/main/java/org/matsim/contrib/taxi/optimizer/DefaultTaxiOptimizer.java +++ b/contribs/taxi/src/main/java/org/matsim/contrib/taxi/optimizer/DefaultTaxiOptimizer.java @@ -21,14 +21,14 @@ import static org.matsim.contrib.taxi.schedule.TaxiTaskBaseType.OCCUPIED_DRIVE; +import java.util.LinkedList; import java.util.List; +import java.util.Queue; import org.matsim.contrib.drt.passenger.DrtRequest; import org.matsim.contrib.dvrp.fleet.DvrpVehicle; import org.matsim.contrib.dvrp.fleet.Fleet; import org.matsim.contrib.dvrp.optimizer.Request; -import org.matsim.contrib.dvrp.passenger.DefaultRequestQueue; -import org.matsim.contrib.dvrp.passenger.RequestQueue; import org.matsim.contrib.dvrp.schedule.ScheduleTimingUpdater; import org.matsim.contrib.dvrp.schedule.Task; import org.matsim.contrib.taxi.run.TaxiConfigGroup; @@ -43,7 +43,7 @@ public class DefaultTaxiOptimizer implements TaxiOptimizer { private final Fleet fleet; private final TaxiScheduler scheduler; - private final RequestQueue unplannedRequests = DefaultRequestQueue.withNoAdvanceRequestPlanningHorizon(); + private final Queue unplannedRequests = new LinkedList<>(); private final UnplannedRequestInserter requestInserter; @@ -66,8 +66,7 @@ public DefaultTaxiOptimizer(EventsManager eventsManager, TaxiConfigGroup taxiCfg @Override public void notifyMobsimBeforeSimStep(@SuppressWarnings("rawtypes") MobsimBeforeSimStepEvent e) { - unplannedRequests.updateQueuesOnNextTimeSteps(e.getSimulationTime()); - requiresReoptimization |= !unplannedRequests.getSchedulableRequests().isEmpty(); + requiresReoptimization |= !unplannedRequests.isEmpty(); if (requiresReoptimization && isNewDecisionEpoch(e, params.getReoptimizationTimeStep())) { if (params.doUnscheduleAwaitingRequests) { @@ -82,7 +81,7 @@ public void notifyMobsimBeforeSimStep(@SuppressWarnings("rawtypes") MobsimBefore } } - requestInserter.scheduleUnplannedRequests(unplannedRequests.getSchedulableRequests()); + requestInserter.scheduleUnplannedRequests(unplannedRequests); if (params.doUnscheduleAwaitingRequests && taxiCfg.vehicleDiversion) { scheduler.stopAllAimlessDriveTasks(); @@ -99,12 +98,12 @@ public static boolean isNewDecisionEpoch(@SuppressWarnings("rawtypes") MobsimBef protected void unscheduleAwaitingRequests() { List removedRequests = scheduler.removeAwaitingRequestsFromAllSchedules(); - removedRequests.forEach(unplannedRequests::addRequest); + removedRequests.forEach(unplannedRequests::add); } @Override public void requestSubmitted(Request request) { - unplannedRequests.addRequest((DrtRequest)request); + unplannedRequests.add((DrtRequest)request); } @Override