Online Algorithms and Competitive Analysis. Paging Algorithms Data brought from slower memory into cache RAM CPU.

Slides:



Advertisements
Similar presentations
Yannis Smaragdakis / 11-Jun-14 General Adaptive Replacement Policies Yannis Smaragdakis Georgia Tech.
Advertisements

Introduction to Computer Science 2 Lecture 7: Extended binary trees
1 SOFSEM 2007 Weighted Nearest Neighbor Algorithms for the Graph Exploration Problem on Cycles Eiji Miyano Kyushu Institute of Technology, Japan Joint.
Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Online Algorithms Amrinder Arora Permalink:
Alternative Models for Online Analysis Alex López-Ortiz University of Waterloo joint work with Reza Dorrigiv, Spyros Angelopoulos and Ian Munro.
Princeton University COS 423 Theory of Algorithms Spring 2001 Kevin Wayne Competitive Analysis.
Online Algor ithm Paging and Caching. Caching (paging) Structure of data storage Cache memory : Static RAM Level 1 Cache Level 2 Cache Main memory Hard.
Introduction To Tracking
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
Bar Ilan University And Georgia Tech Artistic Consultant: Aviya Amir.
2007/3/6 1 Online Chasing Problems for Regular n-gons Hiroshi Fujiwara* Kazuo Iwama Kouki Yonezawa.
Planning under Uncertainty
Evaluation of Algorithms for the List Update Problem Suporn Pongnumkul R. Ravi Kedar Dhamdhere.
The Value of Knowing a Demand Curve: Regret Bounds for Online Posted-Price Auctions Bobby Kleinberg and Tom Leighton.
CS Lecture 9 Storeing and Querying Large Web Graphs.
Institute of Computer Science University of Wroclaw Page Migration in Dynamic Networks Marcin Bieńkowski Joint work with: Jarek Byrka (Centrum voor Wiskunde.
Robust Network Design with Exponential Scenarios By: Rohit Khandekar Guy Kortsarz Vahab Mirrokni Mohammad Salavatipour.
No Free Lunch (NFL) Theorem Many slides are based on a presentation of Y.C. Ho Presentation by Kristian Nolde.
Shuchi Chawla, Carnegie Mellon University Static Optimality and Dynamic Search Optimality in Lists and Trees Avrim Blum Shuchi Chawla Adam Kalai 1/6/2002.
Hash Tables1 Part E Hash Tables  
Near-Optimal Network Design with Selfish Agents By Elliot Anshelevich, Anirban Dasgupta, Eva Tardos, Tom Wexler STOC’03 Presented by Mustafa Suleyman CIFTCI.
Ecole Polytechnique, Nov 7, Online Job Scheduling Marek Chrobak University of California, Riverside.
Preference Analysis Joachim Giesen and Eva Schuberth May 24, 2006.
Evaluation of Algorithms for the List Update Problem Suporn Pongnumkul R. Ravi Kedar Dhamdhere.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
The Hardness of Cache Conscious Data Placement Erez Petrank, Technion Dror Rawitz, Caesarea Rothschild Institute Appeared in 29 th ACM Conference on Principles.
Priority Models Sashka Davis University of California, San Diego June 1, 2003.
1 Last Time: Paging Motivation Page Tables Hardware Support Benefits.
On Error Preserving Encryption Algorithms for Wireless Video Transmission Ali Saman Tosun and Wu-Chi Feng The Ohio State University Department of Computer.
Paging for Multi-Core Shared Caches Alejandro López-Ortiz, Alejandro Salinger ITCS, January 8 th, 2012.
Memory Management Last Update: July 31, 2014 Memory Management1.
Minimizing Cache Usage in Paging Alejandro Salinger University of Waterloo Joint work with Alex López-Ortiz.
1/24 Algorithms for Generalized Caching Nikhil Bansal IBM Research Niv Buchbinder Open Univ. Israel Seffi Naor Technion.
Virtual Memory.
Game Trees: MiniMax strategy, Tree Evaluation, Pruning, Utility evaluation Adapted from slides of Yoonsuck Choe.
Minimax Trees: Utility Evaluation, Tree Evaluation, Pruning CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 2 Adapted from slides of Yoonsuck.
Physical Mapping of DNA Shanna Terry March 2, 2004.
Yossi Azar Tel Aviv University Joint work with Ilan Cohen Serving in the Dark 1.
Online Paging Algorithm By: Puneet C. Jain Bhaskar C. Chawda Yashu Gupta Supervisor: Dr. Naveen Garg, Dr. Kavitha Telikepalli.
Algorithms and their Applications CS2004 ( ) Dr Stephen Swift 1.2 Introduction to Algorithms.
1 ECE-517 Reinforcement Learning in Artificial Intelligence Lecture 7: Finite Horizon MDPs, Dynamic Programming Dr. Itamar Arel College of Engineering.
Online Algorithms. Introduction An offline algorithm has a full information in advance so it can compute the optimal strategy to maximize its profit (minimize.
Dr.Abeer Mahmoud ARTIFICIAL INTELLIGENCE (CS 461D) Dr. Abeer Mahmoud Computer science Department Princess Nora University Faculty of Computer & Information.
Minimizing Cache Usage in Paging Alejandro López-Ortiz, Alejandro Salinger University of Waterloo.
Télécom 2A – Algo Complexity (1) Time Complexity and the divide and conquer strategy Or : how to measure algorithm run-time And : design efficient algorithms.
Market Design and Analysis Lecture 5 Lecturer: Ning Chen ( 陈宁 )
Online Algorithms By: Sean Keith. An online algorithm is an algorithm that receives its input over time, where knowledge of the entire input is not available.
Image segmentation Prof. Noah Snavely CS1114
1 Online algorithms Typically when we solve problems and design algorithms we assume that we know all the data a priori. However in many practical situations.
Combinatorial Optimization Problems in Computational Biology Ion Mandoiu CSE Department.
Motion Planning in Games Mark Overmars Utrecht University.
Thursday, May 9 Heuristic Search: methods for solving difficult optimization problems Handouts: Lecture Notes See the introduction to the paper.
CPSC 404, Laks V.S. Lakshmanan1 External Sorting Chapter 13: Ramakrishnan & Gherke and Chapter 2.3: Garcia-Molina et al.
Stefan Rührup 1 HEINZ NIXDORF INSTITUTE University of Paderborn, Germany Algorithms and Complexity Competitive Time and Traffic Analysis of Position-based.
Amplification and Derandomization Without Slowdown Dana Moshkovitz MIT Joint work with Ofer Grossman (MIT)
A Optimal On-line Algorithm for k Servers on Trees Author : Marek Chrobak Lawrence L. Larmore 報告人:羅正偉.
Course14 Dynamic Vision. Biological vision can cope with changing world Moving and changing objects Change illumination Change View-point.
1 Chapter 5-1 Greedy Algorithms Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved.
Non-Preemptive Buffer Management for Latency Sensitive Packets Moran Feldman Technion Seffi Naor Technion.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
Energy minimization Another global approach to improve quality of correspondences Assumption: disparities vary (mostly) smoothly Minimize energy function:
COS 318: Operating Systems Virtual Memory Paging.
Better Algorithms for Better Computers
Static Optimality and Dynamic Search Optimality in Lists and Trees
Searching for Solutions
Feifei Li, Ching Chang, George Kollios, Azer Bestavros
CS 416 Artificial Intelligence
Time Complexity and the divide and conquer strategy
Presentation transcript:

Online Algorithms and Competitive Analysis

Paging Algorithms Data brought from slower memory into cache RAM CPU

Paging Algorithms Data brought from slow memory into small fast memory (cache) of size k Sequence of requests: equal size pages Hit: page in cache, Fault: page not in cache

Minimizing Paging Faults On a fault evict a page from cache Paging algorithm ≡ Eviction policy Goal: minimize the number of page faults

Worst case In the worst case page, the number of page faults on n requests is n. E.g. cache of size 4, request sequence p 1 p 2 p 3 p 4 p 5 p 6 p 7 p 8 p 9 p 10 p 11 p 12

Difficult sequences Cache of size 4, request sequence p 1 p 2 p 3 p 4 p 5 p 6 p 7 p 8 p 9 p 10 p 11 p 12 Sequence is difficult, for one it never repeats pages so it is impossible to have a page hit

Compare to optimal p 1 p 2 p 3 p 4 p 5 p 6 p 7 p 8 p 9 p 10 p 11 p 12 p 13 … is hard for everyone (i.e. 13 faults) p 1 p 2 p 3 p 4 p 5 p 1 p 2 p 3 p 4 p 5 p 1 p 2 p 3 p 4 … 8 faults Optimal algorithm knows the future

Offline optimum Optimal algorithm knows the future, i.e. offline OPT. Compare online paging strategy to offline paging strategy

Defined as : cost of online algorithm on I cost of offline optimum on I Competitive Ratio sup II

Paging One of the earliest problems to be studied under the online model Competitive ratio defined by Sleator and Tarjan

Competitive Ratio First appeared in the 1960’s in search context, e.g. –On the linear search problem (Beck, 1964) –More on the linear search problem (1965) –Yet more on the linear search problem (1970) –The return of the linear search problem (1972) –Son of the linear search problem (Beck & Beck 1984) –The linear search problem rides again (1986) –The revenge of the linear search problem (1992) Shmuel Gal –Search Games, Academic Press, 1980 –The Theory of Search Games and Rendezvous (with Steve Alpern), Kluwer Academic Press, 2002

Paging Algorithms Least-Recently-Used (LRU) First-In-First-Out (FIFO) Flush-When-Full (FWF) Classes of Paging algorithms Lazy Algorithms: LRU and FIFO Marking Algorithms: LRU and FWF

Paging Competitive analysis not always satisfactory, e.g. LRU “as good as” FWF Real life inputs well understood and characterized (temporal + spatial locality) Goal: derive from first principles a new measure that better reflects observations in practice

Theory 1.Commonly studied under competitive ratio framework 2.Worst case analysis 3.Marking algorithms optimal 4.In practice LRU is best 5.LFD is offline optimal 6.Competitive ratio is k 7.User is malicious adversary 8.No benefit from lookahead Systems 1.Commonly studied using fault rate measure 2.Typical case analysis 3.LRU and friends is best 4.LRU is impractical 5.Huh? 6.Competitive ratio is 2 or 3 7.User is your friend 8.Lookahead helps

Fix the Theory-Practice disconnect 1.Make both columns match How? Fix reality or Fix the model A more realistic theoretical model is likely to lead to practical insights

Previous work 1.Disconnect has been noted before. 2.Intense study of alternatives, viz. 1.Borodin and Ben David 2.Karlin et al. 3.Koutsoupias and Papadimitriou 4.Denning 5.Young 6.Albers et al. 7.Boyar et al. 8.Sleator and Tarjan + many others

Theory: competitive ratio of paging algorithms k for LRU, FIFO, and FWF Thus LRU, FIFO, and FWF equally good Lookahead does not help Practice: LRU never encounters sequences with competitive ratio bigger than 4 LRU better than FIFO and much better than FWF Lookahead helps

Previous work 1.Partial separation : Access graph model. Borodin, Raghavan, Irani, Schieber [STOC ‘91] Diffuse adversary. Koutsopias and Papadimitrou [FOCS ‘94] Diffuse adversary. Young [SODA ‘98] Accommodating ratio. Boyar, Larsen, Nielsen [WADS ‘99] Relative worst order ratio. Boyar, Favrholdt, and Larsen [SODA ‘05]

Previous work Concave Analysis. Albers, Favrholdt, Gielet [STOC ‘02] LRU ≠ certain marking algorithms Adequate Analysis. Pangiotou, Souza [STOC 06] + many others. See survey L-O, Dorrigiv [SIGACT News ’05] None provide full separation between LRU and FIFO and/or FWF

Online motion planning 1.Commonly studied under competitive ratio framework 2.Worst case analysis 3.Continuous curved motions 4.Perfect scans 5.Flawless detection 6.No error in motion 7.Architects are your enemy Robotics 1.Commonly studied using distance & scan cost 2.Typical case analysis 3.Piecewise linear 4.Scanning error 5.High detection error 6.Forward & rotational lag 7.Architects are your friend

“Architects are your friend” Most of the time, anyhow.

Alternatives Turn ratio Performance Ratio Search Ratio Home Ratio Travel Cost Average Ratio Effective Ratio Smooth Analysis Concave Analysis Bijective Analysis Others

Defined as : max p { length of search from s to p } max q { length of path from s to q } Performance Ratio general idea: focus on distant targets searches, those should be efficient allows high inefficiency for target’s near-by

Defined as : length of search from s to target p shortest off-line search from s to p Search Ratio sup pp finer, fairer measure than competitive ratio many on-line “unsearchable” scenarios suddenly practicable, e.g. trees

Example: Searching for a node at depth h in a complete binary tree with unit length edges Competitive ratio = O(2 h / h) Search ratio = O(1) Search Ratio

Defined as : length of search from s to target p shortest path from s to p Home Ratio sup pp where the position of p is known e.g. target has radioed for help, position known, shape of search area unknown

Surprisingly, in some cases is as large as competitive ratio, e.g. street polygons [L-O, Schuierer, 1996] Home Ratio

Defined as : sup { length of search from s to target p } Travel Cost pp unnormalized similar to standard algorithmic analysis

Defined as : length of search from s to target p shortest path from s to p Average Ratio avg sup  P  p Searching on the real line is 4.59 competitive on the average Doubling is 5.27 competitive

Defined as : Ψ ratio + F(cost of computing solution) where Ψ є { Competitive, Performance, Turn, Search, Home, Average, etc.} Function F reflects the difference in computational and navigational costs Sensible adjustments n, n 2, i.e. F(solt’n) = time / n 2 Effective Ratio

Robustness navigational errors detection errors (revisit area) Known probability densities of target location Time sensitive considerations Other considerations

Rescue in high seas (man overboard) High detection error Known probability density from ocean currents data Time sensitive (person must be found within 4 hours in North Atlantic) Example

Current coast guard strategy scan high probability area when done... scan again if several vessels available, rescan Search and Rescue (SAR)

Bijective Analysis Σ n = { σ 1, σ 2, …, σ 10 }: the set of all possible input sequences of length n B( σ ) A( σ ) cost

Bijective Analysis A ≤ B B ≤ A A < B B( σ ) A( σ ) cost

Bijective Analysis Competitive ratio of A: 9 Competitive ratio of B: 4 B( σ ) A( σ ) OPT ( σ )

Strict separation is complex Theorem If the performance measure does not distinguish between sequences of the same length, then no such separation exists Σ*Σ* Σ1Σ1 Σ2Σ2 Σ3Σ3 Input sequences

Proof We prove strong equivalence of all lazy marking algorithms. I.e. given two marking algorithms A 1 and A 2, there is a one-to-one correspondence b() between inputs such that the performance characteristics of A 1 (I) are identical to A 2 (b(I)).

Proof A B σ1σ1 σ3σ3 σ2σ2 σ1σ1 σ4σ4 σ1σ1 σ3σ3 σ2σ2 σ1σ1 σ4σ4 map any σ 2 in A’s sequence to σ 3 in B’s sequence σ4σ4 σ4σ4 σ3σ3 σ2σ2

Partitioning Input Space We need a natural model to partition space. How? Σ*Σ* Σ1Σ1 Σ2Σ2 Σ3Σ3 Input sequences

Not all inputs are equal Adversarial model is wrong model for paging. The user is not out to get you (contrast this with crypto case). Compilers go to great lengths to preserve locality of reference. Designers go to great lengths to create cache friendly (conscious) algorithms.

Updated model Competitive ratio Friendly models: Fault model, Torng [FOCS ’95] Concave analysis, Albers et al. [STOC ’02] ALG(I) nice(I) Cooperative

Cooperative ratio Agreement between user and algorithm about inputs which are: –likely –common –good –important

Cooperative ratio Badly written code (not cache conscious) –(Rightly) considered the programmer’s fault –Paging strategy not responsible for predicting non-standard paging behaviour Well written code (cache conscious) –Code can rely on well defined paging behaviour to produce better code (e.g. I/O model, cache oblivious model)

Friendly models Torng fault model doesn’t fully separate  Albers et al. concave analysis doesn’t either  Bijective + concave analysis separates

Concave analysis f( ): an increasing concave function Definition A request sequence is consistent with f if the number of distinct pages in any window of size n is at most f(n) Intuition Not too many consecutive newly requested pages, i.e. locality of reference Proposed by Albers et al. [AFG05], based on Denning’s working set model

Subpartitioning of Input Space Subsets compatible with f( ) Σ*Σ* Input sequences Σf3Σf3 Σf4Σf4 Σf5Σf5

Bijective analysis Theorem. LRU ≤ f,b A for all paging algorithms A Proof. Construct a continuation of b() such that b( σ ∙r)= b( σ )∙r’ and LRU( σ ∙r) ≤ A(b( σ ∙r)) Corollary. avg(LRU) ≤ avg(A)

Strict separation Theorem For any given paging algorithm A there exists f such that A > f,avg LRU i.e. LRU is unique best [SODA ’07]

Strict separation Theorem For any algorithm A there exists f such that A > f,avg LRU Proof. We want to show avg(A) > avg(LRU). I.e. Σ σ A( σ ) > Σ σ LRU( σ ) Use double counting technique: Compute the number of faults at time i across all sequences, then add for i = 1..n.

Strict separation Σ σ A( σ ) > Σ σ LRU( σ ) [sum by rows] Compute the number of faults at time i across all sequences, then add for i = 1..n. [sum by columns] This shows A(i, σ ) ≥ LRU(i, σ ). Finally we exhibit one sequence σ for which A(i, σ ) > LRU(i, σ ).

Other results Lookahead: the next L items in the list are known in advance It does not improve competitive ratio of any of the standard strategies Theorem LRU with lookahead L is strictly better than LRU with lookahead L’ for all L > L’

Applications to other problems Similar open problem for List Update: “An important open question is whether there exist alternative ways to define competitiveness such that MTF and other good online algorithms for the list update problem would be competitive“ [Martinez and Roura]. Bijective analysis separates MTF from rest

Applications to other problems Leads to better compression results for Burrows-Wheeler based compression BWT reorders text in a way that increases repetitions in text Reordering is compressed using MTF

Applications to other problems Observation: BWT permutations have high locality of reference Use list update algorithms which are designed under locality of reference assumptions, instead of adversarial worst case inputs Leads to better compression

Cooperative ratio for motion planning Robot must search efficiently scenes which are “reasonable” Can perform somewhat worse in “unreasonable” scenes Leads to adaptive-style analysis. E.g. define niceness measure of office floor plan in terms of orthogonality of scene, number of rooms/corridors, size of smallest relevant feature, etc.

Other results It leads to deterministic algorithms that outperform randomized ones in the classical model. single bad case simple cases Under competitive ratio algorithm must tend to single bad case, even if at the expense of the simple case Randomized algorithm can toss a coin and sometimes do one, sometimes do the other Bijective analysis naturally prefers the majority of good cases

Conclusions Introduced refined measurement technique for online analysis Resolved long standing open problem: LRU is unique optimum Bridged theory-practice disconnect Result applicable to –List update (MTF is unique optimum) –BWT compression –Motion planning Leads to new cooperative analysis model