Created
January 25, 2018 19:36
-
-
Save Gijs-Koot/104993c0cc5298b68a51b4fa3cf0e52d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class QueueChain(): | |
def __init__(self, arrival, service): | |
self.arrival = arrival | |
self.service = service | |
def sample_path(self, n): | |
path = [0] | |
for i in range(1, n): | |
path.append(path[i - 1]) | |
if np.random.random() < self.arrival: | |
path[i] += 1 | |
if path[i] > 0 and np.random.random() < self.service: | |
path[i] -= 1 | |
return path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment