The key idea
At first, only one thing about a forecast matters: does it say the run will reach nights? Say
it does, and you buy on night . If the forecast is right, the run reaches night and you pay
against , so the consistency is . If it is wrong, the adversary ends
the run on night : you pay against , so the robustness is .
Buying early is good when the forecast is right and bad when it is wrong. With
, consistency is about and robustness about .
Part B, proved
Take any deterministic rule, even one that uses the exact forecast. Fix the forecast 1,000 and let
be the night the rule buys under it. If the forecast is right, the run lasts 1,000 nights. If
you pay 1,000 against 12; otherwise you pay against 12. So consistency at most
1.25 forces . Keep the forecast, and let the adversary end the run on night : you pay
against , a ratio of . So no rule does better than
3.75, and buying on night 4 when the forecast says long, and on night 12 otherwise, achieves
it.
Part C
Buy on night when the forecast is at least , and on any night from to
otherwise. A correct forecast below means the run ends before you buy, so you pay exactly
what hindsight pays. The adversary's best run against buy night ends on night , which gives
the two ratios above.
Part D: what the two numbers miss
"Buy on night when the forecast says short" passes part C. Yet at , with forecast 10
and run 12, it pays 23 where part D's bound allows : a small error
costs it the full penalty. Waiting until night keeps renting through small errors. That is the
rule of Purohit, Svitkina and Kumar with : buy on night if
the forecast says long, and on night otherwise. It never pays more than
, where is the forecast's error. For
that is part D's bound. Consistency and robustness alone could not tell these two
rules apart.
Going further
- Randomize. Without a forecast, a random buy night guarantees about
against an adversary who cannot see the coin (Karlin, Manasse, McGeoch and Owicki). Purohit,
Svitkina and Kumar also give a randomized rule that uses the forecast.
- The trade-off is optimal. Wei and Zhang proved that no deterministic rule beats
against ; part B is the discrete case of their argument.
- Algorithms with predictions is now a research area, covering caching, scheduling, matching
and more. Start with Mitzenmacher and Vassilvitskii's survey; papers are listed at
algorithms-with-predictions.github.io.
- Several forecasters. Gollapudi and Panigrahi study rent or buy with advice from several
experts, which connects this problem to
Multiplicative Weights.
References
- A. R. Karlin, M. S. Manasse, L. A. McGeoch, S. Owicki. Competitive randomized algorithms for
nonuniform problems. Algorithmica 11 (1994).
- M. Purohit, Z. Svitkina, R. Kumar. Improving online algorithms via ML predictions. NeurIPS
2018.
- S. Gollapudi, D. Panigrahi. Online algorithms for rent-or-buy with expert advice. ICML 2019.
- A. Wei, F. Zhang. Optimal robustness-consistency trade-offs for learning-augmented online
algorithms. NeurIPS 2020.
- M. Mitzenmacher, S. Vassilvitskii. Algorithms with predictions. In Beyond the Worst-Case
Analysis of Algorithms, Cambridge University Press, 2021.