Download presentation
Presentation is loading. Please wait.
Published byJulie Lester Modified over 9 years ago
1
1/24 Algorithms for Generalized Caching Nikhil Bansal IBM Research Niv Buchbinder Open Univ. Israel Seffi Naor Technion
2
2/24 The Paging/Caching Problem Set of n pages, cache of size k<n. Request sequence of pages 1, 6, 4, 1, 4, 7, 6, 1, … If requested page already in cache, no penalty. Else, cache miss: Fetch page in cache (possibly) evicting some other page. Goal: Minimize the number of cache misses. Main Question: Which page to evict?
3
3/24 Previous Results: Paging Paging (Deterministic) [Sleator Tarjan 85]: Any det. algorithm ¸ k-competitive. LRU is k-competitive (also other algorithms) Paging (Randomized): Rand. Marking O(log k) [Fiat, Karp, Luby, McGeoch, Sleator, Young 91]. Lower bound H k [Fiat et al. 91], tight results known.
4
4/24 Generalized Caching First Extension: Pages have different fetching costs. Models scenarios in which the fetching cost is not uniform: Main memory, disk, internet … Second (Orthogonal) Extension: Pages have different sizes (in range [1,k]) Models web-caching problems (Proxy Servers, local cache in browser) web
5
5/24 Generalized Paging Deterministic: (k+1)-competitive [Cao, Irani 97], [ Young 98] Randomized: General Problem: Nothing better Special cases [Irani 97] Bit Model (wt = size): O(log 2 k) Fault Model (wt = 1): O(log 2 k) Offline: NP-Hard, 4-approximation [Bar-noy, Bar-yehuda, Freund, Naor, Schieber 01]
6
6/24 Our Results Thm: O(log 2 k) competitive alg. for Generalized Caching Thm: O(log k) for bit and fault model. Main Technique: Primal Dual Method for Online Algorithms (formalized by Buchbinder and Naor 05) [based on multiplicative updates, several previous works…] Recent Update: Improved to O(log k) [Adamaszek, Czumaj, Englert, Räcke]
7
7/24 High level approach First step: O(log k)-competitive for fractional generalized caching. Maintains fractions on pages. Second Step: Transform fractional solution into Randomized Alg.: Maintain distribution on cache states that is “consistent” with the fractional solution. Keep costs comparable We lose O(1) for Bit/Fault model, O(log k) for general model.
8
8/24 Rest of the Talk Online Primal Dual Method Formulation of Caching Problem Knapsack cover inequalities Final Algorithm
9
9/24 An Abstract Online Problem min 3 x 1 + 5 x 2 + x 3 + 4 x 4 + … 2 x 1 + x 3 + x 6 + … ¸ 3 x 3 + x 14 + x 19 + … ¸ 8 x 2 + 7 x 4 + x 12 + … ¸ 2 Goal: Find feasible solution x * with min cost. Requirements: 1) Upon arrival constraint must be satisfied 2) Cannot decrease a variable. Covering LP (non-negative entries)
10
10/24 Example min x 1 + x 2 + … + x n x 1 + x 2 + x 3 + … + x n ¸ 1 x 2 + x 3 + … + x n ¸ 1 x 3 + … + x n ¸ 1 … x n ¸ 1 Online ¸ ln n (1+1/2+ 1/3+ … + 1/n) Opt = 1 ( x n =1 suffices) Set all x i to 1/n Increase x 2,x 3,…,x n to 1/n-1 … Increase x n to 1
11
11/24 General Covering Results Thm [Buchbinder-Naor 05]: O(log n) competitive fractional alg. (n – number of variables). –Can improve if more structure (e.g. O(log k) for caching, O(ln d) for d-sparse matrix) –Can add “box” constraints to covering LP (e.g. x · 1) –Tradeoff feasibility vs. competitive ratio –Allow variables to increase or decrease –More general forms than covering/packing
12
12/24 Online Primal Dual Approach Primal updated based on dual. Recall, any dual solution is a lower bound on optimum. At each step: Primal · c ( Dual) (if primal and dual feasible) ! c competitive fractional algorithm Algorithm is always similar.
13
13/24 Key Idea for Online Primal Dual Primal: Min i c i x i Dual Step t, new constraint: New variable y t a 1 x 1 + a 2 x 2 + … + a j x j ¸ b t + b t y t in dual objective How much: x i ? y t ! y t + 1 (additive update) primal cost = dx i /dy = a i x i /c i so, x varies as exp(y) = Dual Cost
14
14/24 How to initialize A problem: dx/dy is proportional to x, but x=0 initially. So, x will remain equal to 0 ? Answer: Initialize to 1/n. Complementary slackness : x > 0 only if dual constraint for x is tight. Set x=1/n when its dual constraint becomes tight.
15
15/24 Rest of the Talk Online Primal Dual Method Formulation of Caching Problem Knapsack cover inequalities Final Algorithm
16
16/24 Fractional covering LP At each time we have a profile of how much “fraction” of each page has been evicted. i w i x i ¸ W - k (W = total size of all pages) Real variables: x(i,j) j-th request for page i Initially 0 when page requested, then increases as page evicted over time. If x(i,j) increases by , pay c(i)
17
17/24 Large Integrality Gap Input: Two pages of size k/2+1 requested alternately. 1) Any solution must fault on every step. 2) But LP can hold 1-O(1/k) fraction of each page, incurring only O(1/k) cost at each step. Cannot hope to show o(k) guarantees.
18
18/24 Rest of the Talk Online Primal Dual Method Formulation of Caching Problem Knapsack cover inequalities Final Algorithm
19
19/24 Knapsack Cover Inequalities Knapsack Cover Problem: Knapsack of size D, n items with sizes w 1,w 2,…,w n and cost c 1,..,c n Goal: Choose min cost subset, that covers knapsack (i.e. total size ¸ D) LP: min c i x i s.t. i w i x i ¸ D, x i = {0,1} 2 [0,1] Bad example: Only one item of size 1000 D. LP can just choose 1/1000 of this item. Simple fix: min c i x i s.t. i min(w i, D) x i ¸ D
20
20/24 Still Bad Bad example: 2 items, s 1 = s 2 = D-1 c 1 =0, c 2 = L Any solution must choose item 2. (Integer cost = L) LP: sets x 1 =1 and x 2 = 1/(D-1) (LP cost = L/(D-1)) Consider a subset of jobs S. Even if choose all items in S, still need to cover at least D-W(S) size with remaining items. Thm: Factor 2 in general (Carr, Fleischer, Leung, Phillips’ 97) Exponential constraints, but poly time.
21
21/24 Consider the LP strengthened with Knapsack inequalites (exponentially many per time step) While there exist an unsatisfied primal constraint of set of pages S and time t: Increase the dual variable y(t,S). And update primal according to general recipe. Thm: Gives O(log k)-competitive fractional algorithm. Sketch of Primal-Dual algorithm
22
22/24 Fractional -> Randomized At each time t, LP gives a fractional state p = (p 1,…,p n ) Say p ! p’ at fractional cost = Randomized alg: Distribution on cache states D -> D’ cost should be close to Offline rounding (K.C. inequalities) + Online maintainability Easy: If lose O(log W) and O(log P) (reduce to uniform) We avoid for bit and fault model, but lose O(log k) for general model.
23
23/24 Concluding Remarks Primal-dual approach gives simple unifying framework for caching and many online problems. Strong relation to multiplicative updates technique Recently, used to obtain the first polylog(n,k) competitive algorithm for k-server problem on general metrics [B., Buchbinder, Naor, Madry 11]
24
24/24 Thank You!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.