-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparameter.py
More file actions
52 lines (36 loc) · 1.89 KB
/
parameter.py
File metadata and controls
52 lines (36 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from math import inf
from numpy import random
class Params:
"""
Represents parameters for a queuing system.
This class serves as an abstract base class for specific queuing models.
"""
def __init__(self, lumbda, mu, numberOfServers=1, systemCapacity=inf):
"""
Initializes the parameters.
"""
self.lumbda = lumbda
self.mu = mu
self.numberOfServers = numberOfServers
self.systemCapacity = systemCapacity
def findL(self):
"""Calculates and returns the average number of customers in the system (L)."""
raise NotImplementedError("This method should be implemented in subclasses.")
def findLq(self):
"""Calculates and returns the average number of customers in the queue (Lq)."""
raise NotImplementedError("This method should be implemented in subclasses.")
def findW(self):
"""Calculates and returns the average time a customer spends in the system (W)."""
raise NotImplementedError("This method should be implemented in subclasses.")
def findWq(self):
"""Calculates and returns the average time a customer spends in the queue (Wq)."""
raise NotImplementedError("This method should be implemented in subclasses.")
def findPk(self, k):
"""Calculates and returns the probability of having k customers in the system (Pk)."""
raise NotImplementedError("This method should be implemented in subclasses.")
def findRu(self):
"""Calculates and returns the server utilization (Ru)."""
raise NotImplementedError("This method should be implemented in subclasses.")
def display(self):
"""Displays the calculated performance measures."""
print(f" L = {self.findL()} \n Lq = {self.findLq()} \n W = {self.findW()} \n Wq = {self.findWq()}")