Home Implementing a M/M/c Queue in Ciw
Post
Cancel

Implementing a M/M/c Queue in Ciw

Ciw is a Python package for simulating queueing networks. A M/M/c queue can be implemented and simulated using Ciw in the following way.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import ciw

ciw.seed(2018)

ARRIVAL_TIME = 1
SERVICE_TIME = 1 / 2
NUM_SERVERS = 2
HORIZON = 365


network = ciw.create_network(
    arrival_distributions = [ciw.dists.Exponential(ARRIVAL_TIME)],
    service_distributions = [ciw.dists.Exponential(SERVICE_TIME)],
    number_of_servers = [NUM_SERVERS]
    )
    
simulation = ciw.Simulation(network)
simulation.simulate_until_max_time(HORIZON)
records = simulation.get_all_records()
This post is licensed under CC BY 4.0 by the author.

Implementing a M/M/1 Queue in Ciw

A Ciw Implementation of SimPy's Car Example