2024-05-06

Author

Witek ten Hove

OBP:

Afspraken:

From: Dieleman, Berkhout, and Heidergott (2023)

The provided passage describes the structure and behavior of a tandem queue system and uses specific queuing notation. Let’s break down each component to clarify its meaning:

Key Components:

  1. Arrival Process:
    • Poisson Process with Rate \(\lambda\):
      • A Poisson process is a statistical process that models random events occurring independently over time. In this context, jobs arrive at the first station at a rate \(\lambda\). This means that, on average, \(\lambda\) jobs arrive per unit time.
    • Jobs Lost if No Space:
      • If a job arrives and there is no available space at station 1, the job is lost. This implies a loss system, where jobs that cannot be immediately processed are discarded rather than queued.
  2. Service Times:
    • Exponential Distribution with Rate \(\mu_i\):
      • Service times at each station \(i\) follow an exponential distribution with rate \(\mu_i\). This means that the time to service a job is exponentially distributed, and \(\mu_i\) represents the average service rate of each server at station \(i\).
  3. Queuing Notation (\(\cdot/M/S_i/K_i\)):
    • \(\cdot/M/S_i/K_i\): This is a standard notation for describing a specific type of queue:
      • \(\cdot\): The arrival process, which in this case is a Poisson process.
      • M: The service times are exponentially distributed (Markovian or memoryless property).
      • \(S_i\): The number of servers at station \(i\).
      • \(K_i\): The total capacity of the system at station \(i\), which is the sum of the number of servers \(S_i\) and the buffer capacity \(C_i\). Thus, \(K_i = S_i + C_i\).

Example Breakdown:

For station \(i\), the queue is described as \(\cdot/M/S_i/K_i\), where \(K_i = S_i + C_i\). This means: - Jobs arrive according to a Poisson process. - There are \(S_i\) servers at the station. - Each server has an exponential service time with rate \(\mu_i\). - The total capacity (number of jobs that can be present, including those in service and in the buffer) is \(K_i\).

Explanation with an Example:

If the first station has: - Arrival rate \(\lambda = 1.5\) jobs per second. - 2 servers (\(S_1 = 2\)). - Buffer capacity of 3 (\(C_1 = 3\)).

Then, the queue at the first station can be described as: \[ \cdot/M/2/5 \] where \(K_1 = 2 + 3 = 5\).

This means that: - Jobs arrive at an average rate of 1.5 jobs per second. - There are 2 servers, each serving jobs with an exponentially distributed service time. - The station can hold up to 5 jobs in total (2 being serviced and 3 in the buffer).

Implications:

  • Blocking: If the buffer is full (i.e., 3 jobs are waiting and 2 jobs are being serviced), any new arriving jobs will be lost.
  • Service Dynamics: Jobs are serviced by available servers. If both servers are busy, arriving jobs join the buffer queue until a server becomes free.

Python Code Example for Simulation:

Here is an example of a discrete event simulation for the described system using Python and SimPy:

import simpy
import numpy as np

# Parameters
lambda_arrival = 1.5  # Arrival rate (jobs per second)
mu_service = 2.0  # Service rate (jobs per second per server)
servers = 2  # Number of servers
buffer_capacity = 3  # Buffer capacity (number of jobs that can wait)
serviced = 0 # Counter for jobs serviced
lost = 0 # Counter for jobs lost
arrival_t = 0

def arrival(env, server):
    global lost
    global arrival_t
    while True:
        # Time until next job arrives
        t = np.random.exponential(1 / lambda_arrival)
        arrival_t += t
        print("Job arrival at time ",  arrival_t)
        yield env.timeout(t)
        print("Queue is at ", len(server.queue))
        if len(server.queue) < buffer_capacity:
            env.process(service(env, server))
        else:
            lost += 1
            print("Job lost at time", env.now)

def service(env, server):
    global serviced
    with server.request() as req:
        yield req
        yield env.timeout(np.random.exponential(1 / mu_service))
        serviced += 1
        print("Job serviced at time", env.now)

# Simulation environment
env = simpy.Environment()
server = simpy.Resource(env, capacity=servers)

# Start the arrival process
env.process(arrival(env, server))

