Lecture 23: Competitive ratio: rent or buy problems

Similar documents
14.1 Rent-or-buy problem

9th Max-Planck Advanced Course on the Foundations of Computer Science (ADFOCS) Primal-Dual Algorithms for Online Optimization: Lecture 1

An Introduction to Competitive Analysis for Online Optimization. Maurice Queyranne University of British Columbia, and IMA Visitor (Fall 2002)

The Relative Worst Order Ratio for On-Line Algorithms

Dynamic TCP Acknowledgement: Penalizing Long Delays

Topic: Greedy Approximations: Set Cover and Min Makespan Date: 1/30/06

Lecture 8. Confidence intervals and the central limit theorem

8.1 Min Degree Spanning Tree

REPEATED TRIALS. The probability of winning those k chosen times and losing the other times is then p k q n k.

Victor Shoup Avi Rubin. Abstract

MATH 289 PROBLEM SET 4: NUMBER THEORY

Optimal Online-list Batch Scheduling

Betting rules and information theory

Lecture 5 - CPA security, Pseudorandom functions

1 Completeness of a Set of Eigenfunctions. Lecturer: Naoki Saito Scribe: Alexander Sheynis/Allen Xue. May 3, The Neumann Boundary Condition

HOMEWORK 5 SOLUTIONS. n!f n (1) lim. ln x n! + xn x. 1 = G n 1 (x). (2) k + 1 n. (n 1)!

Section 1.3 P 1 = 1 2. = P n = 1 P 3 = Continuing in this fashion, it should seem reasonable that, for any n = 1, 2, 3,..., =

Load Balancing and Switch Scheduling

6.207/14.15: Networks Lecture 15: Repeated Games and Cooperation

Online Adwords Allocation

1. Prove that the empty set is a subset of every set.

E3: PROBABILITY AND STATISTICS lecture notes

Mathematical finance and linear programming (optimization)

6.041/6.431 Spring 2008 Quiz 2 Wednesday, April 16, 7:30-9:30 PM. SOLUTIONS

Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80)

Universal Portfolios With and Without Transaction Costs

Lecture Note 1 Set and Probability Theory. MIT Spring 2006 Herman Bennett

The sample space for a pair of die rolls is the set. The sample space for a random number between 0 and 1 is the interval [0, 1].

ISyE 2030 Test 2 Solutions

Sample Induction Proofs

Minimax Strategies. Minimax Strategies. Zero Sum Games. Why Zero Sum Games? An Example. An Example

Section 6.1 Joint Distribution Functions

Basics of information theory and information complexity

ONLINE DEGREE-BOUNDED STEINER NETWORK DESIGN. Sina Dehghani Saeed Seddighin Ali Shafahi Fall 2015

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

Data Structures Fibonacci Heaps, Amortized Analysis

Online Appendix to Stochastic Imitative Game Dynamics with Committed Agents

MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.436J/15.085J Fall 2008 Lecture 5 9/17/2008 RANDOM VARIABLES

Offline sorting buffers on Line

K-Cover of Binary sequence

Tiers, Preference Similarity, and the Limits on Stable Partners

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

4 The M/M/1 queue. 4.1 Time-dependent behaviour

4. Continuous Random Variables, the Pareto and Normal Distributions

FEGYVERNEKI SÁNDOR, PROBABILITY THEORY AND MATHEmATICAL

What is a cost? What is an expense?

arxiv: v1 [math.pr] 5 Dec 2011

The Mean Value Theorem

Lecture 5: Put - Call Parity

Duality in Linear Programming

WRITING PROOFS. Christopher Heil Georgia Institute of Technology

Find-The-Number. 1 Find-The-Number With Comps

Chapter Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 10

Row Echelon Form and Reduced Row Echelon Form

5. Continuous Random Variables

Lecture 1: Course overview, circuits, and formulas

Notes on Continuous Random Variables

1 Calculus of Several Variables

Christmas Gift Exchange Games

Adaptive Online Gradient Descent

ECON 459 Game Theory. Lecture Notes Auctions. Luca Anderlini Spring 2015

Overview of Monte Carlo Simulation, Probability Review and Introduction to Matlab

Algorithms for VWAP and Limit Order Trading

A Few Basics of Probability

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Using Generalized Forecasts for Online Currency Conversion

1 Message Authentication

Real Roots of Univariate Polynomials with Real Coefficients

The Binomial Distribution

ST 371 (IV): Discrete Random Variables

Math 461 Fall 2006 Test 2 Solutions

GRAPH THEORY LECTURE 4: TREES

. (3.3) n Note that supremum (3.2) must occur at one of the observed values x i or to the left of x i.

17 Greatest Common Factors and Least Common Multiples

Chapter 1 Computer System Overview

The Ergodic Theorem and randomness

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

Randomized algorithms

Math 319 Problem Set #3 Solution 21 February 2002

