SimPy is a process-based discrete-event simulation framework based on standard Python. Its event dispatcher is based on Python's generators and can also be used for asynchronous networking or to implement multi-agent systems (with both simulated and real communication). Processes in SimPy are simple Python generator functions and are used to model active components such as customers, vehicles, or agents. SimPy also provides various types of shared resources to model limited capacity congestion points (such as servers, checkout counters, and tunnels). From version 3.1, it will also provide monitoring capabilities to aid in gathering statistics about resources and processes:
import simpy def clock(env, name, tick): while True: print(name, env.now) yield env.timeout(tick) # env = simpy.Environment() env.process(clock(env, 'fast', 0.5)) env.process(clock(env, 'slow', 1)) env.run(until=2) ('fast', 0) ('slow', 0) ('fast', 0.5) ('slow', 1) ('fast', 1.0...