matsim-org / matsim-code-examples

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

Plan file of last iteration for successive iterations #834

Open aayushtewari01 opened 1 year ago

aayushtewari01 commented 1 year ago

Has anyone used the output plan file of last iteration from one simulation to run second successive simulation using same network file. I read that the output plan file of nth iteration can be used as initial plan file for a new simulation as n+1th iteration. I tried doing so several times but always I encounter a network error e.g node is disconnected. While I used the same network file to complete 200 iterations and now want to run simulation from 201th iteration onwards.

Any guidance would be helpful in saving a lot of time. Thanks

Janekdererste commented 1 year ago

This should in fact be possible. Could you please provide the logfile, and if possible the population and network file? I will have a look at it then.

tschlenther commented 1 year ago

Just a few more thoughts/questions:

I have done run-chaining many times and never encountered such an issue. Just to be clear: Does your consecutive run point to the exact same network file as the first run or to the *output_network.xml.gz from the first run? Moreover: Does your run script change the network or do you work with other network-changing functionalitites in your simulation scenario? Are you running location choice (only in the second run)? Is the input network file clean (i.e. did you run MultiModalNetworkCleaner on it)?

mrieser commented 1 year ago

This should be possible. Just to clarify (unrelated to your actual problem with the network):

While I used the same network file to complete 200 iterations and now want to run simulation from 201th iteration onwards.

If you use the plans file of iteration 200, start the new run also with iteration 200. Using the "output.plans.xml.gz"-file and continuing with iteration 201 does not result in the same results than when continuing the first run.

Explanation:

The first iteration of a run never does replanning. So if you use the output-plans-file and start with iteration 201, the replanning of iteration 201 would essentially be missing. The plans in "it200/200.plans.xml.gz" are the plans after replanning, but before mobsim, in iteration 200. So you can use those to resume at iteration 200 (it should generate the same events file like the first run), and then continue with iteration 201 and the regular replanning and mobsim.