אלגוריתמים מבוזרים א

40
םםםםםםםםםם םםםםםםם ם' ססססס ססס[email protected] , www.cs.technion.ac.il/~zaks

Upload: hunter

Post on 10-Jan-2016

44 views

Category:

Documents


6 download

DESCRIPTION

אלגוריתמים מבוזרים א'. שמואל זקס [email protected] , 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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: אלגוריתמים מבוזרים א

אלגוריתמים מבוזרים א'

שמואל זקס[email protected], www.cs.technion.ac.il/~zaks

Page 2: אלגוריתמים מבוזרים א

A. Distributed algorithms

12345678

8 days, 1 professor 4 days, 2 professorExercise: find a trade-off between no. of

days and no. of professors.

Example 1: synchony9

Page 4: אלגוריתמים מבוזרים א

Example 3: faults

Impossibility of consensus

The Byzantine Generals Problem

Page 5: אלגוריתמים מבוזרים א

Example 4: snapshot

Page 6: אלגוריתמים מבוזרים א

Example 5: self stabilization

6 6

6

6

6

7

7

7

7

7

B. Self Stabilization

Page 7: אלגוריתמים מבוזרים א

6 7

6

4 6

Exercise: find an algorithm to do it, prove correctness, analyze performance.

Page 8: אלגוריתמים מבוזרים א

:3-ממדי ברדיוס 2כדור

C. Networks (optical)

sp(2,3)= 25

Example 6: layout

Page 9: אלגוריתמים מבוזרים א

-ממדי ברדיוס 2כדור

1 2-ממדי ברדיוס 1כדור

sp(2,1)= sp(1,2)= 5

Exercise: prove: sp(x,y)= sp(y,x)

Page 10: אלגוריתמים מבוזרים א

lightpaths

p1

p2

1 2( ) ( )w p w p

Valid coloring

Page 11: אלגוריתמים מבוזרים א

Saving a switch:

Page 12: אלגוריתמים מבוזרים א

colors = 2

switches = 8

colors=3

switches = 7

Page 13: אלגוריתמים מבוזרים א

colors=3 switches=10

colors=2 switches=9

g=2w/ grooming

Page 14: אלגוריתמים מבוזרים א

Liverpool, 10/10

#ADMs=12 #ADMs=9

14/100

Example 7: min ADMs

Page 15: אלגוריתמים מבוזרים א

Liverpool, 10/10

Coloring of a circular arc graph

15/100

Page 16: אלגוריתמים מבוזרים א

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?

minADMInput: a graph, a set of lightpaths, t>o.

Output: can the lightpath be colored such that #ADMs ≤ t?

G

16/100

Page 17: אלגוריתמים מבוזרים א

Liverpool, 10/10

#ADMs = N + #chains

N lightpaths

cycleschains

Cycles are good, chains are bad

17/100

Page 18: אלגוריתמים מבוזרים א

Liverpool, 10/10

cost(S) = N + chains=13+6=19Every chain costs 1 ADM

cost(S) = 2N-savings=26-7=19Every connection saves 1 ADM

N lightpaths

2.4 cost vs. saving

N=13

18/100

Page 19: אלגוריתמים מבוזרים א

Liverpool, 10/10

D0(S) – lightpath not sharing any ADM

D1(S) – lightpath sharing ONE ADM

D2(S) – lightpath sharing BOTH ADMs

d0(S) = 2

d1(S) = 4

d2(S) = 19

d0(S) + d1(S) + d2(S) = 25 = N

N=25 lightpaths

#ADMs=29

Example:

19/82

Page 20: אלגוריתמים מבוזרים א

Liverpool, 10/10

= =

=-

0 2d (S)- d (S)-2 #chains(S*)ε(S)

2-19- 4 21N

25 25

d0(S) = 2

d2(S) = 19

N=25

suppose #chains(S*)=2, cost(S*)=25+2=27

1 25 21cost(S) =cost(S*)+ N(1+ε(S)) =cost(S*)+ (1- ) =

2 2 25cost(S*)+2=29

20/82

Page 21: אלגוריתמים מבוזרים א

Liverpool, 10/10

S – ALG, S* - OPT

0 1 2d (S)+d (S)+d (S) =N

0 110

2d (S)+d (S)-2#chains(S*)d (S)=d (S)+ - #chains(S*) =

2 2

0 2N +d (S)- d (S)-2#chains(S*)=

2

Solution S=chains + cycles

#ADMs = N + #chains

cost(S)- cost(S*) =#chains(S)- #chains(S*) =

0 2d (S)- d (S)-2#chains(S*)1N(1+ )

2 N

0 1 0 22d (S)+d (S) =N +d (S)- d (S)

21/82

Page 22: אלגוריתמים מבוזרים א

Liverpool, 10/10

We define :

and get

= 0 2d (S)- d (S)-2 #chains(S*)ε(S)

