Palm Calculus
Made Easy
The Importance of the Viewpoint
JY Le Boudec
1
Contents
1. Informal Introduction
2. Palm Calculus
3. Other Palm Calculus Formulae
4. Application to RWP
5. Other Examples
6. Perfect Simulation
2
1. Event versus Time Averages
Consider a simulation, state S t
Assume simulation has a stationary regime
Consider an Event Clock : times T of state occur n at which some specific changes
Ex: arrival of job; Ex. queue becomes empty
Event average statistic
Time average statistic
3
0
Example: Gatekeeper job arrival
90 100 190 200 290 300 t (ms)
5000
1000
5000
1000
5000
1000
4
Sampling Bias
W s and W c are different
A metric definition should mention the sampling method (viewpoint)
Different sampling methods may provide different values: this is the sampling bias
Palm Calculus is a set of formulas for relating different viewpoints
Can often be obtained by means of the Large Time Heuristic
5
Large Time Heuristic Explained on an
Example
6
7
8
The Large Time Heuristic
We will show later that this is formally correct if the simulation is stationary
It is a robust method, i.e. independent of assumptions on distributions (and on independence)
9
0
Impact of Cross-Correlation job arrival
90 100 190 200 290 300 t (ms)
5000
1000
5000
1000
5000
1000
S n
X n
= 90, 10, 90, 10, 90
= 5000, 1000, 5000, 1000, 5000
Correlation is >0
W c
> W s
When do the two viewpoints coincide ?
10
t
0
Two Event Clocks timeout t
1 t
0
0,a 0,a a
Stop and Go protocol
Clock 0: new packets; Clock a: all transmissions
Obtain throughput as a function of t
0
, t
1 and loss rate
0,a t (ms)
11
t
0
0,a 0,a t
1 timeout t
0 a 0,a t (ms)
12
t
0
0,a 0,a t
1 timeout t
0 a 0,a t (ms)
13
Throughput of Stop and Go
Again a robust formula
14
Other Samplings
15
Load Sensitive Routing of Long-Lived IP Flows
Anees Shaikh, Jennifer Rexford and Kang G. Shin
Proceedings of Sigcomm'99
ECDF, per packet viewpoint
ECDF, per flow viewpoint
16
17
18
2. Palm Calculus : Framework
A stationary process (simulation) with state S t
.
Some quantity X t measured at time t. Assume that
(S t
;X t
) is jointly stationary
I.e., S t is in a stationary regime and X t depends on the past, present and future state of the simulation in a way that is invariant by shift of time origin.
Examples
S t
= current position of mobile, speed, and next waypoint
Jointly stationary with S t run until next waypoint
: X t
= current speed at time t; X t
= time to be
Not jointly stationary with S t occurred
: X t
= time at which last waypoint
19
Stationary Point Process
Consider some selected transitions of the simulation, occurring at times T n
.
Example: T n
= time of n th trip end
T n is a called a stationary point process associated to S t
Stationary because S t is stationary
Jointly stationary with S t
Time 0 is the arbitrary point in time
20
Palm Expectation
Assume: X t
, S t are jointly stationary, T process associated with S t n
Definition : the Palm Expectation is is a stationary point
E t (X t
) =
E
(X t
| a selected transition occurred at time t)
By stationarity:
E t (X t
) =
E
0 (X
0
)
Example:
T n
= time of n th trip end, X t
= instant speed at time t
E t (X t
) =
E
0 (X
0
) = average speed observed at a waypoint
21
E (
X t
) =
E
(X
0
) expresses the time average viewpoint.
E t (X t
) =
E
0 (X
0
) expresses the event average viewpoint.
Example for random waypoint:
T n
= time of n th trip end, X t
= instant speed at time t
E t (X t
) =
E
0 (X
0
) = average speed observed at trip end
E (
X t
)=
E
(X
0
) = average speed observed at an arbitrary point in time
X n+1
X n
22
Intensity of a Stationary Point Process
Intensity of selected transitions: := expected number of transitions per time unit
25
Two Palm Calculus Formulae
Intensity Formula : where by convention T
0
≤ 0 < T
1
Inversion Formula
The proofs are simple in discrete time – see lecture notes
26
27
3. Other Palm Calculus Formulae
28
Feller’s Paradox
29
30
Rate Conservation Law
31
32
33
Total load
Campbell’s Formula t
T
1
T
2
T
3
Shot noise model: customer n adds a load h(t-T n attribute and T n is arrival time
,Z n
) where Z n is some
Example: TCP flow: L = λV with
L = bits per second, V = total bits per flow and λ= flows per sec
34
Total load
T
1
T
2
Little’s Formula
T
3 t
35
Two Event Clocks
Two event clocks, A and B, intensities λ(A) and λ(B)
We can measure the intensity of process B with A’s clock
λ
A
(B) = number of B-points per tick of A clock
Same as inversion formula but with A replacing the standard clock
36
A
B
A
B B
A
B
Stop and Go
37
4. RWP and Freezing Simulations
Modulator Model:
38
Is the previous simulation stationary ?
Seems like a superfluous question, however there is a difference in viewpoint between the epoch n and time
Let S n be the length of the n th epoch
If there is a stationary regime, then by the inversion formula so the mean of S n must be finite
This is in fact sufficient (and necessary)
39
Application to RWP
40
Time Average Speed, Averaged over n independent mobiles
Blue line is one sample
Red line is estimate of E(V(t))
41
A Random waypoint model that has no stationary regime !
Assume that at trip transitions, node speed is sampled uniformly on [v min
,v max
]
Take v min
= 0 and v max
> 0
1 v max v max
0
dv
v
Mean trip duration is infinite !
Was often used in practice
Speed decay: “considered harmful” [YLN03]
42
What happens when the model does not have a stationary regime ?
The simulation becomes old
Stationary Distribution of Speed
(For model with stationary regime)
Closed Form
Assume a stationary regime exists and simulation is run long enough
Apply inversion formula and obtain distribution of instantaneous speed V(t)
Removing Transient Matters
A (true) example: Compare impact of mobility on a protocol:
Experimenter places nodes uniformly for static case, according to random waypoint for mobile case
Finds that static is better
Q.
Find the bug !
A.
In the mobile case, the nodes are more often towards the center, distance between nodes is shorter, performance is better
The comparison is flawed . Should use for static case the same distribution of node location as random waypoint. Is there such a distribution to compare against ?
Random waypoint
Static
46
A Fair Comparison
We revisit the comparison by sampling the static case from the stationary regime of the random waypoint
Static, same node location as RWP
Random waypoint
Static, from uniform
Is it possible to have the time distribution of speed uniformly distributed in
[0; v max
] ?
48
5. PASTA
There is an important case where Event average = Time average
“Poisson Arrivals See Time Averages”
More exactly, should be: Poisson Arrivals independent of simulation state See
Time Averages
49
50
51
Exercise
52
Exercise
53
6. Perfect Simulation
An alternative to removing transients
Possible when inversion formula is tractable
Example : random waypoint
Same applies to a large class of mobility models
54
Removing Transients May Take Long
If model is stable and initial state is drawn from distribution other than time-stationary distribution
The distribution of node state converges to the time-stationary distribution
Naïve: so, let’s simply truncate an initial simulation duration
The problem is that initial transience can last very long
Example [space graph]: node speed = 1.25 m/s bounding area = 1km x 1km
55
Perfect simulation is highly desirable (2)
Distribution of path:
Time =
50s
Time =
500s
Time =
100s
Time =
1000s
Time =
300s
Time =
2000s
56
Solution: Perfect Simulation
Def: a simulation that starts with stationary distribution
Usually difficult except for specific models
Possible if we know the stationary distribution
Sample Prev and Next waypoints from their joint stationary distribution
Sample M uniformly on segment [Prev,Next]
Sample speed V from stationary distribution
Stationary Distrib of Prev and Next
Stationary Distribution of Location Is also
Obtained By Inversion Formula
59
60
No Speed Decay
Perfect Simulation Algorithm
Sample a speed V(t) from the time stationary distribution
How ?
A: inversion of cdf
Sample Prev(t), Next(t)
How ?
Sample M(t)
62
Q1: A node receives messages from 2 sensors S1 and S2. Each of the sources sends messages independently of each other. The sequence of time intervals between messages sent by source S1 is iid, with a Gaussian distribution with mean m1 and variance v1 and similarly for S2. The node works as follows. It waits for the next message from S1. When it has received one message from S1, it waits for the next message from S2, and sends a message of its own.
How much time does, in average, the node spends waiting for the second message after the first is received ?
Questions
Q2: A sensor detects the occurrence of an event and sends a message when it occurs. However, the sensing system needs some relaxation time and cannot sense during T milliseconds after an event was sensed. There are l events per millisecond. Can you find the probability that an event is
not sensed, as a function of T?
63
Questions
Q3: Consider the random waypoint model, where the distribution of the speed drawn at a random waypoint has a density f(v) over the interval [0, vmax]. Is it possible to find f() such that (1) the model has a stationary regime and (2) the time stationary distribution of speed is uniform over [0, vmax] ?
Q4: A distributed protocol establishes consensus by periodically having one host send a message to n other hosts and wait for an acknowledgement. Assume the times to send and receive an acknowledgement are iid, with distribution F(t). What is the number of consensus per time unit achieved by the protocol ? Give an approximation when the distribution is
Pareto, using the fact that the mean of the kth order statistic in a sample of n is approximated by F −1 ( k/ n+1).
Q5: We measure the distribution of flows transferred from a web server. We find that the distribution of the size in packets of an arbitrary flow is Pareto. What is the probability that, for an arbitrary packet, it belongs to a flow of length x ?
Q6: A node receives messages from 2 sensors S1 and S2. Each of the sources sends messages independently of each other. The sequence of time intervals between messages sent by source S1 is iid, with a Gaussian distribution with mean m
1 and variance s
1
2 and similarly for S2. The node works as follows. It waits for the next message from S1. When it has received one message from S1, it waits for the next message from S2, and sends a message of its own.
How do you implement a simulator for this system ?
How much time does, in average, the node spends waiting for the second message after the first is received ?
64
Conclusions
A metric should specify the sampling method
Different sampling methods may give very different values
Palm calculus contains a few important formulas
Which ones ?
Freezing simulations are a pattern to be aware of