matsim-org / matsim-code-examples

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

query about the value of parameter "firstIteration" #465

Open yangxiong11 opened 3 years ago

yangxiong11 commented 3 years ago

Hello,

The "config".xml of the "equil" scenario:

How to understand setting the value of parameter "firstIterarion" to a non-zero value (e.g. "5"). I found if I set this value to 5, the output folder will only contain the results generated from the iteration 5 to iteration 10. Whether this value specifies the first execution of the "replanning" module? The "mobsim" module if is still executed from the iteration 0 when the "firstIteration" is equal to "5" (so how many times the "mobsim" module will be executed when "firstIteration" = 5 and "lastIteration" = 10)?

Many thanks!

JWJoubert commented 3 years ago

The mobsim will, in your example @yangxiong11, be executed 6 times: iterations 5, 6, ..., 10.

Why be able to set it? You may have a run that was interrupted due to a power outage, computer crash, end-of-wall-time on a server, etc. If you then want to restart, you may not want to restart all the way from iteration zero, but start where you left off. IT is just the naming convention. You will then likely pass the 5th iteration's plans, network, etc as input files for the new run, which start at iteration 5.

mrieser commented 3 years ago

It is just the naming convention.

Not exactly true: MATSim uses a deterministic seed for the random number generator in each iteration. Setting the firstIteration parameter accordingly when "resuming" a run helps to actually really have the exact same random numbers when continuing.