Skip to content

faq 127369225

Billy Charlton edited this page Sep 5, 2018 · 2 revisions

Getting the iteration number for writing own output

by Jishnu Narayan on 2017-12-01 11:30:02


Dear all,

I want to write some additional output data for each iteration. For this I need to get the number of the ongoing iteration. How can I get the number of the current iteration and the iteration that have just been finished?

Thanks!


Comments: 2


Re: Getting the iteration number for writing own output

by Marcel Rieser on 2017-12-01 11:48:49

You should use a ControlerListener, specifically an IterationEndsListener that gets called when an iteration ends. When your listener is called, you get the current/ending iteration as an Argument and can use it to write out your data. Have a look at the following code example to see how ControlerListeners work:

https://github.com/matsim-org/matsim-code-examples/tree/master/src/main/java/tutorial/programming/example07ControlerListener


Re: Getting the iteration number for writing own output

by Jishnu Narayan on 2018-05-18 09:31:49

Hello Marcel,

The link that you have given is no longer available. Is there any other example out there?

Clone this wiki locally