Αλγόριθμοι Άμεσης Απόκρισης

83
Αλγόριθμοι ΄Αμεσης Απόκρισης Ιωάννης Καραγιάννης Μάρτιος 2009

description

Αλγόριθμοι Άμεσης Απόκρισης

Transcript of Αλγόριθμοι Άμεσης Απόκρισης

  • 2009

  • 2

  • 1 5

    2 ; 92.1 . . . . . 102.2 . . . . . . . . . . . . . . . . . . . . 112.3 . . . . . . . . . . . . . . . . . . 13

    3 153.1 . . . . . . . . . . . . . . . . . . . 163.2 . . . . . . 163.3 (h, k) . . . . . . . . . . . . . . 183.4 . . . 193.5 . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    4 Yao 254.1 . . . . . . . . . . . . . . . . . . . . . . . 254.2 . . . . . . . . . . . . . . . . . . . . . 264.3 . . . . . . . . . . . . 28

    5 315.1 MARK . . . . . . . . . . . . . . . . . . . . . . . 315.2 . . . . . . . . . . 33

    6 376.1 . . . . . . . . . . . 386.2 SLOWFIT . . . . . . 396.3 . . . . . . . . . 436.4 . . . . . . . . . . . . . . . . . . . 446.5 . . . . . . . . . . . . . . . 48

    3

  • 4

    7 537.1 . . . . . . . . . . . . . . . . . . . 537.2 : . . . . . . . . 557.3 ROBIN-HOOD . . . . . . . . . . . . . . . . . . 57

    8 61

    9 699.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 699.2 . . . . . . . . . . . . . . . . . . . . 719.3 . . . . . . . . . . . . . . . . 76

  • 1

    - (online algorithms). . - . .

    , . , - . - (competitive analy-sis), , () . (competitive ratio). ALG . , C

    OPT() C ALG() . OPT() ALG() ()

    5

  • 6 1.

    ALG , .

    ALG . , ALG() -. - ALG (oblivious adversaries) C

    OPT() C IE[ALG()] . , - ALG = 0. , C :

    C = max

    OPT()IE[ALG()]

    .

    , () - ALG C

    IE[ALG()] C OPT() . OPT() ALG() () ALG , .

    C = max

    IE[ALG()]OPT()

    0. .

  • 7 - (, ). , , - .

    ; (ski-rental), (paging) , (load balancing), (bin packing), (call admission).

  • 8 1.

  • 2

    ;

    . . . , . . , . , . . .

    . , . , . ;

    9

  • 10 2. ;

    2.1

    - . . , . , .

    1 - B . 1 , - . , = B, . .

    1. ; = B 2 1B .. - = B 2 1B . t > 0, ALGB(t) t OPT(t) t . B = maxtB(t) B(t) = ALGB(t)OPT(t) . B(t) 2 1/B, t > 0.

    t OPT(t) = min{t, B}. t- ALGB(t) = t t < B (t t ) ALGB(t) =2B 1 t B (B 1 B 1 B). , B(t) = tmin{t,B} = 1 t < B B(t) =

    2B1min{t,B} =

    2B1B = 2 1B t B. , B(t) 2 1B ,

    B 2 1B ., = B

    . - 2 1/B. - () = ALG ()OPT() 21/B.

  • 2.2. 11

    : < B,

    () = 1 +Bmin{, B} =

    1 +B

    > 1 +B 1

    > 1 +B 1B

    = 2 1/B

    > B,

    () = 1 +Bmin{, B} =

    1 +BB

    = 1 + 1B

    > 2 1/B.

    () > 2 1/B, , = maxt (t) () > 2 1/B.

    2.2

    . , , . , - , . 2 1/B B .

    : ; , .

    -. - , -, ( ).

    = dB/e B . (= 1+

    p5

    2 ).

  • 12 2. ;

    2. - ; 5+

    p5

    4 1.81.. t > 0, ALG(t) t. B

    ALG(t) =

    8

  • 2.3. 13

    2.3

    , . 1.81 - . , .

    . , B 1 B. , dB/e 1 dB/e. , (= 1+

    p5

    2 ).

    3. 5+

    p5

    4 1.81 ;

    . . = dB/e. t > 0, ALG1(t) t ALG2(t) t . , ALG(t) t.

    ALG1(t) =

    t t < B2B 1 t B

    ALG2(t) =

    t t < +B 1 t

    . , t > 0 ALG(t) IE[ALG(t)] = 12(ALG1(t) + ALG2(t)) . t OPT(t) = min{t, B}. , (t) = IE[ALG(t)]OPT(t) =

    ALG1(t)+ALG2(t)2OPT(t) ,

  • 14 2. ;

    = maxt (t). t. t < , ALG1(t) = ALG2(t) = t OPT(t) = t. , (t) = 1. t < B, OPT(t) = t, ALG1(t) = t ALG2(t) = +B1. ,

    (t) =ALG1(t) + ALG2(t)

    2 OPT(t) =t+ +B 1

    2t ... 5 +

    p5

    4.

    t B, OPT(t) = B, ALG1(t) = 2B 1 ALG2(t) = + B 1.,

    (t) =ALG1(t) + ALG2(t)

    2 OPT(t) = + 3B 2

    2B ... 5 +

    p5

    4.

    . (t) 5+

    p5

    4 ,, = maxt (t) 5+

    p5

    4 .

  • 3

    - - . , , - P = {p1, p2, ..., pN} N . , , P k k < N . . pi, pi . pi (hit) . , (page fault) - pi . , () pi. .

    . , .

    15

  • 16 3.

    3.1

    , 60. -. :

    LRU (least recently used): - .

    FIFO (first-in-first-out) : - .

    LIFO (last-in-first-out) : .

    LFU (least frequently used) : .

    LFD (longest forward distance) : .

    . , LFD . (demand paging), . , . 2. - .

    3.2 -

    , LFD .

  • 3.2. 17

    , ( ;), . (.., ) , . , .

    4. LFD .

    . - LFD . . 1. ALG . i, i = 1, 2, ..., ||, ALGi :

    1. ALGi i1 ALG.

    2. i , ALGi - .

    ALGi() ALGi ALG() ALG.

    n = || . . OPT, i = 1 OPT1, - OPT1 i = 2 OPT2, . OPTn LFD .

  • 18 3.

    . AL-G, ALGi. i , ALG AL-Gi X [ {v}, X [ {u}, , X k 1 u, v . u = v, ALG ALGi ALGi() = ALG(). v 6= u ( , i- ). v, ALGi ALG u ALG v. - , - k 1. , k (.., ALG v), ALGi ALG .

    v ALG ALGi , ALGi ALG. , v, , u v. ALG, ALGi. , ALGi v ALG. , v, ALGi u .

    3.3 (h, k) .

    k h h k. (h, k)- , k h k. h < k, .

  • 3.4. 19

    ( FIFO ) Belady: , -. - Belady, .

    3. LRU Belady FIFO .

    (h, k) - ; , - . , .

    3.4 -

    LRU FI-FO -. FWF (flush when full) . FWF :

    FWF: , .

    , FWF . , FWF - . , ,

  • 20 3.

    . , , FWF .

    ( - LRU FWF) - kkh+1 (h, k)- . , k ((k, k)-). , -, ( - FIFO) kkh+1 .

    - k . : 0 . i 1, i i 1 k . , i + 1, , (k + 1)- i- . k-. k- .

    . - k-. bit bit . , bit 1, , - . k- . k-, k-. - . FWF - , FWF .

    , -

  • 3.4. 21

    (h, k)- -.

    5. ALG - k OPT h k. ALG kkh+1 OPT.

    . - k-. , k- i 1, ALG k - . k ( k ). - . , k-, ALG .

    i 1 q i. i i+ 1 ( i+ 1 ). OPT h1 q k . , OPT k(h1) = kh+1 . i , OPT k0 h , k0 . OPT.

    , ALG k, , OPT kh+1 . , :

    ALG() kk h+ 1 OPT() + k

    0,

    ALG() OPT() ALG OPT, , k0 k

  • 22 3.

    ALG k-.

    1. LRU .

    . LRU . LRU x k. x k. x, x - . , LRU k . x , LRU - x k . x k- - k 1 . , k- - k+1 , k. , LRU -.

    FWF LRU . 5, 1, , - .

    1. LRU FWF kkh+1 (h, k)- .

    4. FIFO .

    ALG k , ALG k .

  • 3.5. 23

    5. LRU FIFO -. , FWF .

    5. 6. ALG - k OPT h k. - ALG kkh+1 OPT.

    , . 2. FIFO kkh+1 (h, k)- .

    3.5

    k - k.

    kkh+1 (h, k)- . , - LRU, FIFO, FWF (h, k)- .

    - LFD . 2. k + 1 , LFD() LFD ||k + k 1k .. k-. k- - k ,

    l||k

    mk-

    . k k- . , k +

    l||k

    m 1

    k + ||k +k1k 1 = ||k + k 1k .

  • 24 3.

    , . 7. ALG - k k.

    . k + 1 p1, ..., pk+1. ALG . , 2.

    : r1 i 2, ri ALG r1, ..., ri1 ( k+1 , - ). ALG .

    , ALG LFD k.

    LIFO LFU ( k). LIFO. p1, p2, ..., pk+1 .

    = p1, p2, ..., pk, pk+1, pk, pk+1, ...

    , LIFO k + 1 .

    LFU. ` . :

    = p`1, p`2, ..., p

    `k1, (pk, pk+1)

    `1.

    LFU (k 1) ` . , . ` , LFU k.

  • 4

    Yao

    Yao. - . - .

    4.1

    . . - : , v , , v( -). .

    . , . , .

    , . -

    25

  • 26 4. YAO

    . , - . , , 1. , - . - . .

    4.2

    , - , , -, . , , - .

    6. ;

    , - .

    , 1/2 ( ) 1. , 2.

    -, - ( - ). - 1 ( ). 1/2.

  • 4.2. 27

    1/2 1+1/2 /2. , 2.

    2, .

    , - . , - , - . -, :

    , p 1 p.

    , , - .

    p , . p-Random - p. ( p) . , , p-Random .

    p-Random - p . , .

    , p-Random p ( ) 1. , 1/p.

  • 28 4. YAO

    -, - . 1 . p - 1 p. p 1 + (1 p) = p( 1). , - p(1) .

    p p . , - p-Random ( ) p . , p = 21 (- ) - p-Random 1/p = 2 1/.

    4.3

    - . , - . , Yao .

    . P . ALG . , ALG() ALG OPT() P . CP(ALG) - ALG P - C

    IE[OPT()] C IE[ALG()]

  • 4.3. 29

    - . , - . ,

    IE[ALG()] C IE[OPT()]

    ALG() OPT() ALG , .

    Yao - - P. - . - . = 0 .

    Yao. , - . , q , - 1 q . q - . , . , q + (1 q).

    , . - .

  • 30 4. YAO

    -. 1 ( ). q + (1 q).

    - , - . , (1 q) q+(1q)(1q) . , - .

    - - q, q. -, - , q = 11/ - 2 1/. Yao, 2 1/ .

  • 5

    - MARK - . -, Yao. , , - .

    5.1 MARK

    MARK - k. 2Hk , Hk k- (harmonic number) Hk =

    Pki=1

    1i . ln k < Hk < 1+ln k

    MARK .

    MARK: , . p , p . , p , ,

    31

  • 32 5.

    . - p , .

    8. MARK 2Hk .

    . - k-. k-, k-. i- k- - . k- k-.

    i- k-. mi . k-, . , mi , mi . , k mi () .

    j- ( k-) i- k- kmi(j1)k(j1) .

    j- , . mikj+1 . , i- k-

    mi +kmiXj=1

    mik j + 1 = mi +mi(Hk Hmi) = mi(Hk Hmi + 1) miHk.

    . k- - mi, i- (i 1)- k-,

  • 5.2. 33

    k +mi . , k- i ( ), i- (i 1)- k- mi. k- - m1. , 12

    Pimi.

    HkP

    imi, . 7. MARK k Hk N = k + 1.

    8. MARK Hk ( k = 2 N = 4).

    5.2 -

    - k. Yao. 9. ALG - k. Hk.

    . I k + 1 . 1 I. i > 1, i- i k I {i1} .

    k-. , , LFD - - () Hk .

  • 34 5.

    i 2, k . , LFD i, i+ 1. , k 1 .

    A. k + 1 , i, A - q. i ( ). , k I{i}, q 1/k. , Hk, kHk.

    , - . - , , ( - ) . - I k+1 , - . ., k-, k + 1 - , k-. .

    3. k + 1

  • 5.2. 35

    kHk.

    . i i . , 1 = 0, 2 = 1, i > i1 i 3. IE[k+1].

    IE[k+1] =k+1Xi=2

    (IE[i] IE[i1])

    =k+1Xi=2

    IE[i i1].

    . IE[i i1] i1 , i- . (i 1)- , i 1 ki+2k . , i 1 , k k i+ 2 (i 1) . ,

    IE[i i1] =1Xj=1

    j

    1 k i+ 2

    k

    j1 k i+ 2k

    =k

    k i+ 2 .

    j i- j 1 j.

    P1j=1 j(1 x)j1 = 1/x2. -

    ,

    IE[k+1] =k+1Xi=2

    k

    k i+ 2 = kkXi=1

    1

    i= kHk

  • 36 5.

    .

    3 , k- kHk. A 1/k, - Hk . , .

  • 6

    - . . , - . i hri(1), ri(2), ..., ri(N)i. ri(j) i j . (makespan) .

    - (unrelated machines). - . (related machines), i wi j sj. i j ri(j) = wi/sj. - (, sj = 1 j) - (identical machines). - (restricted assignments) . . i j ri(j) = wi/sj j i, ri(j) =1.

    37

  • 38 6.

    . :

    GREEDY: , .

    , GREEDY - . , SLOWFIT . - .

    6.1

    , , - , . , :

    GREEDY : -, . , - .

    .

    10. - 2 1N N .. 2 1/N . , N(N 1) , 1, N . - 1 N 1. , , 2N1. , N

  • 6.2. SLOWFIT 39

    N 1 , N . -, 2 1/N .

    , . r w ` r. , r, ` ( r ). , r N`. , N` + w OPT() ` + wN ., OPT() w. , GR() :

    GR() = `+ w

    = `+w

    N+

    1 1

    N

    w

    OPT() +1 1

    N

    OPT()

    =

    2 1

    N

    OPT()

    .

    6.2 SLOWFIT

    , . , - SLOWFIT . - SLOWFIT, . -

  • 40 6.

    SLOWFIT, .

    SLOWFIT: , . . . i, - j 2,

    j = argmink

    {`i1(k) + ri(k) 2} (6.1)

    `i1(j) j i 1 SLOWFIT ri(j) i j. , .

    11. . - OPT() , SLOWFIT SLOWFIT() 2.. SLOWFIT , SLOWFIT() 2.

    . OPT() SLOWFIT t. - t. , t OPT(). - OPT(), t 1 j j t 1 .

    f `t1(f) OPT(). f 6= N `t1(N) + rt(N)

  • 6.2. SLOWFIT 41

    2OPT() 2 rt(N) t. , t N .

    = {j : j > N} f ( f `t1(j) > OPT() j 2 ). , t 1 , t1 . g j , i0 f . , rg(i0) OPT() f i0, rg(f) rg(i0) OPT()., f , `t1(f) OPT() `g(f) OPT(). , g, `g1(f) + rg(f) 2OPT() 2. f j, g . .

    SLOWFIT, - SLOWFIT .

    SLOWFIT: . -, SLOWFIT . 0, 0 r1(N) . - SLOWFIT0 ( SLOWFIT) - 1. , i 1, i = 2i1, SLOWFITi t SLOWFITi1 -

  • 42 6.

    , . SLOWFITi .

    12. SLOWFIT 8 .

    . SLOWFIT k, k = 2kr1(N). k k . - h. h = 0, 20 2OPT(), SLOWFIT0 . h > 0, r h. h 1 h1r h1 = 2h1r1(N),

    OPT() OPT(h1r) > 2h1r1(N).

    SLOWFIT :

    SLOWFIT() =hX

    k=0

    SLOWFITk(k) hX

    k=0

    2k

    =hX

    k=0

    2 2kr1(N) = 2(2h+1 1)r1(N).

    , SLOWFIT() < 8 OPT().

    , :

    13. . ALG , OPT() ) ALG() c (. c = 2 SLOWFIT ). ALG , ALG() 4c OPT(). , ALG 4c-.

  • 6.3. 43

    6.3 -

    -. . , .

    14. blogNc - N .

    . k = blogNc. N 0 = 2k k+1 . , N 0 . k , . i i = 1, ..., k1, (a, b), 1 a b . i - . , 1 .

    , i k 2ki ,, N 0/2 , N 0/4 ,..., k. -, i i k, i. 1 0 2 1. , j < k, j+1. , k + 1 k + 1.

  • 44 6.

    ( ) . , i i i + 1. , . k , , k . , , , .

    , k + 1 =blogNc+ 1.

    6.4

    O(logN) . Lp , p 1 . Lp.

    `j j, j = 1, ..., N . , Lp :

    |`|p =

    NXj=1

    `pj

    !1/p.

    , :

    maxj

    {`j} = limp!1

    |`|p.

    Lp :

  • 6.4. 45

    p-GREEDY: , p- .

    . 15. p 1, p-GREEDY 1

    21/p1 Lp.

    . n N . `j j Lp . yij 2 {0, 1} i j (yij = 1) (yij = 0).,

    Pi yijri(j) = `

    j ri(j) i

    j. , ij j i 0j = 0 .

    i, - p- . , p- .

    NXj=1

    pij pi1,j

    NXj=1

    (i1,j + yijri(j))p pi1,j

    .

    (x + a)p xp x = i1,j, a = yijri(j) 0, p 1. x [0,+1] ,

    NXj=1

    pij pi1,j

    NXj=1

    (nj + yijri(j))

    p pnj. (6.2)

    , . 4. p 1, t 0, ai 0, i = 1, ..., k. ,

    kXi=1

    ((t+ ai)p tp)

    t+

    kXi=1

    ai

    !p tp.

  • 46 6.

    . ai = 0 i = 1, ..., k . - ai > 0 =

    Pki=1 ai i = ai/. ,

    Pki=1 i = 1.

    zp [0,1),

    (t+ ai)p =

    (1 i)t+ i

    t+

    kXi=1

    ai

    !!p

    (1 i)tp + it+

    kXi=1

    ai

    !p(6.3)

    i = 1, ..., k. (6.3),

    kXi=1

    ((t+ ai)p tp) tp

    kXi=1

    (1 i) k!

    +

    t+

    kXi=1

    ai

    !p kXi=1

    i

    =

    t+

    kXi=1

    ai

    !p tp

    p- :

    |n|pp =NXj=1

    pnj

    =NXj=1

    nXi=1

    pij pi1,j

    =

    nXi=1

    NXj=1

    pij pi1,j

    .

    (6.2), ,

  • 6.4. 47

    4,

    |n|pp nXi=1

    NXj=1

    (nj + yijri(j))

    p pnj

    =NXj=1

    nXi=1

    (nj + yijri(j))

    p pnj

    NXj=1

    (nj +

    nXi=1

    yijri(j))p pnj

    !.

    Pn

    i=1 yijri(j) = `j

    Minkowski ( Lp)

    Pkt=1 (at + bt)

    p1/p Pkt=1 apt1/p + Pkt=1 bpt1/p p 1

    at, bt 0,

    |n|pp NXj=1

    (nj + `j)p

    NXj=1

    pnj

    0@ NX

    j=1

    pnj

    ! 1p

    +

    NXj=1

    `pj

    ! 1p

    1Ap NXj=1

    pnj

    =|n|p + |`|p

    p |n|pp

    |`|pp c = |n|p / |`|p, 2cp (c+ 1)p c 1

    21/p1 .

    ez 1+ z, p-GREEDY 1

    21/p1 pln 2 1.4427p.

    .

    5. Ap c Lp ., Ap cN1/p N .

  • 48 6.

    . ` . ` Lp c cN1/pmaxj `j . , |`|pp N maxj `pj |`|p N1/pmaxj `j . , maxj `j |`|p. - |`|p c|`|p , maxj `j cN1/pmaxj `j .

    p-GREEDY - pln 2 Lp, - .

    3. p-GREEDY p = lnN e logN N .

    6.5

    , . , : , (weighted). ( ), .

    - . G = (V,E) rj = (sj, tj, bj) bj sj tj. , bj bj : E ! R+. rj Pj sj tj e Pj bj(e).

    -. , . , , (

  • 6.5. 49

    ). , , .

    .

    ROUTEEXP > 0 = (1 + ). rj = (sj, tj, bj), rj Pj

    Pe2Pj a

    Lj1(e)+j(e) aLj1(e),

    Lj(e) =Xij

    Pi:e2Pi

    bj(e),

    Lj(e) =Lj(e)

    ,

    j(e) =bj(e)

    .

    , rj cj(e) = aLj1(e)+j(e) aLj1(e) = aLj1(e)

    aj(e) 1.

    16. G = (V,E) m . OPT() , ROUTEEXP() = O(logm) .

    . a = (1 + ),

    ax 1 x, x 2 [0, 1] (6.4)

    P1, . . . , Pn ( P 1 , . . . , P n ) - ROUTEEXP ( ) -

  • 50 6.

    r1, . . . , rn .Xe2Pj

    aLj1(e)aj(e) 1 X

    e2P jaLj1(e)

    aj(e) 1

    Pj

    Xe2P j

    aLn(e)aj(e) 1

    Lk(e) k

    Xe2P j

    aLn(e)j(e),

    (6.4)

    nX

    j=1

    Xe2Pj

    aLj1(e)aj(e) 1 X

    j

    Xe2P j

    aLn(e)j(e).

    Xe

    Xj:e2Pj

    aLj1(e)aj(e) 1 X

    e

    aLn(e)X

    j:e2P jj(e)

    Xe

    (aLn(e) 1) Xe

    aLn(e)X

    j:e2P jj(e)

    1 - OPT(r1, . . . , rn) X

    e

    aLn(e) m Xe

    aLn(e).

  • 6.5. 51

    , < 1, Xe

    aLn(e) m1

    Ln(e) loga

    m

    1

    Ln(e) loga

    m

    1

    ROUTEEXP() = O(logm) (6.5)

    ROUTEEXP ROUTE-EXP 13.

  • 52 6.

  • 7

    - . . j- - sj fj, j- dj = fj sj. fj dj - j. , . ALG() ALG , .

    , GREEDY 2 1N , - . , 2 1N . , SLOWFIT .

    7.1

    , , , T , . , T

    53

  • 54 7.

    , .

    - .

    17. ( ), T ( ), ROUTE-KNOWNT , O(logNT )-.

    . - [(k1)T, kT ] k. ( ), : Gk 2TN + 3T

    uki,h 0 i < 2T 1 h N , tki+1 0 i < 2T 1, ski 0 i < T , .

    i , h . Gk 5NT 2N :

    2NT N eki,h = (uki,h, uki+1,h), - ( ) .

    2NT N (uki+1,h, tki+1) 0 i < 2T 1 1 h N , ( ).

    NT (ski , uki,h) 0 i < T 1 h N , ( ).

    rj = hrj(1), . . . , rj(N)i, dj (k 1)T + l, (0 l < T ), r0j skl , tkl+dj ,

  • 7.2. : 55

    bj(eki,h) = rj(h), l i < l + dj, bj(e) = 0 e. ROUTEEXP, , r0j.

    r0j k, Gk. , rj h. , h (.. t = (k 1)T + i) ek1i+T,h, eki,h. Gk O(logNT ) , ROUTE-KNOWNT O(logNT )-.

    7.2 :

    . , .

    18. - . (

    pN).

    . Li(t) i t ( - t, ). t, . , L1(t) L2(t) Lq(t)(t) Li(t) = 0 i > q(t). - , .

    1. , N - . , OPT() 1.

    2. , N Li(t) Li+1(t) + 1, 1 i q 1.

  • 56 7.

    3. r i L(k)i > 0, ALG r i. k , .

    - . . 1.

    L = hL1(t), . . . , Lq(t)(t)i L0 = hL1(t0), . . . , Lq(t0)(t0), L < L0, Lj(t) = Lj(t0) j < i Li(t) < Li(t0) 1 i q(t0)

    : . N , -

    . ( .)

    . k k

    L(k) = hL(k)1 , . . . , L(k)q(k)i, k. L(k) (L(k)i L(k)i+1 + 1), = k., k k+1 L(k) < L(k+1).

    Pqki=1 L

    (k)i = N

    , .

    , k + 1

    L(k)i = L(k)i+1 > 0

    i 1, . :

    1. i i + 1 . ( ALG , 3)

  • 7.3. ROBIN-HOOD 57

    2. , {i, i + 1}. - ALG i, i+ 1.

    3. i + 1 ALG.

    4. , .

    k+1. L(k+1)i = L(k)i +1 L(k) < L(k+1).

    . , l = L1(t) = ALG()

    N =qX

    i=1

    Li(t) q1Xi=0

    (l i) = ql q(q 1)2

    q l, l (q 1) Lq(t) > 0. l q = l l(l+1)2 N , l p2N(1 + o(1)). ,

    ALG() = (pN).

    7.3 ROBIN-HOOD

    . , . - (N2/3), O(

    pN)) .

    rj sj lj - Mj . Li(sj) i rj (- t sj ).

  • 58 7.

    j j r1, r2, . . . , rj. j - B(sj) OPT , B(s0) = 0 B(sj) = max{B(sj1), lj, 1N (lj +

    Pi Li(sj))},

    . i sj, Li(sj)

    pN B(sj).

    B , B(sj1) < B(sj), . , (, ) (, ).

    ROBIN-HOOD r1 . rj, sj , i 2 Mj sj Li(sj) >>>>>:16 2" i = 1, . . . , n.13 + " i = n+ 1, . . . , 2n.

    12 + " i = 2n+ 1, . . . , 3n.

    , OPT() = n. , , FIRST-FIT ( BEST-FIT) , " n6 n ,

    n2 n, n

    n . , 5n3 .

    FF() 1710OPT() + 2. :

    w(r) =

    8>>>>>>>>>>>>>>>:

    65r 0 r 16 .95r 110 16 r 13 .65r +

    110

    13 r 12 .

    1 12 < r.

    = r1, r2, . . . , rn, W () =Pn

    i=1w(ri), B, W (B) =

    Ptj=1w(rij), {rij |j = 1, . . . , t}

    B. , .

    6. B W (B) 1710 , W () 1710OPT().

    . 12 ,

    w(ri)

    ri 3

    2 12 rij ri

    tXj=1

    rij 13 . . r1 13 > r2, r2 > 13 ,

    w(r1)+w(r2) =6

    5r1+

    9

    5r2 =

    6

    5(r1+r2)+

    3

    5r2 >

    6

    5(1)+ 3

    5 > 1

    3. m = 3. .

    13 12 m. .

    9. B r1 rm.

    Pmi=1w(ri) = 1 > 0, (i) m = 1 r1 12 , (ii)Pm

    i=1 ri 1 59.. m = 1, r1 > 12 > 0.

    m 2, , r1 r2 > .

    Pmi=1 ri = 1 . eB

  • 66 8.

    r3, . . . , rm 1, 2, 1 + 2 = r1 + r2 + i ri. 8 eB,

    mXi=3

    w(ri) + w(1) + w(2) 1 (8.1)

    w 95 12 ,

    w(1) + w(2) w(r1) + w(r2) + 95

    (8.1) mXi=1

    w(ri) +9

    5

    mXi=3

    w(ri) + w(1) + w(2) 1,

    1 =mXi=1

    w(ri) 1 95.

    5

    9

    .

    W (Bi) = 1 i i > 0 i < 12 Bi. Bi ri1, ri2, . . .

    l > 1. 9, 1 < i l:

    i 1Xj

    ri1j i1 +5

    9i1.

    Bi1 (i) 9, i 12 .

    l1Xi=1

    i 95

    lXi=2

    (i i1) = 95(l 1) 9

    5 12< 1.

    l 1, Pl

    i=1 i 2. , l = 1 .

  • 67

    l 9, m (FF() = m + l). 8 1. ,

    W () =X

    w(ri) m+lX

    i=1

    W (Bi) = m+lX

    i=1

    (1 i) = m+ l lX

    i=1

    i

    FF() 2. FF() W () + 2. 6

    FF() 1710

    OPT() + 2.

    .

  • 68 8.

  • 9

    , . , . , . , -, . , , . , , , - . .

    9.1

    ( , - ) ( ) . - , , -.

    i- ri = (si, ti, bi, pi) - si ti,

    69

  • 70 9.

    bi, pi ., - (throughput) :

    .

    .

    . , , , .

    , - , .

    - , - (.. ) :

    1. (bidirectional mode). - hu, vi - hu, vi hv, ui, c, c .

    2. (undirected mode). - hu, vi - , - . , c, c .

    , - , , .

  • 9.2. 71

    9.2

    , - . . , , -.

    ALG . - u(e) e Lj(e) - e ( ) j ALG. Aj , j , , Pk rk, k 2 Aj.

    Lj(e) =1

    u(e)Xk2Aje2Pk

    bk

    Ln(e) 1 e = r1, . . . , rn. :

    cj(e) = u(e)[Lj(e) 1], (9.1)

    D - . , , , ( ), pi = D bi, ri =(si, ti, bi, pi). , . , 0 " 1 ri, i = 1, 2, . . . n

    bi mine

    u(e)

    " logD + 1 + "= b(e)

    ,bi = O

    u(e)

    logD

  • 72 9.

    " 1 1logD .

    AAP" D (.. ) , 0 " 1. bi b(") pi = D bi ri. = 21+ 1"D. j- rj = (sj, tj, bj, pj) P

    Xe2P

    bju(e)

    cj1(e) pj.

    rj , . Lj(e) cj(e) . " .

    21. , - AAP .

    . , Ln(e) 1 e. = r1, . . . , rn, A rj ( Pj) AAP. .

    k 2 A. AAP, - rk

    Xe2Pk

    bku(e)

    ck1(e) pk = D bk.

    Xe2P

    ck1(e)u(e)

    D.

  • 9.2. 73

    e 2 Pk

    D ck1(e)u(e) = Lk1(e) 1

    = Lk(e)bku(e) 1

    Lk(e) 1(" logD+1+") 1

    bku(e) 1(" logD+1+") .

    = Lk(e)1

    (" log ) 1

    " log = " logD + 1 + ".

    x = 2x log . . .

    = Lk(e)

    21" 1.

    Lk(e) 2 1"D + 2 1" 21+ 1"D = , Lk(e) 1. 22. , - AAP

    21+1" log + 1 = O(2

    1" + 2

    1" logD).

    . r1, r2, . . . rn . A rj ( Pj) AAP, A AAP, . C , C =

    Pe cn(e).

    :

    1.C (21+ 1" log )

    Xj2A

    pj,

    .

  • 74 9.

    2. Xj2A

    pj C,

    - .

    1 2, ,

    AAP() =Xj2A

    pj OPT() AAP() +Xj2A

    pj.

    |A|, - AAP. , . , . , rk . X

    e

    ck1(e) 21+ 1" log X

    j2A{k}pj, (9.2)

    Xe

    ck(e) 21+ 1" log Xj2A

    pj. (9.3)

    Xe

    ck(e)Xe

    ck1(e) =Xe2Pk

    (ck(e) ck1(e)) 21+ 1"pk log . (9.4)

    e 2 Pk,[ck(e) ck1(e)] = u(e)[Lk1(e)+

    bku(e) Lk1(e)]

    = u(e)Lk1(e)[bku(e) 1]

    u(e)Lk1(e)hlog bku(e)

    i21"

    = 21" log

    hck1(e)u(e) + 1

    i bk

    = 21" log

    hbku(e)ck1(e) + bk

    i.

  • 9.2. 75

    :

    x 1 = 2x log 1, log bku(e)

    1",

    2y 1 y2 1" y 2 [0, 1"]. ,

    Xe2Pk

    [ck(e) ck1(e)] 2 1" log Xe2Pk

    bku(e)

    ck1(e) + bk

    = 21" log

    Xe2Pk

    bku(e)

    ck1(e) +Xe2Pk

    bk

    !

    2 1" log pk +

    Xe2Pk

    bk

    !

    AAP

    2 1" log (pk +D bk)

    = 21" log 2pk.

    1. , P j , -

    rj. -, AAP, - ,

    pj < minsjtj-

    P

    Xe2P

    bju(e)

    cj1(e) Xe2P j

    bju(e)

    cj1(e)

  • 76 9.

    ,Xj2A

    pj 0 .

    bi mineu(e)

    " logDT + 1 +

    1

    "

    pi = Dbi(fiai) ri. = 21+ 1"DT . j- rj = (sj, tj, bj, pj, aj, fj) P sj tj X

    ajt

  • 80 9.

  • [1] D. Achlioptas, M. Chrobak, and J. Noga. Competitive analysis of ran-domized paging algorithms. Proceedings of the 4th Annual EuropeanSymposium on Algorithms (ESA 96), LNCS 1136, Springer, pp. 419-430, 1996.

    [2] S. Albers. Lecture notes on competitive online algorithms. BRICS Lec-ture Series LS-96-2, AArhus University, Denmark, 1996.

    [3] J. Aspnes, Y. Azar, A. Fiat, S. Plotkin, and O. Waarts. On-line routingof virtual circuits with applications to load balancing and machinescheduling. Journal of the ACM, 44(3), pp. 486-504, 1997.

    [4] B. Awerbuch, Y. Azar, E. F. Grove, M.-Y. Kao, P. Krishnan, and J. S.Vitter. Load balancing in the Lp norm. Proceedings of the 36th AnnualSymposium on Foundations of Computer Science (FOCS 95), pp. 383-391, 1995.

    [5] B. Awerbuch, Y. Azar, and S. Plotkin. Throughput-competitive on-linerouting. Proceedings of the 34th Annual Symposium on Foundations ofComputer Science (FOCS 93), pp. 32-40, 1993.

    [6] B. Awerbuch, Y. Bartal, A. Fiat, and A. Rosen. Proceedings of the 5thAnnual ACM-SIAM Symposium on Discrete Algorithms (SODA 94), pp.312-320, 1994.

    [7] Y. Azar. On-line load balancing. Online Algorithms, The state of theart. LNCS 1442, Springer, pp. 178-195, 1996.

    [8] Y. Azar, A. Z. Broder, and A. Karlin. On-line load balancing. Theoreti-cal Computer Science, 130(1), pp. 73-84, 1994.

    81

  • 82

    [9] Y. Azar, J. Naor, and R. Rom. The competitiveness of on-line assign-ments. Journal of Algorithms, 22(1), pp. 221-237, 1995.

    [10] Y. Bartal. On-line Computation and Network Algorithms, LectureNotes. Hebrew University of Jerusalem, Israel, 1997.

    [11] L. A. Belady. A study of replacement algorithms for virtual storagecomputers. IBM Systems Journal, 5, pp. 78-101, 1966.

    [12] L. A. Belady, R. A. Nelson, and G. S. Shedler. An anomaly in space-time characteristics of certain programs running in a paging machine.Communications of the ACM, 12(6), pp. 349-353, 1969.

    [13] A. Borodin and R. El-Yaniv. Online computation and competitive anal-ysis. Cambridge University Press, 1998.

    [14] A. Borodin, S. Irani, P. Raghavan, and B Schieber. Competitive pagingwith locality of reference. Journal of Computer and System Sciences,50(2), pp. 244-258, 1995.

    [15] I. Caragiannis. Better bounds for online load balancing on unrelatedmachines. Proceedings of the 19th Annual ACM-SIAM Symposium onDiscrete Algorithms (SODA 08), pp. 972-981, 2008.

    [16] I. Caragiannis, C. Kaklamanis, and E. Papaioannou. Ecient on-linefrequency allocation and call control in cellular networks. Theory ofComputing Systems, 35(5), pp. 521-543, 2002.

    [17] I. Caragiannis, A. V. Fishkin, C. Kaklamanis, and E. Papaioan-nou. Randomized on-line algorithms and lower bounds for computinglarge independent sets in disk graphs. Discrete Applied Mathematics,155(2), pp. 119-136, 2007.

    [18] A. Fiat, R. M. Karp, M. Luby, L. A. McGeoch, D. D. Sleator, and N. E.Young. On competitive paging algorithms. Journal of Algorithms, 12,pp. 685-699, 1991.

    [19] R. L. Graham. Bounds on certain multiprocessor anomalies. Bell Sys-tems Technical Journal, 45, pp. 1563-1581, 1996.

    [20] M. X. Goemans. Advanced Algorithms, Lecture Notes, MIT Laboratoryof Computer Science, 1993.

  • 83

    [21] A. R. Karlin, C. Kenyon, and D. Randall. Dynamic TCP acknowledge-ment and other stories about e/(e 1). Proceedings on 33rd AnnualACM Symposium on Theory of Computing (STOC 01), pp. 502-509,2001.

    [22] A. R. Karlin, M. S. Manasse, L. Rudolph, and D. D. Sleator. Competi-tive snoopy caching. Algorithmica, 3, pp. 77-119, 1988.

    [23] R. J. Lipton and A. Tomkins. Online interval scheduling. Proceedingsof the 5th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA94), pp. 302-311, 1994.

    [24] R. Motwani and P. Raghavan. Randomized Algorithms. Cambridge U-niversity Press, 1995.

    [25] D. D. Sleator and R. E. Tarjan. Amortized eciency of list update andpaging rules. Communications of the ACM, 28(2), pp. 202-208, 1985.

    [26] E. Torng. A unified analysis of paging and caching. Algorithmica, 20,pp. 175-200, 1998.

    [27] J. Ullman. The performance of a memory allocation algorithm. Techni-cal Report 100, Dept. of Electrical Engineering, Princeton University,1971.

    [28] A. C. Yao. Probabilistic computations: Towards a unified measure ofcomplexity. Proceedings of the 18th Annual Symposium on Foundationsof Computer Science (FOCS 77), 1977.