matsim-org / matsim-code-examples

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

Terminate matsim simulation after specific run time #331

Open orennahum opened 4 years ago

orennahum commented 4 years ago

Hi,

I'm using MatSim as part of a genetic algorithm. The run situations in which MatSim runs for a very long time. Is there a way to limit MatSim's run time, let's say for 2 or 3 minutes? In such cases, I don't mind if the results of the MatSim simulation are not close to optimal.

Thanks, Oren

golanbendor commented 4 years ago

Hi Oren

Just set in code:

config.controler().setLastIteration(numberofiterations);

Or in the config file:

<module name="controler">
    <param name="lastIteration" value="numberofiterations" />
</module>

Best, Golan

orennahum commented 4 years ago

Thanks, I will try it.

Oren