matsim-org / matsim-code-examples

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

Cadyts Integration between car and public transit #286

Open whizkid-25 opened 4 years ago

whizkid-25 commented 4 years ago

I have successfully ran Cadyts integration using car as main mode. However, my goal is to combine public transit and car and then observe the mode switch. I am trying to calibrate using Cadyts.

Additional Modules I have added to incorporate PT

  1. SubtourModeChoice
  2. TransitRouter 3.Strategies: (a) Best Score 0.5 (b) Select Random 0.2 (c) ChangeTripMode 0.3
  3. Transit Module
  4. qsim; main mode: car,pt
  5. counts; analyze modes car,pt I have attached the error log file along with my input files. I am struggling to understand the errors. Can you guys please help me!

config.txt counts.txt facilities.txt transitVehicles.txt transitschedule.txt

logfileWarningsErrors.log

Janekdererste commented 4 years ago

Hi,

the error indicates, that somewhere in the program an experimental transit route is assumed to be a NetworkRoute. This is becuase you are defining car and pt as mainModes in the qsim config module. Instead, only use car as mainMode. Pt will still be routed on the pt network, but you don't have to specify it there.

Also, your counts scale factor is 1.0 but you have a comment in your config, stating you are running a 1% sample. In this case you would have to have a counts scale factor of 100.

whizkid-25 commented 4 years ago

Hi @Janekdererste I have used only car as MainMode in qsim and also I have changed the count scale factor to 100.

However, I have used two separate count modules one for car and the other for PT.

The run shows a NoSuchMethod Error (See the attached photo)

NoSuchMethod Error

In terms of strategy I have used ChangeExpBeta, Reroute, ChangeTripMode and SubTourModeChoice together in the ratio (0.7/0.1/0.1/0.1) together.

I have included another strategy " TimeAllocationMutator_Reroute" but set the value as 0.0

In SubTourMode Module I have used the modes as PT. Also, in the ChangeMode module I used 'pt' as modes used.

I have attached the config. file here. config.txt

Janekdererste commented 4 years ago

NoSuchMethodErros indicate conflicting library versions in your classpath. Which matsim version do you use? the current version is 11.

The recomended way to run matsim is to clone the matsim example project https://github.com/matsim-org/matsim-example-project and alter the run class (https://github.com/matsim-org/matsim-example-project/blob/master/src/main/java/org/matsim/project/RunMatsim.java). If you fork the example-project and push your changes to your fork I could even inspect your run class.

If you then want to include different modules simply add them to your pom.xml as dependency. When using contribs like cadyts the version numbre should match used matsim version.

Yet another pit-fall I've noticed in your config file is your storage and flow capacity. They have to be adjusted to your sample size as well. In this case, for a 1% Sample set both to 0.1.

Also, you have set the available modes in subtourmodechoice to only pt. This means agents may change to pt, but they will not change back to car. If you want to allow mode changes in both directions (which is the case most of the times) you'd have to set modes to "car,pt"

whizkid-25 commented 4 years ago

Hi @Janekdererste

Thank you for your valuable comment and feedback. I use Matsim 10.0 and the run command for cadyts intergration is " java -Xmx2048m -cp matsim-0.10.0.jar;cadytsIntegration-0.11.0-SNAPSHOT\cadytsIntegration-0.11.0-SNAPSHOT.jar org.matsim.contrib.cadyts.run.RunCadyts4CarExample config.xml

If I install MatSim 11.0 and use the contrib eg. cadyts 11.0 snapshot then you think this will work? I will change the storage and flow capacity accordingly.

Janekdererste commented 4 years ago

You should always use the same version numbers for the matsim core module as well as for all contribs. We make sure, that within the same version things like your classnotfound error don't happen.

I'd recommend using matsim 11.0. cadyts car should also be available in that version.

I also recommend to do dependency management via Maven and the matsim-example-project, as stated in an earlier comment. You can easily add dependencies via pom.xml. To get a runnable jar you have to execute

mvn clean package

But I also see, that this might be a little overwhelming if you are not familiar with the java Toolchain.

whizkid-25 commented 4 years ago

Hi @Janekdererste

I have tried to run the cadyts and MATSim using the same version. However, there's still errors. Probably the run command for PT is different than car because my config. with car is running perfectly. I am using the org.matsim.contrib.cadyts.run.RunCadyts4CarExample run command. Is there a different run command for PT?