63
Palm Calculus Made Easy The Importance of the Viewpoint JY Le Boudec 1

Palm Calculus Made Easy The Importance of the Viewpoint JY Le Boudec 1

Embed Size (px)

Citation preview

Palm CalculusMade Easy

The Importance of the ViewpointJY 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 St

Assume simulation has a stationary regime

Consider an Event Clock: times Tn at which some specific changes of state occur

Ex: arrival of job; Ex. queue becomes empty

Event average statistic

Time average statistic

3

Example: Gatekeeper

4

0 90 100 190 200 290 300

50001000

t (ms)

job arrival

50001000

50001000

Sampling Bias

Ws and Wc 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

Impact of Cross-Correlation

Sn = 90, 10, 90, 10, 90

Xn = 5000, 1000, 5000, 1000, 5000

Correlation is >0

Wc > Ws

When do the two viewpoints coincide ? 10

0 90 100 190 200 290 300

50001000

t (ms)

job arrival

50001000

50001000

Two Event Clocks

Stop and Go protocol

Clock 0: new packets; Clock a: all transmissions

Obtain throughput as a function of t0, t1 and loss rate

11

t (ms)

timeoutt0 t1 t0

0,a 0,a a 0,a

12

t (ms)

timeoutt0 t1 t0

0,a 0,a a 0,a

13

t (ms)

timeoutt0 t1 t0

0,a 0,a a 0,a

Throughput of Stop and Go

Again a robust formula

14

Other Samplings

15

16

Load Sensitive Routing of Long-Lived IP FlowsAnees Shaikh, Jennifer Rexford and Kang G. Shin

Proceedings of Sigcomm'99

ECDF, per flow viewpoint

ECDF, per packet viewpoint

17

18

19

2. Palm Calculus : Framework

A stationary process (simulation) with state St.

Some quantity Xt measured at time t. Assume that

(St;Xt) is jointly stationary

I.e., St is in a stationary regime and Xt depends on the past, present and future state of the simulation in a way that is invariant by shift of time origin.

ExamplesSt = current position of mobile, speed, and next waypoint

Jointly stationary with St: Xt = current speed at time t; Xt = time to be run until next waypoint

Not jointly stationary with St: Xt = time at which last waypoint occurred

Stationary Point Process

Consider some selected transitions of the simulation, occurring at times Tn.

Example: Tn = time of nth trip end

Tn is a called a stationary point process associated to St

Stationary because St is stationary

Jointly stationary with St

Time 0 is the arbitrary point in time

20

21

Palm ExpectationAssume: Xt, St are jointly stationary, Tn is a stationary point process associated with St

Definition : the Palm Expectation is

Et(Xt) = E(Xt | a selected transition occurred at time t)

By stationarity:

Et(Xt) = E0(X0)

Example: Tn = time of nth trip end, Xt = instant speed at time t

Et(Xt) = E0(X0) = average speed observed at a waypoint

22

E(Xt) = E(X0) expresses the time average viewpoint.

Et(Xt) = E0(X0) expresses the event average viewpoint.

Example for random waypoint: Tn = time of nth trip end, Xt = instant speed at time t

Et(Xt) = E0(X0) = average speed observed at trip end

E(Xt)=E(X0) = average speed observed at an arbitrary point in time

Xn

Xn+1

25

Intensity of a Stationary Point Process Intensity of selected transitions: := expected number of transitions per time unit

26

Two Palm Calculus Formulae Intensity Formula:

where by convention T0 ≤ 0 < T1

Inversion Formula

The proofs are simple in discrete time – see lecture notes

27

3. Other Palm Calculus Formulae

28

29

Feller’s Paradox

30

Rate Conservation Law

31

32

33

Campbell’s Formula

Shot noise model: customer n adds a load h(t-Tn,Zn) where Zn is some attribute and Tn is arrival time

Example: TCP flow: L = λV with L = bits per second, V = total bits per flow and λ= flows per sec

34

t

Total load

T1 T2 T3

Little’s Formula

35

t

Total load

T1 T2 T3

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

Stop and Go

37

A A AB B BB

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 Sn be the length of the nth epoch

If there is a stationary regime, then by the inversion formula

so the mean of Sn must be finite

This is in fact sufficient (and necessary)

39

40

Application to RWP

41

Time Average Speed, Averaged over n independent mobiles

Blue line is one sample

Red line is estimate of E(V(t))

42

A Random waypoint model that has no stationary regime !

Assume that at trip transitions, node speed is sampled uniformly on [vmin,vmax]

Take vmin = 0 and vmax > 0

Mean trip duration = (mean trip distance)

Mean trip duration is infinite !

Was often used in practice

Speed decay: “considered harmful” [YLN03]

max

0max

1v

v

dv

v

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)

46

Removing Transient MattersA. In the mobile case, the nodes are more often towards the center, distance between nodes is shorter, performance is betterThe 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

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 Fair Comparison

We revisit the comparison by sampling the static case from the stationary regime of the random waypoint

Random waypoint

Static, from uniform

Static, same node location as RWP

48

Is it possible to have the time distribution of speed uniformly distributed in [0; vmax] ?

49

5. PASTAThere 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

50

51

Exercise

52

Exercise

53

6. Perfect Simulation

An alternative to removing transients

Possible when inversion formula is tractable

Example : random waypointSame applies to a large class of mobility models

54

55

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/sbounding area = 1km x 1km

56

Perfect simulation is highly desirable (2)

Distribution of path:

Time = 100s

Time = 50s

Time = 300s

Time = 500s

Time = 1000s

Time = 2000s

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 distributionSample M uniformly on segment [Prev,Next]Sample speed V from stationary distribution

Stationary Distrib of Prev and Next

59

Stationary Distribution of Location Is also Obtained By Inversion Formula

60

No Speed Decay

62

Perfect Simulation Algorithm

Sample a speed V(t) from the time stationary distributionHow ?

A: inversion of cdf

Sample Prev(t), Next(t)How ?

Sample M(t)

QuestionsQ1: 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 ?

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

QuestionsQ3: 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 m1 and variance s1

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

ConclusionsA metric should specify the sampling methodDifferent sampling methods may give very different valuesPalm calculus contains a few important formulas

Which ones ?

Freezing simulations are a pattern to be aware of