Documentation

CslibFrontier.Probability.OptimalStopping.MatroidSecretary

Matroid secretary problems: threshold-price and partition algorithms #

In the matroid secretary problem ([BIK07], Section 2), elements of a finite matroid M : Matroid α with nonnegative weights w : α → ℝ arrive in uniformly random order σ : Fin (Fintype.card α) ≃ α. Upon each arrival the algorithm makes an irrevocable accept/reject decision maintaining matroid independence (M.Indep), seeking to maximize the total weight of selected elements relative to an offline maximum-weight independent set.

Main definitions #

Main results #

References #

Sampling splits under uniform arrival orders #

The sample set consisting of the first s elements in the arrival order σ.

The post-sample arrival sequence (elements arriving at times s, …, n - 1 in order).

@[simp]
theorem Cslib.Probability.OptimalStopping.MatroidSecretary.mem_sampleSet_iff {α : Type u_1} [Fintype α] [DecidableEq α] (σ : Fin (Fintype.card α) ≃ α) (s : ℕ) (x : α) :
x ∈ sampleSet σ s ↔ ↑(σ.symm x) < s
@[simp]
theorem Cslib.Probability.OptimalStopping.MatroidSecretary.card_filter_mem_sample_not_mem_sample {α : Type u_1} [Fintype α] [DecidableEq α] {a b : α} (hab : a ≠ b) {s : ℕ} (hs : s ≤ Fintype.card α) :
{σ : Fin (Fintype.card α) ≃ α | a ∈ sampleSet σ s ∧ b ∉ sampleSet σ s}.card = s * (Fintype.card α - s) * (Fintype.card α - 2).factorial

For any two distinct elements a ≠ b and sample size s ≤ |α|, exactly s * (|α| - s) * (|α| - 2)! arrival orders place a in the sample and b after the sample.

Under a uniformly random arrival order of n ≥ 2 elements, observing s = (n + 1) / 2 elements puts any chosen a in the sample and any distinct b after the sample with probability at least 1 / 4.

Lower bound for optimal classical secretary cutoff #

Non-asymptotic 1/e bound for the optimal secretary cutoff: for every n ≥ 1, the optimal cutoff rule selects the best of n candidates with probability at least 1/e (without an O(1/n) slack, because the optimal success probability decreases monotonically to 1/e).

Partition matroids: e-competitive independent secretary copies #

def Cslib.Probability.OptimalStopping.MatroidSecretary.partitionBlockSize {α : Type u_1} {ι : Type u_2} [Fintype α] [DecidableEq ι] (part : α → ι) (i : ι) :

Block size |{a | part a = i}|.

noncomputable def Cslib.Probability.OptimalStopping.MatroidSecretary.partitionSelect {α : Type u_1} {ι : Type u_2} [Fintype α] [DecidableEq α] [LinearOrder α] [DecidableEq ι] (part : α → ι) (w : α → ℝ) (σ : Fin (Fintype.card α) ≃ α) :

Online selection on a unit-capacity partition matroid unitPartitionMatroid part: runs Secretary.cutoffRule (Secretary.optimalCutoff m) independently on each block of size m, using toLex (w a, a) for tie-breaking independent of σ.

Every set selected by partitionSelect is independent in unitPartitionMatroid part (at most one element per block).

noncomputable def Cslib.Probability.OptimalStopping.MatroidSecretary.partitionSecretaryPMF {α : Type u_1} {ι : Type u_2} [Fintype α] [DecidableEq α] [LinearOrder α] [DecidableEq ι] (part : α → ι) (w : α → ℝ) :
PMF (Finset α)

The PMF of the independent set selected by partitionSelect under a uniformly random arrival order.

noncomputable def Cslib.Probability.OptimalStopping.MatroidSecretary.expectedPartitionSecretary {α : Type u_1} {ι : Type u_2} [Fintype α] [DecidableEq α] [LinearOrder α] [DecidableEq ι] (part : α → ι) (w : α → ℝ) :

Expected weight collected by partitionSelect under a uniformly random arrival order.

theorem Cslib.Probability.OptimalStopping.MatroidSecretary.exp_neg_one_mul_sum_le_expectedPartitionSecretary {α : Type u_1} {ι : Type u_2} [Fintype α] [DecidableEq α] [LinearOrder α] [DecidableEq ι] (part : α → ι) (w : α → ℝ) (hw : ∀ (x : α), 0 ≤ w x) {I : Finset α} (hI : (Algorithms.Lean.Matroid.unitPartitionMatroid part).Indep ↑I) :
Real.exp (-1) * ∑ x ∈ I, w x ≤ expectedPartitionSecretary part w

Partition matroid secretary theorem ([BIK07], Section 6, p. 9): running independent copies of the optimal classical secretary cutoff rule on each part of a unit-capacity partition matroid unitPartitionMatroid part achieves expected weight at least (1 / e) · ∑ x ∈ I, w x for every independent set I and nonnegative weight function w.

General matroids: O(log k) Threshold Price algorithm #

Maximum weight of a sample S, or 0 when empty.

