UCRL2 admits an optimistic phase run on the good event
ProvedBanditAlgorithm.mdp_ucrl2_optimistic_phase_run_on_good_eventFix states, actions, a horizon , a confidence level and a known reward function with values in . There is a policy, depending on these known quantities but not on the transition matrix, such that for every communicating MDP with reward function and diameter and every initial state distribution there is an event of trajectories with on which every trajectory admits an optimistic phase run.
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 probabilistic half of the analysis of UCRL2 (Lattimore--Szepesvari, Section 38.6). The policy is UCRL2 itself: it proceeds in phases ended by the doubling criterion, which gives (1); at the start of each phase it plays the memoryless deterministic action map of a solution of the Bellman optimality equation of the extended MDP built from the confidence balls, which gives (2), (3) and (4) provided the true transition rows lie in those balls. The event is the intersection of the event that they do -- controlled by the categorical concentration inequality together with a union bound over rounds and state-action pairs, and turned into (5) by Hoelder's inequality and the doubling bound on -- with the event that the martingale of (6) does not deviate, controlled by Azuma-Hoeffding.
Formalization Note The states and actions of the trajectory are named by functions on agreeing with below , so that the terminal state may be supplied as extra data.
import Definitions.Def_FiniteMDPLearning import Mathlib.Analysis.SpecialFunctions.Sqrt import Mathlib.Analysis.SpecialFunctions.Log.Basic open MeasureTheory ProbabilityTheory ENNReal
theorem BanditAlgorithm.mdp_ucrl2_optimistic_phase_run_on_good_event
(S A n : ℕ) (hS : 2 ≤ S) (hA : 0 < A) (hn : 0 < n)
(δ : ℝ) (hδ : δ ∈ Set.Ioo (0 : ℝ) 1)
(r : Fin S → Fin A → ℝ) (hr : ∀ s a, r s a ∈ Set.Icc (0 : ℝ) 1) :
∃ π : MDPPolicy S A,
∀ M : FiniteMDP S A, M.r = r → M.IsCommunicating → 1 ≤ mdpDiameter M →
∀ μ0 : MDPStateDistribution S,
∃ G : Set (MDPTrajectory S A n),
mdpMeasure M μ0 π n Gᶜ ≤ ENNReal.ofReal δ ∧
∀ h ∈ G,
∃ (st : ℕ → Fin S) (act : ℕ → Fin A) (K : ℕ) (τ : ℕ → ℕ)
(ρ : ℕ → ℝ) (v : ℕ → Fin S → ℝ) (q : ℕ → Fin S → Fin S → ℝ),
(∀ t : Fin n, h t = (st t, act t)) ∧
τ 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 / δ))) := by
sorry