Exemple #1
0
def arrival_rate(t):
    
    # print("Possion",qt.poisson_random_measure(t, rate, 100))                                  # Poission Distribution
    # print("===")
    # print(qt.poisson_random_measure(t, rate, 100))
    # return qt.poisson_random_measure(t, rate, 100)
    # print(qt.poisson_random_measure(t, rate, 200))
    return qt.poisson_random_measure(t, rate, 200)
Exemple #2
0
def observed_new_arrival():

    rate = lambda t: 2 + 16 * np.sin(np.pi * t / 8)**2
    arr = lambda t: qt.poisson_random_measure(t, rate, 18)
    ser = lambda t: t + np.random.gamma(4, 0.1)
    q = qt.QueueServer(5, arrival_f=arr, service_f=ser, seed=54)
    q.set_active()

    nA0, nD0 = q.num_arrivals[1], q.num_departures
    q.simulate(nA=1000)
    result = q.num_departures - nD0, q.num_arrivals[1] - nA0,
    print(result)
Exemple #3
0
def time_simulation():

    rate = lambda t: 2 + 16 * np.sin(np.pi * t / 8)**2
    arr = lambda t: qt.poisson_random_measure(t, rate, 18)
    ser = lambda t: t + np.random.gamma(4, 0.1)
    q = qt.QueueServer(5, arrival_f=arr, service_f=ser, seed=54)
    q.set_active()

    num_events = q.num_arrivals[0] + q.num_departures
    t0 = q.time
    q.simulate(t=175)
    round(float(q.time - t0), 1)
    result = q.num_arrivals[1] + q.num_departures - num_events
    print(result)
Exemple #4
0
def event_simulation():

    rate = lambda t: 2 + 16 * np.sin(np.pi * t / 8)**2
    arr = lambda t: qt.poisson_random_measure(t, rate, 18)
    ser = lambda t: t + np.random.gamma(4, 0.1)
    q = qt.QueueServer(5, arrival_f=arr, service_f=ser, seed=54)
    q.set_active()

    q.collect_data = True
    q.simulate(100)
    data = q.fetch_data()
    print(data)

    num_events = q.num_arrivals[0] + q.num_departures
    print("the number of job arrival: ", q.num_arrivals[0])
    print("the number of job departure: ", q.num_departures)
    print("the total number of jobs ", num_events)
Exemple #5
0
import numpy as np

# Queueing parameters
a, b = 158, 50
h  = 13.0
nc = 8
mu = 30.0

# Data collection variables and parameters
N  = 10 # 500
w0 = np.array([] )
s0 = np.zeros(N)

# Queueing process functions
rate = lambda t: a + b - b * np.cos(2 * np.pi * t / h)
arr = lambda t: qt.poisson_random_measure(t, rate, a + 2 * b)
ser = lambda t: t + np.random.exponential(1 / mu)

# The Queue
q = qt.QueueServer(nServers=nc, deactive_t=h,
                   arrival_f=arr, service_f=ser)
for k in range(N):
  q.collect_data = True
  q.set_active()
  q.simulate(t=h+5)
  
  data  = q.fetch_data()
  s0[k] = np.std(data[:,1] - data[:, 0] )
  w0 = np.hstack((w0, data[:,1] - data[:, 0] ) )
  
  q.clear()
Exemple #6
0
def arr(t): 
    return qt.poisson_random_measure(t, rate, 18)
Exemple #7
0
def arrival_rate(t):

    print("Possion", qt.poisson_random_measure(t, rate,
                                               100))  # Poission Distribution
    return qt.poisson_random_measure(t, rate, 100)
def arr_f(t):
   # precinctPop = 500
    if t<=1:
        return qt.poisson_random_measure(t,arrival_rate,0.156*precinctPop)
    elif t<=2:
        return qt.poisson_random_measure(t,arrival_rate,0.087*precinctPop)
    elif t<=3:
        return qt.poisson_random_measure(t,arrival_rate,0.095*precinctPop)
    elif t<=4:
        return qt.poisson_random_measure(t,arrival_rate,0.112*precinctPop)
    elif t<=5:
        return qt.poisson_random_measure(t,arrival_rate,0.087*precinctPop)
    elif t<=6:
        return qt.poisson_random_measure(t,arrival_rate,0.054*precinctPop)
    elif t<=7:
        return qt.poisson_random_measure(t,arrival_rate,0.072*precinctPop)
    elif t<=8:
        return qt.poisson_random_measure(t,arrival_rate,0.067*precinctPop)
    elif t<=9:
        return qt.poisson_random_measure(t,arrival_rate,0.063*precinctPop)
    elif t<=10:
        return qt.poisson_random_measure(t,arrival_rate,0.067*precinctPop)
    elif t<=11:
        return qt.poisson_random_measure(t,arrival_rate,0.068*precinctPop)
    elif t<=12:
        return qt.poisson_random_measure(t,arrival_rate,0.053*precinctPop)
    else: 
        return qt.poisson_random_measure(t,arrival_rate,0.02*precinctPop)