Question? Leave a message!




Contention Resolution: randomized protocol

Contention Resolution: randomized protocol
Dr.AlexanderTyler Profile Pic
Dr.AlexanderTyler,India,Teacher
Published Date:21-07-2017
Website URL
Comment
13. RANDOMIZED ALGORITHMS contention resolution ‣ global min cut ‣ linearity of expectation ‣ max 3-satisfiability ‣ universal hashing ‣ Chernoff bounds ‣ load balancing ‣ Lecture slides by Kevin Wayne
 Copyright © 2005 Pearson-Addison Wesley
 http://www.cs.princeton.edu/wayne/kleinberg-tardos Last updated on 2/15/17 6:04 PMRandomization Algorithmic design patterns. Greedy. Divide-and-conquer. Dynamic programming. Network flow. Randomization. in practice, access to a pseudo-random number generator Randomization. Allow fair coin flip in unit time. Why randomize? Can lead to simplest, fastest, or only known algorithm for a particular problem. Ex. Symmetry breaking protocols, graph algorithms, quicksort, hashing, load balancing, Monte Carlo integration, cryptography. 213. RANDOMIZED ALGORITHMS contention resolution ‣ global min cut ‣ linearity of expectation ‣ max 3-satisfiability ‣ universal hashing ‣ Chernoff bounds ‣ load balancing ‣Contention resolution in a distributed system Contention resolution. Given n processes P , …, P , each competing for 1 n access to a shared database. If two or more processes access the database simultaneously, all processes are locked out. Devise protocol to ensure all processes get through on a regular basis. Restriction. Processes can't communicate. Challenge. Need symmetry-breaking paradigm. P 1 P 2 .
 .
 . P n 4Contention resolution: randomized protocol Protocol. Each process requests access to the database at time t with probability p = 1/n. Claim. Let Si, t = event that process i succeeds in accessing the database at time t. Then 1 / (e⋅ n) ≤ Pr S(i, t) ≤ 1/(2n). n – 1 Pf. By independence, Pr S(i, t) = p (1 – p) . process i requests access none of remaining n-1 processes request access n – 1 Setting p = 1/n, we have Pr S(i, t) = 1/n (1 – 1/n) . ▪ 
 value that maximizes PrS(i, t) between 1/e and 1/2 Useful facts from calculus. As n increases from 2, the function: n -1 (1 – 1/n) converges monotonically from 1/4 up to 1 / e. n – 1 (1 – 1/n) converges monotonically from 1/2 down to 1 / e. 5Contention Resolution: randomized protocol Claim. The probability that process i fails to access the database in
 -c en rounds is at most 1 / e. After e ⋅ n (c ln n) rounds, the probability ≤ n . Pf. Let Fi, t = event that process i fails to access database in rounds 1 through t. By independence and previous claim, we have
 t Pr Fi, t ≤ (1 – 1/(en)) . en en % 1 1 1 PrF(i, t) ≤ 1− ≤ 1− ≤ Choose t = ⎡e⋅ n⎤: ( ) ( ) en en e c ln n −c Choose t = ⎡e⋅ n⎤ ⎡c ln n⎤: 1 PrF(i, t) ≤ = n ( ) e € € 6Contention Resolution: randomized protocol Claim. The probability that all processes succeed within 2e ⋅ n ln n rounds
 is ≥ 1 – 1 / n. Pf. Let Ft = event that at least one of the n processes fails to access database in any of the rounds 1 through t. n n " % t 1 Pr Ft = Pr Fi,t ≤ PrFi,t ≤ n 1− ∑ ∪ ( ) en ' & i=1 i=1 union bound previous slide € -2 Choosing t = 2 ⎡en⎤ ⎡c ln n⎤ yields PrFt ≤ n · n = 1 / n. ▪ n n " % Pr E ≤ PrE ∑ ∪ i i Union bound. Given events E , …, E , ' 1 n & i=1 i=1 7 € 13. RANDOMIZED ALGORITHMS contention resolution ‣ global min cut ‣ linearity of expectation ‣ max 3-satisfiability ‣ universal hashing ‣ Chernoff bounds ‣ load balancing ‣Global minimum cut Global min cut. Given a connected, undirected graph G = (V, E),
 find a cut (A, B) of minimum cardinality. Applications. Partitioning items in a database, identify clusters of related documents, network reliability, network design, circuit design, TSP solvers. Network flow solution. Replace every edge (u, v) with two antiparallel edges (u, v) and (v, u). Pick some vertex s and compute min s- v cut separating s from each other vertex v ∈ V. False intuition. Global min-cut is harder than min s-t cut. 9Contraction algorithm Contraction algorithm. Karger 1995 Pick an edge e = (u, v) uniformly at random. Contract edge e. replace u and v by single new super-node w preserve edges, updating endpoints of u and v to w keep parallel edges, but delete self-loops Repeat until graph has just two nodes v and v . 1 1 Return the cut (all nodes that were contracted to form v ). 1 a b c a b c ⇒ u v w d contract u-v e f f 10Contraction algorithm Contraction algorithm. Karger 1995 Pick an edge e = (u, v) uniformly at random. Contract edge e. replace u and v by single new super-node w preserve edges, updating endpoints of u and v to w keep parallel edges, but delete self-loops Repeat until graph has just two nodes v and v . 1 1 Return the cut (all nodes that were contracted to form v ). 1 Reference: Thore Husfeldt 11Contraction algorithm 2 Claim. The contraction algorithm returns a min cut with prob ≥ 2 / n . Pf. Consider a global min-cut (A, B) of G. Let F be edges with one endpoint in A and the other in B. Let k = F = size of min cut. In first step, algorithm contracts an edge in F probability k / E . Every node has degree ≥ k since otherwise (A, B) would not be
 a min-cut ⇒ E ≥ ½ k n. Thus, algorithm contracts an edge in F with probability ≤ 2 / n. B A F 12Contraction algorithm 2 Claim. The contraction algorithm returns a min cut with prob ≥ 2 / n . Pf. Consider a global min-cut (A, B) of G. Let F be edges with one endpoint in A and the other in B. Let k = F = size of min cut. Let G' be graph after j iterations. There are n' = n – j supernodes. Suppose no edge in F has been contracted. The min-cut in G' is still k. Since value of min-cut is k, E' ≥ ½ k n'. Thus, algorithm contracts an edge in F with probability ≤ 2 / n'. Let E = event that an edge in F is not contracted in iteration j. j PrE ∩E ∩E = PrE × PrE E × × PrE E ∩E∩E 1 2 n−2 1 2 1 n−2 1 2 n−3 2 2 2 2 ≥ 1− 1− 1− 1− ( ) ( ) ( ) ( ) n n−1 4 3 n−2 n−3 2 1 = ( ) ( ) ( ) ( ) n n−1 4 3 2 = n(n−1) 2 ≥ 2 n 13 € Contraction algorithm Amplification. To amplify the probability of success, run the contraction algorithm many times. with independent random choices, 2 Claim. If we repeat the contraction algorithm n ln n times,
 2 then the probability of failing to find the global min-cut is ≤ 1 / n . Pf. By independence, the probability of failure is at most 2lnn 2 2 1 n lnn n ) , 2 2lnn & & 2 2 1 −1 + . 1− = 1− ≤ e = % ( % ( ( ) 2 2 2 ' ' n n n + . - x (1 – 1/x) ≤ 1/e € 14Contraction algorithm: example execution trial 1 trial 2 trial 3 trial 4 trial 5 (finds min cut) trial 6 ... Reference: Thore Husfeldt 15Global min cut: context 2 Remark. Overall running time is slow since we perform Θ(n log n) iterations and each takes Ω(m) time. 2 3 Improvement. Karger–Stein 1996 O(n log n). Early iterations are less risky than later ones: probability of contracting an edge in min cut hits 50% when n / √2 nodes remain. Run contraction algorithm until n / √2 nodes remain. Run contraction algorithm twice on resulting graph and
 return best of two cuts. Extensions. Naturally generalizes to handle positive weights. 3 Best known. Karger 2000 O(m log n). faster than best known max flow algorithm or
 deterministic global min cut algorithm 1613. RANDOMIZED ALGORITHMS contention resolution ‣ global min cut ‣ linearity of expectation ‣ max 3-satisfiability ‣ universal hashing ‣ Chernoff bounds ‣ load balancing ‣Expectation Expectation. Given a discrete random variable X, its expectation EX
 is defined by: ∞ EX = j PrX = j ∑ j=0 Waiting for a first success. Coin is heads with probability p and tails with € probability 1– p. How many independent flips X until first heads? ∞ ∞ ∞ p p 1− p 1 j−1 j EX = j⋅ PrX = j = j (1− p) p = j (1− p) = ⋅ = ∑ ∑ ∑ 2 1− p 1− p p p j=0 j=0 j=0 j –1 tails 1 head € 18Expectation: two properties Useful property. If X is a 0/1 random variable, EX = PrX = 1. ∞ 1 Pf. EX = j⋅ PrX = j = j⋅ PrX = j = PrX =1 ∑ ∑ j=0 j=0 not necessarily independent € Linearity of expectation. Given two random variables X and Y defined over the same probability space, EX + Y = EX + EY. Benefit. Decouples a complex calculation into simpler pieces. 19Guessing cards Game. Shuffle a deck of n cards; turn them over one at a time;
 try to guess each card. Memoryless guessing. No psychic abilities; can't even remember what's been turned over already. Guess a card from full deck uniformly at random. Claim. The expected number of correct guesses is 1. Pf. surprisingly effortless using linearity of expectation th Let X = 1 if i prediction is correct and 0 otherwise. i Let X = number of correct guesses = X + … + X . 1 n EX = PrX = 1 = 1 / n. i i EX = EX + … + EX = 1 / n + … + 1 / n = 1. ▪ 1 n linearity of expectation 20