N

1cost(S) =cost(S*)+ N(1+ε(S))

2

0 2d (S)- d (S)-2#chains(S*)1N(1+ )

2 Ncost(S)- cost(S*) =

22/82

Page 23: אלגוריתמים מבוזרים א

Liverpool, 10/10

g=2

#ADMs=9

#ADMs=8

23/100

Example 8: min ADMs w/grooming

Page 24: אלגוריתמים מבוזרים א

Liverpool, 10/10

ALG 2N N OPT

ALG 2 x OPT

N: # of lightpaths

ALG: #ADMs used by the algorithm

OPT: #ADMs used by an optimal solution

2.2 approximation ratio

24/100

Page 25: אלגוריתמים מבוזרים א

d=23 .Regenerators

Liverpool, 10/10 25/100

Example 9: min regenerators

Page 26: אלגוריתמים מבוזרים א

Liverpool, 10/10

Assume that an optimal solution S* saves x ADMs,

and a solution S saves y ADMs

x if y then

k1

cost(S) (2- )cost(S*)k

Lemma: ³

£

x if y then

23

cost(S)

f or

cost(S*)

exa

2

mple: ³

£ 26/100

Page 27: אלגוריתמים מבוזרים א

Liverpool, 10/10

Proof: Optimal solution S* saves x ADMsa solution S saves y ADMs

³ ³

= £ £ = =

cost(S*) Ny

k k

cost(S) = 2N - y

cost(S*) =2N - x

N N N2N - 2N - 2N -2N - ycost(S) 1k k k 2-

cost(S*) 2N - x 2N - x 2N -N N k

³

£

cost(S*) if y then

k1

cost(S) (2- )cost(S*)k

Lemma:

27/100

Page 28: אלגוריתמים מבוזרים א

Liverpool, 10/10

On-line problemInput 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).28/100

Page 29: אלגוריתמים מבוזרים א

Liverpool, 10/10

ALG: ADM=7 OPT: ADM=4

ALG ≥ 7/4

ALG ≥ 7/4, even for a ring

29/100

Page 30: אלגוריתמים מבוזרים א

Liverpool, 10/10

Case a :

7/4=1.75

Any algorithm ≥ 7/4 , even for a ring

30/100

Page 31: אלגוריתמים מבוזרים א

Liverpool, 10/10

Case b :Case b1:

6/3 = 2

Case b2: 5/3 = 1.67

any algorithm ≥ 1.67

any algorithm ≥ 1.75 - We prove : 31/100

Page 32: אלגוריתמים מבוזרים א

Liverpool, 10/10

k paths

k-1 spaces:x between same colork-1-x between different colors

k=12x=6

any algorithm for a path ≥ 3/2

32/100

Page 33: אלגוריתמים מבוזרים א

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)

Any algorithm uses at least one more ADM for each (ALG uses exactly one)

So: any algorithm ≥ 2k + (k-1-x) ADMs

k=12, x=6, 12-1-6=5

33/100

Page 34: אלגוריתמים מבוזרים א

Liverpool, 10/10

now – two long paths at each of the k gap of same color

So far: use ≥ 2k + (k-1-x) ADMs

Any algorithm must use 2 ADMs for each

So: any algorithm ≥ 2k + (k-1-x) + 4x= = 3k+3x-1 ADMs

34/100

Page 35: אלגוריתמים מבוזרים א

Liverpool, 10/10

OPT: the short paths ≤ 2k ADMsfor the long paths 2x ADMs

any algorithm/OPT 3/2 – 1/(2k)

We showed: any algorithm uses ≥ 3k+3x-1 ADMs

OPT 2k + 2x

35/100

Page 36: אלגוריתמים מבוזרים א

Liverpool, 10/10

Optimal solution S* saves x ADMs

Our solution S saves y ADMs³ Þ £

x 1 y cost(S) (2- )cLem ost(S*)

k kma: ≥ >- ≥

3.7 ALG for a path ≤ 3/2

³x

y2We show that

Þ £3

cost(S) cost(S*)2

36/100

Page 37: אלגוריתמים מבוזרים א

d=2g=1

set A = 3 set B = 1

Liverpool, 10/10 37/100

Page 38: אלגוריתמים מבוזרים א

d=2g=1

set A and set B = 4

Liverpool, 10/10 38/100

Page 39: אלגוריתמים מבוזרים א

d=2g=1

set A or set B = 3

Liverpool, 10/10 39/100

Page 40: אלגוריתמים מבוזרים א

Liverpool, 10/10

D0(S) – lightpath not sharing any ADM

D1(S) – lightpath sharing ONE ADM

D2(S) – lightpath sharing BOTH ADMs

d0(S) = 2

d1(S) = 4

d2(S) = 19

d0(S) + d1(S) + d2(S) = 25 = N

N=25 lightpaths

2.6 a useful tool

40/82