Rent, Lease or Buy: Randomized Algorithms for Multislope Ski Rental

In the Multislope Ski Rental problem, the user needs a certain resource for some unknown period of time. To use the resource, the user must subscribe to one of several options, each of which consists of a one-time setup cost (``buying price''), and c…

Authors: Zvi Lotker, Boaz Patt-Shamir, Dror Rawitz

Symposium on Theoretical Aspects of Computer Science 2008 (Bordeaux), pp. 503-514 www .stacs-conf .org RENT, LEASE OR BUY: RANDOMIZED ALGORITHMS F OR MUL TISLOPE SKI RENT AL ZVI LOTKER 1 , BO A Z P A TT-SH AMIR 2 , AND DROR RA WITZ 3 1 Dept. of Communication Systems En gineering, Ben Gurion Universit y , Beer S hev a 84105 , Israel. 2 School of Electrical Engineering, T el Aviv Universit y , T el Aviv 6997 8, Israel. 3 F aculty of Science and Science Education & C.R.I., Un iversit y of Haifa, Haifa 31905, Israel. E-mail addr ess : zvilo@cse. bgu.ac.il, boaz@eng.tau.ac.il, rawitz@cri.haifa.ac.il Abstra ct. In the Multislop e S ki Rental problem, the user needs a certain resource for some un k now n p erio d of time. T o u se the resource, the u ser must subscribe to one of sever al options, eac h of which consists of a one-time setup cost (“buying price”), and cost prop ortional to the duration of the usage (“ren tal rate”). The large r the price, the smaller the ren t. The actual usage time is determined b y an adversary , and the goal of an algo- rithm is to minimize the cost by choosing the b est opt ion at any p oint in time. Multislope Ski Rental is a natural generalizati on of the classical Ski Rental problem (where th e only options are pure rent and pure buy), whic h is one of the fundamen tal problems of online computation. The Multislope Sk i Rental problem is an abstraction of many problems where online decisions cannot b e mo deled b y just tw o options, e.g., pow er management in systems which can b e shut down in parts. In this pap er we stu dy randomized algo- rithms for Multislope Sk i Rental. Our results include the b est p ossible online randomized strategy for an y additive instance, where the cost of switc hing from one op t ion to another is th e difference in their buying prices; and an algorithm that p rodu ces an e -comp etitive randomized strategy for any (non- ad d itive) instance. 1. I n tro duction Arguably , the “ren t or buy” dilemma is the fun damen tal problem in online algorithms: in tuitive ly , there is an ongoing game w hic h ma y end at an y m oment, and the question is to commit or not to commit. Cho osing to commit (the ‘buy’ option) imp lies pa ying large cost immediately , but lo w o veral l cost if the game lasts for a long time. Cho osing not to commit (the ‘ren t’ option) means high sp ending rate, but lo wer o v erall cost if the game ends quic kly . This p roblem w as fir st abstr acted in the “Ski Ren tal” formula tion [10] as follo ws. In the buy option, a one-time cost is incur red, and thereafter usage is free of charge. In the r en t option, the cost is pr op ortional to usage time, and there is no one-time cost. The deterministic solution is straigh tforwa rd (with comp etitiv e factor 2). In the rand omized Key wor ds and phr ases: competitive analysis; ski ren tal; randomized algorithms. The second author wa s supp orted in part b y the Israel Science F oun dation (grant 664/05) and by Israel Ministry of Science and T echnolo gy F oundation. c  Z. Lotker, B. P att-Shamir, and D . Rawitz CC  Cre ative Commons Attribution-NoDer ivs License 504 Z. LOTKER, B. P A TT-SHAMIR, AND D. RA WITZ mo del, the algorithm c h o oses a random time to switc h fr om t he rent to the buy option (the adv ersary is assumed to know the algorithm but not the actual outcomes of random exp eriments) . As is well kno wn , th e b est p ossible online strategy for classical ski ren tal has comp etitiv e ratio of e e − 1 ≈ 1 . 582 . In many realistic cases, there ma y b e s ome in termediate options b et ween the extreme alternativ es of pu re b uy and pure rent : in general, it ma y b e p ossible to pa y only a part of the bu ying cost and then pay only partia l ren t. The general problem, called here the Multislop e Ski R ental problem, can b e d escrib ed as fol lows. There are several states (or slop es ), where eac h state i is c haracterized b y t w o num b ers: a bu ying c ost b i and a r ental r ate r i (see Fig. 1). Without lo ss of g eneralit y , we may assume t h at for all i , b i < b i +1 and r i > r i +1 , n amely that after ord ering the states in increasing b u ying costs, the rental rates are decreasing. The basic semant ics of the m ultislop e pr ob lem is n atural: to h old the resource under state i for t time units, the user is c harged b i + r i t cost units. An adv ersary gets to c ho ose ho w long the game will last, and the task is to minimize tota l cost un til the game is o v er. The Multislop e Ski Rent al p roblem in tro duces entirely new difficulties when compared to the classical S ki Rent al pr oblem. I n tuitive ly , whereas the only question in th e classical v ersion is when to b u y , in the multislop e v ersion w e need also to ans w er the qu estion of what to bu y . Another w a y to see the diffi cu lt y is that the num b er of p ote ntial transitions from one slop e to another in a strategy is one less than the n umb er of slop es, and fi nding a single p oint of transition is qualitativ ely easier than fin ding more than one such p oint . In addition, the p ossibilit y of m ultiple transitions forces u s to d efine the relation b et ween m ultiple “buy s .” F ollo wing [2], we distin gu ish b et ween tw o natural cases. In the additive case, buyin g costs are cum u lative , n amely to mov e from state i to state j we only need to pa y the d ifference in buyin g prices b j − b i . In the non-additive case , there is an arbitrarily defined transition cost b ij for eac h pair of states i and j . Our results. In this pap er w e analyze randomized strategies for Multislop e S ki Rental . (W e u se the term str ate gy to r efer to th e pro cedu re th at makes online decisions, and the term algorithm to refer to the pro ce d ure that computes strategies.) Our m ain fo cus is the additiv e case, and ou r main result is an efficien t algorithm that compu tes the b est p ossible randomized online s trategy for any giv en in stance of additiv e Multislop e Ski Renta l problem. W e first giv e a simpler algo rith m whic h decomp oses a ( k + 1 )-slop e instance in to k t wo- slop e instances, w hose comp etitiv e factor is e e − 1 . F or the n on-additiv e m o del, w e give a simple e -comp etitiv e randomized str ategy . Related W ork. V arian ts of ski ren tal are implicit in many online problems. The classical (t w o-slop e) s k i renta l problem, wh ere the buying cost of the fir s t slop e and the rental rate of the s econd slop e are 0, was int r o duced in [10], with optimal strategies ac hieving comp etitiv e factors of 2 (deterministic) and e e − 1 (randomized). Karlin et al. [9] app ly th e rand omized strategy to TCP ac kno wledgment mec hanism and other problems. Th e classical ski rental is sometimes called the le asing problem [5]. Azar et al. [3] consider a p roblem that can be view ed as n on-additiv e m ultislop e ski ren tal where slop es b ecome a v ailable o v er time, and obtain an online strategy wh ose comp et- itiv e r atio is 4 + 2 √ 2 ≈ 6 . 83 . Bejerano et al. [4], motiv ated by rerouting in A TM netw orks , study th e non-additiv e m u ltislop e problem. They giv e a d eterministic 4-co mp etitiv e strat- egy , and s h o w t h at the factor of 4 holds assu ming only that the slop es are conca ve, i.e., when th e rent in a slop e m a y decrease with time. Damasc hk e [6] considers a static v ersion RENT, LEASE OR B U Y 505 t cost s 1 b 1 s 2 b 2 s 3 b 3 s 4 b 4 Figure 1: A multislop e ski r ental instanc e with 5 slop es: The thick line indic ates the optima l c ost as a function of the game dur ation time. of the p roblem fr om [3 ], namely non-additive multislop e ski r en tal problem where eac h slop e is b ought “from s cratc h.” 1 F or deterministic strategie s, [6] giv es an upp er b ound of 4 and a lo wer b ound of 5+ √ 5 2 ≈ 3 . 618 ; [6] also presents a randomized strategy whose comp eti tive factor is 2 / ln 2 = 2 . 88. As far as we know, Damasc hk e’s strategy is th e only r andomized strategy f or m ultislop e ski rental to app ear in the literature. Irani et al. [8] p resen t a d eterministic 2-comp etitiv e strategy for the additiv e m o del that generalizes the strategy for th e t w o slop es case. They motiv ate their w ork by energy savi n g: eac h slo p e corresp onds to s ome partial “sleep” mo d e of the system. Au gustine et al. [2] present a dynamic program that compu tes the b est deterministic strategy for non-additive m ultislop e instances. The case wh ere the length of th e game is a sto chastic v ariable w ith kno wn distribution is also considered in b oth [8, 2]. Mey erson [12] defi nes the seemingly related “parking p ermit” p roblem, wh ere there are k types of p ermits of different costs, s u c h that eac h p ermit allo ws usage for some duration of time. Mey erson’s results indicate that the problems are n ot ve r y closely related, at least from the comp etitiv e analysis p oint of view: It is sho wn in [12] that th e comp etitiv e ratio of th e parking p ermit p r oblem is Θ( k ) and Θ(log k ) for deterministic and r andomized strategies, resp ectiv ely . Organization. The remainder of this pap er is organized as follo ws. In Sectio n 2 we defin e the basic additiv e model and mak e a few preliminary observ ations. In Section 3 we giv e a simple algorithm to solv e the multislope problem, and in Section 4 we p resen t our main result: an optimal online algorithm. An e -comp etitiv e algorithm for the non-add itive case is presented in Section 5. 2. P roblem Statemen t and Preliminary Observ ations In this section we formalize the additive version of the multislo p e s k i ren tal pr oblem. A k -ski ren tal instance is defined by a set of k + 1 states , and for eac h state i there is a bu yi ng c ost b i and a r enting c ost r i . A state can b e represented b y a line: t h e i th state corresp onds to the line y = b i + r i x . Fig. 1 giv es a geometrical interpretatio n of a multislo p e ski renta l instance with fiv e states. W e u se the terms “state” and “slop e” in terc hangeably . The requ iremen t of th e pr oblem is to sp ecify , for all times t , wh ic h s lop e is c hosen at time t . W e assume that state tr ansitions can b e only forward, and that s tates cannot b e 1 It can b e sho wn that strategies that work for t his case also work for t he general non- additive case (see Section 5). 506 Z. LOTKER, B. P A TT-SHAMIR, AND D. RA WITZ skipp ed, i.e., the o n ly t r an s itions allo w ed are of the t yp e i → i + 1. W e stress that t h is assumption h olds without loss of generalit y in the additiv e mo d el, where a transition from state i → j for j > i + 1 is equiv alen t to a sequence of transitions i → i + 1 → . . . → j (cf. S ection 5). It follo ws that a deterministic str ate gy for the additive multislo p e ski ren tal problem is a monotone non-decreasing sequence ( t 1 , . . . , t k ) where t i ∈ [0 , ∞ ) corresp onds to the transition i − 1 → i . A r andomize d str ate gy can b e describ ed using a pr ob ab ility distribution o ver the family of deterministic strateg ies. Ho w eve r , in this pap er w e use a n other w a y to describ e ran- domized strategies. W e sp ecify , for all times t , a probabilit y distrib ution ov er the set of k + 1 slop es. The in tuition is that this distribution d etermines the actual cost p aid by an y online strategy . F orm ally , a r andomize d pr ofile (or simply a pr ofile ) is s p ecified b y a v ector p ( t ) = ( p 0 ( t ) , . . . , p k ( t )) of k + 1 functions, where p i ( t ) is the pr obabilit y to b e in state i at time t . The correctness r equiremen t of a profile is P k i =0 p i ( t ) = 1 f or all t ≥ 0. Clea r ly , an y strategy is related to some profile. In the sequel we consider a sp ecific type of p rofiles for whic h a rand omized strategy can b e easily obtained. The p erformance of a pr ofile is defined by its total accrued cost, whic h consists of t w o parts as follo ws. Give n a randomized pr ofi le p , the exp ected r ental c ost of p at time t is R p ( t ) def = P i p i ( t ) · r i , and the exp ected total ren tal cost up to time t is Z t z =0 R p ( z ) dz . The second part of the cost is the buyin g cost. In this case it is easier to defin e the cum ulativ e bu ying cost. Sp ecifically , the exp ect ed total buying c ost up to time t is B p ( t ) def = P i p i ( t ) · b i . The exp ect ed total c ost for p up to time t is X p ( t ) def = B p ( t ) + Z t z =0 R p ( z ) dz . The goal of the algorithm is to minimize total cost up to time t for any giv en t ≥ 0, with resp ect to the b est p ossible. In tuitiv ely , we think of a game that ma y end at an y time. F or an y p ossible en d ing time, w e compare th e total cost of the algorithm with the b est p ossible (offline) cost. T o this end, consider the optimal solution of a giv en instance. If the games ends at time t , the optimal solution is to select the slop e with the least cost at time t (the thic k line in Fig. 1 denotes the optimal cost for an y given t ). More formally , the optimal offline cost at time t is opt ( t ) = min i ( b i + r i · t ) . F or i > 0, d enote by s i the time t instance where b i − 1 + r i − 1 · t = b i + r i · t , and d efine s 0 = 0. It f ollo ws that the optimal slop e for a game ending at time t is the slop e i for whic h t ∈ [ s i , s i +1 ] (if t = s i for some i then b oth slop es i − 1 and i are optimal). Finally , let us rule out a few trivial cases. First, note that if there are t w o slop es such that b i ≤ b j and r i ≤ r j then the cost incurr ed by slop e j is nev er less than the cost incurred slop e i , and w e ma y therefore just ignore slop e j from the instance. C onsequen tly , w e will assume hen ceforth, withou t loss of generalit y , that the states are order ed suc h that r i − 1 > r i and b i − 1 < b i for 1 ≤ i ≤ k . RENT, LEASE OR B U Y 507 Second, using similar reasoning, note that w e ma y consider only strategies that are monotone o v er time with resp ect to ma jorizati on [11], i.e., strategies suc h that for any t w o times t ≤ t ′ w e ha v e j X i =0 p i ( t ) ≥ j X i =0 p i ( t ′ ) . (2.1) In tuitivel y , Eq. (2.1) means that there is no p oi nt is “rolling bac k” purchases: if at a giv en time w e ha ve a certain comp osition of the slop es, then at any later time the comp ositi on of slop es ma y only i mp ro ve . Note that Eq. (2.1) imp lies that B p is monotone in creasing and R p is monotone decreasing, i.e., o v er time, the strategy inv ests non -n egativ e amounts in bu ying, resulting in decreased ren tal rates. 3. A n e e − 1 -Comp etitiv e Algorithm In this section w e describ e ho w to solv e the m u ltislop e problem by redu cing it to the classical t w o-slop e version, resulting in a randomized str ategy wh ose comp etitiv e factor is e e − 1 . This resu lt s er ves as a warm-up and it also giv es us a concrete up p er b ound on the comp etitiv eness of the algorithm presen ted in Section 4 . The case of r k = 0 . Sup p ose we are giv en an instance ( b, r ) with k + 1 slopes, where r k = 0. W e define the follo wing k instances of th e classical t w o-slop es sk i rental problem: in instance i for i ∈ { 1 , . . . , k } , w e s et instance i : b i 0 = 0 and r i 0 = r i − 1 − r i ; b i 1 = b i − b i − 1 and r i 1 = 0 . (3.1) Observe that b i 1 = r i 0 · s i , i.e., the t wo slop es of t h e i th instance i ntersect exactly at s i , their in tersection p oint at the original multislope instance. No w, let op t ( t ) denote the optimal offline solution to the original m u ltislop e instance, and let opt i ( t ) denote the optimal solution of the i th in stance at time t , i.e., opt i ( t ) = min { b i 1 , r i 0 · t } . W e hav e th e follo wing. Lemma 3.1. opt ( t ) = P k i =1 opt i ( t ) . Pr o of. C onsider a time t and let i ( t ) b e the optimal multislope state at time t . Then, k X i =1 opt i ( t ) = X i : s i ≤ t b i 1 + X i : s i >t r i 0 · t = X i : s i ≤ t ( b i − b i − 1 ) + X i : s i >t ( r i − 1 − r i ) · t = b i ( t ) + r i ( t ) · t = opt ( t ) . Giv en th e d ecomp osition (3.1), it is easy to obtain a strategy for any m u ltislop e in s tance b y combining strategies for k classical instances. Sp ecifically , what we do is as follo ws. Let p i b e the e e − 1 -comp etitiv e profile for the i th (tw o slop e) instance (see [10]). W e defi n e a profile ˆ p for the m u ltislop e instance as follo w s: ˆ p i ( t ) = p i 1 ( t ) − p i +1 1 ( t ) for i ∈ { 1 , . . . , k − 1 } , ˆ p 0 ( t ) = p 1 0 ( t ), and ˆ p k ( t ) = p k 1 ( t ). W e fir st prov e that the pr ofile is well defined. Lemma 3.2. (1) p i 1 ( t ) ≤ p i − 1 1 ( t ) for every i ∈ { 1 , . . . , k } and time t . (2) P k i =0 ˆ p i ( t ) = 1 . 508 Z. LOTKER, B. P A TT-SHAMIR, AND D. RA WITZ Pr o of. By the algorithm f or classical ski ren tal, w e ha ve that the strategy for the i instance is p i 1 ( t ) = ( e t · r i 0 /b i 1 − 1) / ( e − 1). Claim (1) of th e lemma now follo ws fr om that fact that b i 1 /r i 0 = s i > s i − 1 = b i − 1 1 /r i − 1 0 for ev ery i ∈ { 1 , . . . , k } . Claim (2) follo ws from th e telesco p ic sum k X i =0 ˆ p i ( t ) = p 1 0 ( t ) + k − 1 X i =1 ( p i 1 ( t ) − p i +1 1 ( t )) + p k 1 ( t ) = p 1 0 ( t ) + p 1 1 ( t ) = 1 . Next, we sh o w ho w to co nv ert the profile ˆ p in to a strat egy . Note t h at the strate gy uses a single random exp eriment, since arbitrary dep end ence b et ween the differen t p i s are allo w ed. Lemma 3.3. Given ˆ p one c an obtain an online str ate gy whose pr ofile is ˆ p . Pr o of. Defin e ˆ P i ( t ) def = P j ≥ i ˆ p j ( t ) and let U b e a random v ariable that is c hosen u niformly from [0 , 1]. The strategy is as follo ws: we mov e fr om state i to state i + 1 wh en U = ˆ P i ( t ) for eve ry state i . Namely , the i th tr an s ition time t i is th e time t such that U = ˆ P i ( t ). Th u s w e obtain the follo wing: Theorem 3.4. The exp e cte d c ost of the str ate gy define d by ˆ p is at most e e − 1 times the optimal offline c ost. Pr o of. W e first sho w that by linearit y , the exp ected cost to the combined strategy is the sum of the costs to the t wo- slop e strategies, i.e., that X ˆ p ( t ) = P k i =1 X p i ( t ). F or example, the b uying cost is B ˆ p ( t ) = k X i =0 ˆ p i ( t ) · b i = k − 1 X i =0 ( p i 1 ( t ) − p i +1 1 ( t )) · b i + p k 1 ( t ) · b k = k X i =1 p i 1 ( t ) · ( b i − b i − 1 ) = k X i =1 B p i ( t ) . Similarly , R ˆ p ( t ) = P k i =1 R p i ( t ) by linearit y , and therefore, X ˆ p ( t ) = B ˆ p ( t ) + Z t z =0 R ˆ p ( z ) dz = k X i =1 B p i ( t ) + Z t z =0 k X i =1 R p i ( z ) ! dz = k X i =1 X p i ( t ) . Finally , b y Lemma 3.1 and the f act that the strategies p 1 , . . . , p k are e e − 1 -comp etitiv e we conclude th at X ˆ p ( t ) = k X i =1 X p i ( t ) ≤ k X i =1 e e − 1 · opt i ( t ) = e e − 1 · opt ( t ) whic h means that ˆ p is e e − 1 -comp etitiv e. The case of r k > 0 . W e n ote that if the smallest ren tal r ate r k is p ositiv e, then the comp etitiv e ratio is strictly less that e e − 1 : this can b e seen b y considering a new instance where r k is su b tracted from all rental rates, i.e., b ′ i = b i and r ′ i = r i − r k for all 0 ≤ i ≤ k . Supp ose p is e e − 1 -comp etitiv e with r esp ect to ( r ′ , k ′ ) (note that r ′ k = 0). Then the comp etitiv e ratio of p at time t w.r.t. the original ins tance is: c ( t ) = X p ( t ) opt ( t ) = X ′ p ( t ) + r k · t opt ′ ( t ) + r k · t ≤ e e − 1 · opt ′ ( t ) + r k · t opt ′ ( t ) + r k · t = e e − 1 − 1 e − 1 · 1 opt ′ ( t ) r k · t + 1 RENT, LEASE OR B U Y 509 d dt opt ′ ( t ) = r i − r k for t ∈ [ s i − 1 , s i ). Hence, the ratio opt ′ ( t ) r k · t is monotone decreasing, and th us c ( t ) is monotone decreasing as well. It follo ws that c ≤ e e − 1 − 1 e − 1 · 1 r 0 − r k r k + 1 = e − r k /r 0 e − 1 Observe th at c = e e − 1 when r k = 0, and that c = 1 when r k = r 0 (i.e., wh en k = 0). 4. A n Optimal Online A lgorithm In this s ection w e d ev elop an op timal online strategy f or an y given additiv e m ultislop e ski rental in stance. W e r educe the set of all p ossible strategies to a subset of m uch simp ler strategies, whic h on one hand con tains an optimal str ategy , and on the other hand is easier to analyze, and in particular, allo ws u s to effectiv ely find suc h an optimal strategy . Consider an arb itrary profile. (Recall that w e assume w.l.o.g. that no slop e is completely dominated b y another.) As a first simplification, w e confine ourselv es to profiles where eac h p i has only fin itely man y discon tinuitie s. Th is allo ws us to a vo id measure-theoretic patholo- gies without ruling ou t an y reasonable solution w ithin the Ch urch-T uring compu tational mo del. It can b e sho w n that we ma y consider only con tinuous p r ofiles (details omitted). So let su c h a profile p = ( p 0 , . . . , p k ) b e giv en. W e sho w that it can b e transf ormed in to a p rofile of a certain s tr ucture without increasing the comp et itive factor. Our c hain of transformations is as follo ws. First, we sho w that it suffi ces to consider only simple profiles w e call “prudent.” Pru den t strategie s buy slop es in order, one by o n e, without skipping and w ith ou t buyin g more than one slop e at a time. W e then define the concept of “tigh t” pr ofiles, whic h are p rudent profiles that sp end money at a fixed rate relativ e to the optimal offline strategy . W e prov e that there exists a tigh t optimal profile. F u rthermore, the b est tight profile can b e effect ively computed: Giv en a constan t c , we sho w ho w to c heck whether there exists a tigh t c -comp etitiv e strategy , and this w a y , using binary searc h on c , w e can find the b est tigh t strategy . Finally , w e explain ho w to construct that profile and a corresp onding strategy . 4.1. Pruden t and Tigh t Profiles Our main simplification step is to sho w th at it is s u fficien t to consider only p rofiles that buy slop es consecutiv ely one by one. F ormally , prudent profiles are defined as follo w s . Definition 4.1 ( activ e slop es, prudent profiles) . A s lop e i is active at time t if p i ( t ) > 0. A profile is called prudent if at all times there is either one or t w o consecutiv e activ e slop es. A t an y giv en time t , at least one slop e is activ e b ecause P i p i ( t ) = 1 by the problem definition. C onsidering Eq. (2.1) as w ell, we see that a con tin uous pru den t p r ofile progresses from one slop e to next w ithout skip ping an y slop e in b et wee n: once slop e i is f ully “p aid for” (i.e., p i ( t ) = 1), the algorithm will start buying slop e i + 1. W e no w prov e that the set of con tinuous prudent p rofiles con tains an optimal pr ofi le. In tuitivel y , the idea is that a non-p r udent profile m ust ha v e tw o non -consecutive slop es with p ositiv e pr ob ab ility at some time. In this case we can “shift” some p r obabilit y to wa rd a middle slop e and only impro ve the o veral l cost. Theorem 4.2. If th er e exists a c ontinuous c -c omp etitive pr ofile p for some c ≥ 1 , then ther e exists a prudent c -c omp etitive pr ofile ˜ p . 510 Z. LOTKER, B. P A TT-SHAMIR, AND D. RA WITZ Pr o of. L et p = ( p 0 , . . . , p k ) b e a profile and s upp ose that all the p i s are con tin uous. It follo ws that B p is also con tin uous. Define b est( t ) = max { i : b i ≤ B p ( t ) } and next( t ) = min { i : b i ≥ B p ( t ) } . In words, b est( t ) is th e most exp en s iv e slop e th at is fully within the buying budget of p at time t , and next( t ) is the most exp ensiv e slop e that is at least partially within the buyin g bu dget of p at time t . Obvio us ly , b est ( t ) ≤ next( t ) ≤ b est( t ) + 1 for all t . No w , w e define ˜ p as follo ws: ˜ p i ( t ) =              b next − B p ( t ) b next − b best i = b est( t ) and b est( t ) 6 = next( t ) , B p ( t ) − b b est b next − b b est i = next( t ) and b est( t ) 6 = next( t ) , 1 i = b est( t ) = next( t ) , 0 otherwise. It is not h ard to verify that P i p i ( t ) = 1 for ev ery time t . F urthermore, observe that ˜ p is prud ent, b ecause B p is contin uous. It r emains to sh ow that ˜ p is c -comp etitiv e. W e do so b y pro ving that B ˜ p ( t ) = B p ( t ) and R ˜ p ( t ) ≤ R p ( t ) for all t . First, directly from definitions w e ha v e B ˜ p ( t ) = p best ( t ) ( t ) · b best ( t ) + p next( t ) ( t ) · b next( t ) = b next( t ) − B p ( t ) b next( t ) − b best ( t ) · b best ( t ) + B p ( t ) − b best ( t ) b next( t ) − b best ( t ) · b next( t ) = B p ( t ) . Consider n o w rental pa yments. T o pr o v e that R ˜ p ( t ) ≤ R p ( t ) for ev ery time t w e construct inductive ly a sequ ence of pr obabilit y distribu tions p = p 0 , . . . , p ℓ = ˜ p . The first distribution p 0 is defined to b e p . Supp ose no w that p j is not prudent. Distribution p j + 1 is obtained f r om p j as follo ws. F or an y t suc h that there are t wo non-consecutiv e slop es with p ositiv e probabilit y , let i 1 ( t ) , i 2 ( t ) , i 3 ( t ) b e an y three slop es such that i 1 ( t ) = argmin { i : p j i ( t ) > 0 } , i 3 ( t ) = argmax { i : p j i ( t ) > 0 } , and i 1 ( t ) < i 2 ( t ) < i 3 ( t ) (suc h i 2 ( t ) exists b eca u se p j is not prudent). Define p j + 1 i ( t ) =              p j i ( t ) − ∆ j ( t ) b i 2 ( t ) − b i 1 ( t ) i = i 1 ( t ) , p j i ( t ) + ∆ j ( t ) b i 2 ( t ) − b i 1 ( t ) + ∆ j ( t ) b i 3 ( t ) − b i 2 ( t ) i = i 2 ( t ) , p j i ( t ) − ∆ j ( t ) b i 3 ( t ) − b i 2 ( t ) i = i 3 ( t ) , p j i ( t ) i 6∈ { i 1 ( t ) , i 2 ( t ) , i 3 ( t ) } where ∆ j ( t ) > 0 is maximized so that p j + 1 i ( t ) ≥ 0 for all i . Intuitiv ely , w e shift a m aximal amoun t of probabilit y mass from slop es i 1 ( t ) and i 3 ( t ) to the mid dle slop e i 2 ( t ). T he fact that ∆ j ( t ) is ma ximized means that we hav e either that p j + 1 i 1 ( t ) = 0, or p j + 1 i 3 ( t ) = 0, or b oth. In an y case, w e ma y already conclud e that ℓ < k . Also note that by construction, for all t w e ha v e B p j +1 ( t ) = P i p j + 1 i ( t ) · b i = P i p j i ( t ) · b i = B p j ( t ). Hence, p ℓ = ˜ p . As to the rental cost, fi x a time t , and consider n o w the rent paid by p j and p j + 1 : R p j ( t ) − R p j +1 ( t ) = = r i 1 ( t ) ∆ j ( t ) b i 2 ( t ) − b i 1 ( t ) − r i 2 ( t )  ∆ j ( t ) b i 2 ( t ) − b i 1 ( t ) ∆ j ( t ) b i 3 ( t ) − b i 2 ( t )  + r i 3 ( t ) ∆ j ( t ) b i 3 ( t ) − b i 2 ( t ) = ∆ j ( t ) ·  r i 1 ( t ) − r i 2 ( t ) b i 2 ( t ) − b i 1 ( t ) − r i 2 ( t ) − r i 3 ( t ) b i 3 ( t ) − b i 2 ( t )  > 0 RENT, LEASE OR B U Y 511 where the last in equ alit y follo ws f rom the f act that if i < j , then b j − b i r i − r j is the x co ord inate of the in tersection p oin t b et ween the slop es i and j . Our next step is to consider pr ofi les th at inv est in bu y in g as muc h as p ossible under some sp ending r ate cap. Our app roac h is motiv ated by the follo wing int u itive observ ation. Observ ation 4.3. Let p 1 and p 2 b e tw o randomized prudent pr ofiles. If B p 1 ( t ) ≥ B p 2 ( t ) for eve ry t , then R p 1 ( t ) ≤ R p 2 ( t ) for ev ery t . In other words, inv esting a v ailable funds in buyin g as so on as p ossible results in low er ren t, and therefore in more a v ailable funds. Hence, w e define a class of profiles which sp end money as so on as p ossible in b uying, as long as there is a b etter slop e to buy , namely as long as p k ( t ) < 1. Definition 4.4. Let c ≥ 1 . A pru den t c -comp etitiv e pr ofi le p is called tight if X p ( t ) = c · opt ( t ) for all t with p k ( t ) < 1. Clearly , if the last slop e is flat, i.e., r k = 0, then it must b e the case that p k ( s k ) = 1 for an y p rofile with fin ite comp et itive factor: otherwise, the cost to t h e p rofile will gro w without b ound w hile the optimal cost remains constant. Ho wev er, it is imp ortant to note that if r k > 0, there ma y exist an optimal pr ofile p that nev er buys the last slop e, but still its exp ecte d sp ending rate as t tends to infinit y is c · r k . It is easy to see that a tigh t profile can ac hiev e any ac hiev able comp etitiv e factor. Lemma 4.5. If ther e exists a c -c omp etitive prudent pr ofile p for som e c ≥ 1 , then th er e exists a c -c omp etitive tight pr ofile ˜ p . Pr o of. L et ˜ p b e the pr udent p rofile satisfying X ˜ p ( t ) = c · opt ( t ) for all t for whic h ˜ p k ( t ) < 1. W e need to sho w that ˜ p is feasible. Since by definition, p bu ys with any amoun t left, it suffices to sh o w that for all t , the rent p aid by p is a t most c · d dt opt ( t ). Indeed, R ˜ p ( t ) ≤ R p ( t ) for ev ery t du e to Observ ation 4.3, and since p is c -comp etitiv e it follo ws that R p ( t ) ≤ c · d dt opt ( t ) and w e are d on e. 4.2. Constructing Optima l Online Strategies W e now u se the r esults ab o v e to construct an algorithm that pro d uces the b est p ossible online s trategy for the multi slop e problem. The id ea is to guess a comp etitiv e f actor c , and then try to constru ct a c -comp etitiv e tigh t pr ofile. Giv en a wa y to test for success, w e can apply bin ary searc h to find the optimal comp etitiv e ratio c to any desired precision. The main questions are ho w to test wh ether a giv en c is feasible, and ho w to construct the profi les. W e ans wer these questions together: giv en c , w e construct a tigh t c -comp etitiv e profile until either w e fail (b ecause c w as to o small) or u n til we can guaran tee success. In the remainder of this section we describ e how to construct a tigh t pr ofile p for a giv en comp etitiv e factor c . W e b egin with analyzing the wa y a tight profi le ma y sp en d money . Consider the situation at s ome time t suc h that p k ( t ) < 1. Let j b e the maxim um index su c h that s j ≤ t . Then d dt opt ( t ) = r j . Therefore, the sp ending rate of a tigh t profile at time t m ust b e c · r j . If j < k , the tigh t profile ma y sp end at rate c · r j unt il time s j + 1 (or u n til p k ( t ) = 1), and if 512 Z. LOTKER, B. P A TT-SHAMIR, AND D. RA WITZ j = k the tigh t profile ma y con tinue sp endin g at this rate forever. He n ce, for t ∈ ( s j , s j + 1 ), w e ha v e d dt B p ( t ) + R p ( t ) = c · d dt opt ( t ) = c · r j . (4.1) Since p is tigh t and therefore prud en t, we also hav e, assuming b est( t ) = i and n ext( t ) = i + 1, that B p ( t ) = p i ( t ) b i + p i +1 ( t ) b i +1 , and R p ( t ) = p i ( t ) r i + p i +1 ( t ) r i +1 . Plugging the ab o ve equations into Eq. (4.1), we get d dt p i ( t ) b i + d dt p i +1 ( t ) b i +1 + p i ( t ) r i + p i +1 ( t ) r i +1 = c · r j Since p is pr udent, p i ( t ) = 1 − p i +1 ( t ) and hence d dt p i ( t ) = − d dt p i +1 ( t ). It follo ws that d dt p i +1 ( t ) + p i +1 ( t ) · r i +1 − r i b i +1 − b i = c · r j − r i b i +1 − b i (4.2) A solution to a differen tial equation of the form y ′ ( x ) + αy ( x ) = β w here α and β are constan ts is y = β α + Γ · e − αx , w h ere Γ d ep ends on the b oundary condition. Hence in our case we conclude that p i +1 ( t ) = c · r j − r i r i +1 − r i + Γ · e r i − r i +1 b i +1 − b i · t , (4.3) and p i ( t ) = 1 − p i +1 ( t ), wh ere the constan t Γ is d etermined by the b oundary condition. Eq. (4.3 ) is our to ol to construct p in a p iecewise iterativ e fashion. F or example, we start constructing p from t = 0 using p 1 ( t ) = c · r 0 − r 0 r 1 − r 0 + Γ · e r 0 − r 1 b 1 − b 0 · t and the b oun dary condition p 1 (0) = 0. W e get that Γ = r 0 ( c − 1) r 0 − r 1 , i.e., p 1 ( t ) = r 0 ( c − 1) r 0 − r 1 · ( e r 0 − r 1 b 1 − b 0 t − 1) , and this holds for all t ≤ min( s 1 , t 1 ), wh ere t 1 is th e solution to p 1 ( t 1 ) = 1. In general, Eq. (4.2) remains true so long as there is no c hange in th e sp ending rate and in th e slop e the profile p is buying. Th e sp ending rate c hanges when t crosses s j , and the p rofile starts b uying slop e i + 2 when p i +1 ( t ) = 1. W e can now d escrib e our algorithm. Given a ratio c , Algorithm F easible is able to construct the ti ght p rofile p or t o dete r mine that suc h a pr ofile d o es not exist. It starts with the b ou n dary condition p 1 (0) = 0 and reve als the fir st part of the profi le as sho wn ab o ve . T hen, eac h time the sp ending rate c hanges or there is a c hange in b est( i ) it mov es to the n ext differenti al equation with a new b oundary condition. After at most 2 k suc h iterations it either computes a c -comp etitiv e tigh t pr ofile p or disco v ers that such a profile is infeasible. Since w e are able to test for success using Algorithm Feas ible , w e can apply binary s earch to fi nd the optimal comp etitiv e ratio to an y desired precision. W e n ote that it is easy to constru ct a strategy that corr esp onds to an y giv en prud en t profile p , as describ ed in the pro of of Lemma 3.3. W e conclude with the follo wing theorem. Theorem 4.6. Ther e exists an O ( k log 1 ε ) time algorithm that given an instanc e of the addi- tive multislop e ski r e ntal pr oblem for which the optimal r andomize d str ate gy has c omp etitive r atio c , c omputes a ( c + ε ) -c omp etitive str ate gy. RENT, LEASE OR B U Y 513 Algorithm 1 – Feasible ( c, M ): true if the k -ski instance M = ( b, r ) admits comp etitiv e factor c 1: Let s i = b i − b i − 1 r i − 1 − r i for ea ch 1 ≤ i ≤ k 2: Boundary Condition ← “ p 1 (0) = 0” 3: j ← 0 ; i ← 1 4: lo o p 5: Define p i ( t ) = c · r j − r i − 1 r i − r i − 1 + Γ · exp( r i − 1 − r i b i − b i − 1 · t ) 6: T r y to solve for Γ using Boundary Condition 7: if no solutio n then return f alse ⊲ p ossible esc ap e if not fe asible 8: y ← p i ( s j ) 9: if y < 1 then 10: Boundary Condition ← “ p i ( s j ) = y ” 11: j ← j + 1 ⊲ c ontinue at the next int erval [ s j , s j 1 ] 12: else 13: Let x b e suc h that p i ( x ) = 1 14: Boundary Condition ← “ p i +1 ( x ) = 0” 15: i ← i + 1 ⊲ move to next slop e 16: end if 17: if i > k or j ≥ k then return true ⊲ we’r e done 18: end lo op 5. A n e -Compet itiv e Strategy for the Non-Additive Case In this sectio n w e consider the non-additive multislop e ski ren tal problem. W e present a simple rand omized strategy w h ic h impro v es the b est known comp etitiv e ratio from 2 / ln 2 = 2 . 88 to e . Our tec hnique is a simple application of r an d omized rep eated doubling (see, e.g., [7]), used extensive ly in comp etitiv e analysis of online algo rithm s. F or example, deter- ministic r ep eated doubling app ears in [1], and a randomized v ersion app ears in [13]. Before presen ting the strategy let us consider the deta ils of the n on -add itiv e mod el. Augustine at el. [2] defin e a ge ner al non-additive mo del in which a t ran s ition co st b ij is asso ciated with ev ery t wo states i and j , and sh o w that one ma y assu me w .l.o.g. that b ij = 0 if i > j and that b ij ≤ b j for every i < j . O bserv e that we ma y further assume that b ij = b j for ev ery i and j , since the optimal (offline) strategy remains the u nc hanged. It follo ws that the strategies f rom [3, 4, 6] that w ere designed for th e case of buying slop es “from scratc h” also w ork for the general non-additive case. W e prop ose u sing the follo wing iterativ e online strategy , which is similar to the one in [6], except for th e choice of th e “doubling factor.” Sp ecifically , the j th iteration is asso ciated with a b ou n d B j on opt ( τ ), w here τ denotes the termination time of the game. W e define B 1 def = opt ( s 1 ) /α X , w h ere α > 1 and X is a chosen at random un iformly in [0 , 1). W e also define B j + 1 = α · B j . Let τ j = opt − 1 ( B j ) and let i j b e the optimal offlin e state at time τ j . In case there are t wo suc h s tates, i.e., τ j = s i for some i , w e d efine i j = i − 1. It follo ws that i 1 = 0. In the b eginnin g of the j th iteration the online strategy buys i j and sta ys in i j unt il the this iteration ends. The j th iteration end s at time τ j . Obser ve that the fi rst iteration starts with B 1 = opt ( s 1 ), namely w e use slop e 0 until s 1 . Theorem 5.1. The exp e cte d c ost of the str ate gy describ e d ab ove is at most e times the optimum. 514 Z. LOTKER, B. P A TT-SHAMIR, AND D. RA WITZ Pr o of. O bserv e that the first iteration starts with B 1 = opt ( s 1 ), namely we use s lop e 0 unt il s 1 , and hence, if the game ends d uring the fi rst iteration, i.e., b efore s 1 /α X , then the online s trategy is optimal. Consider no w the case where the game ends at time τ ≥ s 1 /α X , and supp ose that τ ∈ [ τ ℓ , τ ℓ +1 ) for ℓ > 1. I n this case, the exp ected cost o f th e online strategy is b ound ed by E   ℓ X j = 1 opt ( τ j ) + o pt ( τ )   ≤ E   ℓ +1 X j = 1 opt ( τ j )   ≤ E  α α − 1 · opt ( τ ℓ +1 )  = E  α 2 − X α − 1 · opt ( τ )  = α α − 1 · Z 1 x =0 α x dx · opt ( τ ) = α ln α · opt ( τ ) By choosing α = e the comp etiti ve ratio is α ln α = e as r equired. Ac knowled gment W e thank Seffy Naor and Niv Buc hbinder for stim ulating discussions. References [1] J . Aspnes, Y. Azar, A. Fiat, S . A. Plotkin, and O. W aarts. On-line routing of virtual circuits with applications to load balancing and mac hin e scheduling. Journal of the A CM , 44(3):486–504 , 1997. [2] J . Augustine, S. I rani, and C. Swa my . Op timal p ow er-down strategies. In 45th IEEE Symp. on F oun- dations of Computer Scienc e , p ages 530–539, 2004. [3] Y. Azar, Y. Bartal, E. F euerstein, A. Fiat, S. Leonardi, and A. Ros ´ en. On capital inve stment. Algor i th- mic a , 25(1):22–3 6, 1999. [4] Y. Bejerano, I . Cidon, and J. S. Naor. Dynamic session managemen t for static and mob ile users: a compet itive on-line algorithmic approac h. In 4th Internat i onal Workshop on Discr ete Algorithms and Metho ds for Mobile Com puting and Communic ations , pages 65–74. ACM , 2000. [5] A. Boro din and R. El-Y aniv. Online Computation and Comp etitive An alysis . Cambridge U niversi ty Press, 1998. [6] P . D amaschke . Nearly optimal strategies for sp ecial cases of on- line capital inv estment. T he or etic al Computer Scienc e , 302(1-3):35–44, 2003. [7] S. Gal. Se ar ch Games . Academic Press, 1980. [8] S. I rani, R . K. Gupta, and S. K. Shukla. Competitive analysis of dynamic p o wer management strategies for systems with m ultiple p ow er sa vings states. In Design, Automat i on and T est in Eur op e C onfer enc e and Exhibition , pages 117–123, 2002. [9] A. R. Karlin, C. Keny on, and D. Randall. D y namic TCP acknow ledgment and other stories ab out e/ ( e − 1). A l gorithmic a , 36(3):209–224, 2003 . [10] A . R. K arlin, M. S. Manasse, L. Rud olph, and D. D. S leator. Competitive snoopy cac hing. Algorithmic a , 3(1):77–11 9, 1988. [11] A . W. Marshall and I. Olkin. Ine quali ties: The ory of Majorization and I ts Applic ations . Academic Press, 1979. [12] A . Meyerson. The parking p ermit p roblem. In 46th IEEE Symp. on F oundations of Computer Scienc e , pages 274–2 84, 2005. [13] R . Motw ani, S. Phillips, and E. T orn g. Non-clairvo yan t scheduling. The or. Comput. Sci. , 130(1):17– 47, 1994. This work is licensed under the Creative Co mmons Attribution-NoDer ivs License. T o view a copy of this license, visit http:/ /creativ e commons.org/licenses/by- nd/3.0/ .

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment