Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Waiting lines, queues and ciw

Waiting lines, queues and ciw

A lightning talk about the discrete event simulation package ciw: http://ciw.readthedocs.io/

Vince Knight

August 31, 2017
Tweet

More Decks by Vince Knight

Other Decks in Science

Transcript

  1. >>> import ciw >>> dist = [’Deterministic’, 1] >>> N

    = ciw.create_network(Arrival_distributions=[dist], ... Service_distributions=[dist], ... Number_of_servers=[1]) >>> seed = 0 >>> max_customers = 5000 >>> ciw.seed(seed) >>> Q = ciw.Simulation(N) >>> Q.simulate_until_max_customers(max_customers)
  2. >>> def get_times(Q): ... """ ... Obtain total time and

    service time of every individual ... """ ... ... total_times = [ind.data_records[0].exit_date - ... ind.data_records[0].arrival_date ... for ind in Q.nodes[-1].all_individuals[:-1]] ... service_times = [ind.data_records[0].service_time ... for ind in Q.nodes[-1].all_individuals[:-1]] ... return total_times, service_times >>> total_times, service_times = get_times(Q)
  3. 0.6 0.8 1.0 1.2 1.4 Time units 0 1000 2000

    3000 4000 5000 Deterministic queue Total time Service time
  4. >>> dist = [’Exponential’, 1] >>> N = ciw.create_network(Arrival_distributions=[dist], ...

    Service_distributions=[dist], ... Number_of_servers=[1]) >>> seed = 0 >>> max_customers = 5000 >>> ciw.seed(seed) >>> Q = ciw.Simulation(N) >>> Q.simulate_until_max_customers(max_customers) >>> total_times, service_times = get_times(Q)
  5. 0 20 40 60 80 100 Time units 0 250

    500 750 1000 1250 1500 1750 Realistic (stochastic) queue Total time Service time
  6. 0 20 40 60 80 100 Time units 0 250

    500 750 1000 1250 1500 1750 Realistic (stochastic) queue Total time Service time github.com/CiwPython/Ciw