26 Integers: Multiplication, Division, and Order

2.1 Complexity Classes

Online and Offline Selling in Limit Order Markets

Universal hashing. In other words, the probability of a collision for two different keys x and y given a hash function randomly chosen from H is 1/m.

On Best response Bidding in GSP Auc5ons. By M. Cary et al., HBS working paper , CS 700 Commentary by Thomas Léauté and Luděk Cigler

Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max. structure of a schedule Q...

4.6 Linear Programming duality

CHAPTER 6: Continuous Uniform Distribution: 6.1. Definition: The density function of the continuous random variable X on the interval [A, B] is.

On the Unique Games Conjecture

The Fundamental Theorem of Arithmetic

Integer Programming Formulation

1. The Fly In The Ointment

L4: Bayesian Decision Theory

1 Portfolio Selection

Chapter 4 - Lecture 1 Probability Density Functions and Cumul. Distribution Functions

An Approximation Algorithm for the Unconstrained Traveling Tournament Problem

Practical Guide to the Simplex Method of Linear Programming

Dynamic Programming Problem Set Partial Solution CMPSC 465

WORKED EXAMPLES 1 TOTAL PROBABILITY AND BAYES THEOREM

Full and Complete Binary Trees

Transcription:

COMPSCI 53: Design and Analysis of Algorithms November 19, 213 Lecture 23: Competitive ratio: rent or buy problems Lecturer: Debmalya Panigrahi Scribe: Hangjie Ji 1 Overview In this lecture, we focus on a ind of problem where the optimization needs to be performed without the input in advance. This ind of algorithm is called online algorithm. To evaluate the performance of the algorithm, we introduce the concept of competitive ratio. Then we illustrate the concepts through the sirental problem and the online paging/caching problem. Finally we discuss the randomized online algorithm for the randomized si-rental problem. 2 Online Algorithms An online algorithm is one that processes its input which arrives in phases, without having the entire input information available from the beginning. On the contrary, an offline algorithm refers to the algorithm that has access to the entire input from the start and outputs its decision in this setting. Because of the lac of the whole input, the decision that an online algorithm maes may turn out not to be optimal later. Thus the quality evaluation of online algorithms has focused on comparing the performance of an online algorithm and its corresponding offline algorithm for the same problem instance, which is exactly the idea of competitive analysis. Following this idea, we define the competitive ratio of the online algorithm as follows: Definition 1. Competitive ratio = max over input sequences of online ALGO cost cost of offline OPT } 2.1 Si-rental problem In this subsection, we analyze the online algorithm for the si-rental problem, which is also called the rent-or-buy problem. Suppose we need sis to go siing in the winter. Everyday we have two options: either renting the sis for cost $1 per day, or paying $ B to buy the sis and use it for the rest of the season. However, we do not now for how long the season will last, thus we cannot mae our decision by comparing the total cost of the two options at the beginning of the season. Let x be the length of the season. Suppose we buy sis on the (+1)-th day, then B + if x online ALGO cost = x if x < and as the offline optimal algorithm nows the length of the season in advance, we have B if x B offline OPT = x if x < B. #-1

We want to minimize the competitive ratio ρ which is defined by Competitive ratio ρ = max over input sequences If we let = B, i.e. we buy sis on the (B+1)-th day, then If x B, then ρ = x x = 1; If x > B, then ρ = B+B B = 2. of online ALGO cost cost of offline OPT }. We will show that ρ = 2 is the best competitive ratio we can get by the following online lower bounds argument. Let us consider a game between an adversary (ADV) and the algorithm (ALGO), in which ADV wants the lower bound of the competitive ratio to be as large as possible while ALGO wants the lower bound to be as small as possible. In each round of the game, ADV gives an input to the problem and ALGO provides its optimal solution based on the available input information at this stage. The game continues until ADV decides to stop the game, which means the season ends in the si-rental problem. Since ADV is in favor of the larger competitive ratio, once ALGO decides to buy the sis, ADV s strategy should be ending the season at once; otherwise, the competitive ratio will become smaller, since the cost of ALGO eeps fixed and the cost of offline OPT increases after ALGO buys the sis. Therefore if we continue the game for rounds, i.e. ALGO buys the sis at the + 1-th day and ADV stops at once, then we have the competitive ratio L being L = +B Then the lower bound of the competitive ratio would be and the minimum is attained when = B. 2.2 Online paging/caching problem if B +B B if > B. lower bound L = min L = 2, Next we turn to the online paging problem, which is also called caching problem. To access data from some page of the main memory, we need to bring the page into a smaller section of fast memory called cache. When the requested page is already in the cache, then it can be served directly. Otherwise, we have a cache miss, which means we need to go in the main memory to bring the requested page and this will slow down the speed of fetching data. Assume that the cache has slots (capacity) and that the main memory has a capacity of N pages. Requests (a sequence of pages) are served from the cache and many result in cache misses. The objective of a online paging/caching algorithm is to evict pages from the cache in a good way that minimizes the number of cache misses. This algorithm is an online algorithm because generally we do not now what the requests will be from the beginning. First we introduce the concepts of Least Recently Used (LRU) and Round. Definition 2. Least Recently Used : LRU removes the page which was used farthest in the past. That is to say, the page that has been in the cache for the longest time without being used will be evicted by LRU rule. #-2

