This project provides a Python-based simulation for M/M/1 and M/M/2 queueing systems. The simulator models queue behaviors and computes key metrics like average response time, queue length, and server utilization. It is designed for both academic and practical insights into queueing theory.
- Overview
- Project Structure
- Setup and Installation
- Usage Instructions
- Output Metrics
- Simulation Details
Queueing systems are an essential part of operational research and are widely used to model real-world systems like call centers, server networks, and traffic flows. This project simulates:
- M/M/1 Queue: A single-server queue with exponential inter-arrival and service times.
- M/M/2 Queue: A two-server queue with exponential inter-arrival and service times.
The results provide insights into how changes in arrival and service rates affect the queue's performance.
-
MM1Simulator.py:- Simulates an M/M/1 queue with Poisson arrivals and exponential service times.
- Uses a priority queue to manage events like arrivals and departures.
-
MM2Simulator.py:- Simulates an M/M/2 queue with two servers.
- Extends the M/M/1 logic to allocate tasks between two servers.
-
main.py:- Acts as the entry point for running the simulations.
- Accepts command-line inputs and displays simulation results.
- Python 3.x
numpylibrary
Run the simulation using the main.py script from the command line:
python main.py <queue_type> <arrival_rate> <service_rate>
<queue_type>: The type of queueing system to simulate (mm1ormm2).<arrival_rate>: Average number of arrivals per unit of time (λ).<service_rate>: Average number of services completed per unit of time (μ).
-
Simulate an M/M/1 queue with arrival rate 5 and service rate 10:
python main.py mm1 5 10 -
Simulate an M/M/2 queue with arrival rate 8 and service rate 12:
python main.py mm2 8 12
The simulation outputs the following:
- Average Response Time: Mean time a customer spends in the system (waiting + service).
- Average Queue Length: Mean number of customers in the queue.
- Server Utilization (ρ): Fraction of time the server(s) are busy.
Simulation results for 10000 customers:
Average Response Time: 1.25 units of time
Average Queue Length: 3.50 customers
Server Utilization (ρ): 0.75
To ensure accuracy, the first 100 × λ units of time are discarded, minimizing bias from initial system conditions.
Markdown 2983 bytes 416 words 101 lines Ln 28, Col 9HTML 2170 characters 369 words 54 paragraphs Import/export No file chosen No file chosen