theorem Cslib.Probability.OptimalStopping.MatroidSecretary.le_sampleMax_of_mem {α : Type u_1} {w : α → ℝ} {S : Finset α} {x : α} (hx : x ∈ S) :
w x ≤ sampleMax w S
theorem Cslib.Probability.OptimalStopping.MatroidSecretary.sampleMax_le {α : Type u_1} {w : α → ℝ} {S : Finset α} {b : ℝ} (hS : S.Nonempty) (hb : ∀ x ∈ S, w x ≤ b) :
theorem Cslib.Probability.OptimalStopping.MatroidSecretary.exists_mem_sampleMax {α : Type u_1} {w : α → ℝ} {S : Finset α} (hS : S.Nonempty) :
∃ x ∈ S, sampleMax w S = w x
noncomputable def Cslib.Probability.OptimalStopping.MatroidSecretary.thresholdPriceRun {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) (σ : Fin (Fintype.card α) ≃ α) (j : Fin (Nat.clog 2 M.eRank.toNat + 1)) :

Threshold Price Algorithm ([BIK07], Section 3.2) for fixed arrival order σ and log-scale exponent j: observes s = ⌈n/2⌉ elements (sampleSet σ s), sets threshold τ = sampleMax w S / 2^j, and greedily selects positive-weight elements above τ in the remaining stream while maintaining matroid independence (M.Indep). Filtering 0-weight elements (Section 6) ensures zero-weight ties cannot block the maximum element when sampleMax = 0.

theorem Cslib.Probability.OptimalStopping.MatroidSecretary.thresholdPriceRun_indep {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) (σ : Fin (Fintype.card α) ≃ α) (j : Fin (Nat.clog 2 M.eRank.toNat + 1)) :
M.Indep ↑(thresholdPriceRun M w σ j)

Every run of thresholdPriceRun outputs an independent set of M.

noncomputable def Cslib.Probability.OptimalStopping.MatroidSecretary.thresholdPricePMF {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) :
PMF (Finset α)

The randomized Threshold Price experiment drawing σ and j uniformly and independently.

theorem Cslib.Probability.OptimalStopping.MatroidSecretary.thresholdPricePMF_indep {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) {B : Finset α} (hB : B ∈ (thresholdPricePMF M w).support) :
M.Indep ↑B

Every set in the support of thresholdPricePMF M w is independent in M.

noncomputable def Cslib.Probability.OptimalStopping.MatroidSecretary.expectedThresholdPrice {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) :

Expected weight collected by the Threshold Price Algorithm under uniform random arrival order and uniform random threshold exponent j : Fin (Nat.clog 2 M.eRank.toNat + 1).

theorem Cslib.Probability.OptimalStopping.MatroidSecretary.expectedThresholdPrice_eq_tsum {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) :
expectedThresholdPrice M w = ∑ B : Finset α, ((thresholdPricePMF M w) B).toReal * ∑ x ∈ B, w x
theorem Cslib.Probability.OptimalStopping.MatroidSecretary.thresholdPriceRun_subset_post {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) (σ : Fin (Fintype.card α) ≃ α) (j : Fin (Nat.clog 2 M.eRank.toNat + 1)) {x : α} (hx : x ∈ thresholdPriceRun M w σ j) :
x ∈ postSampleList σ ((Fintype.card α + 1) / 2) ∧ 0 < w x ∧ sampleMax w (sampleSet σ ((Fintype.card α + 1) / 2)) / 2 ^ ↑j ≤ w x

Every element chosen by thresholdPriceRun arrived after the sample, has strictly positive weight, and exceeds or equals the sampled threshold τ = sampleMax w S / 2 ^ j.

theorem Cslib.Probability.OptimalStopping.MatroidSecretary.sum_le_mul_expectedThresholdPrice {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) (hw : ∀ (x : α), 0 ≤ w x) (hwb : ∀ (x y : α), x ≠ y → w x = w y → w x = 0) (hnl : ∀ (x : α), M.Indep {x}) (hn : 2 ≤ Fintype.card α) {I : Finset α} (hI : M.Indep ↑I) :
∑ x ∈ I, w x ≤ 32 * ↑(Nat.clog 2 M.eRank.toNat + 1) * expectedThresholdPrice M w

Theorem 3.2 (Threshold Price Algorithm) of [BIK07] (Section 3.2, p. 5): on well-behaved nonnegative weights (w x = w y → w x = 0 for x ≠ y) over a loopless finite matroid (∀ x, M.Indep {x}) with 2 ≤ |α|, the expected weight output by thresholdPriceRun is at least 1 / (32 * (⌈log₂ k⌉ + 1)) of the weight of any independent set I, where k = M.eRank.toNat.

theorem Cslib.Probability.OptimalStopping.MatroidSecretary.sum_le_sixtyFour_clog_mul_expectedThresholdPrice {α : Type u_1} [Fintype α] [DecidableEq α] (M : Matroid α) [DecidablePred fun (S : Finset α) => M.Indep ↑S] (w : α → ℝ) (hw : ∀ (x : α), 0 ≤ w x) (hwb : ∀ (x y : α), x ≠ y → w x = w y → w x = 0) (hnl : ∀ (x : α), M.Indep {x}) (hn : 2 ≤ Fintype.card α) (hr : 2 ≤ M.eRank.toNat) {I : Finset α} (hI : M.Indep ↑I) :
∑ x ∈ I, w x ≤ 64 * ↑(Nat.clog 2 M.eRank.toNat) * expectedThresholdPrice M w

O(log k) form of Theorem 3.2 for rank k = M.eRank.toNat ≥ 2: since ⌈log₂ k⌉ + 1 ≤ 2 * ⌈log₂ k⌉, Threshold Price is (64 * ⌈log₂ k⌉)-competitive.