# Run the simulation for a specified time
env.run(until=100)

print("Simulation completed with", serviced, "jobs serviced and", lost, "jobs lost.")
Job arrival at time  0.8981026803499553
Queue is at  0
Job arrival at time  1.746310633133335
Job serviced at time 0.9234180508298803
Queue is at  0
Job arrival at time  1.9324599301597136
Job serviced at time 1.8506563910847056
Queue is at  0
Job arrival at time  2.5525780077645726
Queue is at  0
Job arrival at time  2.7092342837899417
Queue is at  0
Job arrival at time  3.202751937158748
Job serviced at time 2.9153422867544627
Job serviced at time 3.09043127390668
Queue is at  0
Job arrival at time  3.664069514654242
Job serviced at time 3.413535282023194
Queue is at  0
Job arrival at time  3.9612038694361997
Job serviced at time 3.826648707492715
Queue is at  0
Job arrival at time  4.234554588729262
Job serviced at time 4.1539401581835005
Queue is at  0
Job arrival at time  4.9025118605356575
Job serviced at time 4.327319547060555
Job serviced at time 4.328298189508357
Queue is at  0
Job arrival at time  5.31737169930116
Queue is at  0
Job arrival at time  6.012349520059198
Job serviced at time 5.379239078138647
Job serviced at time 5.730818348760548
Queue is at  0
Job arrival at time  6.078524535742406
Queue is at  0
Job arrival at time  6.093553141286488
Queue is at  0
Job arrival at time  6.109402478494261
Queue is at  1
Job arrival at time  6.1844240586753525
Queue is at  2
Job arrival at time  6.222252342024973
Queue is at  3
Job lost at time 6.222252342024973
Job arrival at time  6.989763583506549
Job serviced at time 6.477626960258993
Job serviced at time 6.539292540862439
Job serviced at time 6.800779393955135
Queue is at  0
Job arrival at time  7.819810129192476
Job serviced at time 7.145016672951321
Job serviced at time 7.529237164442229
Job serviced at time 7.587979232755861
Queue is at  0
Job arrival at time  8.815369403053836
Job serviced at time 7.898753225305165
Queue is at  0
Job arrival at time  9.769751058340702
Job serviced at time 8.818295183681446
Queue is at  0
Job arrival at time  10.017550017819037
Queue is at  0
Job arrival at time  11.950718704868317
Job serviced at time 10.112732327918799
Job serviced at time 10.548222045212032
Queue is at  0
Job arrival at time  12.356142687032214
Job serviced at time 12.209553565942366
Queue is at  0
Job arrival at time  13.70999003360443
Job serviced at time 12.499322395295449
Queue is at  0
Job arrival at time  13.773755309443043
Queue is at  0
Job arrival at time  15.016130658314996
Job serviced at time 13.814029574515942
Job serviced at time 14.003957568939724
Queue is at  0
Job arrival at time  15.068912712754623
Queue is at  0
Job arrival at time  16.593160089128112
Job serviced at time 15.284750014916058
Job serviced at time 15.856015807049788
Queue is at  0
Job arrival at time  17.057187836599233
Job serviced at time 16.779977904487275
Queue is at  0
Job arrival at time  17.557390981327714
Queue is at  0
Job arrival at time  18.51980482383699
Job serviced at time 17.754060419414813
Queue is at  0
Job arrival at time  19.595965088708798
Job serviced at time 18.76180829062562
Job serviced at time 19.02785565514967
Queue is at  0
Job arrival at time  20.173035706973547
Job serviced at time 19.921083568105924
Queue is at  0
Job arrival at time  22.25576809830318
Job serviced at time 20.640805771618506
Queue is at  0
Job arrival at time  22.264744781156608
Queue is at  0
Job arrival at time  26.790865994255157
Job serviced at time 22.411099514422908
Job serviced at time 22.583894216366943
Queue is at  0
Job arrival at time  27.112728084521947
Queue is at  0
Job arrival at time  28.38590253423652
Job serviced at time 27.32923578402554
Job serviced at time 27.44088916231578
Queue is at  0
Job arrival at time  29.488456285698668
Job serviced at time 28.723926656131937
Queue is at  0
Job arrival at time  31.235428171203722
Job serviced at time 29.75277462265207
Queue is at  0
Job arrival at time  31.653742719287983
Queue is at  0
Job arrival at time  31.65808687578071
Queue is at  0
Job arrival at time  32.62826794852055
Job serviced at time 31.90301568495596
Job serviced at time 31.993573602949507
Queue is at  0
Job arrival at time  33.66594245000072
Job serviced at time 32.98874496041226
Job serviced at time 33.021210959573395
Queue is at  0
Job arrival at time  33.91233146471795
Queue is at  0
Job arrival at time  34.21226382916446
Job serviced at time 33.91889273925291
Queue is at  0
Job arrival at time  35.482347591557804
Job serviced at time 34.24635146591844
Job serviced at time 34.2506658566213
Queue is at  0
Job arrival at time  36.39572543780796
Job serviced at time 35.64997884472859
Queue is at  0
Job arrival at time  37.00140021353614
Job serviced at time 36.72571281297437
Queue is at  0
Job arrival at time  37.19072947232807
Job serviced at time 37.08639122039082
Queue is at  0
Job arrival at time  38.74482996723519
Job serviced at time 37.30086044065411
Queue is at  0
Job arrival at time  38.77433308900548
Queue is at  0
Job arrival at time  39.031724275337005
Queue is at  0
Job arrival at time  39.70831422911732
Job serviced at time 39.22946727739459
Job serviced at time 39.5251564274396
Job serviced at time 39.62711420810526
Queue is at  0
Job arrival at time  41.54457055274068
Job serviced at time 40.05368277943606
Queue is at  0
Job arrival at time  41.83320652053424
Queue is at  0
Job arrival at time  43.42552020170431
Job serviced at time 42.056878379728474
Job serviced at time 42.36812938327381
Queue is at  0
Job arrival at time  44.18965345649889
Job serviced at time 43.901858023284596
Queue is at  0
Job arrival at time  44.665673519904956
Job serviced at time 44.33387630388357
Queue is at  0
Job arrival at time  47.047816988264174
Job serviced at time 44.775202057724535
Queue is at  0
Job arrival at time  47.88372680313168
Job serviced at time 47.43835191053523
Queue is at  0
Job arrival at time  48.820478359527286
Job serviced at time 48.344100218914235
Queue is at  0
Job arrival at time  49.11440523362717
Queue is at  0
Job arrival at time  50.91182438023361
Job serviced at time 49.59088789368178
Job serviced at time 49.84413090377363
Queue is at  0
Job arrival at time  52.97453602855902
Job serviced at time 50.96883386348044
Queue is at  0
Job arrival at time  53.396223558257994
Queue is at  0
Job arrival at time  53.74455564917955
Queue is at  0
Job arrival at time  55.953544015760265
Job serviced at time 54.09849787843129
Job serviced at time 54.31668233539487
Job serviced at time 54.86414476404649
Queue is at  0
Job arrival at time  56.39593489441773
Queue is at  0
Job arrival at time  57.24848417950226
Queue is at  0
Job arrival at time  57.25578291523991
Queue is at  1
Job arrival at time  59.121157183498106
Job serviced at time 57.63128491937888
Job serviced at time 57.69156897975345
Job serviced at time 58.52415136134898
Queue is at  0
Job arrival at time  59.15504790709919
Queue is at  0
Job arrival at time  59.64272473008733
Job serviced at time 59.404636493833024
Job serviced at time 59.477398395033944
Queue is at  0
Job arrival at time  60.04718725638941
Job serviced at time 59.714421398587724
Queue is at  0
Job arrival at time  60.414428680798714
Queue is at  0
Job arrival at time  60.42110008669361
Queue is at  1
Job arrival at time  60.99923519153089
Job serviced at time 60.572463501321046
Job serviced at time 60.78919100527762
Job serviced at time 60.94147865484286
Queue is at  0
Job arrival at time  61.226324244389694
Queue is at  0
Job arrival at time  62.493880799713125
Job serviced at time 61.32328333879424
Job serviced at time 61.39437187528327
Job serviced at time 61.68305180254386
Queue is at  0
Job arrival at time  62.95492077730133
Queue is at  0
Job arrival at time  64.06277344224799
Job serviced at time 62.97279199159778
Queue is at  0
Job arrival at time  64.59118566331337
Job serviced at time 64.09318982815041
Queue is at  0
Job arrival at time  66.1089539230284
Job serviced at time 65.07666359757503
Job serviced at time 65.91753895017045
Queue is at  0
Job arrival at time  66.38763007984493
Job serviced at time 66.11350665148674
Queue is at  0
Job arrival at time  67.1815095559804
Queue is at  0
Job arrival at time  67.44422291553417
Job serviced at time 67.18326773027579
Job serviced at time 67.26125641166837
Queue is at  0
Job arrival at time  67.78448915363202
Job serviced at time 67.58668429085037
Queue is at  0
Job arrival at time  67.94849356662046
Job serviced at time 67.93310231389209
Queue is at  0
Job arrival at time  68.63978192447848
Job serviced at time 67.99225280113312
Queue is at  0
Job arrival at time  69.41380545452861
Queue is at  0
Job arrival at time  69.53357243131231
Queue is at  0
Job arrival at time  70.05862243560946
Job serviced at time 69.82252831408226
Job serviced at time 70.00368435808399
Queue is at  0
Job arrival at time  70.10663734731415
Queue is at  0
Job arrival at time  70.24963509261893
Queue is at  1
Job arrival at time  72.36105535555231
Job serviced at time 70.98214581321145
Job serviced at time 70.99939545881925
Job serviced at time 71.24043986926984
Job serviced at time 71.26353864311166
Queue is at  0
Job arrival at time  72.65254725727695
Queue is at  0
Job arrival at time  74.09770688937569
Job serviced at time 72.66462828432205
Job serviced at time 73.06696796856923
Queue is at  0
Job arrival at time  74.23996370686413
Queue is at  0
Job arrival at time  74.49716543081757
Job serviced at time 74.35453026962051
Job serviced at time 74.35997249316213
Queue is at  0
Job arrival at time  74.78057631109732
Queue is at  0
Job arrival at time  74.95074920454921
Queue is at  0
Job arrival at time  75.23174212642358
Queue is at  1
Job arrival at time  75.25788704667019
Queue is at  2
Job arrival at time  75.93791536283533
Queue is at  3
Job lost at time 75.93791536283533
Job arrival at time  75.99910259930476
Queue is at  3
Job lost at time 75.99910259930476
Job arrival at time  76.9723498871455
Job serviced at time 76.37442479799951
Job serviced at time 76.63395232536823
Job serviced at time 76.91361494727053
Queue is at  0
Job arrival at time  77.34490902660657
Queue is at  1
Job arrival at time  78.4359278657204
Job serviced at time 77.90173427412041
Job serviced at time 78.1855739601266
Job serviced at time 78.23578572794078
Queue is at  0
Job arrival at time  78.7461872359616
Job serviced at time 78.55482067867176
Job serviced at time 78.68550384128443
Queue is at  0
Job arrival at time  79.54012740686143
Job serviced at time 78.84093127775265
Queue is at  0
Job arrival at time  80.82768273723161
Job serviced at time 80.03181745897318
Queue is at  0
Job arrival at time  81.08695414645346
Queue is at  0
Job arrival at time  81.09013847630163
Queue is at  0
Job arrival at time  81.15788323092116
Queue is at  1
Job arrival at time  81.55464479017728
Job serviced at time 81.30464592434221
Job serviced at time 81.3833394803832
Job serviced at time 81.43538580933654
Queue is at  0
Job arrival at time  81.5925900982775
Queue is at  0
Job arrival at time  82.55491501916566
Job serviced at time 81.60171716867741
Job serviced at time 81.81210057991845
Queue is at  0
Job arrival at time  82.55657325532592
Queue is at  0
Job arrival at time  83.41773854185962
Job serviced at time 82.88623839505553
Queue is at  0
Job arrival at time  83.93378492277387
Job serviced at time 83.4583509202548
Job serviced at time 83.71428132023551
Queue is at  0
Job arrival at time  84.39166007270256
Job serviced at time 84.3356150235801
Queue is at  0
Job arrival at time  85.98532039510967
Job serviced at time 84.39878978141948
Job serviced at time 84.49336804157431
Queue is at  0
Job arrival at time  86.00858587144893
Queue is at  0
Job arrival at time  86.22898691458516
Job serviced at time 86.0776801951558
Queue is at  0
Job arrival at time  89.42185466304845
Job serviced at time 86.51946400475747
Job serviced at time 86.87910196523964
Queue is at  0
Job arrival at time  90.3293690966306
Job serviced at time 90.30304783673232
Queue is at  0
Job arrival at time  90.43631142215857
Job serviced at time 90.38638224201124
Queue is at  0
Job arrival at time  90.74117831173032
Queue is at  0
Job arrival at time  93.35279931382216
Job serviced at time 90.76469350641905
Job serviced at time 90.95556645069595
Queue is at  0
Job arrival at time  94.35771732005327
Job serviced at time 93.50541413408338
Queue is at  0
Job arrival at time  94.41863608457663
Queue is at  0
Job arrival at time  94.55170375767224
Queue is at  0
Job arrival at time  94.96621588218592
Job serviced at time 94.66118347014452
Job serviced at time 94.68211419798729
Job serviced at time 94.70126903280115
Queue is at  0
Job arrival at time  95.83172703990635
Job serviced at time 95.13016642793244
Queue is at  0
Job arrival at time  96.81486705540605
Job serviced at time 96.50066466053497
Queue is at  0
Job arrival at time  96.8638820831409
Queue is at  0
Job arrival at time  97.69388590929736
Job serviced at time 97.22260487026516
Job serviced at time 97.5115945766201
Queue is at  0
Job arrival at time  97.94523330393558
Queue is at  0
Job arrival at time  98.22925789936282
Queue is at  0
Job arrival at time  100.92621934427555
Job serviced at time 98.34379084140906
Job serviced at time 98.39203350378317
Job serviced at time 98.90259727849006
Simulation completed with 138 jobs serviced and 3 jobs lost.

Explanation of the Simulation Code:

  • Arrival Process: Jobs arrive according to an exponential inter-arrival time based on the Poisson process.
  • Service Process: Jobs are serviced by servers with exponentially distributed service times.
  • Buffer Management: If the buffer is full, arriving jobs are lost.

This simulation mimics the behavior described in the passage and helps illustrate the queuing dynamics of the system.

To generalize the provided simulation code to handle a tandem line with multiple stations, servers, buffers, and configurable arrival and service rates, we need to extend the functionality accordingly. Here is the generalized version:

import simpy
import numpy as np

class TandemQueueSystem:
    def __init__(self, env, num_stations, arrival_rate, service_rates, num_servers, buffer_capacities):
        self.env = env
        self.num_stations = num_stations
        self.arrival_rate = arrival_rate
        self.service_rates = service_rates
        self.num_servers = num_servers
        self.buffer_capacities = buffer_capacities
        self.serviced = [0] * num_stations
        self.lost = [0] * num_stations
        self.stations = [simpy.Resource(env, capacity=num_servers[i]) for i in range(num_stations)]

    def arrival(self):
        while True:
            t = np.random.exponential(1 / self.arrival_rate)
            yield self.env.timeout(t)
            print(f"Job arrival at time {self.env.now}")
            yield self.env.process(self.process_job(0))

    def process_job(self, station_index):
        if station_index < self.num_stations:
            if len(self.stations[station_index].queue) < self.buffer_capacities[station_index]:
                yield self.env.process(self.service(station_index))
            else:
                self.lost[station_index] += 1
                print(f"Job lost at station {station_index + 1} at time {self.env.now}")

    def service(self, station_index):
        with self.stations[station_index].request() as req:
            yield req
            service_time = np.random.exponential(1 / self.service_rates[station_index])
            yield self.env.timeout(service_time)
            self.serviced[station_index] += 1
            print(f"Job serviced at station {station_index + 1} at time {self.env.now}")
            if station_index + 1 < self.num_stations:
                yield self.env.process(self.process_job(station_index + 1))

def simulate_tandem_queue(num_stations, arrival_rate, service_rates, num_servers, buffer_capacities, simulation_time):
    env = simpy.Environment()
    system = TandemQueueSystem(env, num_stations, arrival_rate, service_rates, num_servers, buffer_capacities)
    env.process(system.arrival())
    env.run(until=simulation_time)
    print("Simulation completed.")
    for i in range(num_stations):
        print(f"Station {i + 1}: {system.serviced[i]} jobs serviced, {system.lost[i]} jobs lost.")

# Parameters
num_stations = 3
arrival_rate = 4.0
service_rates = [1.0, 5.0, 1.6]
num_servers = [1, 1, 1]
buffer_capacities = [1, 1, 2]
simulation_time = 100

simulate_tandem_queue(num_stations, arrival_rate, service_rates, num_servers, buffer_capacities, simulation_time)
Job arrival at time 0.042750161418414055
Job serviced at station 1 at time 0.20981920888811614
Job serviced at station 2 at time 0.6329697814442299
Job serviced at station 3 at time 0.9652107184677103
Job arrival at time 1.54493133267443
Job serviced at station 1 at time 2.6500521844543083
Job serviced at station 2 at time 2.689665999070776
Job serviced at station 3 at time 3.265572436522329
Job arrival at time 4.074932194899884
Job serviced at station 1 at time 7.009932790968977
Job serviced at station 2 at time 7.272956038118756
Job serviced at station 3 at time 7.797304060575787
Job arrival at time 7.856190545613826
Job serviced at station 1 at time 7.956771761978929
Job serviced at station 2 at time 7.980005062115344
Job serviced at station 3 at time 8.095513239423727
Job arrival at time 8.195047065986635
Job serviced at station 1 at time 9.248184944449791
Job serviced at station 2 at time 9.612098849428513
Job serviced at station 3 at time 9.760242259556955
Job arrival at time 9.853585220148561
Job serviced at station 1 at time 10.001798470311698
Job serviced at station 2 at time 10.534480155434164
Job serviced at station 3 at time 10.605128514977544
Job arrival at time 11.008094057413215
Job serviced at station 1 at time 11.030458120100532
Job serviced at station 2 at time 11.625828241437814
Job serviced at station 3 at time 12.637251917239464
Job arrival at time 12.870829501017239
Job serviced at station 1 at time 13.422180964932338
Job serviced at station 2 at time 13.784765984370308
Job serviced at station 3 at time 14.178263506271254
Job arrival at time 14.483209956973186
Job serviced at station 1 at time 14.882804801860317
Job serviced at station 2 at time 15.023333758585208
Job serviced at station 3 at time 15.953721957284024
Job arrival at time 16.080645113892725
Job serviced at station 1 at time 16.469501296658553
Job serviced at station 2 at time 16.513375691180585
Job serviced at station 3 at time 16.741237152525418
Job arrival at time 16.78729979463326
Job serviced at station 1 at time 17.018626646021623
Job serviced at station 2 at time 17.05622254596397
Job serviced at station 3 at time 17.292679792567174
Job arrival at time 17.491031230249874
Job serviced at station 1 at time 18.227377835166187
Job serviced at station 2 at time 18.5192893467626
Job serviced at station 3 at time 18.548066456613228
Job arrival at time 19.091314014714847
Job serviced at station 1 at time 20.672552443707907
Job serviced at station 2 at time 21.6614726876951
Job serviced at station 3 at time 21.973305306082153
Job arrival at time 22.42211661160578
Job serviced at station 1 at time 23.27082124595678
Job serviced at station 2 at time 23.480064871649148
Job serviced at station 3 at time 23.627268215194494
Job arrival at time 23.74533821657186
Job serviced at station 1 at time 25.34638938837654
Job serviced at station 2 at time 25.612394862412863
Job serviced at station 3 at time 26.4088974306794
Job arrival at time 26.49248066922868
Job serviced at station 1 at time 30.460880986029245
Job serviced at station 2 at time 31.034429804404386
Job serviced at station 3 at time 34.36916711174729
Job arrival at time 34.58454702683875
Job serviced at station 1 at time 36.87907337705465
Job serviced at station 2 at time 37.029691313778855
Job serviced at station 3 at time 37.16541248088871
Job arrival at time 37.35242947075741
Job serviced at station 1 at time 37.53546527561338
Job serviced at station 2 at time 37.78543810226351
Job serviced at station 3 at time 40.22776998392912
Job arrival at time 40.97619923379749
Job serviced at station 1 at time 43.226613229542366
Job serviced at station 2 at time 43.42174070538814
Job serviced at station 3 at time 43.955962835187904
Job arrival at time 44.54903474957364
Job serviced at station 1 at time 45.16189316920455
Job serviced at station 2 at time 45.28229093747573
Job serviced at station 3 at time 46.65874136710196
Job arrival at time 46.79924772812842
Job serviced at station 1 at time 46.93320722514411
Job serviced at station 2 at time 46.97952333639883
Job serviced at station 3 at time 47.196639686718484
Job arrival at time 47.24978874654156
Job serviced at station 1 at time 47.35148627566539
Job serviced at station 2 at time 47.43502303768189
Job serviced at station 3 at time 47.67202747642729
Job arrival at time 47.75569686134065
Job serviced at station 1 at time 47.79997224865722
Job serviced at station 2 at time 47.918917204585085
Job serviced at station 3 at time 48.358243875379614
Job arrival at time 48.63537877691777
Job serviced at station 1 at time 49.58717093262329
Job serviced at station 2 at time 49.79234538883397
Job serviced at station 3 at time 50.20180753841185
Job arrival at time 50.37444871197364
Job serviced at station 1 at time 51.365793717405865
Job serviced at station 2 at time 51.41029156872421
Job serviced at station 3 at time 51.501730675871606
Job arrival at time 51.664230305274394
Job serviced at station 1 at time 52.39939301110896
Job serviced at station 2 at time 52.54537949587909
Job serviced at station 3 at time 52.63895925701898
Job arrival at time 52.94547961231834
Job serviced at station 1 at time 54.30318969253554
Job serviced at station 2 at time 54.50582142966061
Job serviced at station 3 at time 54.65700022001676
Job arrival at time 54.84039721213848
Job serviced at station 1 at time 55.538446503324934
Job serviced at station 2 at time 55.539642081364214
Job serviced at station 3 at time 56.02638818348305
Job arrival at time 56.264656109159574
Job serviced at station 1 at time 56.28963394204074
Job serviced at station 2 at time 56.36863112577375
Job serviced at station 3 at time 56.65897387692944
Job arrival at time 56.972625441219336
Job serviced at station 1 at time 57.245996290758065
Job serviced at station 2 at time 57.73585661617738
Job serviced at station 3 at time 58.38041623294806
Job arrival at time 58.42354983551822
Job serviced at station 1 at time 58.83466806182267
Job serviced at station 2 at time 58.916476077349834
Job serviced at station 3 at time 59.04467259441132
Job arrival at time 59.115277562352084
Job serviced at station 1 at time 59.896860325532
Job serviced at station 2 at time 60.15439139931925
Job serviced at station 3 at time 61.08930704828299
Job arrival at time 61.22052405083447
Job serviced at station 1 at time 61.88901126539659
Job serviced at station 2 at time 62.26354148771658
Job serviced at station 3 at time 63.68991493191389
Job arrival at time 64.13406973803149
Job serviced at station 1 at time 65.6229782675798
Job serviced at station 2 at time 65.69921301945101
Job serviced at station 3 at time 67.36231096388327
Job arrival at time 67.41758615617819
Job serviced at station 1 at time 67.89834938647441
Job serviced at station 2 at time 67.95192937254845
Job serviced at station 3 at time 68.84566089476613
Job arrival at time 68.92863548116956
Job serviced at station 1 at time 69.03445621206528
Job serviced at station 2 at time 69.23764052795377
Job serviced at station 3 at time 69.27811665993521
Job arrival at time 69.36928338539133
Job serviced at station 1 at time 69.39306197608866
Job serviced at station 2 at time 69.45032059748591
Job serviced at station 3 at time 69.78587516162196
Job arrival at time 69.8344050664951
Job serviced at station 1 at time 72.80738471010315
Job serviced at station 2 at time 73.14914192308332
Job serviced at station 3 at time 73.48472320803376
Job arrival at time 73.69775998261304
Job serviced at station 1 at time 78.48433354743294
Job serviced at station 2 at time 78.83526820733586
Job serviced at station 3 at time 78.93404729737642
Job arrival at time 79.24530237507314
Job serviced at station 1 at time 80.73562927883161
Job serviced at station 2 at time 80.78368689392843
Job serviced at station 3 at time 83.10702181555178
Job arrival at time 83.31639332154333
Job serviced at station 1 at time 83.75086144854097
Job serviced at station 2 at time 84.85133130659476
Job serviced at station 3 at time 85.27566241162104
Job arrival at time 85.5736803494718
Job serviced at station 1 at time 85.83068093651826
Job serviced at station 2 at time 86.15704882100644
Job serviced at station 3 at time 86.32437978777111
Job arrival at time 86.72079678649591
Job serviced at station 1 at time 87.39560245158357
Job serviced at station 2 at time 87.53286889467252
Job serviced at station 3 at time 89.30443056345634
Job arrival at time 89.38925561048043
Job serviced at station 1 at time 90.97830249877708
Job serviced at station 2 at time 91.17361092743361
Job serviced at station 3 at time 91.87028620868264
Job arrival at time 92.44472517087839
Job serviced at station 1 at time 92.44606582693294
Job serviced at station 2 at time 93.11630459282833
Job serviced at station 3 at time 93.2119201483685
Job arrival at time 93.40058807658905
Job serviced at station 1 at time 95.266269477032
Job serviced at station 2 at time 95.37365371007378
Job serviced at station 3 at time 95.49860189493383
Job arrival at time 95.50121504517178
Job serviced at station 1 at time 95.98845960444125
Job serviced at station 2 at time 96.07798595112021
Job serviced at station 3 at time 96.88125135819087
Job arrival at time 96.88420879908563
Job serviced at station 1 at time 96.89069911374021
Job serviced at station 2 at time 97.09216029810743
Job serviced at station 3 at time 97.32329313204788
Job arrival at time 97.75648926802695
Job serviced at station 1 at time 98.42611581327493
Job serviced at station 2 at time 98.45071504714917
Job serviced at station 3 at time 98.46051827125855
Job arrival at time 98.86870544989407
Job serviced at station 1 at time 99.02551518252257
Job serviced at station 2 at time 99.17472932131221
Simulation completed.
Station 1: 50 jobs serviced, 0 jobs lost.
Station 2: 50 jobs serviced, 0 jobs lost.
Station 3: 49 jobs serviced, 0 jobs lost.

Explanation:

  1. TandemQueueSystem Class:
    • Initialization: Sets up the number of stations, arrival rate, service rates, number of servers, and buffer capacities. Initializes counters for serviced and lost jobs.
    • arrival(): Generates job arrivals based on an exponential distribution with the given arrival rate.
    • process_job(): Manages job processing at each station, including checking buffer capacity and either servicing the job or marking it as lost.
    • service(): Simulates the service process for each job, including moving the job to the next station if applicable.
  2. simulate_tandem_queue Function:
    • Initializes the simulation environment and the tandem queue system.
    • Starts the arrival process and runs the simulation for the specified time.
    • Prints the results of the simulation for each station.
  3. Parameters:
    • Define the number of stations, arrival rate, service rates, number of servers per station, buffer capacities, and the simulation duration.
    • Call the simulate_tandem_queue function with these parameters to run the simulation.

This setup allows you to easily configure and simulate a tandem line with multiple stations, each with customizable servers, buffers, arrival rates, and service rates.

References

Dieleman, NA, Joost Berkhout, and Bernd Heidergott. 2023. “A Neural Network Approach to Performance Analysis of Tandem Lines: The Value of Analytical Knowledge.” Computers & Operations Research 152: 106124.
Homem-de-Mello, Tito, Qingxia Kong, and Rodrigo Godoy-Barba. 2022. “A Simulation Optimization Approach for the Appointment Scheduling Problem with Decision-Dependent Uncertainties.” INFORMS Journal on Computing 34 (5): 2845–65.