Definition 3. Round(): the maximal sequence of requests that as for exactly pages. Remar 1. Note that in this sequence, each page can be ased for more than once. Example 1. Let = 3. Suppose the request sequence is [1,2,1,3,3,2,1,4]. Then the round is [1,2,1,3,3,2,1]. In this example, value of ALGO + 1 and offline OPT 1, thus giving us Theorem 1. LRU has a competitive ratio of. value of ALGO offline OPT + 1. Proof. In general, we can divide a request sequence into M rounds. According to the LRU rule, at most cache misses can happen in each round, as once a specific page is used in a round, it will not be evicted out of cache until the end of this round. Therefore value of ALGO M. Since the cache has only slots, the offline optimal algorithm must have at least one cache miss after serving distinctive pages without cache misses. Therefore the optimal algorithm leads to at least one cache miss in each round and offline OPT M. Hence the competitive ratio ρ. Next we show that LRU has ρ by proving the Theorem 2 via example construction. This finishes our proof. Theorem 2. Paging has a lower bound of. Proof. We construct an example for this lower bound. Let the main memory has a capacity of n = + 1 pages, where the cache has slots. Consider an adversary (ADV) vs. algorithm (ALGO) game similar to the game for the si-rental problem. ADV wants to get a greater lower bound of the competitive ratio while ALGO wants a smaller lower bound. Clearly the best strategy of ADV is to request the page that is not in algorithm cache. Then the number of cache misses in ALGO equals the number of requests, which is greater than + 1, while the offline optimal algorithm is to evict the page that is farthest into the future and the value of OPT is 1. This example gives the lower bound of for the paging problem. 3 Randomized Online Algorithms Now we consider an extension for the online algorithms. The idea of randomized online algorithms is that we toss a coin in the algorithm to mae decisions. In this case, in the Adversary vs. Algorithm analysis, instead of nowing the output of ALGO, ADV nows only the strategy of ALGO but not its output. 3.1 Randomized si-rental problem Under the same settings of the above si-rental problem, we change our strategy to be buying sis on the (x+1)-th day with probability P x, where P x = 1 and the events of buying sis on specific dates are x= mutually independent. Let be the length of the winter season, then apparently the optimal offline solution #-3

OPT () = min(b,), i.e. buying the sis on the first day if B and renting for the whole season otherwise. In the online algorithm, suppose we plan to buy the sis on the (x+1)-th day, then we need to pay $ (x + B) if x < and $ if x. Hence we have ALGO(x,P x ) = P x + (x + B)P x x x< The goal of this problem is to minimize max ALGO(,Px) OPT () P x dx + (x + B)P x dx. (1) over all Px distributions s.t. P xdx = 1. Remar 2. Note that the online algorithm has control over P x but has no control over. Fact 3. The minimax problem can be solved when ALGO(,Px) OPT () is independent of. Using variational analysis, it can be shown that the minimax goal can be attained when the functional ALGO(,Px) OPT () is uniform with respect to. Then we solve for the optimal distribution P x. Let α = ALGO(,Px) OPT (), where α is independent of. So with eqn (1) and OPT () = min(b,), we have P x dx + (x + B)P x dx = α min(b,). (2) Case B : Taing derivatives with respect to of both sides of eqn (2) yields P + Since B > and P x, we have P =. P x dx + ( + B)P =, (3) BP + P x dx =. (4) Case < B : Taing derivatives with respect to of both sides of eqn (2) yields P + P x dx + ( + B)P = α, (5) BP + Differentiating both sides with respect to again gives us Hence B dp d P =, Combining the both cases and using P xdx = 1, we have thus and the competitive ratio P x dx = α. (6) P = Ae /B,where A is a constant to be determined. (7) P x dx = A = α = B Ae /B d = 1, 1 B(e 1) e e 1. #-4

4 Summary This lecture introduces the concepts of (randomized) online algorithms via examples of (randomized) sirental problems and caching/paging problems with an emphasis on their competitive analysis. References [1] Online algorithm. Wiipedia contributors. Wiipedia, The Free Encyclopedia.. http://en. wiipedia.org/wii/online_algorithm. Accessed November 2, 213. [2] Shuchi Chawla, Lecture notes for an Advanced Algorithms course at WISC available at http://pages.cs.wisc.edu/~shuchi/courses/787-f9/scribe-notes/lec14.pdf. Accessed November 2, 213. #-5