400 likes | 545 Views
אלגוריתמים מבוזרים א'. שמואל זקס zaks@cs.technion.ac.il , www.cs.technion.ac.il/~zaks. A. Distributed algorithms. Example 1: synchony. 9. 8. 7. 6. 5. 4. 3. 2. 1. 8 days, 1 professor. 4 days, 2 professor . Exercise: find a trade-off between no. of days and no. of professors.
E N D
אלגוריתמים מבוזרים א' שמואל זקס zaks@cs.technion.ac.il, www.cs.technion.ac.il/~zaks
A. Distributed algorithms Example 1: synchony 9 8 7 6 5 4 3 2 1 8 days, 1 professor 4 days, 2 professor Exercise: find a trade-off between no. of days and no. of professors.
Example 2: leader election x x 4 8 ? x x 5 6 9 Exercise: find a better algorithm to find the maximum, prove correctness and analyze performance.
Example 3: faults Impossibility of consensusThe Byzantine Generals Problem
B. Self Stabilization Example 5: self stabilization 6 7 6 7 6 7 6 7 6 7
6 7 6 6 4 Exercise: find an algorithm to do it, prove correctness, analyze performance.
C. Networks (optical) כדור 2-ממדי ברדיוס 3: Example 6: layout sp(2,3)= 25
כדור 2-ממדי ברדיוס 1 כדור 1-ממדי ברדיוס 2 sp(2,1)= sp(1,2)= 5 Exercise: prove: sp(x,y)= sp(y,x)
lightpaths Valid coloring p1 p2
colors=3 switches = 7 colors = 2 switches = 8
w/ grooming g=2 colors=3 switches=10 colors=2 switches=9
Example 7: min ADMs #ADMs=12 #ADMs=9 Liverpool, 10/10
Coloring of acircular arc graph Liverpool, 10/10
Coloring of a circular arc graph Input: circular arc graph G, k>o. Output: can the arcs be colored with ≤ k colors? G minADM Input: a graph, a set of lightpaths, t>o. Output: can the lightpath be colored such that #ADMs ≤ t ? Liverpool, 10/10
N lightpaths cycles chains #ADMs = N + #chains Cycles are good, chains are bad Liverpool, 10/10
2.4 cost vs. saving N lightpaths cost(S) = N + chains=13+6=19 • Every chain costs 1 ADM cost(S) = 2N-savings=26-7=19 • Every connection saves 1 ADM N=13 Liverpool, 10/10
Example: D0(S) – lightpath not sharing any ADM D1(S) – lightpath sharing ONE ADM D2(S) – lightpath sharing BOTH ADMs N=25 lightpaths d0(S) = 2 d1(S) = 4 #ADMs=29 d2(S) = 19 d0(S) +d1(S)+d2(S)= 25 = N Liverpool, 10/10
N=25 suppose #chains(S*)=2, cost(S*)=25+2=27 d0(S) = 2 d2(S) = 19 Liverpool, 10/10
Solution S=chains + cycles #ADMs = N + #chains S – ALG, S* - OPT Liverpool, 10/10
We define: and get Liverpool, 10/10
Example 8: min ADMs w/grooming g=2 #ADMs=9 #ADMs=8 Liverpool, 10/10
2.2 approximation ratio ALG 2N N OPT ALG 2 xOPT N: # of lightpaths ALG: #ADMs used by the algorithm OPT: #ADMs used by an optimalsolution Liverpool, 10/10
Example 9: min regenerators d=2 3. Regenerators Liverpool, 10/10
Assume that an optimal solution S* savesx ADMs, and a solution S savesy ADMs Liverpool, 10/10
Proof: Optimal solution S* savesx ADMs a solution S savesy ADMs Liverpool, 10/10
On-line problem • Input arrives one at a time, and a decision is made (and cannot be changed). • In the minADM problem: lightpaths arrive one at a time, and need to be colored. • Competitive analysis • An on-line algorithm A is c-competitive if A(I) c OPT(I) for any input sequence I. (A(I) and OPT(I) are #ADMs used by A and by an optimal offline algorithm OPT.) Liverpool, 10/10
ALG ≥ 7/4,even for a ring ALG: ADM=7 OPT: ADM=4 ALG ≥ 7/4 Liverpool, 10/10
Any algorithm ≥ 7/4 , even for a ring Case a: 7/4=1.75 Liverpool, 10/10
Case b: Case b1: 6/3 = 2 Case b2: 5/3 = 1.67 any algorithm ≥ 1.67 We prove: any algorithm ≥ 1.75- Liverpool, 10/10
any algorithm for a path ≥ 3/2 k paths k=12 x=6 k-1 spaces: x between same color k-1-x between different colors Liverpool, 10/10
So far: any algorithm uses 2k ADMs now – a short path at each gap of diffferent colors (k-1-x such gaps) k=12, x=6, 12-1-6=5 Any algorithm uses at least one more ADM for each (ALG uses exactly one) So: any algorithm ≥2k + (k-1-x) ADMs Liverpool, 10/10
So far: use ≥2k + (k-1-x) ADMs now – two long paths at each of the k gap of same color Any algorithm must use 2 ADMs for each So: any algorithm ≥2k + (k-1-x) + 4x = =3k+3x-1 ADMs Liverpool, 10/10
We showed: any algorithm uses ≥ 3k+3x-1 ADMs OPT: the short paths ≤ 2k ADMs for the long paths 2x ADMs OPT 2k+ 2x any algorithm/OPT 3/2 – 1/(2k) Liverpool, 10/10
3.7 ALG for a path ≤ 3/2 Optimal solution S* savesx ADMs Our solution S savesy ADMs ≤ -> ≤ We show that ≤ ≤ Liverpool, 10/10
set A = 3 set B = 1 d=2 g=1 Liverpool, 10/10
set A andset B = 4 d=2 g=1 Liverpool, 10/10
set A orset B = 3 d=2 g=1 Liverpool, 10/10
2.6 a useful tool D0(S) – lightpath not sharing any ADM D1(S) – lightpath sharing ONE ADM D2(S) – lightpath sharing BOTH ADMs N=25 lightpaths d0(S) = 2 d1(S) = 4 d2(S) = 19 d0(S) +d1(S)+d2(S)= 25 = N Liverpool, 10/10