Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 5314 – Spring 2004 Homework #1 - Solutions [Soumya Sanyal] Q 1.5: Prove that the algorithm “MTF every-other-access” (i.e. move the item to the front.

Similar presentations


Presentation on theme: "CSE 5314 – Spring 2004 Homework #1 - Solutions [Soumya Sanyal] Q 1.5: Prove that the algorithm “MTF every-other-access” (i.e. move the item to the front."— Presentation transcript:

1 CSE 5314 – Spring 2004 Homework #1 - Solutions [Soumya Sanyal] Q 1.5: Prove that the algorithm “MTF every-other-access” (i.e. move the item to the front on every even request for that item) is strictly 2-competitive. A: To prove this bound, we adopt the original model for proving the competitiveness of the MTF algorithm i.e. by the usual notations we represent the two lists as MTF’ (every-other-access) and OPT. First, the rule is adapted into a ‘marking-like’ algorithm where we MTF when the element is unmarked and then mark it, or simply unmark it if it was originally marked and make no changes. Second, redefine the potential function as follows: Φ(x)= φ A (x) + φ B (x), where is ‘x’ is an element in MTF’ and OPT. x є {x o,x 1 } … ( x o = unmarked, x 1 = marked ) where, φ A (x 0 ) = # of inversions between MTF’ and OPT. φ A (x 1 ) = 0 φ B (x 1 ) = # of inversions between MTF’ and OPT. φ B (x 0 ) = 0 University of Texas at Arlington

2 It naturally follows that, ΔΦ(x) = Δφ A (x) + Δφ B (x) We use the same notations used in the handouts, i.e. k, j, |W| and |WE| all have their usual meanings. An access to any element ‘x’ will result in either of following two actions:  x = x 0 (unmarked), move the element to the head of the list and mark it. – after MTF and before marking, Δφ A (x) = -|WE| lost inversions ; Δφ B (x) = 0. Δφ A (x) = -|WE| lost inversions ; Δφ B (x) = 0. – after marking, Δ φ B (x) = |W| new inversions. ; Δ φ A (x) = 0. Δ φ B (x) = |W| new inversions. ; Δ φ A (x) = 0.  x = x 1 (marked), unmark it, do nothing. –Δφ A (x) = |W| new inversions ; Δφ B (x) = - |W| lost inversions Hence, ΔΦ(x) = Δφ A (x) + Δφ B (x) ≤ |W| - |WE| … (since the second case contributes nothing) ≤ |W| - |WE| … (since the second case contributes nothing) Hence, COST k(MTF’) = k + ΔΦ(x) --- (1) Now recall the identity, k - |WE| ≤ j ---- (2) From (1) and (2) and the previous results, COST k(MTF’) ≤ 2j – 1.

3 University of Texas at Arlington Adjusting the cost for the changes made to OPT’s list, COST k(MTF’) ≤ 2j – 1 - f + p. It follows from previous proof styles that, COST MTF’ (σ) ≤ 2 COST OPT (σ) – n Hence, as α = - n, the competitive ratio of 2 is strict …. (Q.E.D) Q 1.10: Show that the above derivation holds without strict competitiveness i.e. if in equation 1.6 [i.e. ALG * xy (σ) ≤ c.OPT * xy (σ) ] there is some additive constant α, then ALG is c- competitive up to an additive constant of {αl(l-1)}/2. A: Given, ALG * (σ xy ) ≤ c.OPT * (σ xy ) + α … (1) By the pairwise property we have, ALG * (σ xy ) = ALG * xy (σ) OPT * (σ xy ) = OPT * xy (σ) … (2) Equation 1.4 gives us, ALG * (σ) = Σ {x,y} ⊆ L,x≠y ALG * xy (σ) (a) OPT * (σ) = Σ {x,y} ⊆ L,x≠y OPT * xy (σ) (b)… (3) Using (1) we have, ALG * (σ) ≤ Σ {x,y} ⊆ L,x≠y {c.OPT * (σ xy ) + α}

4 University of Texas at Arlington Or,ALG * (σ) ≤ c. Σ {x,y} ⊆ L,x≠y OPT * (σ xy ) + α.Σ {x,y} ⊆ L,x≠y 1 By (2) and subsequently (3), we have ALG * (σ) ≤ c. OPT * (σ) + α. l C 2 Or, ALG * (σ) ≤ c. OPT * (σ) + α.l.(l-1)/2 … (Q.E.D.) Q 2.1: Consider the following modification to the BIT algorithm. Instead of always complementing b(x) on every access of the element x, complement b(x) only if it is not in the front of the list. Show that this BIT algorithm is not 7/4 competitive. A: We make an observation about the altered BIT algorithm before we proceed with the proof. It in action is very similar to the randomized MTF (RMTF) algorithm where an element ‘x’ is moved to the front with probability of ½ every time it is accessed. Since we assume an initial uniform random distribution in {0,1}, our modified BIT algorithm essentially follows RMTF behavior. To complete the proof, we will try and construct an input sequence that is going to prove that the competitiveness of 7/4 does not hold. A good starting point is a nemesis request sequence similar to the one constructed for RMTF. Let, σ = [(x l ) 2 (x l-1 ) 2 (x l-2 ) 2 … (x 1 ) 2 ] k, k>1; x 1 is at the front, x l is at the end. It is easy to observe that after the first round with (k=1), all the bits will be

5 University of Texas at Arlington set to 1, and the algorithm thereafter will assume a deterministic behavior. Hence, each x i, i є {1,2,…,l} will be moved to the front on every second request deterministically. Therefore, other than the aberrant first round, where the expected cost is 3/2 [½.1 + ½.2] (because it is a random distribution), the cost to serve the sequence for k>1 is at least 2l 2 + 4l – 2l [2l(l+1)] … (from the RMTF derivation). The cost for MTF on this sequence would be l(l+1). Hence the competitiveness is no larger than 2 times the optimal offline for a sufficiently large value of l. Hence it is not 7/4 competitive… (Q.E.D.)


Download ppt "CSE 5314 – Spring 2004 Homework #1 - Solutions [Soumya Sanyal] Q 1.5: Prove that the algorithm “MTF every-other-access” (i.e. move the item to the front."

Similar presentations


Ads by Google