Pause/restart simulation

451 views
Skip to first unread message

Hashan Mendis

unread,
Dec 21, 2015, 2:24:48 PM12/21/15
to python-simpy
Hi,

I am a research student using SimPy for multicore resource management simulations. Have been using SimPy 3.0.5 for a while now.

Does SimPy have capability to pause/restart simulations ? restart - meaning if a simulation crashes for some reason, to restart from the crash point ?

Many thanks
Rosh

Stefan Scherfke

unread,
Dec 22, 2015, 1:24:30 PM12/22/15
to Hashan Mendis, python-simpy
Hi Rosh,

unfortunately, this is not possible. SimPy relies heavily on Python
generators and you can not (re)store a certain state for generators (you
cannot even pickle them).

Maybe you can find a workaround by storing the state state of your processes
(e.g. from instance attributes) and manually restoring it.

Cheers,
Stefan
> --
> You received this message because you are subscribed to the Google Groups "python-simpy" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to python-simpy...@googlegroups.com.
> To post to this group, send email to python...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/python-simpy/7fe3a2f8-bcd1-4972-b5df-028883be9116%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

James Arruda

unread,
Dec 30, 2015, 11:07:10 AM12/30/15
to python-simpy
Why are you trying to restart? Or rather, what is the cause of the crash?

You can use a random seed to make your code deterministic and repeatable, so if you have a failure of some kind you can redo all the exact same steps. That would only work if you don't have external data sources or interfaces that are beyond your control (can't be seeded).

You can easily create a numpy random object with a given seed: http://stackoverflow.com/a/5837352/3491531 and share that object with your simulation objects. 

James

徐倩

unread,
May 8, 2018, 10:51:45 PM5/8/18
to python-simpy
Hi, I am also interested in restart simulation. I want to pause the simulation and change its schedule path and restart it again, like rerouting in computer network. Have you found any available solution for this? Thanks!


Qian

在 2015年12月22日星期二 UTC+8上午3:24:48,Hashan Mendis写道:
Reply all
Reply to author
Forward
0 new messages