Skip to content

Instantly share code, notes, and snippets.

@Gijs-Koot
Created January 25, 2018 19:36
Show Gist options
  • Save Gijs-Koot/104993c0cc5298b68a51b4fa3cf0e52d to your computer and use it in GitHub Desktop.
Save Gijs-Koot/104993c0cc5298b68a51b4fa3cf0e52d to your computer and use it in GitHub Desktop.
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