Online Algorithms SS 2013

Similar documents
1 Online Problem Examples

Lecture 9 Feb. 21, 2017

15-451/651: Design & Analysis of Algorithms October 23, 2018 Lecture #16: Online Algorithms last changed: October 22, 2018

Optimal Search for Parameters in Monte Carlo Simulation for Derivative Pricing

15-451/651: Design & Analysis of Algorithms November 9 & 11, 2015 Lecture #19 & #20 last changed: November 10, 2015

Handout 4: Deterministic Systems and the Shortest Path Problem

Sublinear Time Algorithms Oct 19, Lecture 1

Lecture l(x) 1. (1) x X

Introduction to Greedy Algorithms: Huffman Codes

Essays on Some Combinatorial Optimization Problems with Interval Data

2. This algorithm does not solve the problem of finding a maximum cardinality set of non-overlapping intervals. Consider the following intervals:

Lecture 2: The Simple Story of 2-SAT

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE

Lecture Notes 1

4 Martingales in Discrete-Time

91.420/543: Artificial Intelligence UMass Lowell CS Fall 2010

SAT and DPLL. Introduction. Preliminaries. Normal forms DPLL. Complexity. Espen H. Lian. DPLL Implementation. Bibliography.

Lecture 5: Tuesday, January 27, Peterson s Algorithm satisfies the No Starvation property (Theorem 1)

Lecture 10: The knapsack problem

SAT and DPLL. Espen H. Lian. May 4, Ifi, UiO. Espen H. Lian (Ifi, UiO) SAT and DPLL May 4, / 59

Long-Term Values in MDPs, Corecursively

Outline Introduction Game Representations Reductions Solution Concepts. Game Theory. Enrico Franchi. May 19, 2010

The Value of Information in Central-Place Foraging. Research Report

The Stackelberg Minimum Spanning Tree Game

Lecture 6. 1 Polynomial-time algorithms for the global min-cut problem

Computing Unsatisfiable k-sat Instances with Few Occurrences per Variable

On the Optimality of FCFS for Networks of Multi-Server Queues

Section 5 Foundations of Shared Memory: Fault-Tolerant Simulations of read/write objects

Optimal Control of Batch Service Queues with Finite Service Capacity and General Holding Costs

Lecture 17: More on Markov Decision Processes. Reinforcement learning

Single Machine Inserted Idle Time Scheduling with Release Times and Due Dates

Non-Deterministic Search

Lecture 7: Bayesian approach to MAB - Gittins index

Repeated Games. EC202 Lectures IX & X. Francesco Nava. January London School of Economics. Nava (LSE) EC202 Lectures IX & X Jan / 16

Game Theory: Normal Form Games

Lecture 14: Basic Fixpoint Theorems (cont.)

Markov Decision Processes

Finding Equilibria in Games of No Chance

Quadrant marked mesh patterns in 123-avoiding permutations

Yao s Minimax Principle

Dynamic Programming: An overview. 1 Preliminaries: The basic principle underlying dynamic programming

Pricing theory of financial derivatives

Optimal online-list batch scheduling

Virtual Demand and Stable Mechanisms

Crash-tolerant Consensus in Directed Graph Revisited

Maximum Contiguous Subsequences

A1: American Options in the Binomial Model

Lecture 19: March 20

Best response cycles in perfect information games

CS364A: Algorithmic Game Theory Lecture #14: Robust Price-of-Anarchy Bounds in Smooth Games

SRPT is 1.86-Competitive for Completion Time Scheduling

6 -AL- ONE MACHINE SEQUENCING TO MINIMIZE MEAN FLOW TIME WITH MINIMUM NUMBER TARDY. Hamilton Emmons \,«* Technical Memorandum No. 2.

CS 188: Artificial Intelligence

On the 'Lock-In' Effects of Capital Gains Taxation

IEOR E4004: Introduction to OR: Deterministic Models

Lecture 14: Examples of Martingales and Azuma s Inequality. Concentration

So we turn now to many-to-one matching with money, which is generally seen as a model of firms hiring workers

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE

Haiyang Feng College of Management and Economics, Tianjin University, Tianjin , CHINA

Epistemic Game Theory

Economics 209A Theory and Application of Non-Cooperative Games (Fall 2013) Repeated games OR 8 and 9, and FT 5

Department of Social Systems and Management. Discussion Paper Series

THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE

Bandit Learning with switching costs

1 Overview. 2 The Gradient Descent Algorithm. AM 221: Advanced Optimization Spring 2016

COS402- Artificial Intelligence Fall Lecture 17: MDP: Value Iteration and Policy Iteration

TDT4171 Artificial Intelligence Methods

On the Optimality of a Family of Binary Trees Techical Report TR

On the Lower Arbitrage Bound of American Contingent Claims

Mixed Strategies. Samuel Alizon and Daniel Cownden February 4, 2009

Computing Unsatisfiable k-sat Instances with Few Occurrences per Variable

Structural Induction

Application of the Collateralized Debt Obligation (CDO) Approach for Managing Inventory Risk in the Classical Newsboy Problem

Competitive Market Model

An effective perfect-set theorem

