Regret bound for any trajectory admitting an optimistic phase run
ProvedBanditAlgorithm.mdp_ucrl2_regret_bound_of_optimistic_phase_runThere is a universal constant such that, for every MDP with states, actions and diameter , every horizon , every and every trajectory of rounds admitting an optimistic phase run, the regret satisfies
Call an optimistic phase run for a trajectory of rounds the following data: a partition of into consecutive phases , , with and , and for each phase a gain , a bias and a transition matrix , subject to
- few phases: ;
- optimism: ;
- span: for all states ;
- Bellman equation along the trajectory: for every round of phase ;
- estimation error: ;
- martingale fluctuation: .
This is the deterministic half of the analysis of UCRL2 (Lattimore--Szepesvari, Section 38.6): no probability appears, the whole argument being the per-phase telescoping of the Bellman equation, which turns the regret into the sum of the three quantities bounded in (3), (5) and (6), followed by the arithmetic that collects them into the stated bound.
Formalization Note The states and actions of the trajectory are named by functions on agreeing with below ; this lets the terminal state , which the trajectory does not record but the telescoping and the martingale term refer to, be an unconstrained extra datum. The hypothesis is not a restriction: a one-state MDP has empty diameter supremum, hence .
import Definitions.Def_FiniteMDPLearning import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.SpecialFunctions.Log.Basic open MeasureTheory ProbabilityTheory
theorem BanditAlgorithm.mdp_ucrl2_regret_bound_of_optimistic_phase_run :
∃ C : ℝ, 0 < C ∧
∀ S A n : ℕ, 2 ≤ S → 0 < A → 0 < n →
∀ δ : ℝ, δ ∈ Set.Ioo (0 : ℝ) 1 →
∀ M : FiniteMDP S A, 1 ≤ mdpDiameter M →
∀ (h : MDPTrajectory S A n) (st : ℕ → Fin S) (act : ℕ → Fin A),
(∀ t : Fin n, h t = (st t, act t)) →
∀ (K : ℕ) (τ : ℕ → ℕ) (ρ : ℕ → ℝ) (v : ℕ → Fin S → ℝ)
(q : ℕ → Fin S → Fin S → ℝ),
τ 0 = 0 → τ K = n → (∀ k, τ k ≤ τ (k + 1)) →
(K : ℝ) ≤ 3 * Real.sqrt (S * A * n) →
(∀ k < K, mdpOptimalGain M ≤ ρ k) →
(∀ k < K, ∀ x y : Fin S, v k x - v k y ≤ mdpDiameter M) →
(∀ k < K, ∀ t ∈ Finset.Ico (τ k) (τ (k + 1)),
ρ k + v k (st t)
= M.r (st t) (act t) + ∑ s', q k (st t) s' * v k s') →
(∑ k ∈ Finset.range K, ∑ t ∈ Finset.Ico (τ k) (τ (k + 1)),
∑ s', (q k (st t) s' - (M.P (st t) (act t) s' : ℝ)) * v k s'
≤ mdpDiameter M * (Real.sqrt 2 + 1) *
Real.sqrt (14 * S * Real.log (2 * S * A * n / δ)) *
Real.sqrt (S * A * n)) →
(∑ k ∈ Finset.range K, ∑ t ∈ Finset.Ico (τ k) (τ (k + 1)),
((∑ s', (M.P (st t) (act t) s' : ℝ) * v k s') - v k (st (t + 1)))
≤ mdpDiameter M * Real.sqrt (2 * n * Real.log (2 / δ))) →
mdpRegret M n h <
C * mdpDiameter M * S *
Real.sqrt (A * n * Real.log (n * S * A / δ)) := by
sorry