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

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

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

An odd number of processors are arranged in a circle.

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

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

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

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.

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?

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).

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.

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).

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).

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.

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

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?

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.

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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3842616/slides/slide_16.jpg", "name": "We give an exact formula for the expected cost. For r≥1, take variables a 1...", "description": "a 2r+1. A triple with even gaps is a term of the form a i a j a k with i

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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/13/3842616/slides/slide_17.jpg", "name": "We give an exact formula for the expected cost. For r≥1, take variables a 1...", "description": "a 2r+1. A triple with even gaps is a term of the form a i a j a k with i

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 )

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.

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.

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.

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

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.

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.

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.

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.

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.