[Tutor] python simulations - saving state

Kent Johnson kent37 at tds.net
Wed May 17 12:07:06 CEST 2006


sarahjm at cc.usu.edu wrote:
> Hi,
> 
> I am fairly new to programming in python, but for work I am running a simulation
> of a distribution center.  What I am trying to do now is to save the state of
> the simulation (i.e. the event list and any other necessary variables) so that
> it can be "restored" later.  I eventually want to be able to save the state of
> the simulation and restart it as well as being able to save periodically and
> change the event list for changes in the simulation (i.e. for a distribution
> center if a truck is running late and will not be arriving on time I would need
> to modify it's arrive time and see how that would change the execution of the
> rest of the simulation).
> 
> I have found I can't pickle _e (the event list) and I was wondering what
> suggestions you could give or where I could go to get more help on this topic.

What error do you get when you try to pickle _e?

You might me interested in SimPy, it seems well suited for this kind of 
simulation:
http://simpy.sourceforge.net/

Kent



More information about the Tutor mailing list