Documentation

CslibFrontier.DataStructure.Online.Randomized

Randomized online strategies against an oblivious adversary #

This file adds randomized strategies to the online model of CslibFrontier.DataStructure.Online.Basic, for the oblivious adversary, which fixes the whole request sequence before the strategy's coins are tossed. Against such an adversary a randomized online strategy can be viewed as a probability distribution over deterministic online strategies: drawing all coins up front and then running the resulting deterministic strategy gives the same costs as tossing coins online, because the requests do not depend on the outcomes. This is the standard mixed-strategy view of randomized online algorithms against oblivious adversaries; see Borodin and El-Yaniv, Online Computation and Competitive Analysis for a textbook treatment.

A RandStrategy is a PMF, so it covers only discrete (countably supported) mixtures of deterministic strategies. Nothing is lost for ski rental (CslibFrontier.DataStructure.Online.SkiRental), where every deterministic strategy acts as a rent-then-buy threshold in ℕ ∪ {∞}, so every randomized algorithm induces a countably supported law. Algorithms that toss fresh independent coins at unboundedly many steps, such as the marking algorithm for paging, generally induce a non-atomic law on DetStrategy P. They need a behavioural or bounded-horizon variant of this model.

A RandStrategy P is a PMF (DetStrategy P). Its expected cost on a request sequence is ∑' A, μ A * A.cost s₀ reqs in ℝ≥0∞ (RandStrategy.expectedCost), and (c, b)-competitiveness (RandStrategy.IsCompetitive) asks for E[ALG] ≤ c * OPT + b against every valid offline schedule, with c b : ℝ≥0∞ so that irrational ratios such as e / (e - 1) can be stated. Point masses recover the deterministic notions (RandStrategy.expectedCost_pure, RandStrategy.isCompetitive_pure_iff).

Lower bounds use the easy direction of Yao's principle [Yao77] (RandStrategy.exists_le_mul_expectedCost): if, under a distribution ν on request sequences, every deterministic strategy has mean cost at least the mean of a benchmark g, then every randomized strategy has a single request sequence on which its expected cost is at least g. The general averaging lemmas of CslibFrontier.Probability.Minimax bound some outcome above by a mean; this one needs a sequence on which the expected cost is at least the benchmark, which is why it is proved here.

Adaptive adversaries, which choose each request after seeing the strategy's earlier actions, are not modelled.

Main definitions #

Main results #

References #

@[reducible, inline]

A randomized online strategy for P against an oblivious adversary: a discrete (countably supported) probability distribution over deterministic online strategies, all of whose coins are drawn before the first request.

noncomputable def Cslib.DataStructure.Online.RandStrategy.expectedCost {P : Problem} (μ : RandStrategy P) (s₀ : P.State) (reqs : List P.Req) :

Expected online cost of the randomized strategy μ from initial configuration s₀ on the request sequence reqs, which the oblivious adversary fixes before the coins are drawn.

μ is (c, b)-competitive from s₀ against an oblivious adversary when its expected cost on every request sequence is at most c times any valid offline schedule's cost from s₀, plus b.

μ is (c, b)-competitive against an oblivious adversary when it is (c, b)-competitive from every admissible initial state.

μ is (c, b)-competitive across arbitrary initial states when its expected cost from any admissible s₀ is at most c times any valid offline schedule's cost from any admissible s_off, plus b.

Competitiveness across arbitrary initial states implies same-initial-state competitiveness.

@[simp]
theorem Cslib.DataStructure.Online.RandStrategy.expectedCost_pure {P : Problem} (A : DetStrategy P) (s₀ : P.State) (reqs : List P.Req) :
expectedCost (PMF.pure A) s₀ reqs = ↑(A.cost s₀ reqs)

A deterministic strategy, as a point mass, has its deterministic cost as expected cost.

For natural coefficients, the point mass at A is (c, b)-competitive exactly when A is.

For natural coefficients, the point mass at A is (c, b)-competitive across arbitrary initial states exactly when A is.

theorem Cslib.DataStructure.Online.RandStrategy.IsCompetitive.mono {P : Problem} {μ : RandStrategy P} {c₁ c₂ b₁ b₂ : ENNReal} (hc : c₁ ≤ c₂) (hb : b₁ ≤ b₂) (h : μ.IsCompetitive c₁ b₁) :
μ.IsCompetitive c₂ b₂

Monotonicity of IsCompetitive in the ratio and the additive constant.

theorem Cslib.DataStructure.Online.RandStrategy.expectedCost_map {P : Problem} {α : Type u_1} (ν : PMF α) (f : α → DetStrategy P) (s₀ : P.State) (reqs : List P.Req) :
expectedCost (PMF.map f ν) s₀ reqs = ∑' (a : α), ν a * ↑((f a).cost s₀ reqs)

Expected cost of a strategy f a drawn by first sampling the parameter a from ν.

theorem Cslib.DataStructure.Online.RandStrategy.expectedCost_bind {P : Problem} {α : Type u_1} (ν : PMF α) (f : α → RandStrategy P) (s₀ : P.State) (reqs : List P.Req) :
expectedCost (ν.bind f) s₀ reqs = ∑' (a : α), ν a * (f a).expectedCost s₀ reqs

Expected cost of a mixture ν.bind f of randomized strategies.

theorem Cslib.DataStructure.Online.RandStrategy.exists_le_mul_expectedCost {P : Problem} {ι : Type u_1} (ν : PMF ι) (s₀ : P.State) (reqs : ι → List P.Req) (g : ι → ENNReal) (b : ENNReal) (hg : ∑' (i : ι), ν i * g i ≠ ⊤) (h : ∀ (A : DetStrategy P), ∑' (i : ι), ν i * g i ≤ b * ∑' (i : ι), ν i * ↑(A.cost s₀ (reqs i))) (μ : RandStrategy P) :
∃ i ∈ ν.support, g i ≤ b * μ.expectedCost s₀ (reqs i)

The easy direction of Yao's principle [Yao77] for online lower bounds against an oblivious adversary. Let ν be a distribution on indices i, each naming a request sequence reqs i with a benchmark g i (typically a multiple of the offline optimum on reqs i). If the ν-mean of g is finite and at most b times the ν-mean cost of every deterministic strategy, then every randomized strategy μ has an index i that ν can produce with g i ≤ b * E_μ[cost on reqs i].