matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
83 stars 179 forks source link

[DRT Module Error] RuntimeException. Undefined Time. Reason could be that the dvrp network is not fully connected. #586

Closed vsgo222 closed 3 years ago

vsgo222 commented 3 years ago

Hello. I am trying to model a city that has ride-hailing services (Door2Door) in addition to bus, rail, tram, and cable_car. I was referring to the MATSim MAAS documentation I am running the RunDRTScenario as the main entry point for MATSim simulation. However, I get an error and not sure which entry in the config file needs to be edited. The error is org.matsim.core.router.TripRouter$UnknownModeException: unregistered main mode |bike|: does not pertain to [car, drt, walk] SFConfig.zip logfile.zip

What could be the potential error?

Thank you Vedant

vsgo222 commented 3 years ago

Hello. I am trying to model a city that has ride-hailing services (Door2Door) in addition to bus, rail, tram, and cable_car. I was referring to the MATSim MAAS documentation I am running the RunDRTScenario as the main entry point for MATSim simulation. However, I get an error and not sure which entry in the config file needs to be edited. The error is org.matsim.core.router.TripRouter$UnknownModeException: unregistered main mode |bike|: does not pertain to [car, drt, walk] SFConfig.zip logfile.zip

What could be the potential error?

Thank you Vedant

My main mode in the city are car,bike, walk, bus, rail,cable_car, tram. City is San Francisco.

kainagel commented 3 years ago

A typical reason to obtain that error message is if there is no router registered for "bike".

If that is the issue, then the easiest way to make progress is to define a "teleportation" router for bike. https://www.matsim.org/docs/userguide/ , Section 7.2.

(There is a bit of an issue that there are some teleportation routers configured by default, but they get removed as soon as other routers are added. A bit like the default constructor in Java.)

Please let us know if that helps or not.

vsgo222 commented 3 years ago

