שקופית 1

Rent, Lease or Buy:
Randomized Algorithms for
Multislope Ski Rental
Zvi Lotker
Ben-Gurion University
Boaz Patt-Shamir
Dror Rawitz
Tel Aviv University
Rent or Buy Dilemma
the sleeping Baby Problem:

You finally managed to put baby to sleep

Baby will wake up at some unknown time

Should parent stay awake or go to sleep?


– Going to sleep incurs some fixed effort
– Staying awake incurs an effort per time unit
Rent or Buy Dilemma

Question:


Competitive Analysis:



How do we measure the quality of our solution
Worst case analysis:
Baby will try to make parent’s life hard
Compare our solution to

best possible solution
Rent or Buy

Classical Ski Rental:





–
–
–
–
–
Vacation at ski resort
End of vacation is unknown
Cost of skis is €B, rent is €1/day
Should we rent or buy the skis?
When should we buy?
Optimal offline cost:
Out[5]=
Optimal Online Strategies:
2-competitive deterministic strategy
[Karlin et al. 88]
e

-competitive
randomized
strategy
e 1
[Karlin et al. 94]
 What if the second option is not const?

Out[5]=
General two slope

Assume that we can chose:




To rent or to buy hose
But even when we by the hose we need to
pay the property tax
1+(1-r)-competitive deterministic
strategy
e
e 1  r -competitive randomized
strategy
Deterministic strategy

If the end of the game is at t<1


If the end of the game is at t>1


Opt cost r·t+(1-r)
Assume the game end at the time
online move to the second option


Opt cost t
In this case online cost is t+1-r
So the competitive is
 1 r t 1 r t 
 1 r  t 1 r  t  2  r
,

Max 
 Min 1  r  rt , t   1
t  t
t 1 r  rt
t
Ski rental
rate due
towith two general options
investment in
buying slope
2
i

third term is
due to being at
slope 2
Let p (t) be the probability that the
algorithm is using slope i=1,2
The expected rate in which the
algorithm spends money is
dP2 t 
1P1 t   1  r 
 rP2 t   1  c
dt

dP1 t  
1  c e t  c  r 

r  1  r  P1 t  
  c  P1 t  
dt 
1 r

How we find c

At time t>1,optimal strategy spends money
at rate a P1 1  1  c e  c  r 
1 r

Assume that the online stop buying
e
r  (1  r ) P1 1  rc  c 
e 1  r
 r  e  e t  c  r 
t 1

e  1  r 
P1 t   
r

t 1

e  1  r 
P2 t   1  P1 t 
Interpretation of the algorithm

We pick an random time according to P2



If this number is bigger than 1 we do not
move to the second option
If this number is less then 1 we buy the
second option at that time.
Example assume that r=0.3, c=1.34683
1.0
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1.0
Optimality of the algorithm


We use Yao’s Lemma
We assume that the game end at time t
t

e
t 1
with the prob

Pt    1
t2
 e

The optimal expected cost is
1 e 1  r
c   xe dx  1  r  2r  
e
e
0
1
x
e  t
Pt    1
 e
Optimality of the algorithm

x
t 1
t2
Assume that Ax is a deterministic
algorithm that end x them the expected
cost of Ax is 1, for 0<x<1
1
1
0 te dt  x x  1  r   r t  xe dt  x  1  r   r 2  x e  1
t

t
Therefore the competitive is
1
e
C

e 1 r e 1 r
e
Rent, Lease or Buy

Housing costs game:



Price of house/apartment increases closer to city center
Transportation rates decrease closer to city center
Extended Ski Rental:


Mixed rent and buy options
Pure buy or pure rent may not exist
Multislope Ski Rental

Problem Definition:




Several states/slopes
Slope i: bi+ri·t
bi+1>bi for all i
ri+1<ri for all i

End time is unknown

Which slope should we buy? When?
Multislope Ski Rental


Online Buying Costs:
Say we are in slope i, how much do we
pay for slope j



Additive Model: bj−bi
Non-Additive Model: bij
“From scratch”: bj
Offline Strategy




Competitive Analysis:
The online strategy is compared to the offline
strategy
Offline Strategy:
Buy a slope at time 0 according to end time
Previous Results &
Applications

Online Capital Investments:



Deterministic 6.83-competitive strategy (slopes
may arrive over time) [Azar et al. 99]
Deterministic lower bound 3.618 Randomized
2.88-competitive strategy [Damaschke 03]
Rerouting in ATM networks: 4-competitive
strategy (slopes may be concave) [BCN 00]
Previous Results &
Energy Saving

Slopes are hibernation modes


Deterministic 2-competitive strategy for
additive model [IGS 02]
Algorithm that computes best deterministic
strategy for non-additive model [AIS 04]
Our Results

Additive Model:





Randomized e/(e−1) competitive strategy
(e−rk/r0)/(e−1) when rk >0
Decomposition into k classical ski rental instances
Strategy is combination of k strategies
Main Result:

Algorithm that computes best randomized strategy
Profiles Costs

Expected rent at time t: RP t    Pi t ri
i

Expected total rental cost at time t:

t
z 0

RP t dz
Expected buying cost at time t:
BP t    Pi t bi

t
Total: Expected cost at time t: BP t    Rp t 
i
0
diff. equations

Min C
The problem weThis
want
to solve is
can by
approximate
by lp
S.t for all t
k
t ,  Pi t   1
i 1
k
k
i j
i j
j  1,.., k , t  t '   Pi t    Pi t '
t , i  1,..., k , Pi t   0
P1 0  1
t ,
dB p t 
dt
k
  ri Pi t   c
i 1
dOpt t 
dt
So we ran lp aproximation

And this is what we got
1
0.8
0.6
0.4
0.2
20
40
60
80
100
Strategies & Profiles

Randomized Startegy:




Randomized Profile:






Additive model: we go from slope i to slope i + 1
When do we move to the next slope?
Probability distribution over deterministic strategies
pi(t) – probability of being in slope i at time t
Σipi(t) = 1 for all t≥0
Plan:
Every strategy induces a profile
Find best profile
Construct strategy
Optimal Profiles

Chain of Transformations:




Optimal profile
Continuous optimal profile Continuous in t
Prudent optimal profile Only one or two
consecutive active slopes
Tight optimal profile Moves to the next
slope as soon as possible
Prudent Profiles


Continuous to Prudent:
for all t two consecutive slopes are
determined



Buying cost is preserved
⇛ Rent may only decrease
⇛ Continuity is preserved
Prudent to Tight

Tight: Buy next slope as soon as
possible


⇛ Rent may only decrease
Theorem: There exists a tight optimal
profile
Computing Tight Profile

Computing tight profile for a given c:
dBP t 
dOpt t 
 Solve diff. equations:
 R t   c
dt

For tight profiles:
dPi t 
dPi 1 t 
bi

dt
 bi 1
dt
 ri pi t   ri 1 pi 1 t   c
p
dt
dOpt t 
 crj
dt
We assume that we know c and then we
solve all those diff. equations


If we solve all of them before time 1 we can make
c small
If not we have to make c bigger
Algorithm



Computing a Strategy:
Let p be a tight profile X~U(0, 1)
Move from slope i to slope i + 1 when
 P t   X
j i

j
Theorem: Randomized (c + ε)-competitive
strategy can be found in O(k log 1/ε), where
c is the best possible ratio
3-Slope Examples:
An 1.581 Competitive
Algorithm

Assume rk=0




Let b’0=0; r’i0=ri-1-ri; b’i1=bi-bi-1; r’i1=0
Let Opti(t) be the offline alg for ski prob
{(b0i, r0i), (b1i, r1i)}
Lemma Opt(t)=Σ Opti(t)
k
k
k
i
i
i


Opt
t

b

tr
Proof:

1  0
i 1
i 1,t  si

i 1,t  si
k
b b
i 1,t  si
i
i 1
 bi ( t )  tri ( t )  Opt (t )

k
 t r
i 1,t  si
i 1
 ri 
An 1.581 Competitive
Algorithm

We solve each problem separate


Let P0i(t), P1i(t) be the solution.
We define the profile for the multislope:


Pi(t)= P1i(t)- P1i+1(t) for i=1,…,k-1
P0(t)= P01(t), Pk(t)= P1k(t)
An 1.581 Competitive
Algorithm

We solve each problem separate

Let P0i(t), P1i(t) be the solution.
Lemma P1i-1(t)≥P1i(t)
 Proof P1i(t)=Exp[b1i/r0i] now
b1i/r0i>b1i-1/r0i-1


It is clear that the sum of all prob is 1.
An 1.581 Competitive
Algorithm



Given P one can obtain an online
strategy whose profile is P.
let U~U[0,1]
we move from state i to state i + 1
when U=P1i(t) for every state i
An 1.581 Competitive
Algorithm



Theorem The competitive ratio of P is:
e/(e−1)
Proof:
expected cost to the combined strategy is the
sum of the costs to the two-slope strategies



buying cost is ΣBPi(t)
Ranting cost is ΣrPi(t)
By the fact that each of the strategies is e/(e-1)
competitive the lemma follows.
Open Problems:


Compute best randomized strategy for
non-additive model
What is the get LP for homogeneous
differential equation.
C:\Users\user\Documents\Zvi\old\2007\sky k