Ski rental problem


In computer science, the ski rental problem is a name given to a class of problems in which there is a choice between continuing to pay a repeating cost or paying a one-time cost which eliminates or reduces the repeating cost.

The problem

Many online problems have a sub-problem called the rent/buy problem. We need to decide whether to stay in the current state and pay a certain amount of cost per time unit, or switch to another state and pay some fixed large cost with no further payment. Ski rental is one example where the rent/buy is the entire problem. Its basic version is:
A person is going skiing for an unknown number of days. Renting skis costs $1 per day and buying skis costs $10. Every day, the person must decide whether to continue renting skis for one more day or buy a pair of skis. If the person knows in advance how many days she will go skiing, she can decide her minimum cost. If she will be skiing for more than 10 days it will be cheaper to buy skis but if she will be skiing for fewer than 10 days it will be cheaper to rent. What should she when she does not know in advance how many days you will ski?
Formally, the problem can be set up as follows. There is a number of days d that the person will ski. The goal is to find algorithm that minimizes the ratio between what the person pay using the algorithm and what the person would pay optimally if the person knew d in advance. The problem is generally analyzed in the worst case, where the algorithm is fixed and then we look at the worst-case performance of the algorithm over all possible d. In particular, no assumptions are made regarding the distribution of d.

The break-even algorithm

The break-even algorithm instructs you to rent for 9 days and buy skis on the morning of day 10 if you are still up for skiing. If you have to stop skiing during the first 9 days, it costs the same as what you would pay if you had known the number of days you would go skiing. If you have to stop skiing after day 10, your cost is $19 which is 90% more than what you would pay if you had known the number of days you would go skiing in advance. This is the worst case for the break-even algorithm.
The break-even algorithm is known to be the best deterministic algorithm for this problem.

Breaking even

A person can flip a coin. If it comes up heads, she buy skis on day eight; otherwise, she buys skis on day 10. This is an instance of a randomized algorithm. The expected cost is at most 80% more than what the person would pay if she had known the number of days she would go skiing, regardless of how many days she skis. In particular, if the person skis for 10 days, her expected cost is 1/2 + 1/2 = 18 dollars, only 80% excess instead of 90%.
A randomized algorithm can be understood as a composition of different algorithms, each one which occurs with a given probability. We define the expected competitive ratio on a given instance i as:
, where is the competitive ratio for instance i, given.
Consequently, the competitive ratio of a randomized algorithm is given by the worst value of over all given instances. In the case of the coin flipping ski-rental, we note that the randomized algorithm has 2 possible branches: If the coin comes up heads, we buy on day 8, otherwise we buy on day 10. We may call the branches and, respectively., for.
,
, and
, for.
Therefore, the competitive ratio of the randomized ski-rental coin flipping algorithm is 1.8.
The best randomized algorithm against an oblivious adversary is to choose some day i at random according to the following distribution p, rent for i-1 days and buy skis on the morning of day i if you are still up for skiing. Karlin et al. first presented this algorithm with distribution
where buying skis costs $ and renting costs $1. Its expected cost is at most e/ 1.58 times what you would pay if you had known the number of days you would go skiing. No randomized algorithm can do better.

Applications