Prof @kainagel Thank you for the response. for the moment, I skipped "bike" mode. Now it surpass the initialization however gets stuck in creating DVRP free-speed TT matrix. Is there a way to look further into the creating of free-speed TT matrix. What I could figure out is that MATSim spits the San Francisco city into 2756 zones and in the log files I see that it keeps iterating zone 1 & 2 numerous times. So I am guessing that this is where the code is stuck. `

[Guice/ErrorInCustomProvider]: UncheckedExecutionException: RuntimeException: Undefined Time. Reason could be that the dvrp network is not fully connected. Please check and/or clean. at DvrpModule.install(DvrpModule.java:78) _ installed by: Modules$CombinedModule -> Modules$CombinedModule -> AbstractModule$4 -> Modules$OverrideModule -> AbstractModule$4 -> Modules$OverrideModule -> AbstractModule$4 -> Modules$OverrideModule -> AbstractModule$4 -> Modules$OverrideModule -> AbstractModule$4 -> Modules$OverrideModule -> DvrpModule while locating DvrpTravelTimeMatrix while locating DvrpTravelTimeMatri SF_SmallSample.zip x annotated with @DvrpMode(value=drt) at AbstractDvrpModeQSimModule.bindModal(AbstractDvrpModeQSimModule.java:66) _ installed by: QSimProvider$1 -> AbstractQSimModule$1 -> Modules$OverrideModule -> DrtModeQSimModule -> DrtModeOptimizerQSimModule -> ExtensiveInsertionSearchQSimModule while locating DrtInsertionSearch<OneToManyPathSearch$PathData> annotated with @DvrpMode(value=drt) at AbstractDvrpModeQSimModule.bindModal(AbstractDvrpModeQSimModule.java:62) _ installed by: QSimProvider$1 -> AbstractQSimModule$1 -> Modules$OverrideModule -> DrtModeQSimModule -> DrtModeOptimizerQSimModule while locating UnplannedRequestInserter annotated with @DvrpMode(value=drt) at AbstractDvrpModeQSimModule.bindModal(AbstractDvrpModeQSimModule.java:62) _ installed by: QSimProvider$1 -> AbstractQSimModule$1 -> Modules$OverrideModule -> DrtModeQSimModule -> DrtModeOptimizerQSimModule while locating DrtOptimizer annotated with @DvrpMode(value=drt) while locating VrpOptimizer annotated with @DvrpMode(value=drt) at AbstractDvrpModeQSimModule.bindModal(AbstractDvrpModeQSimModule.java:62) _ installed by: QSimProvider$1 -> AbstractQSimModule$1 -> Modules$OverrideModule -> DrtModeQSimModule -> PassengerEngineQSimModule while locating PassengerEngine annotated with @DvrpMode(value=drt) while locating PassengerHandler annotated with @DvrpMode(value=drt) at AbstractDvrpModeQSimModule.bindModal(AbstractDvrpModeQSimModule.java:62) _ installed by: QSimProvider$1 -> AbstractQSimModule$1 -> Modules$OverrideModule -> DrtModeQSimModule -> DrtModeOptimizerQSimModule while locating VrpAgentLogic$DynActionCreator annotated with @DvrpMode(value=drt) at AbstractDvrpModeQSimModule.bindModal(AbstractDvrpModeQSimModule.java:62) _ installed by: QSimProvider$1 -> AbstractQSimModule$1 -> Modules$OverrideModule -> DrtModeQSimModule -> VrpAgentSourceQSimModule while locating VrpAgentSource annotated with @DvrpMode(value=drt) while locating QSimProvider while locating Mobsim

Learn more: https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER Caused by: UncheckedExecutionException: RuntimeException: Undefined Time. Reason could be that the dvrp network is not fully connected. Please check and/or clean. at Futures.wrapAndThrowUnchecked(Futures.java:1333) at Futures.getUnchecked(Futures.java:1319) at java.base/ArrayList.forEach(ArrayList.java:1541) at ExecutorServiceWithResource.submitRunnablesAndWait(ExecutorServiceWithResource.java:83) at TravelTimeMatrices.calculateTravelTimeMatrix(TravelTimeMatrices.java:41) at DvrpTravelTimeMatrix.(DvrpTravelTimeMatrix.java:41) at DvrpGlobalTravelTimesMatrixProvider.get(DvrpGlobalTravelTimesMatrixProvider.java:50) at DvrpGlobalTravelTimesMatrixProvider.get(DvrpGlobalTravelTimesMatrixProvider.java:35) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at SingletonScope$1.get(SingletonScope.java:169) at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at FactoryProxy.get(FactoryProxy.java:60) at InjectorImpl$1.get(InjectorImpl.java:1100) at InjectorImpl.getInstance(InjectorImpl.java:1133) at ModalProviders$InstanceGetter.getModal(ModalProviders.java:83) at ExtensiveInsertionSearchQSimModule.lambda$configureQSim$0(ExtensiveInsertionSearchQSimModule.java:58) at ModalProviders$2.get(ModalProviders.java:56) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at SingletonScope$1.get(SingletonScope.java:169) at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at InjectorImpl$1.get(InjectorImpl.java:1100) at InjectorImpl.getInstance(InjectorImpl.java:1133) at ModalProviders$InstanceGetter.getModal(ModalProviders.java:87) at DrtModeOptimizerQSimModule.lambda$configureQSim$3(DrtModeOptimizerQSimModule.java:95) at ModalProviders$2.get(ModalProviders.java:56) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at SingletonScope$1.get(SingletonScope.java:169) at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at InjectorImpl$1.get(InjectorImpl.java:1100) at InjectorImpl.getInstance(InjectorImpl.java:1133) at ModalProviders$InstanceGetter.getModal(ModalProviders.java:83) at DrtModeOptimizerQSimModule.lambda$configureQSim$0(DrtModeOptimizerQSimModule.java:82) at ModalProviders$2.get(ModalProviders.java:56) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at SingletonScope$1.get(SingletonScope.java:169) at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at FactoryProxy.get(FactoryProxy.java:60) at InjectorImpl$1.get(InjectorImpl.java:1100) at InjectorImpl.getInstance(InjectorImpl.java:1133) at ModalProviders$AbstractProvider.getModalInstance(ModalProviders.java:110) at DefaultPassengerEngine$1.get(DefaultPassengerEngine.java:182) at DefaultPassengerEngine$1.get(DefaultPassengerEngine.java:172) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at SingletonScope$1.get(SingletonScope.java:169) at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at FactoryProxy.get(FactoryProxy.java:60) at InjectorImpl$1.get(InjectorImpl.java:1100) at InjectorImpl.getInstance(InjectorImpl.java:1133) at ModalProviders$InstanceGetter.getModal(ModalProviders.java:83) at DrtModeOptimizerQSimModule.lambda$configureQSim$6(DrtModeOptimizerQSimModule.java:141) at ModalProviders$2.get(ModalProviders.java:56) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at SingletonScope$1.get(SingletonScope.java:169) at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at InjectorImpl$1.get(InjectorImpl.java:1100) at InjectorImpl.getInstance(InjectorImpl.java:1133) at ModalProviders$AbstractProvider.getModalInstance(ModalProviders.java:110) at VrpAgentSourceQSimModule$1.get(VrpAgentSourceQSimModule.java:52) at VrpAgentSourceQSimModule$1.get(VrpAgentSourceQSimModule.java:42) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:57) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47) at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at SingletonScope$1.get(SingletonScope.java:169) at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) at InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213) at InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186) at InternalInjectorCreator.build(InternalInjectorCreator.java:113) at InjectorImpl.createChildInjector(InjectorImpl.java:239) at InjectorImpl.createChildInjector(InjectorImpl.java:244) at QSimProvider.get(QSimProvider.java:97) at QSimProvider.get(QSimProvider.java:52) at ProviderInternalFactory.provision(ProviderInternalFactory.java:86) at BoundProviderFactory.provision(BoundProviderFactory.java:72) at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:60) at BoundProviderFactory.get(BoundProviderFactory.java:59) at InjectorImpl$1.get(InjectorImpl.java:1100) at NewControler.runMobSim(NewControler.java:124) at AbstractController$8.run(AbstractController.java:211) at AbstractController.iterationStep(AbstractController.java:243) at AbstractController.mobsim(AbstractController.java:207) at AbstractController.iteration(AbstractController.java:154) at AbstractController.doIterations(AbstractController.java:121) at AbstractController$1.run(AbstractController.java:81) at MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:69) at MatsimRuntimeModifications.run(MatsimRuntimeModifications.java:52) at AbstractController.run(AbstractController.java:89) at NewControler.run(NewControler.java:82) at Controler.run(Controler.java:249) at RunDrtScenario.run(RunDrtScenario.java:36) at RunDrtScenario.main(RunDrtScenario.java:42) Caused by: RuntimeException: Undefined Time. Reason could be that the dvrp network is not fully connected. Please check and/or clean. at TravelTimeMatrices.lambda$computeForDepartureZone$3(TravelTimeMatrices.java:60) at OptionalTime.orElseThrow(OptionalTime.java:92) at TravelTimeMatrices.computeForDepartureZone(TravelTimeMatrices.java:60) at TravelTimeMatrices.lambda$calculateTravelTimeMatrix$1(TravelTimeMatrices.java:43) at ExecutorServiceWithResource.lambda$submitRunnable$1(ExecutorServiceWithResource.java:73) at java.base/Executors$RunnableAdapter.call(Executors.java:515) at java.base/FutureTask.run(FutureTask.java:264) at java.base/ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/Thread.run(Thread.java:834)

` SF_trial.zip

vsgo222 commented 3 years ago

I am sharing the sample file, if the issue needs to be recreated. SF_SmallSample.zip

vsgo222 commented 3 years ago

I kind of re-ran the whole simulation with focus purely on DRT similar to the example in MAAS - COTBUS but setup exclusively for San Francisco. I still get the same error. What I could guess from the error is something pertaining to TT matrix, similar to the notes I mentioned above. @kainagel @michalmac sf-drt_200Sample.zip

Any help would be very helpful.

kainagel commented 3 years ago

This is entirely @michalmac 's domain; there is unfortunately nothing I can do.

Have you followed the hint? There are different ways to configure this. If you have drt running on links that are attributed with "drt", than the network of those drt links needs to be connected.

vsgo222 commented 3 years ago

This is entirely @michalmac 's domain; there is unfortunately nothing I can do. Have you followed the hint? There are different ways to configure this. If you have drt running on links that are attributed with "drt", than the network of those drt links needs to be connected.

Prof. @kainagel, Yes. When I test using a simple network the scenario runs perfectly fine. However, when I switch to larger network like San Francisco one, it kinds of throws me and error. The DvrpTravelTimeMatrix is generated for simple one but it throws exception on actual road network

@michalmac , is there any observations you have?

tschlenther commented 3 years ago

