Ski rental: the break-even strategy and the deterministic lower bound #
This file instantiates Cslib.DataStructure.Online.Problem for the deterministic ski-rental
(rent-or-buy) problem. The rent-or-buy framing goes back to Karlin, Manasse, Rudolph, and
Sleator, Competitive snoopy caching; the textbook treatment
is in Borodin and El-Yaniv, Online Computation and Competitive Analysis.
Each request is one more day of skiing. Before every day the skier either rents for that day
(cost 1) or buys (cost B, after which every further day is free). The online strategy does not
know how many days remain. Offline schedules use the same states, transitions and costs, so the
offline optimum on n days is min n B (exists_optimal_schedule,
min_le_scheduleCost).
The break-even strategy rents for B - 1 days and buys on day B. On every request sequence
and against every valid offline schedule its cost satisfies B * ALG ≤ (2B - 1) * OPT
(breakEven_mul_cost_le), i.e. competitive ratio 2 - 1/B with no additive constant.
Conversely every deterministic online strategy has an instance with OPT ≥ 1 and
(2B - 1) * OPT ≤ B * ALG (exists_witness), so no deterministic strategy achieves any rational
ratio p / q < 2 - 1/B without an additive constant (exists_ratio_violation_of_lt).
The break-even strategy is (1, B - 1)-competitive (breakEven_isCompetitive_one), so with an
additive constant the factor-1 question is trivial; the meaningful ratio has no additive
constant, and ratios for ski rental are stated with additive constant 0.
Main definitions #
Cslib.DataStructure.Online.SkiRental.problem: the ski-rentalOnline.Problemwith purchase priceB.SkiRental.rentThenBuy: the deterministic strategy that rents fortdays and buys on dayt + 1.SkiRental.breakEven:rentThenBuy (B - 1).
Main results #
min_le_scheduleCost,exists_optimal_schedule: the offline optimum ismin n B.cost_rentThenBuy: exact cost of the rent-then-buy strategies.breakEven_mul_cost_le,breakEven_isCompetitive_two: the break-even strategy has ratio2 - 1/B, hence is(2, 0)-competitive.exists_witness,exists_ratio_violation_of_lt,not_isCompetitive_one: no deterministic strategy beats ratio2 - 1/Bwithout an additive constant.exists_rentThenBuy_cost_eq: on boundedly many days, every deterministic strategy has the cost of a rent-then-buy strategy.
Randomized ski rental (ratio 1 / (1 - (1 - 1/B)^B) ≤ e/(e-1) and its matching lower bound) is in
CslibFrontier.DataStructure.Online.SkiRental.Randomized.
References #
The ski-rental Online.Problem with purchase price B. The state records whether the skis
have been bought; buying is irreversible; every run starts without skis.
Offline schedules #
Once the skis are owned, every valid continuation keeps them and costs nothing.
Offline lower bound. Every valid schedule from the initial state costs at least
min n B on n ski days.
Renting every day costs one per day.
Offline optimum. Renting every day (if n ≤ B) or buying on the first day (otherwise)
is a valid schedule costing exactly min n B.
A valid schedule that rents for d days and then buys costs d + B, whatever follows the
purchase.
Rent-then-buy strategies #
The deterministic strategy that rents for the first t days and buys on day t + 1. Its
memory records whether the skis are owned and how many days have been rented.
From the rented state after k ≤ t days, the remaining cost is the number of remaining days if
the skier stops before day t + 1, and t - k + B otherwise.
The break-even strategy: rent for B - 1 days and buy on day B.
Break-even upper bound (for the rent-or-buy framing of [KMRS88]
only): on every request sequence and against every valid offline schedule, the break-even strategy
satisfies B * ALG ≤ (2B - 1) * OPT, i.e. it has competitive ratio 2 - 1/B with no additive
constant.
The break-even strategy is (2, 0)-competitive.
With additive constant B - 1, the break-even strategy is even (1, B - 1)-competitive, which
is why the ski-rental ratio 2 - 1/B is a statement without additive constant.
Deterministic lower bound #
Deterministic lower-bound witness. For every deterministic online ski-rental strategy
(1 ≤ B) there are a request sequence and a valid offline schedule with offline cost at least 1
and (2B - 1) * OPT ≤ B * ALG. The adversary stops skiing on the day the strategy buys, or after
2B - 1 days if it never buys.
Deterministic lower bound ([BElY98]): for every deterministic online
ski-rental strategy and every rational ratio p / q < 2 - 1/B (i.e. p * B < (2B - 1) * q) there
are a request sequence and a valid offline schedule with p * OPT < q * ALG.
For B ≥ 2, no deterministic online ski-rental strategy is (1, 0)-competitive.
On the first N ski days every deterministic strategy behaves like a rent-then-buy strategy:
there is a threshold t with A.cost = (rentThenBuy B t).cost on every n ≤ N days. Take t
to be the number of days the strategy rents before buying when it skis N days, or N if it never
buys. This reduces lower bounds over arbitrary deterministic strategies, such as the randomized
lower bound in CslibFrontier.DataStructure.Online.SkiRental.Randomized, to threshold
strategies.