matsim-org / matsim-code-examples

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

Running DRT MATSim Unexpected Shutdown #472

Open jingjunL opened 3 years ago

jingjunL commented 3 years ago

Hello Everyone,

I tried to add DRT into our basic scenario following the code from 12.0 MATSim code example: https://github.com/matsim-org/matsim-code-examples/blob/12.x/src/main/java/org/matsim/codeexamples/extensions/dvrp/RunDrtExample.java

I adapted the above code a bit (but not too much) and added my plan and config file. However, the exception occurred saying MATSim unexpectedly terminated caused by java.lang.NoSuchMethodError: com.google.common.collect.ImmutableMap.toImmutableMap(Ljava/util/function/Function;Ljava/util/function/Function;)Ljava/util/stream/Collector;

You can also find my logfileWarningsErrors for better clarifications.

I'm wondering if anyone is aware of the reason for such termination? Thanks very much for your help in advance! logfileWarningsErrors.log logfile.log

michalmac commented 3 years ago

Seems that an older guava library is used instead. This method was added in 21.0, and we use version something like 28 or 29. Please check your project dependencies.

jingjunL commented 3 years ago

Seems that an older guava library is used instead. This method was added in 21.0, and we use version something like 28 or 29. Please check your project dependencies.

Indeed @michalmac , I moved my scenario to the code example project and it works now.

May I ask you an additional question? I'm wondering if there's a pom.xml that making sure I always have the latest dependencies? Since I find it tricky knowing which dependencies should be added running different extensions also there are code examples available.

Thanks for your kindly help of course :)

michalmac commented 3 years ago

This is how you can do it from a console: https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

But different IDEs (intelliJ, eclipse) offer similar functionality where you can track down conflicts in a more graphical/readable way.

jingjunL commented 3 years ago

This is how you can do it from a console: https://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html

But different IDEs (intelliJ, eclipse) offer similar functionality where you can track down conflicts in a more graphical/readable way.

Thanks again for the answer @michalmac !

Really sorry for bothering you again but I faced another problem when running DRT, and didn't find any solutions after checking online. I used the code example from the MATSim Maas Cottbus door2door scenario. The initial plans of my agents all mode "car", and it will ideally switch to drt, bus, walk and cycle in the coming iterations.

The iteration 0 runs successfully, and I did see some agents have DRT plan already in the iteration 1. However, the simulation just stopped at 7:00:00 saying the SimStepParallelEventsManagerImpl$ProcessEventsRunnable0 died with exception while handling events, and the coming exceptions say "no scoring parameters are defined for drt". However, I did define such parameters in my config file, so I cannot think of any reason for this.

I attached my config and logfile here for better clarifications. Will be very appreciated if you can offer me some suggestions! config.txt logfile.log logfileWarningsErrors.log

Thanks :)

kainagel commented 3 years ago

Something like

    <parameterset type="modeParams">
        <param name="mode" value="drt"/>
        <param name="constant" value="6.0"/>
        <param name="marginalUtilityOfTraveling_util_hr" value="0" />
    </parameterset>

in planCalcScore.

You also almost certainly will want your marginal utilities of travelling negative.

jingjunL commented 3 years ago

Something like in planCalcScore. You also almost certainly will want your marginal utilities of travelling negative.

Thanks very much for your answer, Professor Nagel! I added your code into my config, and now DRT is working on my model.

However, I still feel a bit puzzled about this setting: since I have already added the drtFare module config at the beginning (e,g, setting daily subscription fee etc.), why do I need to do another setting in the modeParams? And, if I have the values in these two groups differently, which fare will MATSim actually implement when running the model? In the future when I calibrating my DRT fare strategies, which is the right parameter I should adjust?

I hope the above states my meaning well. Many thanks for your suggestions! :)

ArezHK commented 1 month ago

@jingjunL Hi, may I ask if you were able to successfully run your model consisting of Drt and other modes? If so, could you please share your config and code, if possible?