Skip to content Skip to sidebar Skip to footer

What Is The Easiest Way To Copy A Class Instance That Contains Simpy Processes?

I'm trying to create a copy of a class instance that I can simulate without affecting the original instance of the class. I've tried using copy.copy, but I run into this problem: s

Solution 1:

One way of having an existing simpy.Environment take several different paths of execution in parallel would be to use os.fork() when you're done setting up the Environment. You then can, for example, leverage the interprocess communication primitives in multiprocessing, such as Queues, etc, for collecting the interesting results of the different simulations. This requires writing a fair amount of boilerplate associated with manual forking, but it can be more than worth it.

NB: os.fork(), that I know of, is available only under Unix-like OSes.

Post a Comment for "What Is The Easiest Way To Copy A Class Instance That Contains Simpy Processes?"