title: How can I iterate a SimPy simulation in parallel?
body: <p>I have a SimPy model that returns a random result which I would like to replicate many times. Each replication is independent so to make it faster I'd like to run them in parallel. I've tried Python's <a href="https://docs.python.org/3.7/library/multiprocessing.html" rel="nofollow noreferrer">multiprocessing</a>, <a href="https://github.com/uqfoundation/pathos" rel="nofollow noreferrer">Pathos multiprocessing</a>, and joblib <a href="https://joblib.readthedocs.io/en/latest/parallel.html" rel="nofollow noreferrer">Parallel</a>, but with each approach I get the same error: <code>TypeError: can't pickle generator objects</code>. Is there any way to avoid this error and run the simulation in parallel?</p>
  
  <p>SimPy relies on generators as explained <a href="https://simpy.readthedocs.io/en/latest/simpy_intro/basic_concepts.html" rel="nofollow noreferrer">here</a>, so avoiding them isn't possible.</p>