Documentation

CslibFrontier.DataStructure.Online.SkiRental.Continuous

Continuous-time randomized ski rental: exact e/(e-1) competitiveness, tight #

This file formalizes the continuous-time ski-rental problem with purchase price B > 0 and unit rental rate, following Karlin, Manasse, McGeoch, and Owicki, Competitive randomized algorithms for nonuniform problems and Borodin and El-Yaniv, Online Computation and Competitive Analysis.

A deterministic strategy chooses a buy time t ≥ 0: on ski duration x ≥ 0, it rents at unit rate until stopping if x < t (paying x), and rents up to time t then buys if t ≤ x (paying t + B, continuousCost). At the boundary x = t, the skier buys and pays t + B. The offline optimum is continuousOpt B x = min x B (continuousOpt_le_continuousCost, exists_continuousCost_eq_continuousOpt). The deterministic break-even strategy t = B is 2-competitive (continuousCost_breakEven_le), with equality at x = B.

Upper bound. Drawing the buy time t ∈ [0, B] from the Karlin–Manasse–McGeoch–Owicki density buyDensity B t = exp (t / B) / (B * (e - 1)) yields a probability measure buyMeasure B on [0, B] (integral_buyDensity, isProbabilityMeasure_buyMeasure, buyMeasure_Iio_zero) whose expected cost on every ski duration x ≥ 0 is exact: ∫ t in 0..B, buyDensity B t * continuousCost B t x = (e / (e - 1)) * min x B (integral_buyDensity_mul_continuousCost, and as measure integrals lintegral_buyMeasure_continuousCost, integral_buyMeasure_continuousCost).

Lower bound. Every Borel probability measure μ on [0, ∞) (μ (Set.Iio 0) = 0) has competitive ratio at least e / (e - 1) against an oblivious adversary, stated both via Lebesgue lintegral (exp_div_exp_sub_one_le_of_continuous_competitive) and via real Bochner integration (exp_div_exp_sub_one_le_of_continuous_competitive_real; integrability of continuousCost B · x holds automatically for every finite measure on [0, ∞) by integrable_continuousCost). The proof applies Tonelli's theorem (lintegral_lintegral_swap) against the continuous adversary distribution advMeasure B with density (1 / B) * exp (-x / B) on [0, B] plus a point mass exp (-1) at 2 * B: every buy time t ≥ 0 incurs expected cost at least B (le_lintegral_advMeasure_continuousCost), while the expected offline optimum is B * (1 - exp (-1)) (lintegral_advMeasure_continuousOpt).

Main definitions #

Main results #

References #

Continuous-time cost and offline optimum #

Continuous-time ski-rental cost with purchase price B, buy time t, and ski duration x: if skiing stops strictly before t (x < t) the skier pays only rent x; otherwise (t ≤ x) the skier rents until t and buys at cost B, paying t + B. At the boundary x = t, the skier buys and pays t + B.

@[reducible, inline]

Offline optimal continuous-time ski-rental cost for purchase price B and duration x: rent for x if x ≤ B, or buy immediately at t = 0 for B if B ≤ x.

theorem Cslib.DataStructure.Online.SkiRental.continuousCost_nonneg {B t x : ℝ} (hB : 0 ≤ B) (ht : 0 ≤ t) (hx : 0 ≤ x) :

Continuous-time ski-rental cost is nonnegative whenever B, t, and x are nonnegative.

Every buy time t ≥ 0 costs at least continuousOpt B x = min x B.

The offline optimum continuousOpt B x is attained by some buy time t ≥ 0.

Deterministic break-even (t = B) is 2-competitive for continuous-time ski rental, with equality at x = B.

Calculus and measure helpers #

Optimal continuous randomized strategy #

The Karlin–Manasse–McGeoch–Owicki buy-time density exp (t / B) / (B * (e - 1)) on [0, B].

buyDensity B is strictly positive everywhere whenever 0 < B.

buyDensity B integrates to 1 over [0, B].

Continuous-time upper bound ([KMMcGO94]; [BElY98]): for every purchase price B > 0 and ski duration x ≥ 0, the expected cost under buyDensity B on [0, B] is exact: (e / (e - 1)) * min x B.

The Karlin–Manasse–McGeoch–Owicki buy-time probability measure on [0, B], defined by density buyDensity B with respect to Lebesgue measure restricted to [0, B].

buyMeasure B is supported on [0, ∞) (it assigns measure 0 to (-∞, 0)).

For every fixed B and x, t ↦ continuousCost B t x is bounded by |x| + |B| on [0, ∞), so it is integrable under every finite measure μ supported on [0, ∞).

Exact expected cost of buyMeasure B as an extended-real Lebesgue integral.

Exact expected cost of buyMeasure B as a real Bochner integral.

Matching continuous Yao adversary and lower bound #

The continuous-time Yao adversary distribution on ski durations x ∈ [0, ∞): density (1 / B) * exp (-x / B) on [0, B] plus a point mass exp (-1) at 2 * B.

advMeasure B is supported on [0, ∞) whenever 0 < B.

Expected offline optimum under advMeasure B: B * (1 - exp (-1)).

Every buy time t ≥ 0 incurs expected cost at least B against advMeasure B (with exact equality for 0 ≤ t ≤ B and for 2 * B < t).

Continuous-time randomized lower bound ([KMMcGO94]; [BElY98]; [Yao77]): for every purchase price B > 0 and every Borel probability measure μ on [0, ∞) (μ (Set.Iio 0) = 0), if μ is c-competitive in expected cost (measured via Lebesgue lintegral, requiring no integrability assumption on μ), then e / (e - 1) ≤ c.

Bochner-integral corollary of exp_div_exp_sub_one_le_of_continuous_competitive: for every purchase price B > 0 and every Borel probability measure μ on [0, ∞) (μ (Set.Iio 0) = 0), if ∫ t, continuousCost B t x ∂μ ≤ c * continuousOpt B x for all x ≥ 0, then e / (e - 1) ≤ c. Integrability of continuousCost B · x holds unconditionally by integrable_continuousCost.