Presentation is loading. Please wait.

Presentation is loading. Please wait.

Herman’s algorithm Introduced by T. Herman (1990).

Similar presentations


Presentation on theme: "Herman’s algorithm Introduced by T. Herman (1990)."— Presentation transcript:

1 Herman’s algorithm Introduced by T. Herman (1990)

2 An odd number of processors are arranged in a circle.

3 An odd number of them have tokens. We want to get to a state with exactly one token.

4 At each time step, every processor with a token either keeps it or passes it clockwise (independently, 50-50).

5 At each time step, every processor with a token either keeps it or passes it clockwise (independently, 50-50).

6 At each time step, every processor with a token either keeps it or passes it clockwise (independently, 50-50). When two tokens collide they annihilate each other.

7 This eventually reaches a state with only one token. For a fixed initial configuration with N processors, how large can the expected time taken be?

8 This eventually reaches a state with only one token. For a fixed initial configuration with N processors, how large can the expected time taken be? Herman (1990): it is O(N 2 logN).

9 This eventually reaches a state with only one token. For a fixed initial configuration with N processors, how large can the expected time taken be? Herman (1990): it is O(N 2 logN). McIver and Morgan (2004): it is Θ(N 2 ). Three equally-spaced tokens take time 4N 2 /27. Conjecture: this is the worst case.

10 Three equally-spaced tokens take time 4N 2 /27. Conjecture: this is the worst case. Nakata (2005): any configuration has expected time at most N 2 (π 2 –8)/2 (about 6·3 times the conjectured bound).

11 Three equally-spaced tokens take time 4N 2 /27. Conjecture: this is the worst case. Nakata (2005): any configuration has expected time at most N 2 (π 2 –8)/2 (about 6·3 times the conjectured bound). We get an upper bound of N 2 (π 2 –8)/12 (about 5% more than the conjectured bound).

12 McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N.

13 McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N. Here 32/7. 4 2 1

14 McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N. Can this approach be extended to more tokens?

15 McIver and Morgan showed that if there are three tokens, with the distances between successive tokens being a,b,c, then the expected time is 4abc/N. Can this approach be extended to more tokens? Yes, sort of. Instead of each step taking time 1, give each step a cost of r if there were 2r+1 tokens at the start of that step. With 3 tokens, cost=time. With more, cost>time.

16 We give an exact formula for the expected cost. For r≥1, take variables a 1... a 2r+1. A triple with even gaps is a term of the form a i a j a k with i<j<k and k–j, j–i even. This is preserved by cyclic shifts of the variables.

17 We give an exact formula for the expected cost. For r≥1, take variables a 1... a 2r+1. A triple with even gaps is a term of the form a i a j a k with i<j<k and k–j, j–i even. This is preserved by cyclic shifts of the variables. Write steg(a 1... a 2r+1 ) for the sum of such triples. This sum has r(r+1)(2r+1)/6 terms.

18 If r>1, what happens when one variable vanishes? steg(a 1... a 2r–1,0,a 2r+1 )= steg(a 1... a 2r–2, a 2r–1 +a 2r+1 )

19 If r>1, what happens when one variable vanishes? steg(a 1... a 2r–1,0,a 2r+1 )= steg(a 1... a 2r–2, a 2r–1 +a 2r+1 ) Suppose we have 2r+1 tokens, and distances between successive tokens are a 1... a 2r+1 in that order, so a 1 + a 2 +···+a 2r+1 =N.

20 If r>1, what happens when one variable vanishes? steg(a 1... a 2r–1,0,a 2r+1 )= steg(a 1... a 2r–2, a 2r–1 +a 2r+1 ) Suppose we have 2r+1 tokens, and distances between successive tokens are a 1... a 2r+1 in that order, so a 1 + a 2 +···+a 2r+1 =N. Taking one time step in the algorithm changes these distances to random variables ã 1... ã 2r+1.

21 If r>1, what happens when one variable vanishes? steg(a 1... a 2r–1,0,a 2r+1 )= steg(a 1... a 2r–2, a 2r–1 +a 2r+1 ) Suppose we have 2r+1 tokens, and distances between successive tokens are a 1... a 2r+1 in that order, so a 1 + a 2 +···+a 2r+1 =N. Taking one time step in the algorithm changes these distances to random variables ã 1... ã 2r+1. E(steg(ã 1... ã 2r+1 ))= steg(a 1... a 2r+1 )–rN/4.

22 So the expected total cost from this starting state is 4steg(a 1... a 2r+1 )/N. How big can this be?

23 So the expected total cost from this starting state is 4steg(a 1... a 2r+1 )/N. How big can this be? If x 1... x 2r+1 are non-negative with sum 1 then steg(x 1... x 2r+1 )≤(1-(2r+1) –2 )/24 (the value taken when they are all equal). So for any r, expected cost < N 2 /6.

24 We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write A s for the first configuration with ≤2s+1 tokens, C s for the cost accumulated after that point, and T for the total time.

25 We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write A s for the first configuration with ≤2s+1 tokens, C s for the cost accumulated after that point, and T for the total time. T=∑ s (C s –C s–1 )/s = ∑ s C s (s –1 –(s+1) –1 ) = ∑ s C s s –1 (s+1) –1.

26 We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write A s for the first configuration with ≤2s+1 tokens, C s for the cost accumulated after that point, and T for the total time. T=∑ s (C s –C s–1 )/s = ∑ s C s (s –1 –(s+1) –1 ) = ∑ s C s s –1 (s+1) –1. E(C s )=E(E(C s |A s ))≤(1–(2s+1) –2 )N 2 /6.

27 We can get a tighter bound on the expected time. Fix a start state with 2r+1 tokens. Write A s for the first configuration with ≤2s+1 tokens, C s for the cost accumulated after that point, and T for the total time. T=∑ s (C s –C s–1 )/s = ∑ s C s (s –1 –(s+1) –1 ) = ∑ s C s s –1 (s+1) –1. E(C s )=E(E(C s |A s ))≤(1–(2s+1) –2 )N 2 /6. So E(T) ≤ ∑ s s –1 (s+1) –1 (1–(2s+1) –2 )N 2 /6 = ∑ s s –1 (s+1) –1 (4s 2 +4s)(2s+1) –2 N 2 /6 = ⅔N 2 ∑ s (2s+1) –2 = N 2 (π 2 –8)/12.


Download ppt "Herman’s algorithm Introduced by T. Herman (1990)."

Similar presentations


Ads by Google