MASM006 UNIVERSITY OF EXETER SCHOOL OF ENGINEERING, COMPUTER SCIENCE AND MATHEMATICS MATHEMATICAL SCIENCES FINANCIAL MATHEMATICS.

CS 343: Artificial Intelligence

Smoothed Analysis of Binary Search Trees

Lecture 2: The Neoclassical Growth Model

Single-Parameter Mechanisms

An Approximation Algorithm for Capacity Allocation over a Single Flight Leg with Fare-Locking

6.207/14.15: Networks Lecture 10: Introduction to Game Theory 2

CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 6: Prior-Free Single-Parameter Mechanism Design (Continued)

Game theory for. Leonardo Badia.

CSE 417 Algorithms. Huffman Codes: An Optimal Data Compression Method

DRAFT. 1 exercise in state (S, t), π(s, t) = 0 do not exercise in state (S, t) Review of the Risk Neutral Stock Dynamics

Unary PCF is Decidable

Mechanisms for House Allocation with Existing Tenants under Dichotomous Preferences

Topics in Contract Theory Lecture 1

SUCCESSIVE INFORMATION REVELATION IN 3-PLAYER INFINITELY REPEATED GAMES WITH INCOMPLETE INFORMATION ON ONE SIDE

Advanced Algorithmics (4AP) Heaps

The Neoclassical Growth Model

Lecture 5. 1 Online Learning. 1.1 Learning Setup (Perspective of Universe) CSCI699: Topics in Learning & Game Theory

Lecture B-1: Economic Allocation Mechanisms: An Introduction Warning: These lecture notes are preliminary and contain mistakes!

Rational Behaviour and Strategy Construction in Infinite Multiplayer Games

Algorithmic Game Theory

Comparing Partial Rankings

The Complexity of Simple and Optimal Deterministic Mechanisms for an Additive Buyer. Xi Chen, George Matikas, Dimitris Paparas, Mihalis Yannakakis

General Equilibrium under Uncertainty

Decision making in the presence of uncertainty

Transcription:

Faculty of Computer Science, Electrical Engineering and Mathematics Algorithms and Complexity research group Jun.-Prof. Dr. Alexander Skopalik Online Algorithms SS 2013 Summary of the lecture by Vanessa Petrausch (vape@mail.upb.de)

1 Introduction Definition 1.1. classical optimization problem given input instance compute solution that max-/minimizes object function, e.g. shortest path Definition 1.2. Online problem instance is not shown in advance revealed step by step decision (part of solution) have to be made each step, e.g. paging/caching Main Memory: 4GB 4K Cache: 16MB CPU Definition 1.3. Optimisation problem II I π set of instances For each σ I π there is set of solutions S σ objective functions f σ : S σ R 0 min/max OPT(a) value of optimal solution A(σ) solution computed by algorithm A w A (σ) = f σ (A(σ)) value of A s solution Online Optimization Problem Input is of the form σ = (σ 1,, σ p ), p is not fixed Online algorithm reacts on every σ i does not know σ i+1, σ i+2, does not know their number (p) These decisions form the solution A(σ) S σ Offline algorithms: know the future Definition 1.4. Competitive ratio An online algorithm A for minimization problem π has a competitive ratio r > 1 if there is some constant τ R s.t. w A (σ) r OP T (σ) + τ σ I π A is strict r-competitive w A (σ) r OP T (σ) σ I π 2

2 Paging Hard Disk Main Memory cheap slow large 2nd Level Cache CPU Cache Registers CPU expensive fast small here: only two levels 1 2 3 N 1 2 k input: σ = (σ 1, σ n ) sequence of page requests σ i N denotes the number of requested page if σ i is in the cache, no additional cost if σ i is not in the cache, cost of 1 (the algorithm has to load the page into the cache: page fault) if cache is full, the algorithm has to choose a page in the cache that has to be removed deterministic algortihms LRU (least-recently used) removes the page requested least recently LFU (last-frequently used) removes the page that was requested least of them FIFO (first-in-first-out) removes the oldest page in cache LIFO (last-in-first-out) removes newest page in cache FWF (flush-when-full) completely empties the cache when the cache is full and there is a page fault LFD (longest-forwarded-distance) remove the page that will be requested the latest Marking algorithm Decompose input σ = (σ 1 σ n ) into phases as follows Phase 1: maximal prefix with k different pages Phase i 2: maximal sequence following phase i-1 with at most k different pages Example: k = 3: σ = 1, 2, 4, 2, 1, 3, 5, 2, 3, 5, 1, 2, 3, 4 }{{}}{{}}{{} P hase1 P hase2 P hase3 A marking algorithm is an algorithm that never removes a marked page from the cache. At the beginning of a phase no page is marked. A page that is accessed during a phase becomes marked. Theorem 2.1. LRU is a marking algorithm 3

Proof. Assume LRU is not a marking algorithm. There is an input sequence σ on which LRU removes a marked page x in phase i. Let σ t be the corresponding event since x is marked, it was used in phase i before, let σ t in phase i. with t < t the first access of page x of all pages requested after σ t, x is the most least recently used since x is removed at time σ t there must be k different pages different from x accessed between σ t and σ t together with the requests of x this would be k + 1 different pages requested in one phase. (contradiction definition phase) Theorem 2.2. Every marking algorithm is strict k-competitive (at most k time worse than optimal offline algorithm) Proof. Let σ be an arbitrary input instance and l is the number of phases of this input instance. w.l.o.g (without loss of generality) l 2 1. Cost of marking algorithm is at most l k l phases, each phase at most k different request every page is marked at the first request and never removed. At most one page fault per page. 2. Cost of an optimal offline algorithm is at least k + l 2 k page faults in the first phase one page fault in each of the following phases, except the last one (l 2 phases). Define subsequence i as follows: starts with the second request of phase i + 1 ends with first request of phase i + 2 Example: phase σ = 1,2,4,2,1,3,5,2,3,5,1,2,3,4 k=3 subsequence Beginning of phase i + 1, there is some request x Beginning of subsequence i, x and k + 1 pages different from x in the cache in subsequence i there are k different (different from x) requests at least one page fault OPT(σ) k + l 2 w A (σ) l k (k + l 2) k k OP T Corollary 2.1. LRU is k-competitive 4

Theorem 2.3. LFU & LIFO are not competitive Proof. of Theorem Given any τ, r construct sequence σ s.t. (such that) w LF U (σ) > r OP T (σ) + τ Consider for any constant l 2 : σ( 1 l }{{} l,,l optimal solution, only k + 1 page faults LFU/LIFO:, 2 l,, (k 1) l, (k, k + 1) l 1 ) until first request of k + 1 : k page faults and {1 k} in cache Both remove k (last-in/least frequently) following request of k : Both remove page k + 1 this repeats at least 2 (l 1) page faults Choice of l : 2(l 1) > r (k + 1) + τ = r OP T (σ) + τ Lemma 2.1. Let A be an optimal offline algorithm different from LFD and σ an arbitrary input sequence where LFD and A behave differently. Let σ t be the first request where they differ. Then there is an algorithm B that behaves like A on σ 1, σ t 1 at σ t it removes the page from the cache that will be requested the latest incurs no higher cost than A Proof. We construct algorithm B as follows: on σ 1, σ t 1 behaves like A at σ t B removes the LFD-page (Idea: from now on, A and B have at least one page different in the cache) Let b be the LFD-page and a be the page that A chooses. Cache content of A after σ t : X {B}; of B is X {a} with X = k 1 Denote content of A (or B) cache before σ s with A s (or B s, respectively) Divide σ t+1, σ t+2, into two phases Phase 1 includes all s t + 1 with B s = (A s \ {b}) {u s } Phase 2 includes all s t + 1 with B s = A s Construct algorithm B such that there is an event t and all events between σ t+1 σ t in phase 1 and all events between σ t +1, σ t +2 are in phase 2. are Phase 1 Phase 2 B s = A s \{b}ᴜ{u s } σ 1 σ t σ t B s = A s Phase 1: At request σ s algorithm B works as follows (reminder: B s = (A s \ {b}) {u s }) 1. request σ s A S B s : no page faults 2. request σ s / A S B s : A and B cause page faults (a) A replaces b: B replaces u s A s+1 = B s+1 (in phase 2) 5

(b) A replaces v b : B replaces v B s+1 = A s+1 \ {b} {u s } (still in phase 1) 3. request u s : Only A causes page fault (a) A replaces b A s+1 = B s+1 (phase 2) (b) A replaces v b B s+1 = A s+1 \ {b} {v} (phase 1) 4. request of b : Only B causes page faults and B removes page u s from cache. Then A s+1 = B s+1 (phase 2) Phase 2: B behaves like A and never leave leaves phase 2. Observe that 1) - 4) ensure that we only reach configurations in phase 1 and 2. It remains to show that B causes not more page faults than A: Obvious in case 1, 2 and 3 case 4: can only happen once b was the latest requested page at time t there must have been a request of page a until first request of a : u s = a first request of a : case 3 also one page fault of A Theorem 2.4. LFD (longest-forwarded-distance) is an optimal offline algorithm for paging Proof. Let A OP T be an optimal offline algorithm different from LFD. We modify A OP T without increasing its cost, s.t. the resulting algorithm is LFD. Repeatedly apply Lemma 1.1.: For any sequence σ, let A 0 = A OP T 1. Let σ t be the first request where A 0 and LFD differ. 2. Apply Lemma 1.1. and let A 1 be algorithm B from Lemma 1.1. 3. repeat step 1 and 2 to obtain algorithm A i until A i behaves like LFD ( same costs of A and LFD) Theorem 2.5. There is no deterministic r-competitive online algorithm for paging with r < k. Proof. Let A be an arbitrary deterministic online algorithm for paging. We show that for any τ R and every r < k there exists a sequence σ with w A (σ) > r OP T (σ) + τ We construct sequence σ with k + l different page request k + 1 different pages σ 1, σ k : k different pages, i.e. 1, 2,, k σ k+1, σ k+l : request the page that is not in the cache of A A causes k + l page faults. Show that LFD will have first k and then k + l k 6

7