I did not really look into it might be that the network of your dvrp mode(s) is not entirely connected. Please try running the MultiModalNetworkCleaner and report back.

michalmac commented 3 years ago

I just run the scenario with a cleanedup network and it passes the dvrp TT matrix creation step. Please make sure that the "car" network is connected.

vsgo222 commented 3 years ago

Hello @tschlenther, @michalmac , I did the network clean using MultiModalNetworkCleaner; however I still get the same error. Is there a way to learn from you, how are you doing? Maybe my setup is wrong or something. Perhaps a zoom call to walk me through if that sounds feasible. I am in the U.S. East Coast.

michalmac commented 3 years ago

Can you send the cleaned up network (along with the other files)? I will try to run.

Janekdererste commented 3 years ago

I did the network clean using MultiModalNetworkCleaner; however I still get the same error.

The MultimodalNetworkCleaner's API is not very intuitive. Could you post a code snippet on how you apply it? Chances are good that you need to use the cleaner differently.

vsgo222 commented 3 years ago

I did the network clean using MultiModalNetworkCleaner; however I still get the same error.

The MultimodalNetworkCleaner's API is not very intuitive. Could you post a code snippet on how you apply it? Chances are good that you need to use the cleaner differently.

@Janekdererste coming from a non-java/programming background I think I can agree. I looked for its implementation, if any, and found matsim berlin as a good scenario case. So, I used it as a backend. Let me know if I am using the right way. RunDrtSanFranciscoScenario.zip

vsgo222 commented 3 years ago

Can you send the cleaned up network (along with the other files)? I will try to run.

@michalmac Right now, I am keeping it very simple and running on a very small sample. In the end with city like San Francisco, I would have Pt modes as bus, cable_car, tram, train along with ride_hailing. Attach is the set of files I am using to run for this small run. Second zip file contains the network which is spitted out after passing the existing network through MultiModalNetworkCleaner. input_drt.zip cleaned_network.zip Please let me know if I can be helpful in any more way.

vsgo222 commented 3 years ago

Can you send the cleaned up network (along with the other files)? I will try to run.

@michalmac Right now, I am keeping it very simple and running on a very small sample. In the end with city like San Francisco, I would have Pt modes as bus, cable_car, tram, train along with ride_hailing. Attach is the set of files I am using to run for this small run. Second zip file contains the network which is spitted out after passing the existing network through MultiModalNetworkCleaner. input_drt.zip cleaned_network.zip Please let me know if I can be helpful in any more way.

Hello @michalmac or anyone, if you had a chance to look into it or have time to guide me I would be very much happy. I really want to know why it is throwing me errors. A simple network exercise just completes the run without any issue.

michalmac commented 3 years ago

There is some mismatch between the network and the plans in your input files (links referenced in the plans are not present in the network). It does not matter if I use matsim_network.xml or drtnetwork.xml

michalmac commented 3 years ago

Maybe the easiest way for you to make it run woudl be to:

  1. add "drt" to modes of all links where the drt vehicles can move
  2. change the network modes in the dvrp config to: <param name="networkModes" value="drt"/>
  3. add the following line inside the drt config: <param name="useModeFilteredSubnetwork" value="true"/> (this will automatically clean up the drt network)
michalmac commented 3 years ago

I kind of re-ran the whole simulation with focus purely on DRT similar to the example in MAAS - COTBUS but setup exclusively for San Francisco. I still get the same error. What I could guess from the error is something pertaining to TT matrix, similar to the notes I mentioned above. @kainagel @michalmac sf-drt_200Sample.zip

Any help would be very helpful.

I did all 3 steps (https://github.com/matsim-org/matsim-code-examples/issues/586#issuecomment-884811620) for this scenario input data (I simply added "drt" to all links having "car" as one of the modes) and the calculation of the matrix worked.

However, the simulation stopped a bit later with errors like acttype "business" is not known in utility parameters (module name="planCalcScore" in the config file). After providing all the missing scoring params for several activity types, the simulation completed without errors.

michalmac commented 3 years ago

Here's the modified scenario that can be run from RunMaas: sf-drt_200Sample-modified.zip

vsgo222 commented 3 years ago

@michalmac thank you for the feedback and instructions. I would have a look, hopefully it runs on my side.