feat(drt): add/remove vehicles dynamically during qsim #3104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a draft for introducing dynamic vehicle fleets in DVRP/DRT. The PR fixes #3086.
Major changes:
Fleet
is now an object with its own logic. In particular, it generates generats events when vehicles are added and removed;VehicleAddedEvent
andVehicleRemovedEvent
.Fleet
from aFleetSpecification
, users now need to implement aFleetCreator
. However, it works 99% analogously to the previous logic of creating a fleet. In most cases, this is changing two lines of code (see code changes in the unit tests). The change is necessary asFleet
has now become a container object to which vehicles are added at start-up or later on during the simulation.Fleet
, (2)QSim
, (3)DynActivityEngine
and DRT vehicles also need to get an initial task assigned. For that, two helper classes have been introduced:FleetExtensionHelper
(is a MobsimEngine), andDrtFleetExtensionHelper
(delegates to the former).All of this functionality is covered by
RunDrtExampleIT.testRunWithVariableFleetSize
. Here is an example of the integration test's output. Three vehicles are added dynamically between 8h00 and 12h00, thus, giving additional capacity during that period: