L3 - Queues
L3 - Queues
Lecture 3. Queues
Mobile bottlenecks
.... and density shock-waves
2
Real queues
3
Real queues
4
Trajectories (s-t) + queues (N-t)
Transport operations s
• Trajectories (in movement)
– Speed, acceleration, etc. Dual analysis of
movement
t
• Queues (waiting)
– Waiting time, average
and maximum queue,
N
etc. (Acum.
A(t)
number)
Ds(t) N
A(t): Acumulated arrivals of clients from 0 to t
Ds(t): Acumulated departures of clients from 0 to t
T time 5
Trajectories and 3D acumulated diagrams
6
Queue system: Components
SYSTEM
• Customer ARRIVAL
DEPOSIT RESTRICTION
DEPARTURE
QUEUE
• Server
• Process arrivals
and service
• Queue discipline observer observer observer
7
Customers, entrance source and arrival process
•CUSTOMERS
- Some one or some thing that requires a service
- Generated from a Entrance Source/Population:
- Finite (limited group), variations affect the
system
- Infinite (unlimited group), variations does not
affect the system Cum #
(N)
•SERVICE Prob
(dpf)
- SERVICE TIME: MEAN AND VARIANCE; Service time
SERVICE RATE (FREQUENCY)
- NUMBER OF SERVERS
- ORGANIZATION OF SERVERS
(QUEUEING SYSTEM): SERIES, PARALEL
time
Queue
Fast lane
Regular queues
COMBINATION
IN PARALEL, SERVERS/QUEUES NON UNIFORMS
9
Queue disciplines
DISCIPLINE
- EMERGENCY
- PRIORITY
- FCFS Same
E(W), with
CONDUCT
- LCFS
different
- SIRO (Service In Random Order) ABANDONMENT, JUMP,
var(W)
- SST (Shortest Service Time) ...
- EDDF (Ealiest Due Date First)
- SWST (Shortest Weighted Service Time)
- RR (Round Robin – “tiovivo”)
11
11
Acumulated diagrams
ACUMULATED
NUMBER OF
COSTUMERS
CUSTOMERS 1
IN SERVICE
0 TIME
12
Arrival and Departure rates
1
N (t)
(Cumulative
number of Q
customers)
A(t) D(t)
N
1
time T
13
Queue length and Waiting time
Queue length:
Lq (t): Number of cutomers on the queue at time t. Lq(t)= A(t)-Dq(t)
Ls(t): Number of customers in the system at time t. Ls(t)=A(t)-Ds(t)
Ws(t): Total waiting time in the system, 𝑊𝑠 𝑡 = ∫ 𝐴 𝑡 − 𝐷 (𝑡) 𝑑𝑡
Then: A(t) ≥ Dq(t) ≥ Ds(t) t≥0
Maximum length (longest vertical distance) and waiting time (longest horizontal distance)
A-1(n) , Dq-1(n) , Ds-1(n) are arrival time, departure time from the queue, departure time
from the system for the customer n. 14
Deterministic and Stochastic systems
Guarantee:
Equilibrium ρ < 1
OPERATING STEPS:
CLIENT SERVER
•DECISIONS •COSTS:
SERVICE
- ADEQUATE LEVEL OF SERVICE - CONSTRUCTION/INVESTMENT
- PRIORITY OF SERVICE - OPERATION
- OPENING HOURS - MAINTENANCE, ETC.
WAITING
- VALUE OF TIME
16
Optimization
Cost
Optimization:
• Cost of TOTAL
resources COST
Cost of
• Cost of the service
MIN
queue
Cost of
waiting
17
Deterministic queues
Deterministic queues
Queue generation :
18
Little’s law (1961)
Deterministic queue.
If it vanishes at t=0 and at
t=T, we can calculate
the total delay = area
between A(t) and D(t) 1
N (t)
(Cumulative
number)
Dq(t)
A(t) Ds(t)
Average queue = Total Delay/T
Average waiting = Total Delay/N N
Time
0 T
19
Serial Queues (tandem)
µ1 µ2 µn
D1(t)=A2(t) D2(t)
A(t)
∞ C1 C2 Cn ∞
µ0 µ1 µ2 µn
Initial queue
DK(t) = DK(0) + µk t
k = 0,1,…,n
...UNTIL A
CAPACITY
CONSTRAINT IS
VIOLATED
21
Serial servers
A bus stop with two platforms: In case of one platform:
BUS 0
BUS 2
BUS 1
𝐸 𝐻 = 𝐸 𝑅 + 𝐸 𝑃 + 𝐸(𝐷)
𝐶= capacity
Service Service ( )
position 2 position 1
In case of 2 platforms:
Distance
Service Service
position 1 position 1
Service Bus 0 Service Bus 0
position 2 position 2
Waiting Bus 1 Waiting Bus 1
position 1 position 1
Waiting Bus 2 Waiting
Bus 2
position 2 position 2
R’1 R’2 P’2 D’2 R’1 P’1 D’1 R’2
H’ H’
Time Time
𝐻′ = max( 𝑅 + 𝑅 +𝑃 + 𝐷 , 𝑅 + 𝑅 +𝑃 + 𝐷 )
𝐶 = ∆𝐶 = −1= − 1= −1
∆ ,
Given two stop times Di independents, function of distribution of the maximum value is:
𝐹 , 𝑥 = 𝑃 max 𝐷 , 𝐷 ≤ 𝑥 = 𝑃 𝐷 ≤ 𝑥 𝑃 𝐷 ≤ 𝑥 = 𝐹 𝑥 then,
12
10
0
0 10 20 30 40 50
Dwell time (seconds)
70
65
E(S)=30 s
60
50 20 s
45 15 s
40
10 s
35
30
0 5 10 15 20 25 30 35 40 45
Standard Deviation of Dwell Time (seconds)
23
Parallel servers
Queue Server
Arrivals
Server
Queue
Server
Queue
Arrivals
Server
Queue
Server
24
Deterministic queues - Exercises
Deterministic queues
Examples and exercises
25
Example of optimal decision
Cost
TOTAL
COST
Cost of service
MIN
Cost of waiting
H3
𝑇𝑜𝑡𝑎𝑙 𝑑𝑒𝑙𝑎𝑦 (𝑎𝑟𝑒𝑎 𝑜𝑓 𝑎𝑙𝑙 𝑡𝑟𝑖𝑎𝑛𝑔𝑙𝑒𝑠)
<𝑤 >=
H2 𝑃𝑎𝑠𝑠𝑒𝑛𝑔𝑒𝑟𝑠 𝑡ℎ𝑎𝑡 𝑤𝑎𝑖𝑡𝑒𝑑 𝑖𝑛 𝑡ℎ𝑒 𝑏𝑢𝑠 𝑠𝑡𝑜𝑝
Var ( X ) E ( X 2 ) E 2 ( X ) H1 Time
2
2
n 1
2 H i2
Hi
H
i i H i
2
w in i i
H var( H )
n 2 H
Hi 2 Hi
i 1 i 1
27
Bus bunching
Bus bunching offers worst service….
…. at same cost
Trajectory bunching: Do not open
bus doors
Waiting time increases with VC2
of the headway
Variable headways increase the
user’s waiting time even though
the average headway remains
constant
Variable compensation of demora
controllers (3%) to minimize
headways variance (TMB)
28
Accident in highway
Additional queue due to an accident
Accumulated
number of A(t)
vehicles
Incident Time
2 lanes in use
Reestablishment
of 3 lanes
Accumulated
vehicles
n’
n
λ µmax
r g r t
30
Queues at traffic lights
INTERSECTION
(i=1)
(i=2)
μ r 2
w 1 i i
i 2 C (μ λ )
i i
Cycle : C = g1 + g2 + l
l: amber + clearance (all red)
r1= g2 + l/2 ; r2= g1 + l/2
31
Queues at traffic lights
PML:
2
min Z = i1
i C w i TOTAL Delay
PROFESSIONAL PRACTICE:
LoS w
λ
i
μ
i A <5”
g (C l)
i 2 B 5-15”
λ j μ j
j1
…
E 40-60” HCM
Proportional to utilization factor F >60”
Flows for the quarter of rush hour
32
Queues at PT stops
Loading: all links of the chain are important
1
CAPACITY test before Olympics’92 Cum. #
34
Exam (GEC 2018)
We assume a highway with 3 lanes, each with capacity c (veh / lane-h). A traffic flow of q veh / h (c <q <2c) is
observed. At t = 0 the traffic is cut off by an accident for t1 minutes. After this time only one lane is opened for t2
minutes and finally all three lanes are restored to traffic. Draw the arrival and departure curves of the vehicles as
a function of time. Calculate: The queue dissipation time (T), The maximum length of queue of vehicles (Lmax),
the average delay per vehicle in the queue episode (w).
35
Problem
Problem. A highway is capable of processing vehicles (customers) at a constant service rate
of μ (veh / h). Customers arrive at a constant rate λ1 < μ until a certain time t = 0, after which
the arrival rate is λ2 > λ1 until a time t = τ. After t = τ, the arrival rate returns to the value λ1
until a time τ ’. The previous global sequence of the rush hour phenomenon repeats itself
indefinitely. If λ2> μ is considered, the clients that cannot be served form a queue with a
FIFO service discipline.
Draw the accumulated arrival and departure curves as a function of time, analytically
calculate the following concepts:
• The maximum length of the queue
• Maximum customer delay
• The duration of the queuing phenomenon
• The total delay of all clients from t = 0 to t = τ ’.
If the cost of providing a service during the time τ’ is αμτ', (α is a constant of proportionality)
regardless of whether the highway is in capacity or not, and the unit value of the users' time
is π (Euros/h), then:
• Determine the optimal highway capacity, μ *, that minimizes service and delay costs
• Draw μ as a function of Δ = πτ2 / (2ατ ’)
• Determine precisely the μ* values for Δ> 1, Δ = 0, and 0 <Δ <1 and physically interpret each
of these responses.
36
Problem
Problem. In a station of a subway line, the passenger arrival rate λ is constant and
the service (trains) circulation intervals have the same probability of being 4, 5 and
7 minutes. All passengers are supposed to board the first train that arrives at the
station. Then:
b) What is the probability that a passenger will wait between 4 and 5 minutes for
the next train?
c) Analytically calculate the function G (x) that represents the probability that the
waiting time at the station is greater than x (study in the domain 0 <x <7).
e) What would happen if the regularity of service increased and all trains ran at a
constant interval of h = 5.5 minutes?
37
Number of photocopiers
A large company makes photocopies with a rush hour pattern: 50% of the
photocopies are made between 10:00 - 12:00 (working hours are from 9:00 a.m. to
5:00 p.m., without breaks). The photocopying machines have a capacity (speed in
pag / min). How many photocopiers (F) are needed?
Cumulative
number of
photocopies máx
0
100% 1 1
min
1
50%
*
1
9 10 11 12 13 14 15 16 17 Hours
38
38
Number of photocopiers
Unit
Cost
Photocopies
Total
Waiting + access
Cumulative
photocopies F* F
Delay D 1
0
T = 2(max-0)/(*-0)
1 Q = 2 (max-*)
Q *
max 1
D=QT/2
0 2 T time
39
Stochastic models
Stochastic models
40
Total time in the system
“It is better to have stochastic service time than stochastic arrivals”
Total time in
the system
S/S
S/D
D/S
1/µ
D/D
ρ
0 1 Traffic intensity
D: DETERMINISTIC; S: STOCHASTIC
Total time in
the system
M/M/n
n Number of servers
1/µ
1 ρ
43
Poisson process and exponential distribution
• Time T between two consecutive arrivals following a
Poisson process follows an exponential distribution
with parameter λ.
t f(t)
t
P (T t ) 1 e
e t0 t
f (t ) P (T t ) e
0 t0
1
E (T ) Var(T) 1/2 t
• n parallel servers with service rate μi. If the rate is constant μi = μ, Z follows
an exponential Distribution with parameter nμ. 44
Stochastic models and Probability distributions
P(A)=0 P(B)=1
B
A B = P(A B) = P(A) + P(B) A
T. BAYES: P(B/A) = P(A B) / P(A)
P(B) = P(B/A) P(A) + P(B/Ac) P(Ac)
POISSON x=0,1...
E (x) x
dF ( x ) (1
0
F ( x )) dx
x ex
P(X x)
x!
1/ 1/2 EXPONENCIAL x0 If x [0, )
f (x) e x
45
Birth-Death Process. Markov chain
• A queue model that assumes arrivals and departures occur according to a birth
(arrival)-death (departure) process.
• The model explains based on probability how N(t) varies during time. N(t) = n
associated probability Pn.
• Assumption 1. Given N(t)=n, current probability distribution of the time for the
next birth (arrival) is exponential with parameter n (n=0,1,2…)
• Assumption 2. Given N(t)=n, current probability distribution of the time for the
next death (departure) is exponential with parameter n (n=0,1,2…)
• Assumption 3. n and n are independent (n=0,1,2…)
• Transition:
n n+1 (birth)
Depending on which of the 2
n n-1 (death) rates is smaller
0
P1 P0
1
P2 1 P1 0 1 P0
2 1 2 L n 0
nP n
.....0
Pn 1 n n 1 P0
n 1 n .....1 Lq ( n c ) Pn
n n 1.....0 n0
n 1,2...
Si Cn n 1 n .....1 Pn Cn P0
1 𝜆̅ = 𝜆 𝑃
n0
1
Si P
n 0
n 1 P0
n 0
Cn
47
Stochastic Models
48
Queuing systems M/M/c
n
• c=1 Simple
n
49
Queuing systems M/M/1
• Data: : Arrival rate; : Service rate
• Solve: – L: Average number of customers in the system
– Lq: Average number of customers in the queue
– W: Average waiting time in the global system
– Wq : Average waiting time on the queue
L
Lq
1
Wq
P0 P1
n-1 n n+1
( ) Pn Pn 1 Pn 1
• Step 2
51
Queuing systems M/M/1
• Step 3
• Step 4
Resolution L: L nPn n (1 ) (1 )
n 0 n 0
n
n
n 1
n 1
(1 ) d
d
n
n 0
(1 ) dd
1
1
(1 ) (1 )
1
(1 )2
Resolution W, Wq and Lq W L
1
1
Wq W
1
1
( )
Lq Wq ( ) 2
( ) 52
Key indicators
system n0 n! N! (1- ρ/N)
pn Prob. Exactly without n p0 ρn
p 0 nN
customers in the system n!
ρn
p
nN 0
nN
N!N
E(m) Customers waiting to 2/(1-) ρ N 1
p0
1
2
be served N!N 1 ρ/N
E(m/m>0) Customers 1/(1-) 1
1 ρ/N
waiting to be served with
queue
E(n) Customers in system 1/(1-) ρ E(m)
(queue + being served)
E(v) Time in system (queue 1/(-) E(n)/λ
+ service)
E(w) Time in queue /(-) E(v)
1
μ
53
Centralization vs. Descentralization
a
A
RESOURCES: RESOURCES:
𝑪 𝑨 𝑫 𝒂
𝑨 𝒂
R
𝑫 𝒂 𝑨
1 n 𝑫 𝑪
54
Queuing management
Reduction of delays
CHANGES IN SERVICE
- SERVICE IN GROUP: Free server helps
- FLEXIBLE ASSIGNMENT
- AUTOMATIZED SERVICE
- REDUCTION OF COSTUMER PARTICIPATION
- COSTUMER PARTICIPATION: e.g. gas station, forms, packing in supermarket.
- SIMULTANEOUS SERVICE: meanwhile a customer decides or participates.
- SERVICE IN GROUPS: similar customers e.g. Medical prescriptions in Social Security
services
- ALTERNATION OF CUSTOMER TYPES: e.g. Pick up + delivery “messengers”
- INCREASING THE NUMBER OF SERVERS: Part-Time
- ELIMINATION OF PREDICTABLE QUEUES
- TEMPORARY INCREMENT OF CAPACITY (RESOURCES ASSIGNMENT)
55
Queuing management
Reduction of delays
CHANGES IN ARRIVALS
- RESERVATIONS AND APPOINTMENTS e.g. Restaurant, doctor
- PRICE e.g. Automatic discounts on Sunday from 8 to 12 h (Macy’s, USA)
- UNDERLYING ARRIVAL PROCESS: Flextime
- DROPOUTS: Info. traffic dynamics, radio
-PSYCHOLOGY
- Entertainment: comfort, performances
- Information: reasons+ info.+ remember they have not been forgotten
- Equity
- FISIOLOGY
- Noise
DESIGN - Lighting
- Ventilation / temperature: water in queues under the sun
- Agglomerations
-QUEUING DISCIPLINE
- Passive maintenance
- Active maintenance
- QUEUE DESIGN Avoid demoralization
56
Conclusions
57
Mobility & Transport Networks
Plan de Formación (40h)
Plan de Formación (40h)
(2021)
Lecture 3. Queues