Ronan Fruit
email: ronan.fruit@inria.fr

Matteo Pirotta
email: matteo.pirotta@inria.fr

Alessandro Lazaric
email: lazaric@fb.com

Near Optimal Exploration-Exploitation in Non-Communicating Markov Decision Processes

While designing the state space of an MDP, it is common to include states that are transient or not reachable by any policy (e.g., in mountain car, the product space of speed and position contains configurations that are not physically reachable). This results in weakly-communicating or multi-chain MDPs. In this paper, we introduce TUCRL, the first algorithm able to perform efficient exploration-exploitation in any finite Markov Decision Process (MDP) without requiring any form of prior knowledge. In particular, for any MDP with S C communicating states, A actions and Γ C ≤ S C possible communicating next states, we derive a O(D C √ Γ C S C AT ) regret bound, where D C is the diameter (i.e., the length of the longest shortest path between any two states) of the communicating part of the MDP. This is in contrast with existing optimistic algorithms (e.g., UCRL, Optimistic PSRL) that suffer linear regret in weakly-communicating MDPs, as well as posterior sampling or regularised algorithms (e.g., REGAL), which require prior knowledge on the bias span of the optimal policy to achieve sub-linear regret. We also prove that in weaklycommunicating MDPs, no algorithm can ever achieve a logarithmic growth of the regret without first suffering a linear regret for a number of steps that is exponential in the parameters of the MDP. Finally, we report numerical simulations supporting our theoretical findings and showing how TUCRL overcomes the limitations of the state-of-the-art.

Introduction

Reinforcement learning (RL) [START_REF] Richard | Reinforcement learning: An introduction[END_REF] studies the problem of learning in sequential decision-making problems where the dynamics of the environment is unknown, but can be learnt by performing actions and observing their outcome in an online fashion. A sample-efficient RL agent must trade off the exploration needed to collect information about the environment, and the exploitation of the experience gathered so far to gain as much reward as possible. In this paper, we focus on the regret framework in infinite-horizon average-reward problems [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF], where the exploration-exploitation performance is evaluated by comparing the rewards accumulated by the learning agent and an optimal policy. Jaksch et al. [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF] showed that it is possible to efficiently solve the exploration-exploitation dilemma using the optimism in face of uncertainty (OFU) principle. OFU methods build confidence intervals on the dynamics and reward (i.e., construct a set of plausible MDPs), and execute the optimal policy of the "best" MDP in the confidence region [e.g., [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF][START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF][START_REF] Fruit | Regret minimization in mdps with options without prior knowledge[END_REF][START_REF] Sadegh | Variance-aware regret bounds for undiscounted reinforcement learning in mdps[END_REF][START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF]]. An alternative approach is posterior sampling (PS) [START_REF] William | On the likelihood that one unknown probability exceeds another in view of the evidence of two samples[END_REF], which maintains a posterior distribution over MDPs and, at each step, samples an MDP and executes the corresponding optimal policy [e.g., [START_REF] Osband | more) efficient reinforcement learning via posterior sampling[END_REF][START_REF] Abbasi | Bayesian optimal control of smoothly parameterized systems[END_REF][START_REF] Osband | Why is posterior sampling better than optimism for reinforcement learning?[END_REF][START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF][START_REF] Agrawal | Optimistic posterior sampling for reinforcement learning: worst-case regret bounds[END_REF].

Weakly-communicating MDPs and misspecified states. One of the main limitations of UCRL [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF] and optimistic PSRL [START_REF] Agrawal | Optimistic posterior sampling for reinforcement learning: worst-case regret bounds[END_REF] is that they require the MDP to be communicating so that its diameter D (i.e., the length of the longest path among all shortest paths between any pair of states) is finite. While assuming that all states are reachable may seem a reasonable assumption, it is rarely verified in practice. In fact, it requires a designer to carefully define a state space S that contains all reachable 32nd Conference on Neural Information Processing Systems (NeurIPS 2018), Montréal, Canada. states (otherwise it may not be possible to learn the optimal policy), but it excludes unreachable states (otherwise the resulting MDP would be non-communicating). This requires a considerable amount of prior knowledge about the environment. Consider a problem where we learn from images e.g., the Atari Breakout game [START_REF] Mnih | Human-level control through deep reinforcement learning[END_REF]. The state space is the set of "plausible" configurations of the brick wall, ball and paddle positions. The situation in which the wall has an hole in the middle is a valid state (e.g., as an initial state) but it cannot be observed/reached starting from a dense wall (see Fig. 1a). As such, it should be removed to obtain a "well-designed" state space. While it may be possible to design a suitable set of "reachable" states that define a communicating MDP, this is often a difficult and tedious task, sometimes even impossible. Now consider a continuous domain e.g., the Mountain Car problem [START_REF] William | Efficient memory-based learning for robot control[END_REF]. The state is decribed by the position x and velocity ẋ along the x-axis.

The state space of this domain is usually defined as the cartesian product [-1.2, 0.6] × [-0.07, 0.07].

Unfortunately, this set contains configurations that are not physically reachable as shown on Fig. 1b. The dynamics of the system is constrained by the evolution equations. Therefore, the car can not go arbitrarily fast. On the leftmost position (x = -1.2) the speed ẋ cannot exceed 0 due to the fact that such position can be reached only with velocity ẋ ≤ 0. To have a higher velocity, the car would need to acquire momentum from further left (i.e., x < -1.2) which is impossible by design (-1.2 is the left-boundary of the position domain). The maximal speed reachable for x > -1.2 can be attained by applying the maximum acceleration at any time step starting from the state (x, ẋ) = (-1.2, 0). This identifies the curve reported in the Fig. 1b which denotes the boundary of the unreachable region. Note that other states may not be reachable. Whenever the state space is misspecified or the MDP is weakly communicating (i.e., D = +∞), OFU-based algorithms (e.g.,UCRL) optimistically attribute large reward and non-zero probability to reach states that have never been observed, and thus they tend to repeatedly attempt to explore unreachable states. This results in poor performance and linear regret. A first attempt to overcome this major limitation is REGAL.C [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF] (Fruit et al. [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF] recently proposed SCAL, an implementable efficient version of REGAL.C), which requires prior knowledge of an upper-bound H to the span (i.e., range) of the optimal bias function h * . The optimism of UCRL is then "constrained" to policies whose bias has span smaller than H. This implicitly "removes" non-reachable states, whose large optimistic reward would cause the span to become too large.

Unfortunately, an accurate knowledge of the bias span may not be easier to obtain than designing a well-specified state space. Bartlett and Tewari [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF] proposed an alternative algorithm -REGAL.Dthat leverages on the doubling trick [START_REF] Auer | Gambling in a rigged casino: The adversarial multi-armed bandit problem[END_REF] to avoid any prior knowledge on the span. Nonetheless, we recently noticed a major flaw in the proof of [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF]Theorem 3] that questions the validity of the algorithm (see App. A for further details). PS-based algorithms also suffer from similar issues. 1 To the best of our knowledge, the only regret guarantees available in the literature for this setting are [START_REF] Abbasi | Bayesian optimal control of smoothly parameterized systems[END_REF][START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF][START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF]. However, the counter-example of Osband and Roy [START_REF] Osband | Posterior sampling for reinforcement learning without episodes[END_REF] seems to invalidate the result of Abbasi-Yadkori and Szepesvári [START_REF] Abbasi | Bayesian optimal control of smoothly parameterized systems[END_REF]. On the other hand, Ouyang et al. [START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF] and Theocharous et al. [START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF] present PS algorithms with expected Bayesian regret scaling linearly with H, where H is an upper-bound on the optimal bias spans of all the MDPs that can be drawn from the prior distribution ([18, Asm. 1] and [START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF]Sec. 5]). In [18, Remark 1], the authors claim that their algorithm does not require the knowledge of H to derive the regret bound. However, in App. B we show on a very simple example that for most continuous prior distributions (e.g., uninformative priors like Dirichlet), it is very likely that H = +∞ implying that the regret bound may not hold (similarly for [START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF]). As a result, similarly to REGAL.C, the prior distribution should contain prior knowledge on the bias span to avoid poor performance.

In this paper, we present TUCRL, an algorithm designed to trade-off exploration and exploitation in weakly-communicating and multi-chain MDPs (e.g., MDPs with misspecified states) without any prior knowledge and under the only assumption that the agent starts from a state in a communicating subset of the MDP (Sec. 3). In communicating MDPs, TUCRL eventually (after a finite number of steps) performs as UCRL, thus achieving problem-dependent logarithmic regret. When the true MDP is weakly-communicating, we prove that TUCRL achieves a O( √ T ) regret that with polynomial dependency on the MDP parameters. We also show that it is not possible to design an algorithm achieving logarithmic regret in weakly-communicating MDPs without having an exponential dependence on the MDP parameters (see Sec. 5). TUCRL is the first computationally tractable algorithm in the OFU literature that is able to adapt to the MDP nature without any prior knowledge. The theoretical findings are supported by experiments on several domains (see Sec. 4).

Preliminaries

We consider a finite weakly-communicating Markov decision process [START_REF] Puterman | Markov Decision Processes: Discrete Stochastic Dynamic Programming[END_REF]Sec. 8.3] M = S, A, r, p with a set of states S and a set of actions A = s∈S A s . Each state-action pair (s, a) ∈ S × A s is characterized by a reward distribution with mean r(s, a) and support in [0, r max ] as well as a transition probability distribution p(•|s, a) over next states. In a weakly-communicating MDP, the state-space S can be partioned into two subspaces [21, Section 8.

g π M (s) := lim T →∞ E 1 T T t=1 r s t , π(s t ) ; h π M (s) := C-lim T →∞ E T t=1 r(s t , π(s t )) -g π M (s t ) ,
where the bias h π M (s) measures the expected total difference between the rewards accumulated by π starting from s and the stationary reward in Cesaro-limit2 (denoted C-lim). Accordingly, the difference of bias values h π M (s)h π M (s ) quantifies the (dis-)advantage of starting in state s rather than s . In the following, we drop the dependency on M whenever clear from the context and denote by sp S {h π } := max s∈S h π (s)min s∈S h π (s) the span of the bias function. In weakly communicating MDPs, any optimal policy π * ∈ arg max π g π (s) has constant gain, i.e., g π * (s) = g * for all s ∈ S. Finally, we denote by D, resp. D C , the diameter of M , resp. the diameter of the communicating part of M (i.e., restricted to the set S C ):

D := max (s,s )∈S×S,s =s {τ M (s → s )}, D C := max (s,s )∈S C ×S C ,s =s {τ M (s → s )}, (1)
where τ M (s → s ) is the expected time of the shortest path from s to s in M .

Learning problem. Let M * be the true (unknown) weakly-communicating MDP. We consider the learning problem where S, A and r max are known, while sets S C and S T , rewards r and transition probabilities p are unknown and need to be estimated on-line. We evaluate the performance of a learning algorithm A after T time steps by its cumulative regret ∆(A, T ) = T g * -T t=1 r t (s t , a t ). Furthermore, we state the following assumption. Assumption 1. The initial state s 1 belongs to the communicating set of states S C . While this assumption somehow restricts the scenario we consider, it is fairly common in practice. For example, all the domains that are characterized by the presence of a resetting distribution (e.g., episodic problems) satisfy this assumption (e.g., mountain car, cart pole, Atari games, taxi, etc.).

Multi-chain MDPs. While we consider weakly-communicating MDPs for ease of notation, all our results extend to the more general case of multi-chain MDPs. 3 In this case, there may be multiple communicating and transient sets of states and the optimal gain g * is different in each communicating subset. In this case we define S C as the set of states that are accessible -with non-zero probabilityfrom s 1 (s 1 included) under some stationary deterministic policy. S T is defined as the complement of S C in S i.e., S T := S \ S C . With these new definitions of S C and S T , Asm. 1 needs to be reformulated as follows:

Assumption 1 for Multi-chain MDPs. The initial state s 1 is accessible -with non-zero probabilityfrom any other state in S C under some stationary deterministic policy. Equivalently, S C is a communicating set of states.

Note that the states belonging to S T can either be transient or belong to other communicating subsets of the MDP disjoint from S C . It does not really matter because the states in S T will never be visited by definition. As a result, the regret is still defined as before, where the learning performance is compared to the optimal gain g * (s 1 ) related to the communicating set of states S C s 1 .

Truncated Upper-Confidence for Reinforcement Learning (TUCRL)

In this section we introduce Truncated Upper-Confidence for Reinforcement Learning (TUCRL), an optimistic online RL algorithm that efficiently balances exploration and exploitation to learn in non-communicating MDPs without prior knowledge (Fig. 2).

Similar to UCRL, at the beginning of each episode k, TUCRL constructs confidence intervals for the reward and the dynamics of the MDP. Formally, for any (s, a) ∈ S × A we define

B p,k (s, a) = p(•|s, a) ∈ C : ∀s ∈ S, | p(s |s, a) -p(s |s, a)| ≤ β sas p,k , (2)
B r,k (s, a) := [ r k (s, a) -β sa r,k , r k (s, a) + β sa r,k ] ∩ [0, r max ], (3)
where

C = {p ∈ R S |∀s , p(s ) ≥ 0 ∧ s p(s ) = 1}
is the (S -1)-probability simplex, while the size of the confidence intervals is constructed using the empirical Bernstein's inequality [START_REF] Audibert | Tuning bandit algorithms in stochastic environments[END_REF][START_REF] Maurer | Empirical bernstein bounds and sample-variance penalization[END_REF] as . UCRL is optimistic w.r.t. the confidence intervals so that for all states s that have never been visited the optimistic reward r(s, a) is set to r max , while all transitions to s (i.e., p(s|•, •)) are set to the largest value compatible with B p,k (•, •). Unfortunately, some of the states with N k (s, a) = 0 may be actually unreachable (i.e., s ∈ S T ) and UCRL would uniformly explore the policy space with the hope that at least one policy reaches those (optimistically desirable) states. TUCRL addresses this issue by first constructing empirical estimates of S C and S T (i.e., the set of communicating and transient states in M * ) using the states that have been visited so far, that is

β sa r,k := 14 σ 2 r,k (s, a)b k,δ N + k (s, a) + 49 3 r max b k,δ N ± k (s,
S C k := s ∈ S a∈As N k (s, a) > 0 ∪ {s t k } and S T k := S \ S C k ,
( M k , π k ) = arg max M ∈M k ,π {g π M }. (5)
The resulting algorithm follows the same structure as UCRL and it is shown in Fig. 2. The episode stopping condition at line 4 is slightly modified w.r.t. UCRL. In fact, it guarantees that one action is always executed and it forces an episode to terminate as soon as a state previously in S T k is visited (i.e., N k (s t , a) = 0). This minor change guarantees that N k+1 (s, a) = 0 for all the states s ∈ S T k that were not reachable at the beginning of the episode. The algorithm also needs minor modifications to the extended value iteration (EVI) algorithm used to solve (5) to guarantee both efficiency and convergence. All technical details are reported in App. C.

In practice, we set ρ t = 49b t,δ 3 SA t , so that the condition to remove transition reduces to N ± k (s, a) > t k /SA. This shows that only transitions from state-action pairs that have been poorly visited so far are enabled, while if the state-action pair has already been tried often and yet no transition to s ∈ S T k is observed, then it is assumed that s is not reachable from s, a. When the number of visits in (s, a) is big, the transitions to "unvisited" states should be discarded because if the transition actually exists, it is most likely extremely small and so it is worth exploring other parts of the MDP first. Symmetrically, when the number of visits in (s, a) is small, the transitions to "unvisited" states should be enabled because the transitions are quite plausible and the algorithm should try to explore the outcome of taking action a in s and possibly reach states in S T k . We denote the set of state-action pairs that are not sufficiently explored by

K k = (s, a) ∈ S C k × A : N ± k (s, a) ≤ t k /SA .

Analysis of TUCRL

We prove that the regret of TUCRL is bounded as follows.

Theorem 1. For any weakly communicating MDP M , with probability at least 1δ it holds that for any T > 1, the regret of TUCRL is bounded as

∆(TUCRL, T ) = O r max D C Γ C S C AT ln SAT δ + r max D C 2 S 3 A ln 2 SAT δ .
The first term in the regret shows the ability of TUCRL to adapt to the communicating part of the true MDP M * by scaling with the communicating diameter D C and MDP parameters S C and Γ C . The second term corresponds to the regret incurred in the early stage where the regret grows linearly. When M * is communicating, we match the square-root term of UCRL (first term), while the second term is just slightly bigger than the one appearing in UCRL by a multiplicative factor S 2 /Γ C (ignoring logarithmic terms, see Sec. 5).

We now provide a sketch of the proof of Thm. 1 (the full proof is reported in App. D). In order to preserve readability, all following inequalities should be interpreted up to minor approximations and in high probability.

Let ∆ k := s,a ν k (s, a)(g *r(s, a)) be the regret incurred in episode k, where ν k (s, a) is the number of visits to s, a in episode k. We decompose the regret as

∆(TUCRL, T ) m k=1 ∆ k • 1{M * ∈ M k } m k=1 ∆ k • 1{t k < C(k)} + m k=1 ∆ k • 1{t k ≥ C(k)}
where

C(k) = O (D C ) 2 S 3 A ln 2 ( 2SAt k /δ
) defines the length of a full exploratory phase, where the agent may suffer linear regret.

Optimism. The first technical difficulty is that whenever some transitions are disabled, the plausible set of MDPs M k may actually be biased and not contain the true MDP M * . This requires to prove that TUCRL (i.e., the gain of the solution returned by EVI) is always optimistic despite "wrong" confidence intervals. The following lemma helps to identify the possible scenarios that TUCRL can produce (see App. D.2). 4Lemma 1. Let episode k be such that

M * ∈ M k , S T k = ∅ and t k ≥ C(k). Then, either S T k = S T (case I) or K k = ∅, i.e., ∃(s, a) ∈ S C k × A for which transitions to S T k are allowed (case II).
This result basically excludes the case where S T k ⊃ S T (i.e., some states have not been reached) and yet no transition from S C k to them is enabled. We start noticing that when S T k = ∅, the true MDP M * ∈ M k = M k w.h.p. by construction of the confidence intervals. Similarly, if S T k = S T then M * ∈ M k w.h.p., since TUCRL only truncates transitions that are indeed forbidden in M * itself. In both cases, we can use the same arguments in [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF] to prove optimism. In case II the gain of any state s ∈ S T k is set to r max and, since there exists a path from S C k to S T k , the gain of the solution returned by EVI is r max , which makes it trivially optimistic. As a result we can conclude that g k g * (up to the precision of EVI).

Per-episode regret. After bounding the optimistic reward r k (s, a) w.r.t. r(s, a), the only part left to bound the per-episode regret ∆ k is the term

∆ k = s,a ν k (s, a)( g k -r k (s, a)). Similar to UCRL,
we could use the (optimistic) optimality equation and rewrite ∆ k as

∆ k = s∈S ν k (s, π k (s)) s ∈S p k (s |s, π k (s)) h k (s ) -h k (s) = ν k P k -I w k (6)
where w k := h kmin s∈S { h k }e is a shifted version of the vector h k returned by EVI at episode k, and then proceed by bounding the difference between P k and P k using standard concentration inequalities. Nonetheless, we would be left with the problem of bounding the ∞ norm of w k (i.e., the range of the optimistic vector h k ) over the whole state space, i.e.,

w k ∞ = sp S { h k } = max s∈S h k (s) -min s∈S h k (s).
While in communicating MDPs, it is possible to bound this quantity by the diameter of the MDP as sp S {h k } ≤ D [2, Sec. 4.3], in weakly-communicating MDPs D = +∞, thus making this result uninformative. As a result, we need to restrict our attention to the subset of communicating states S C , where the diameter is finite. We then split the per-step regret over states depending on whether they are explored enough or not as

∆ k s,a ν k (s, a)( g k - r k (s, a))1{(s, a) / ∈ K k } + r max s,a ν k (s, a)1{(s, a) ∈ K k }.
We start focusing on the poorly visited state-action pairs, i.e., (s, a) ∈ K k . In this case TUCRL may suffer the maximum per-step regret r max but the number of times this event happen is cumulatively "small" (App. D.4.1): Lemma 2. For any T ≥ 1 and any sequence of states and actions {s 1 , a 1 , . . . . . . s T , a T } we have:

m k=1 s,a ν k (s, a)1{N ± k (s, a) ≤ t k /SA (s,a)∈K k } ≤ T t=1 1 N ± kt (s t , a t ) ≤ t /SA ≤ 2 √ S C AT + S C A When (s, a) / ∈ K k (i.e., N ± k (s, a) > t k /SA holds), s,a ν k (s, a)( g k -r k (s, a)) • 1{(s, a) /
∈ K k } can be bounded as in Eq. 6 but now restricted on S C k , so that,

ν k ( P k -I) h k = s∈S C k ν k (s, π k (s)) s ∈S C k p k (s |s, π k (s))w k (s ) -w k (s) .
Since the stopping condition guarantees that ν k (s, π k (s)) = 0 for all s ∈ S T k , we can first restrict the outer summation to states in S C . Furthermore, all state-action pairs (s, a) / ∈ K k are such that the optimistic transition probability p k (s |s, a) is forced to zero for all s ∈ S T k , thus reducing the inner summation. We are then left with providing a bound for the range of w k restricted to the states in S C k , i.e., sp

S C k {w k } = max s∈S C k {w k }. We recall that EVI run on a set of plausible MDPs M k returns a function h k such that h k (s ) -h k (s) ≤ r max • τ M k (s → s ), for any pair s, s ∈ S, where τ M k (s → s ) is the expected shortest path in the extended MDP M k . Furthermore, since M * ∈ M k , for all s, s ∈ S C k , τ M k (s → s ) ≤ D C .
Unfortunately, since M * may not belong to M k , the bound on the shortest path in M k (i.e., τ M k (s → s )) may not directly translate into a bound for the shortest path in M k , thus preventing from bounding the range of h k even on the subset of states in S C k . Nonetheless, in App. E we show that a minor modification to the confidence intervals of M k makes the shortest paths between any two states s, s ∈ S C k equivalent in both sets of plausible MDPs, thus providing the bound sp S C k {w k } ≤ D C . The final regret in Thm. 1 is then obtained by combining all different terms.

Experiments

In this section, we present experiments to validate the theoretical findings of Sec. 3. We compare TUCRL against UCRL and SCAL. 5 We first consider the taxi problem [START_REF] Thomas | Hierarchical reinforcement learning with the MAXQ value function decomposition[END_REF] implemented in OpenAI Gym [START_REF] Brockman | Openai gym[END_REF]. 6 Even such a simple domain contains misspecified states, since the state space is constructed as the outer product of the taxi position, the passenger position and the destination. This leads to states that cannot be reached from any possible starting configuration (all the starting states belong to S C ). More precisely, out of 500 states in S, 100 are non-reachable. On Fig. 3(left) we compare the regret of UCRL, SCAL and TUCRL when the misspecified states are present (top) and when they are removed (bottom). In the presence of misspecified states (top), the regret of UCRL clearly grows linearly with T while TUCRL is able to learn as expected. On the other hand, when the MDP is communicating (bottom) TUCRL performs similarly to UCRL. The small loss in performance is most likely due to the initial exploration phase during which the confidence intervals on the transition probabilities used by UCRL (see definition of M k ) are tighter than those used by TUCRL (see definition of M + k ). TUCRL uses a "loose" bound on the 1 -norm while UCRL uses S different bounds, one for every possible next state. Finally, SCAL outperforms TUCRL by exploiting prior knowledge on the bias span.

T E[∆(UCRL, T, M )] O(T ) O(DS AT ln(T )) O D 2 S 2 A γ ln(T ) 0 T † M T * M Regret upper-bound (a) x y b d ε 1 -ε d b r = 0 r = 1 /2 r = 0 r = 1 (b) x y b d b d r = 0 r = 1 /2 r = 1 r = 0 (c)
We further study TUCRL regret in the simple three-state domain introduced in [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF] (see App. G for details) with different reward distributions (uniform instead of Bernouilli). The environment is composed of only three states (s 0 , s 1 and s 2 ) and one action per state, except in s 2 where two actions are available. As a result, the agent only has the choice between two possible policies. Fig. 3(left) shows the cumulative regret achieved by TUCRL and SCAL (with different upper-bounds on the bias span) when the diameter is infinite i.e., S C = {s 0 , s 2 } and S T = {s 1 } (we omit UCRL, since it suffers linear regret). Both SCAL and TUCRL quickly achieve sub-linear regret as predicted by theory. However, SCAL and TUCRL seem to achieve different growth rates in regret: while SCAL appears to reach a logarithmic growth, the regret of TUCRL seems to grow as √ T with periodic "jumps" that are increasingly distant (in time) from each other. This can be explained by the way the algorithm works: while most of the time TUCRL is optimistic on the restricted state space S C (i.e., S C k = S C ), it periodically allows transitions to the set S T (i.e., S C k = S), which is indeed not reachable. Enabling these transitions triggers aggressive exploration during an entire episode. The policy played is then sub-optimal creating a "jump" in the regret. At the end of this exploratory episode, S C k will be set again to S C and the regret will stop increasing until the condition N ± k ≤ t k /SA occurs again (the time between two consecutive exploratory episodes grows quadratically). The cumulative regret incurred during exploratory episodes can be bounded by the term plotted in green on Fig. 3(left). In Lem. 2 we proved that this term is always bounded by O( √ S C AT ). Therefore, it is not surprising to observe a √ T increase of both the green and red curves. Unfortunately, the growth rate of the regret will keep increasing as √ T and will never become logarithmic unlike SCAL (or UCRL when the MDP is communicating). This is because the condition N ± k ≤ t k /SA will always be triggered Θ( √ T ) times for any T . In Sec. 5 we show that this is not just a drawback specific to TUCRL, but it is rather an intrinsic limitation of learning in weakly-communicating MDPs.

Exploration-exploitation dilemma with infinite diameter

In this section we further investigate the empirical difference between SCAL and TUCRL and prove an impossibility result characterising the exploration-exploitation dilemma when the diameter is allowed to be infinite and no prior knowledge on the optimal bias span is available.

We first recall that the expected regret E[∆(UCRL, M, T )] of UCRL (with input parameter δ = 1/3T ) after T ≥ 1 time steps and for any finite MDP M can be bounded in several ways:

E[∆(UCRL, M, T )] ≤      r max T (by definition) C 1 • r max D ΓSAT ln(3T 2 ) + 1 3 [2, Theorem 2] C 2 • r max D 2 ΓSA γ ln(T ) + C 3 (M ) [2, Theorem 4] (7)
where

γ = g * M -max s,π {g π M (s) : g π M (s) < g * M }
is the gap in gain, C 1 := 34 and C 2 := 34 2 are numerical constants independent of M , and C 3 (M ) := O(max π:π(s)=a T π ) with T π a measure of the "mixing time" of policy π. The three different bounds lead to three different growth rates for the function T -→ E[∆(UCRL, M, T )] (see Fig. 4a): 1) for T † M ≥ T ≥ 0, the expected regret is linear in T , 2) for T * M ≥ T ≥ T † M the expected regret grows as √ T , 3) finally for T ≥ T * M , the increase in regret is only logarithmic in T . These different "regimes" can be observed empirically (see [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF]Fig. 5,[START_REF] Agrawal | Optimistic posterior sampling for reinforcement learning: worst-case regret bounds[END_REF]). Using [START_REF] William | On the likelihood that one unknown probability exceeds another in view of the evidence of two samples[END_REF], it is easy to show that the time it takes for UCRL to achieve sub-linear regret is at most

T † M = O(D 2 ΓSA).
We say that an algorithm is efficient when it achieves sublinear regret after a number of steps that is polynomial in the parameters of the MDP (i.e., UCRL is then efficient). We now show with an example that without prior knowledge, any efficient learning algorithm must satisfy T * M = +∞ when M has infinite diameter (i.e., it cannot achieve logarithmic regret). Example 1. We consider a family of weakly-communicating MDPs M = (M ε ) ε∈[0,1] represented on Fig. 4(right). Every MDP instance in M is characterised by a specific value of ε ∈ [0, 1] which corresponds to the probability to go from x to y. For ε > 0 (Fig. 4b), the optimal policy of M ε is such that π * (x) = b and the optimal gain is g * ε = 1 while for ε = 0 (Fig. 4c) the optimal policy is such that π * (x) = d and the optimal gain is g * 0 = 1/2. We assume that the learning agent knows that the true MDP M * belongs to M but does not know the value ε * associated to M * = M ε * . We assume that all rewards are deterministic and that the agent starts in state x (coloured in grey). Lemma 3. Let C 1 , C 2 , α, β > 0 be positive real numbers and f a function defined for all ε ∈]0, 1] by f (ε) = C 1 (1/ε) α . There exists no learning algorithm A T (with known horizon T ) satisfying both 1. for all ε ∈]0, 1], there exists

T † ε ≤ f (ε) such that E[∆(A T , M ε , x, T )] < 1/6 • T for all T ≥ T † ε , 2. and there exists T * 0 < +∞ such that E[∆(A T , M 0 , x, T )] ≤ C 2 (ln(T )) β for all T ≥ T * 0 .
Note that point 1 in Lem. 3 formalizes the concept of "efficient learnability" introduced by Sutton and Barto [START_REF] Sutton | Reinforcement learning: An introduction[END_REF]Section 11.6] i.e., "learnable within a polynomial rather than exponential number of time steps". All the MDPs in M share the same number of states S = 2 ≥ Γ, number of actions A = 2, and gap in average reward γ = 1/2. As a result, any function of S, Γ, A and γ will be considered as constant. For ε > 0, the diameter coincides with the optimal bias span of the MDP and D = sp S {h * } = 1/ε < +∞, while for ε = 0, D = +∞ but sp S {h * } = 1/2. As shown in Eq. 7 and Thm. 1, UCRL and TUCRL satisfy property 1. of Lem. 3 with α = 2 and C 1 = O(S 2 A) but do not satisfy 2. On the other hand, SCAL satisfies 2. with β = 1 and C 2 = O(H 2 SA/γ) (although this result is not available in the literature, it is straightforward to adapt the proof of UCRL [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF]Theorem 4] to SCAL) but since [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF]Theorem 12] holds only when H ≥ sp S {h * }, SCAL only satisfies 1. for ε ≥ 1/H and ε = 0 (not for ε ∈]0, 1/H[). Lem. 3 proves that no algorithm can actually achieve both 1. and 2. As a result, since TUCRL satisfies 1., it cannot satisfy 2. This matches the empirical results presented in Sec. [START_REF] Fruit | Regret minimization in mdps with options without prior knowledge[END_REF] where we observed that when the diameter is infinite, the growth rates of the regret of SCAL and TUCRL were respectively logarithmic and of order Θ( √ T ). An algorithm that does not satisfy 1. could potentially satisfy 2. but, by definition of 1., it would suffer linear regret for a number of steps that is more than polynomial in the parameters of the MDP (more precisely, e D 1/β

). This is not a very desirable property and we claim that an efficient learning algorithm should always prefer finite time guarantees (1.) over asymptotic guarantees (2.) when they cannot be accommodated.

Conclusion

We introduced TUCRL, an algorithm that efficiently balances exploration and exploitation in weaklycommunicating and multi-chain MDPs, when the starting state s 1 belongs to a communicating set (Asm. 1). We showed that TUCRL achieves a square-root regret bound and that, in the general case, it is not possible to design algorithm with logarithmic regret and polynomial dependence on the MDP parameters. Several questions remain open: 1) relaxing Asm. 1 by considering a transient initial state (i.e., s 1 ∈ S T ), 2) refining the lower bound of Jaksch et al. [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF] to finally understand whether it is possible to scale with sp S {h * } (at least in communicating MDPs) instead of D without any prior knowledge (the flaw in REGAL.D may suggest it is indeed impossible).

A Mistake in the regret bound of REGAL.D

A.1 Regularized optimistic RL (REGAL)

In weakly communicating MDPs, to avoid the over-optimism of UCRL, Bartlett and Tewari [3] proposed to penalise the optimism on g * by the optimal bias span sp S {h * }. Formally, at each episode k, their algorithm -REGAL-solves the following optimization problem:

M k = arg max M ∈M k {g * M -C k • sp S {h * M }} (8)
where C k ≥ 0 is a regularisation coefficient. Note that such optimization requires to first compute the optimal policy for a given MDP M ∈ M k and then evaluate the regularized gain. Implicitly, this defines the optimistic policy

π k = arg max π∈Π SD {g π M k }.
The term sp S {h * } can be interpreted as a measure of the complexity of the environment: the bigger sp S {h * }, the more difficult it is to achieve the stationary reward g * by following the optimal policy. In supervised learning, regularisation is often used to penalise the objective function by a measure of the complexity of the model so as to avoid overfitting. It is thus reasonable to expect that over-optimism in online RL can also be avoided through regularisation.

The regret bound of REGAL holds only when C k is set to Θ(1/ s,a ν k (s, a)). This means that REGAL requires the knowledge of (future) visit counts ν k (s, a) before episode k begins in order to tune the regularisation coefficient C k . Unfortunately, an episode stops when the number of visits in a state-action pair (s, a) ∈ S × A has doubled and it is not possible to predict the future sequence of states of a given policy for two reasons: 1) the true MDP M * is unknown and 2) what is observed is a random sampled trajectory (as opposed to expected). As a result, REGAL is not implementable. Bartlett and Tewari [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF] proposed an alternative algorithm -REGAL.D-that leverages on the doubling trick to guess the length of episode k (i.e., s,a ν k (s, a)) and proved a slightly worse regret bound than for REGAL. REGAL.D divides an episode k into sub-iterations where it applies the doubling trick techniques. At each sub-iteration j, REGAL.D guesses that the length of the episode will be at most 2 j and it solves problem [START_REF] Osband | more) efficient reinforcement learning via posterior sampling[END_REF] with C k,j ∝ 1/ √ 2 j . Then, it executes the optimistic policy π k,j on the true MDP until the UCRL stopping condition is reached or 2 j steps are performed. In the first case the episode k ends since the guess was correct, while, in the second case, a new sub-iteration j + 1 is started. This implies that for any k, j:

s,a ν k,j (s, a) ≤ 2 j , (9)
where ν k,j (s, a) denotes the number of visits to (s, a) during episode k and sub-iteration j.

A.2 The doubling trick issue

The mistake in REGAL.D is located in the proof of the regret [3, Theorem 3] (see Sec. 6.3). Let h k,j denote the optimistic bias span at episode k and sub-iteration j induced by the doubling trick. At a high level, the mistake comes from the attempt to upper-bound the term x • s,a ν k,j (s, a) by x • 2 j (for a given x) using the fact the s,a ν k,j (s, a) ≤ 2 j . Unfortunately, this is possible only under the assumption that x ≥ 0 that does not hold in the case of REGAL.D.

Formally, while bounding k∈G ∆ k , the authors have to deal with the term (derived by the combination of [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF]Eq. 15] and [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF]Lem. 11] with [3, Eq. 14]):

U := k∈G j sp S h k,j   c s,a ν k,j (s, a) -C k,j s,a ν k,j (s, a)  
where c := 2S 12 ln(2AT /δ) + 2 ln(1/δ) ≥ 0 and recall that s,a ν k,j (s, a) denotes the actual length of the episode k at sub-iteration j. In the REGAL.D proof the authors directly replaced the actual length of the episode with the guessed length 2 j := k,j showing that the first term can be upperbounded by c • s,a ν k,j (s, a) ≤ c • √ 2 j (due to Eq. 9). Concerning the second term, they write -C k,j s,a ν k,j (s, a)≤ -C k,j 2 j . Since -C k,j := -c/ √ 2 j ≤ 0 is negative, this last inequality is not true and the reverse inequality holds instead (using Eq. 9): -C k,j s,a ν k,j (s, a)≥ -C k,j 2 j . Therefore, it is not possible to guarantee that U ≤ 0 as claimed by Bartlett and Tewari [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF] (the authors probably didn't pay attention to the sign). To do this, we would need to lower-bound s,a ν k,j (s, a). Unfortunately, the only lower bound with probability 1 available for that term is min s,a {N k (s, a)} + 2. This is not big enough to cancel the term c s,a ν k,j (s, a) and C k,j needs to be increased. As a result, the term sp S {h } k∈G j C k,j s,a ν k,j (s, a) becomes too big and all the proof collapses.

Notice that a similar mistake is contained in the work by Maillard et al. [START_REF] Maillard | Optimal regret bounds for selecting the state representation in reinforcement learning[END_REF] where they use a regularized approach to learn a state representation in online settings. Similarly to [START_REF] Bartlett | REGAL: A regularization based algorithm for reinforcement learning in weakly communicating MDPs[END_REF], the authors have to bound the term s,a ν k,j (s, a)(g *g k,j ). By exploiting the fact that g *g k,j ≤ α (we omit the full expression of α for sake of clarity) [27, Eq. 17 Sec. 5.2] the authors derived the bound s,a ν k,j (s, a)(g *g k,j ) ≤ 2 j • α [START_REF] Maillard | Optimal regret bounds for selecting the state representation in reinforcement learning[END_REF]Eq. 18]. The difference g *g k,j might be negative in which case the result does not hold. Actually for the case in which there is no regularization C k,j = 0, g * ≤ g k,j which is what is used in the regret proof of UCRL. Therefore, it is very likely that the sign of g *g k,j can sometimes be negative.

In conclusion, it seems unavoidable to use a lower-bound (and not an upper-bound) on s,a ν k,j (s, a) to derive a correct regret bound for REGAL.D. As already mentioned, given the current stopping condition of an episode, the only reasonable lower bound is min s,a {N k (s, a)} + 2 and it does not seem sufficient to derive a sensible regret bound. Another research direction could be to change the stopping condition. However, one of the terms in the regret bound of REGAL (and of REGAL.D) scales as m √ T log 2 (T ) where m is the number of episodes. The term m is highly sensitive to the stopping condition and there is very little margin if we want to avoid m √ T log 2 (T ) to become the leading term in the regret bound. All the efforts we put in this direction were unsuccessful. We conjecture that regularising by the optimal bias span might not allow to learn MDPs with infinite diameter.

B Unbounded optimal bias span with continuous Bayesian priors/posteriors

Recently, Ouyang et al. [START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF] and Theocharous et al. [START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF] proposed posterior sampling algorithms and proved bounds on the expected Bayesian regret. The regret bounds that they derive scale linearly with H, where H is the highest optimal bias span of all the MDPs that can be drawn from the prior/posterior distribution. Formally, let f (θ) be the density function of the prior/posterior distribution over the family of MDPs (M θ ) parametrised by θ. Then:

H := sup θ:f (θ)>0 {sp S {h * θ }}.
In this section we present an example where H is infinite and argue that it is probably the case for most priors/posteriors used in practice.

Example 2 (Unbounded optimal bias span with continuous prior/posterior). Consider the example of Fig. 5. There is only one action in every state and so one optimal policy. The (unique) action that can be played in state s 0 loops on s 0 with probability 1θ and goes to s 1 with probability θ. The reward associated to this action is 0. Symmetrically, the (unique) action that can be played in state s 1 loops on s 1 with probability 1θ and goes to s 1 with probability θ. The reward associated to this action is 1. This MDP is characterised by the parameter θ and we denote it by M θ . For any θ ∈ [0, 1], we denote by g * θ (resp. h * θ ) the optimal gain (resp. bias) of M θ . Observe that when θ > 0, M θ is ergodic and therefore the optimal gain g * θ = 1/2 is state-independent whereas when θ = 0, M θ is multichain and the optimal gain does depend on the initial state: g * 0 (x) = 0 < 1 = g * 0 (y).

x y r = 0 r = 1 θ 1 -θ θ 1 -θ
Let's assume that the prior/posterior distribution we use on M θ is characterised by a probability density function f satisfying f (θ) > 0 for all θ > 0 and f (0) = 0. Note that this assumption does not constrain the "smoothness" of f e.g., f can have continuous derivatives of all orders. Under this assumption, f is non-zero only for ergodic MDPs. It goes without saying that for all θ ∈ [0, 1] (0 included), sp S {h * θ } < +∞ by definition (the optimal bias span is always finite). More precisely we have:

g * θ = [1/2, 1/2] T if θ > 0 [0, 1] T if θ = 0 and sp S {h * θ } = 1 2θ if θ > 0 0 if θ = 0
As a result, although sp S {h * θ } is always finite, i.e., ∀θ ∈ [0, 1], sp S {h * θ } < +∞, it is unbounded on the set of plausible MDPs θ ∈]0, 1] satisfying f (θ) > 0, i.e.,

H := sup θ∈]0,1] {sp S {h * θ }} = lim θ→0 + 1 2θ = +∞
Therefore, the regret bound O(HS √ AT ) proved by Ouyang et al. [START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF], Theocharous et al. [START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF] does not hold with prior/posterior f since H = +∞. One might argue that the proofs in [START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF][START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF] could be fixed by showing that H is bounded with probability 1. Unfortunately, for any C ∈ [0, +∞[,

the probability P(sp S {h * θ } ≥ C) = 1 2C
θ=0 f (θ)dθ > 0 of sampling an MDP with sp S {h * θ } ≥ C is strictly positive. We therefore conjecture that for this specific choice of priors/posteriors, the regret proof in [START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF][START_REF] Theocharous | Posterior sampling for large scale reinforcement learning[END_REF] cannot be fixed without major changes and new arguments. More generally, let's imagine that we have a prior/posterior distribution f satisfying:

• there exists θ 0 such that M θ0 has non-constant gain i.e., sp S g * θ0 > 0, • there exists an open neighbourhood of θ 0 denoted Θ 0 such that ∀θ ∈ Θ 0 , M θ has constant gain (e.g., M θ is weakly-communicating) and f (θ) > 0.

In this case we will face the same problem as in Ex.

while max s∈S {v n+1 (s) -v n (s)} -min s∈S {v n+1 (s) -v n (s)} > do n := n + 1 v n+1 (s) := L M v n (s), ∀s ∈ S end while g n := 1 2 max s∈S {v n+1 (s) -v n (s)} + min s∈S {v n+1 (s) -v n (s)} π n (s) ∈ arg max a∈As max r∈Br(s,a) r + max p∈Bp(s,a) p T v n , ∀s ∈ S sp S EVI k {v n+1 -v n } ≤ k and

D Regret of TUCRL

We follow the proof structure of Jaksch et al. [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF], Fruit et al. [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF] and use similar notations. Nonetheless, several parts of the proof significantly differ from [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF][START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF]:

• in Sec. D.2 we prove that after a finite number of steps, TUCRL is gain-optimistic (which is not as straightforward as in the case of UCRL),

• in Sec. D.3 we show that the sums taken over the whole state space S that appear in the main term of the regret decomposition of UCRL can be restricted to sums over S C k thanks to the new stopping condition used for episodes and the use of the condition N ± k (s, a) > t k /SA (see [START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF]),

• in Sec. D.4.1, we bound the number of time steps spent in "bad" state-action pairs (s, a)

satisfying N ± k (s, a) ≤ t k /SA, • in Sec. D.4.3, we bound the number of episodes with the new stopping condition.

D.1 Splitting into episodes

The regret of TUCRL after T time steps is defined as: ∆(TUCRL, T ) := T g * -T t=1 r t (s t , a t ). Defining ∆ k = s∈S,a∈A ν k (s, a) (g *r(s, a)) and using the same arguments as in [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF][START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF], it holds with probability 1 -δ 12T 4/5 that:

∆(TUCRL, T ) ≤ m k=1 ∆ k + r max 5 2 T ln 8T δ (
S EVI k = S C k if K k = ∅ S otherwise , M k = M k = M k if S T k = ∅ M + k otherwise . ( 12
)
TEVI returns an approximate solution of a slightly modified version of Problem 5:

( M k , π k ) = arg max M ∈M k ,π {g π M }.
In order to bound ∆ k we first show that g k g * (up to r max / √ t k -accuracy). If S T k = ∅ then by definition M k = M k = M k M * and so we can use the same argument as in [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF]Sec. 4.3 & Thm. 7]. If S T k = ∅, the true MDP M * might not be "included" in the extended MDP M + k considered by EVI and we cannot use the same argument. To overcome this problem we first assume that t k is big enough which allows us to prove a useful lemma (Lem. 4):

t k ≥ 2401 9 D C 2 SA S T k ln 2SAt k δ 2 := C(k) (13)
where

S T k := |S T k | is the cardinal of S T k . Lemma 4. Let episode k be such that M * ∈ M k , S T k = ∅ and (13) holds. Then, ∀(s, a) ∈ S C k × A, N ± k (s, a) > t k SA =⇒ S T k = S T
Proof. Assume that episode k is such that (13) holds and that for any state-action pair (s, a)

∈ S C k ×A N ± k (s, a) > t k SA ≥ 49 3 D C S T k ln 2SAt k δ Since S T k = ∅ and M * ∈ M k , for any (s, a, s ) ∈ S C k × A × S T k p(s |s, a) transition probability in M * ≤ p k (s |s, a) =0 +β sas k = 14 σ 2 p,k (s |s, a) ln(2SAt k /δ) N + k (s, a) =0 + 49 ln(2SAt k /δ) 3N ± k (s, a) ≤ 49 ln (2SAt k /δ) 3N ± k (s, a) < 1 D C S T
(s) = 0 ∀s ∈ S C k τ (s) = 1 + min a∈As      s ∈S p(s |s, a)τ (s ) ≥0      ≥ 1 + min a∈As      s ∈S C k p(s |s, a) τ (s ) ≥τmin      ≥ 1 + τ min • min a∈A    s ∈S C k p(s |s, a)    = 1 + τ min • min a∈A        1 - s ∈S T k p(s |s, a) < 1 D C S T k        > 1 + τ min   1 - s ∈S T k 1 D C S T k   = 1 + τ min 1 - 1 D C
Applying the above inequality to s ∈ S C k achieving τ ( s) = τ min yields τ min > D C . This implies that the shortest path in M * between any state s ∈ S C k ⊆ S C and any state in s ∈ S T k is strictly bigger than D C but by definition D C is the longest shortest path between any pair of states in S C . Therefore, s ∈ S T . Since s ∈ S T k was chosen arbitrarily, then S T k = S T .

As a consequence of Lem. 4, under the assumptions that M * ∈ M k , S T k = ∅ and (13) holds, there are only two possible cases:

1. Either S T k = S T , 2. or ∃(s, a) ∈ S C k × A : N ± k (s, a) ≤ t k SA .
Case 1: k and s ∈ S C k . In M , for all policies, all states in S T k are absorbing states (i.e., loop on themselves with probability 1) with maximal reward r max and all other states s ∈ S C k are transient. The optimal gain of M is thus r max and since M ∈ M

S T k = S T implies that M * ∈ M + k .
+ k we conclude that g k ≥ r max -rmax √ t k ≥ g * -rmax √ t k .
In conclusion, TEVI is always returning an optimistic policy when the assumptions of Lem. 4 hold. The regret ∆ k accumulated in episode k can thus be upper-bounded as:

∆ k = s,a ν k (s, a)(g * -r(s, a)) = s,a ν k (s, a)( g * ≤ g k + rmax √ t k -r k (s, a)) + s,a ν k (s, a)( r k (s, a) -r(s, a)) ≤ s,a ν k (s, a)( g k -r k (s, a)) := ∆ k + s,a ν k (s, a)( r k (s, a) -r(s, a)) + r max s,a ν k (s, a) √ t k
To bound the difference between the optimistic reward r k and the true reward r we introduce the estimated reward r k : ∀s, a ∈ S × A, r k (s, a)r(s, a) = r k (s, a)r k (s, a)

≤β sa r,k by construction + r k (s, a)r(s, a)

≤β sa r,k since M ∈M k ≤ 2β sa r,k
and so in conclusion:

∆ k ≤ ∆ k + 2 s,a ν k (s, a)β sa r,k + r max s,a ν k (s, a) √ t k :=U 1 k (14)

D.3 Bounding ∆ k

The goal of this section is to bound the term ∆ k := s,a ν k (s, a)( g kr k (s, a)). We start by discarding the state-action pairs (s, a) ∈ K k that have been poorly visited so far:

∆ k = s,a ν k (s, a)( g k -r k (s, a)) 1{(s, a) / ∈ K k } :=1 k (s,a) + s,a ν k (s, a) ( g k -r k (s, a)) ≤rmax 1{(s, a) ∈ K k } ≤ s,a ν k (s, a)( g k -r k (s, a))1 k (s, a) := ∆ k +r max s,a ν k (s, a)1{(s, a) ∈ K k } (15)
We will now bound the term

∆ k = s ν k (s, π k (s))( g k -r k (s, π k (s)))1 k (s, π k (s)).
We recall that the policy π k is obtained by executing TEVI(0, M k , S EVI k , ε k ) (see Alg. 1) where ε k := r max / √ t k and S EVI k and M k are defined in [START_REF] Agrawal | Optimistic posterior sampling for reinforcement learning: worst-case regret bounds[END_REF]. In all possible cases for both S EVI k and M k , this amounts to applying value iteration to a communicating MDP with finite state space S EVI k and compact action space. By [START_REF] Puterman | Markov Decision Processes: Discrete Stochastic Dynamic Programming[END_REF]Thm. 8.5.6], since the convergence criterion of value iteration is met we have:

∀s ∈ S EVI k , h k (s) + g k -r k (s, π k (s)) - s ∈S p k (s |s, π k (s)) h k (s ) ≤ r max √ t k (16)
For all s / ∈ S C k , ν k (s, π k (s)) = 0 due to the stopping condition of episode k. Therefore we can plug [START_REF] Gopalan | Thompson sampling for learning parameterized markov decision processes[END_REF] in ∆ k and derive an upper bound restricted to the set S C k ⊆ S EVI k . Before to do that, we further decompose ∆ k as:

∆ k ≤ s ν k (s, π k (s)) s ∈S p k (s |s, π k (s)) h k (s ) -h k (s) + r max √ t k 1 k (s, π k (s)) = ν k P k -I h k + r max s,a ν k (s, a) √ t k 1 k (s, a) (17)
where

ν k = (ν k (s, π k (s))1 k (s, π k (s)
)) s∈S is the vector of visit counts for each state and the corresponding action chosen by π k multiplied by the indicator function 1 k ,

P k = ( P k (s |s, π k (s))) s,s ∈S is transition matrix associated to π k in M
+ k and I is the identity matrix. We now focus on the term ν k ( P k -I) h k . Since the rows of P k sum to 1, ∀λ ∈ R, P k -I h k = P k -I h k + λe where e = (1, . . . 1) is the vector of all ones. Let's take λ :=min s∈S C k { h k (s)} and define w k := h k + λe so that for all s ∈ S C k , w k (s) ≥ 0 and min s∈S C k {w k (s)} = 0. We have:

ν k ( P k -I) h k = s∈S ν k (s, π k (s))1 k (s, π k (s)) s ∈S p k (s |s, π k (s))w k (s ) -w k (s)
We denote by k t := sup{k ≥ 1 : t k ≤ t} the current episode at time t. Whenever s t ∈ S T kt , episode k t stops before executing any action (see the stopping condition of TUCRL in Fig. 2) implying that ∀s ∈ S T k , ν k (s, π k (s)) = 0. Therefore we have:

ν k ( P k -I) h k = s∈S C k ν k (s, π k (s))1 k (s, π k (s)) s ∈S p k (s |s, π k (s))w k (s ) -w k (s)
For all states s such that 1 k (s, π k (s)) = 1, i.e., satisfying N ± k (s, π k (s)) > t k /SA, we force TEVI to set p k (s |s, π k (s)) = 0, ∀s ∈ S T k , by construction of M + k so that:

ν k ( P k -I) h k = s∈S C k ν k (s, π k (s))1 k (s, π k (s))   s ∈S C k p k (s |s, π k (s))w k (s ) -w k (s)   (18)
We can now introduce p:

s ∈S C k p k (s |s, π k (s))w k (s ) -w k (s) = s ∈S C k p k (s |s, π k (s))w k (s ) -p(s |s, π k (s))w k (s ) (19)
+   s ∈S C k p(s |s, π k (s))w k (s ) -w k (s)   (20)
By definition S C k ⊆ S C and using (1, ∞)-Hölder's inequality , the term ( 19) can be bounded as

(19) ≤ p k (•|s, π k (s)) -p(•|s, π k (s)) 1,S C • max s ∈S C k {w k (s )} where for any vector v ∈ R S , v 1,S C := s∈S C |v(s)|. Define s ∈ arg max s∈S C k {w k (s)} and s ∈ arg min s∈S C k {w k (s)}. By definition s, s ∈ S C k and w k ( s) = min s∈S C k {w k (s)} = 0. By Lem. 7, we know that for all s, s ∈ S C k , the difference w k (s ) -w k (s) = h k (s ) -h k (s) is upper bounded by r max • τ M + k (s → s ).
We also know by Lem. 6 that for all s, s ∈

S C k , τ M + k (s → s ) = τ M + k (s → s ). Since M * ∈ M + k (M * is the true MDP), we also have that for all s, s ∈ S C k ⊆ S C , τ M + k (s → s ) ≤ τ M * (s → s ) ≤ D C . In conclusion, ∀s, s ∈ S C k , w k (s ) -w k (s) ≤ r max D C and in particular max s ∈S C k {w k (s )} = w k (s) = w k (s) -w k ( s) ≤ r max D C .
Similarly to what we did to bound | r k -r| (14), we bound the distance in 1 -norm between p k and p by introducing p k :

p k -p 1,S C ≤ p k -p k 1,S C + p k -p 1,S C ≤ 2 s ∈S C β s π k (s)s p,k (21)
We now bound the contribution of the term [START_REF] Osband | Posterior sampling for reinforcement learning without episodes[END_REF]. Jaksch et al. [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF] decompose this term into a martingale difference sequence and a telescopic sum but due to the indicator function 1 k , in our case the sum is not telescopic anymore and an additional term appears.

(20) = s∈S ν k (s, π k (s))1 k (s, π k (s))    s ∈S C k p(s |s, π k (s))w k (s ) ≥0, ∀s ∈S C k 1{s ∈ S C k } -w k (s)1{s ∈ S C k }    ≤ s∈S ν k (s, π k (s))1 k (s, π k (s))   s ∈S C k p(s |s, π k (s))w k (s ) -w k (s)1{s ∈ S C k }   = t k+1 -1 t=t k   s ∈S 1 k p(s |s t , π k (s t ))w k (s ) -w k (s t )1{s t ∈ S C k }   1 k (s t , π k (s t )) = t k+1 -1 t=t k   s ∈S 1 k p(s |s t , π k (s t ))w k (s ) -w k (s t+1 )1{s t+1 ∈ S C k }   1 k (s t , π k (s t )) :=Xt (22)
+ t k+1 -1 t=t k w k (s t+1 )1{s t+1 ∈ S C k } -w k (s t )1{s t ∈ S C k } 1 k (s t , π k (s t )) not telescopic due to 1 k ! (23)
Define the filtration F t = σ(s 1 , a

(s t )) = 1{(s t , π k (s t )) / ∈ K k } = 1 -1{(s t , π k (s t )) ∈ K k }
we can make a telescopic sum appear and rewrite [START_REF] Maurer | Empirical bernstein bounds and sample-variance penalization[END_REF] as:

(23) = t k+1 -1 t=t k w k (s t+1 )1{s t+1 ∈ S C k } -w k (s t )1{s t ∈ S C k } =w k (st k+1 )1{st k+1 ∈S C k }-w k (st k )1{st k ∈S C k }≤rmaxD C (telescopic sum) + t k+1 -1 t=t k w k (s t )1{s t ∈ S C k } -w k (s t+1 )1{s t+1 ∈ S C k } ≤rmaxD C 1{(s t , π k (s t )) ∈ K k } ≤ r max D C + r max D C s,a ν k (s, a)1{(s t , π k (s t )) ∈ K k } (24)
By gathering ( 15), ( 17), ( 21), ( 22) and ( 24) we obtain the following bound for ∆ k : 14) and ( 25) we obtain:

∆ k ≤ 2r max D C s,a s ∈S C 1 k (s, a) ≤1 ν k (s, a)β sas p,k ≥0 + t k+1 -1 t=t k X t + r max D C + r max (D C + 1) s,a ν k (s, a)1{N ± k (s, a) ≤ t k /SA} + r max s,a ν k (s, a) √ t k ≥0 1 k (s, a) ≤1 ≤ 2r max D C s,a s ∈S C ν k (s, a)β sas p,k + r max (D C + 1) s,a ν k (s, a)1{(s, a) ∈ K k } + t k+1 -1 t=t k X t + r max D C + r max s,a ν k (s, a) √ t k := U 2 k ( 25
m k=1 ∆ k • 1(k) ≤ m k=1 U 1 k ≥0 • 1(k) ≤1 + m k=1 U 2 k ≥0 • 1(k) ≤1 ≤ m k=1 U 1 k + U 2 k ( 26
)
and so We will now upper-bound the terms appearing in [START_REF] Maillard | Optimal regret bounds for selecting the state representation in reinforcement learning[END_REF]. The main novelty of ( 27) compared to UCRL is the term m k=1 s,a ν k (s, a)1{(s, a) ∈ K k } which is not present in the proof of Jaksch et al. [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF]. We will show in the next section that this term is bounded by O( √ S C AT ). All the other terms are similar to those found in UCRL.

m k=1 ∆ k • 1(k) ≤2 m k=1 s,a ν k (s, a) r max D C s ∈S C β sas p,k + β s,a r,k + 2r max m k=1 s,a ν k (s, a) √ t k (27)

D.4.1 Poorly visited state-action pairs

We first notice that by definition t kt ≤ t where k t := sup{k ≥ 1 : t k ≤ t} is the current episode at time t. As a result,

1 {(s, a) ∈ K kt } := 1 N ± kt (s t , a t ) ≤ t k t/SA ≤ 1 N ± kt (s t , a t ) ≤ t /SA Instead of directly bounding m k=1
s,a ν k (s, a)1{(s, a) ∈ K k } we will bound the number of visits Z T in state-action pairs that have been visited less than t /SA times

Z T := T t=1 1 N ± kt (s t , a t ) ≤ t /SA ≥ m k=1 s,a ν k (s, a)1 {(s, a) ∈ K k }
Note that the quantity N k (s, a) is updated only after the end of episode k and the stopping condition of episodes used by TUCRL implies that (see Fig. 2):

∀k ≥ 1, ∀(s, a) ∈ S × A, ν k (s, a) ≤ N + k (s, a) (28)
Moreover, for all (s, a) / ∈ S C × A, ν k (s, a) = 0 implying that only the states s ∈ S C should be considered in the above sums. Using (28), we prove the following lemma: Lemma 5. For any T ≥ 1 and any sequence of states and actions {s 1 , a 1 , . . . . . . s T , a T } we have:

Z T ≤ 2 √ S C AT + 2S C A.
Proof. For any episode k starting at time t k , and for any state-action pair (s, a) we recall that N k (s, a) denotes the number of visits in (s, a) prior to episode k (k not included) and by ν k (s, a) the number of visits in (s, a) during episode k: (s, a)} the total number of visits in (s, a) after T time steps (T included). We first decompose Z T as:

Z T := s,a T t=1 1 max{1, N kt (s, a) -1} ≤ t /SA • 1 (s t , a t ) = (s, a) = s∈S C a Z T (s, a)
where Z T (s, a) :=

T t=1 1 max{1, N kt (s, a) -1} ≤ t /SA • 1 (s t , a t ) = (s, a)
Using the fact that for all t ≥ 1, t kt ≤ t ≤ t kt+1 -1 we have:

∀T ≥ τ ≥ 1, Z τ (s, a) = τ t=1 1 max{1, N kt (s, a) -1} ≤ t /SA ≤1 • 1{(s t , a t ) = (s, a)} ≥0 ≤ τ t=1 1{(s t , a t ) = (s, a)} ≤ t kτ +1 -1 t=1 1{(s t , a t ) = (s, a)} = N kτ +1 (s, a) (29)
Let's define t s,a as the last time that Z t (s, a) was incremented by 1: ≤ 2 ts,a /SA + 2

≤ 2 T /SA + 2 =⇒ Z T = s∈S C a Z T (s, a) ≤ 2 √ S C AT + 2S C A
where for the last inequality we used the fact that S C ≤ S (by definition) implying

S C / √ S = S C /S • √ S C ≤ √ S C
. This concludes the proof.

As a consequence of Lem. 5:

m k=1 s,a ν k (s, a)1{N ± k (s, a) ≤ t k /S C A} ≤ Z T ≤ 2 √ S C AT + 2S C A (
ν k (s, a) √ t k ≤ m k=1 s,a ν k (s, a) N + k (s, a) ≤ √ 2 + 1 √ S C AT (35)
and as shown in [6, Appendix F.7] (with the difference that S is restricted to S C ) we have:

m k=1 s,a ν k (s, a) N ± k (s, a) ≤ 6S C A + 2S C A ln(T ) (36)
The terms

D.4.3 Number of episodes

The stopping condition of episodes used by TUCRL (see Fig. 2) combines the original stopping condition of UCRL with the condition s t ∈ S T kt . Using only inequality (28), Jaksch et al. [2, Figure 1] proved that for any any sequence {s 1 , a 1 , . . . , s T , a T }, the number of episodes is bounded by 1 + 2SA + SA log 2 T SA . Since (28) also holds in our case, the total number of episodes m after T time steps can be bounded by the same quantity (with S replaced by S C since sates in S T will never be visited) plus the number of times the event s t ∈ S T kt occurs. Since whenever s t ∈ S T kt state s t is removed from S T kt+1 and s t necessarily belongs to S C (by definition), this event can happen at most S C times. By Proposition 18 in [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF] we thus have:

m ≤ 1 + 2S C A + S C A log 2 T S C A + S C (37) D.4.4 Martingale Difference Sequence X t • 1(k t )
In Sec. D.3 we already proved that (X t , F t ) t≥1 is an MDS i.e., for all t

≥ 1, E[X t |F t-1 ] = 0. Since k t is F t-1 -measurable, we also have E[X t 1(k t )|F t-1 ] = 1(k t ) • E[X t |F t-1 ] = 0 with |X t 1(k t )| ≤ r max D C .
∆ k • 1(k) ≤ 2 √ 28 + √ 14 r max S C AT ln 2SAT δ D C (Γ C -1) + 1 + 196 3 r max S C A ln 2SAT δ (3 + ln(T )) D C S C + 1 + 2r max (D C + 1)( √ S C AT + S C A) + r max D C 5 2 T ln 8T δ + 2 √ 2 + 1 r max √ S C AT + r max D C 1 + 2S C A + S C A log 2 T SA + S C ≤C • r max D C Γ C S C AT ln SAT δ + r max D C S C 2 A ln 2 SAT δ ( 39
)
where C is a numerical constant independent of the MDP instance.

From [START_REF] Ouyang | Learning unknown markov decision processes: A thompson sampling approach[END_REF], with probability at least 1 -δ 12T 5/4 :

∆(TUCRL, T ) ≤ m k=1 ∆ k + r max 5 2 T ln 8T δ = m k=1 ∆ k 1(k) see (39) + m k=1 ∆ k • (1 -1(k)) + r max 5 2 T ln 8T δ
where 1 -1(k) is the complement of 1(k) i.e., takes value 1 only when either t k < C(k) (see [START_REF] Mnih | Human-level control through deep reinforcement learning[END_REF] for the definition of C(k)) or M * / ∈ M k . As is proved in Appendix F.2 of [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF], since both (28) and Theorem 1 of Fruit et al. [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF] hold, we have that with probability at least 1

-δ 20T 5/4 ≥ 1 -δ 12T 5/4 : m k=1 ∆ k 1{M * ∈ M k } ≤ r max √ T (40)
As a consequence of (28) t k+1 ≤ 2t k . Thus, by definition of the condition t k < C(k) we have

m k=1 ∆ k • 1{t k < C(k)} ≥0 ≤ 2r max C(k) ≤ 4802 9 r max D C 2 S 3 A ln 2 2SAT δ (41)
Finally, by Boole's inequality:

1 -1(k) ≤ 1{M * / ∈ M k } + 1{t k < C(k)} and so m k=1 ∆ k • (1 -1(k)) ≤ m k=1 ∆ k • 1{M * / ∈ M k } see (40) + m k=1 ∆ k • 1{t k < C(k)} see (41)
In conclusion, there exists a numerical constant C independent of the MDP instance such that for any MDP and any T > 1, with probability at least 1 -δ 12T 5/4 -δ 12T 5/4 -δ 12T 5/4 = 1 -δ 4T 5/4 we have:

∆(TUCRL, T ) ≤ C • r max D C ΓS C AT ln SAT δ + r max D C 2 S 3 A ln 2 SAT δ (42)
Since +∞ T =2 δ 4T 5/4 = δ, by taking a union bound we have that the regret bound (42) holds with probability at least 1δ for all T > 1.

Algorithm 2 OPTIMISTIC TRANSITION PROBABILITIES (OTP) [START_REF] Jaksch | Near-optimal regret bounds for reinforcement learning[END_REF] Input: We start by proving the following. Lemma 6. For any pair (s, s)

Probability estimate p ∈ R n , confidence interval β ∈ R, value vector v ∈ R n , subset of states I ⊆ {s 1 , . . . , s m }, m ≤ n, such that s∈I p(s) = 1 Output: Optimistic probabilities p ∈ R n Let I = {s 1 , s 2 , . . . , s m } such that v(s 1 ) ≥ v(s 2 ) ≥ . . . ≥ v(s m ) p 1 (s 1 ) = min 1, p(s 1 ) + β 2 p 1 (s j ) = p(s j ), ∀1 < j ≤ m j = m i = 1 while s∈I p i (s) > 1 do i = i + 1 p i (s) = p i-1 (s), ∀s = s j p i (s j ) = max 0, 1 -s∈I\{sj } p i-1 (s) j = j -
∈ S × S C k , τ M + k (s → s) = τ M + k (s → s).
In order to analyse the properties of the stochastic shortest path we need to investigative the maximization over the confidence interval B p (s, a) either in M + k or M + k . This problem can be solved using Alg. 2. For any state-action pair (s, a), we define p M +

+ k or in M + k ) ∀i ∈ {1, . . . , n}, p i (s 1 ) ≥ p(s 1 ) ∀i ∈ {2, . . . , n}, ∀l ∈ {n -i + 2, n}, p i (s l ) = max    0, 1 - s =s l p i-1 (s )    = max 0, p(s l ) - s p i-1 (s ) -1 ≤ p(s l )
where s 1 , . . . , s n are such that τ (s 1 ) ≥ . . . ≥ τ (s n ). The algorithm may stop before n iterations but this means that the states not processed are kept at p. F Proof of Lem. 3

We prove the statement by contradiction: we assume that there exists a learning algorithm denoted A T satisfying 1. for all ε ∈]0, 1], there exists T † ε ≤ f (ε) such that E[∆(A T , M ε , x, T )] < 1/6 • T for all T ≥ T † ε , 2. there exists T * 0 < +∞ such that E[∆(A T , M 0 , x, T )] ≤ C 2 (ln(T )) β for all T ≥ T * 0 .

Any randomised strategy for choosing an action at time t is equivalent to an (a priori) random choice from the set of all deterministic strategies. Thus, it is sufficient to show a contradiction when the action played by A T at any time t is a deterministic function of the past trajectory h t := {s 1 , a 1 , r 1 , . . . , s t }. In the rest of the proof we assume that A T maps any sequence of observations h t = {s 1 , a 1 , r 1 , . . . , s t } to a (single) action a t .

By trivial induction it is easy to see that as long as state y has not been visited, the history h t is independent of ε (A T can not distinguish between different values of ε and plays exactly the same action when the past history is the same). where the sequence of states s t is obtained by executing A T on MDP M ε . We will denote by F (T, ε) the complement of F (T, ε).

For any horizon T , and independently of ε, there is only one possible trajectory h T = {s 1 , a 1 , r 1 , . . . , s T } that never goes to y and which corresponds to the trajectory observed when ε = 0. When ε = 0, the probability of this trajectory is 1 and so P (F (T, 0)) = 1 (recall that everything is deterministic in this case) while in general we have: Proof. It is easy to verify that the derivative of x -→ (1x) 1/x is:

+ E ∆(A Tn , M εn , x, T n )|F (T n , ε n ) • P F (T n , ε n ) ≥0 ≥ T n 2 • (1 -ε n ) N 0 Tn (x,b) = T n 2 • (1 -ε n ) 1/
∀x ∈]0, 1/10], d dx (1 -x) 1/x = - (1 -x) 1/x-1 x 2 ≥0 • ((1 -x) ln(1 -x) + x)
It is well known that for all x ∈]0, 1[, x <ln(1x) < x 1-x implying that (1x) ln(1x) + x is positive. Therefore, d dx (1x) 1/x is negative on ]0, 1/10] implying that x -→ (1x) 1/x is decreasing. As a result: ∀x ∈]0, 1/10], (1x) 1/x ≥ 0.9 10 > 1/3.

G Experiments -Three-State Domain

This domain was introduced in [START_REF] Fruit | Efficient bias-spanconstrained exploration-exploitation in reinforcement learning[END_REF] in order to show the inability of UCRL to learn in weakly communicating MDPs. The graphical representation of the domain is reported in Fig. 6. We keep the same means for the rewards (reported on Fig. 6) but we change the distributions: uniform distributions with range 1/5 instead of Bernouillis. In the main paper we showed how the algorithms behave when δ = 0. Here we consider the case the MDP is communicating by defining δ = 0.005. Fig. 7 shows that, as expected, TUCRL behaves similarly to UCRL. In this example it is able to outperform UCRL since the preliminary phase in which transitions to non-observed states are forbidden leads to a more conservative exploration that, due to the structure of the problem (s 1 is difficult to reach but it is also non-optimal), results in a smaller regret.

Initial state s 1 Reachable from s 1 NOT reachable from s 1 (

 111

Figure 1 :

 1 Figure 1: Examples of non-communicating domains. Fig. b represents a phase plane plot of the Mountain car domain (x, ẋ) ∈ [-1.2, 0.6] × [-0.07, 0.07]. The initial state is (-0.5, 0) and the red area corresponds to non-reachable states from the initial state. Other non-reachable states may exist. Fig. a shows the initial state, one reachable state (middle) and an unreachable one (right).

  3.1]: a communicating set of states (denoted S C in the rest of the paper) with each state in S C accessible -with non-zero probabilityfrom any other state in S C under some stationary deterministic policy, and a -possibly empty-set of states that are transient under all policies (denoted S T ). We also denote by S = |S|, S C = |S C | and A = max s∈S |A s | the number of states and actions, and by Γ C = max s∈S C ,a∈A p(•|s, a) 0 the maximum support of all transition probabilities p(•|s, a) with s ∈ S C . The sets S C and S T form a partition of S i.e., S C ∩ S T = ∅ and S C ∪ S T = S. A deterministic policy π : S → A maps states to actions and it has an associated long-term average reward (or gain) and a bias function defined as

  k (s, a) is the number of visits in (s, a) before episode k, N + k (s, a) := max{1, N k (s, a)}, N ± k (s, a) := max{1, N k (s, a)-1}, σ 2 r,k (s, a) and σ 2 p,k (s |s, a) are the empirical variances of r(s, a) and p(s |s, a) and b k,δ = ln(2SAt k /δ). The set of plausible MDPs associated with the confidence intervals is then M k = M = (S, A, r, p) : r(s, a) ∈ B r,k (s, a), p(•|s, a) ∈ B p,k (s, a)

B

  p,k (s, a) = B p,k (s, a) ∩ p(•|s, a) ∈ C : ∀s ∈ S T k and p + k (s |s, a) < ρ t k , p(s |s, a) = 0 . (4) Given B p,k , TUCRL (implicitly) constructs the corresponding set of plausible MDPs M k and then solves the optimistic optimization problem

Figure 3 :

 3 Figure 3: Cumulative regret in the taxi with misspecified states (left-top) and in the communicating taxi (left-bottom), and in the weakly communicating three-states domain with D = +∞ (right). Confidence intervals β r,k and β p,k are shrunk by a factor 0.05 and 0.01 for the three-states domain and taxi, respectively. Results are averaged over 20 runs and 95% confidence intervals are reported.

Figure 4 :

 4 Figure 4: 4a Expected regret of UCRL (with known horizon T given as input) as a function of T . 4b 4c Toy example illustrating the difficulty of learning non-communicating MDPs. We represent a family of possible MDPs M = (M ε ) ε∈[0,1] where the probability ε to go from x to y lies in [0, 1].

Figure 5 :

 5 Figure 5: Toy example of a parametrised MDP M θ with a single policy (one action per state).

  2 i.e., sup θ: f (θ)>0 {sp S {h * θ }} = +∞ and ∀C ∈ [0, +∞[, P(sp S {h * θ } ≥ C) > 0 When the set of plausible MDPs is finite, this problem cannot occur. But most priors/posteriors used in practice are continuous distributions. For instance, a Dirichlet distribution will most likely satisfy the above assumptions.C Algorithmic DetailsFor technical reasons (see App. E), we consider a slight relaxation of the optimization problem[START_REF] Sadegh | Variance-aware regret bounds for undiscounted reinforcement learning in mdps[END_REF] in which M k is replaced by a relaxed extended MDP M + k ⊇ M k defined by using 1 -norm concentration inequalities for p(•|s, a).Let B + p,k (s, a) = { p(•|s, a) ∈ C : p(•|s, a)p(•|s, a) 1 ≤ s β sas p,k } (resp. B + p,k ) be the relaxed confidence interval, then M + k (resp. M + k ) is the corresponding (relaxed)set of plausible MDPs. This relaxed optimistic optimization problem is solved by running extended value iteration (EVI) on M + k (up to accuracy k = r max / √ t k ). Technically, we restrict EVI to work on the set of states S EVI k that are optimistically reachable from the communicating set S C k . In practice, S EVI k = S C k when K k = ∅ since all the transitions to S T k are forbidden, otherwise S EVI k = S. Alg. 1 shows this variation of EVI that we name Truncated EVI. Then, at each episode k, TUCRL runs TEVI with the following parameters: ( g k , h k , π k ) = TEVI(0, M + k , S EVI k , k ). Starting from an initial vector v 0 = 0, TEVI iteratively applies (on a subset S EVI k of states) the optimal Bellman operator L M + k associated to the (extended) MDP M + k defined as ∀v ∈ R S , L M + k v(s) := max a∈As max r∈B r,k (s,a) r + ( p sa ) T v , (10) where p sa = arg max p∈B + p,k (s,a) { p T v} can be solved using [2, Fig. 2], except for (s, a) / ∈ K k for which we force p sa (s ) := 0 for any s ∈ S T k (see Alg. 2). If TEVI is stopped when Algorithm 1 TRUNCATED EXTENDED VALUE ITERATION (TEVI) Input: value vector v 0 , extended MDP M, set of states S, accuracy Output: g n , v n , π n n := 0 v 1 (s) := L M v 0 (s) := max a∈As max r∈Br(s,a) r + max p∈Bp(s,a) p T v 0 , ∀s ∈ S (see App. C)

k

  where we have exploited the fact that p(s |s, a) = 0 and σ 2 p,k (s |s, a) = 0 for any state s ∈ S T k (remember that N k (s, a, s ) = 0).We denote by τ M * (s → s ) the shortest path between any pair of states (s, s ) ∈ S × S in the true MDP M * . Fix an arbitrary target state s ∈ S T k and denote by τ (s) := τ M * (s → s) and τ min := min s∈S C k {τ (s)}. We have τ

Case 2 :

 2 This is because for any (s, a, s ) ∈ S C k × A × S T k we have p(s |s, a) = p k (s |s, a) = 0 and for any (s, a, s ) / ∈ S C k ×A×S T k we have |p(s |s, a)p k (s |s, a)| ≤ β sas p,k and so p(•|s, a) ∈ B + p,k (s, a). Since M * ∈ M + k , we can use the same argument as Jaksch et al. [2, Sec. 4.3 & Theorem 7] to prove g k ≥ g * -rmax √ t k . For any (s, a) ∈ S T k × A, B + p,k (s, a) = C is the (S -1)-simplex denoting the maximal uncertainty about the transition probabilities, and B r,k (s, a) = [0, r max ]. We will now construct an MDP M ∈ M + k with optimal gain r max . For all (s, a) ∈ S T k × A, we set the transitions to p M (s|s, a) = 1 and rewards to r M (s, a) = r max . Let (s, a) ∈ S C k × A such that N ± k (s, a) ≤ t k SA (which exists by assumption). We set p M (s |s, a) > 0 for all s ∈ S T k . This is possible because by definition of M + k , the support of p(•|s, a) is not restricted to S C k . Finally, for all state-action pairs (s, a) ∈ S C k × A, we set p M (s|s, a) > 0. This is possible because by definition of M + k , the support of p(•|s, a) is only restricted to S C

) D. 4

 4 Summing over episodes with M * ∈ M k and t k ≥ C(k) Denote by 1(k) := 1{t k ≥ C(k)} • 1{M * ∈ M k } the indicator function taking value 1 only when both M * ∈ M k and t k ≥ C(k). By gathering (

+

  r max (D C + 1) m k=1 s,a ν k (s, a)1{(s, a) ∈ K k } + T t=1 X t 1(k t ) + r max mD C

N

  k (s, a) := t k -1 t=1 1{(s t , a t ) = (s, a)} and ν k (s, a) := t k+1 -1 t=t k 1{(s t , a t ) = (s, a)} and so k (s, a) = k-1 i=1 ν i (s, a). By convention, we denote by N k T +1 (s, a) := T t=1 1{(s t , a t ) =

  t s,a := max T ≥ t ≥ 1 : max{1, N kt (s, a) -1} ≤ t /SA and (s t , a t ) = (s, a)= min T ≥ t ≥ 1 : Z t (s, a) = Z T (s, a)We denote by m s,a := k ts,a the corresponding episode. By definition, Z T (s, a) = Z ts,a (s, a) (30) and max{1, N ms,a (s, a) -1} ≤ ts,a /SA (31) Using (29) with τ = t s,a we obtain:Z ts,a ≤ N ms,a+1 (s, a)(32)Moreover, by definition of N k (s, a) and (28): N ms,a+1 (s, a) = N ms,a (s, a) + ν ms,a (s, a) ≤N + ms,a (s,a) ≤ 2 max{1, N ms,a (s, a)} ≤ max{1,Nm s,a (s,a)-1}+1 =⇒ N ms,a+1 (s, a) ≤ 2 • max{1, N ms,a (s, a) -1} + 2 (33) Gathering (30), (31), (32), and (33) we obtain: Z T (s, a) = Z ts,a (s, a) ≤ max{1, N ms,a+1 (s, a) -1} + 1 ≤ 2 • max{1, N ms,a (s, a) -1} + 2

  ν k (s, a)β sa r,k and m k=1 s,a,s ∈S C ν k (s, a)β sas p,k can then be bounded exactly as in [6, App. F.7] with S replaced by S C (except in the logarithm).

1 E. 1

 11 end while p i (s) := 0, ∀s ∈ S \ I p := p i E Shortest Path Analysis We are interesting in comparing the shortest path of any pair (s, s) ∈ S × S C k in M + k and M + k . Formally, given a target state s, the stochastic shortest path τ M (s) := τ M (s → s) of an (extended) MDP M is the (negation) solution of the following Bellman equation τ M (s) = -1 + max a∈As,p∈Bp(s,a) p T τ M , Equivalence of Shortest Path in M + k and M + k

k(

  •|s, a) = OTP( p(•|s, a), B + p,k (s, a), τ, S) and p M + k (•|s, a) = OTP( p(•|s, a), B + p,k (s, a), τ, S). It is easy to notice that the optimistic probability vectors built by Alg. 2 satisfy (either in M

7 .

 7 We start considering the case in which (s, a) ∈ K k . Recall that ∀s ∈ S T k , p(s |s, a) = 0 by definition since s is not reachable from S C k (i.e., N k (s, a, s ) = 0) and that M + k and M + k consider the same empirical average for the transition probabilities (i.e., p). The shortest path to s is such that max s {τ (s)} = τ (s) = 0 and τ (s) ≤ -1 for any state s ∈ S \ {s} (either inM + k or M + k ). As a consequence, s 1 = s and for any s ∈ S T k , p M + k (s ) ≤ p(s ) = 0, and p M + k (s ) ≤ p(s ) = 0which ensures that ∀(s, a) ∈ K k the constraints in M + k hold. This results is independent from the vector v provided to OTP. Then, for any vector v ∈ V = {v ∈ R S |v(s) = 0 ∧ v(s) ≤ -1, ∀s ∈ S \ {s}}, we have thatI 1 = I 2 , since β 1 = β 2 and p M + k (s) = p M + k (s) = 0 for any s ∈ S 2 k then: p M + k (s ) = p M + k (s ), ∀s ∈ S. Finally, ∀(s, a) ∈ (S × A) \ K k it is trivial to notice that: ∀s ∈ S, ∀v ∈ V , p M + k (s ) = p M + k (s ) since B + p,k (s, a) = B + p,k (s, a).The proof follows by noticing thatτ M + k ∈ V and τ M + k ∈ V .E.2 Bounding the bias spanLemma Consider an (extended) MDP M and define L M as the associated optimal (extended) Bellman operator. Given h 0 = 0, andh i = (L M ) i h 0 we have that ∀s, s ∈ S, h i (s )h i (s) ≤ r max τ M (s → s )where τ M (s → s ) is the minimum expected shortest path from s to s in M .Proof. The proof follows from the application of the argument in [2, Sec. 4.3.1].

Let's define N 0 T

 0 (x, b) := T t=1 1{(s t , a t ) = (x, b)} the number of visits in (x, b) with a t = A T (h t ) and ε = 0. Note that N 0 T (x, b) is not random since when ε = 0 both action b and action d loop on x with probability 1. For any ε ∈ [0, 1] and any horizon T define the event: F (T, ε) := 1≤t≤T {s t = y}

∀T ≥ 1 , 2 • 6 1 C N 0 T 1 CC 2 . 2 •

 12610122 ∀ε ∈ [0, 1], P (F (T, ε)) = (1ε) N 0 T (x,b) assume that C := max 10, max T ≥1 {N 0 T (x, b)} < +∞. Taking ε = 1/C and applying the law of total expectation we obtain:∀T ≥ 1, E[∆(A T , M 1/C , x, T )] = E ∆(A T , M 1/C , x, T )|F (T, 1/C) =T /2+1/2•N 0 T (x,b)≥T /P (F (T, 1/C)) =(1-1/C) N 0 T (x,b) + E ∆(A T , M 1/C , x, T )|F (T, 1/C) • P F (T, 1/C)where we used the fact that• N 0 T (x, b) ≤ C and (1-1/C) ∈ [0, 1] by definition, implying 1 -(x,b) ≤ 1 -1 C C ,• since C ≥ 10 we have 1 -≥ 1/3 by Lem. 8 applied to x = 1/C,• and finally under event F (T, 1/C), the regret incurred is exactlyT /2 + 1/2 • N 0 T (x, b) ≥ T /This contradicts our assumption that there existsT † 1/C < +∞ such that for all T ≥ T † 1/C , E[∆(A T , M 1/C , x, T )] < T /6 and so (45) holds. Since lim T →+∞ N 0 T (x, b) = +∞, it is possible to construct a strictly increasing sequence (T n ) n∈N such that: ∀n ∈ N, N 0 Tn+1 (x, b) > N 0 Tn (x, b), T 0 = T * 0 , T 1 ≥ C 2 , T 1 ≥ C 2 (ln(T 1 )) β and N 0 T1 (x, b) ≥ 10 We also define the (strictly decreasing) sequence: ε n := 1/N 0 Tn (x, b), ∀n ≥ 1. By the law of total expectation: E[∆(A Tn , M εn , x, T n )] = E [∆(A Tn , M εn , x, T n )|F (T n , ε n )] ≥Tn/P (F (T n , ε n ))

C 2 =⇒ T n ≥ exp 1 (2C 2 •

 212 Lem. 8 to x = ε n ≤ 1/10 since N 0 Tn (x, b) ≥ 10 for all n ≥ 1. Moreover, since by construction for all n ≥ 1, T n > T 0 = T * 0 we have by assumption that∀n ≥ 1, E[∆(A Tn , M 0 , x, T n )(ln(T n )) β ε n ) 1/βSince lim n→+∞ 1/ε n = +∞ and lim x→+∞ exp x 1/β /x α = +∞ there exists N ∈ N such that for all n ≥ N , T n ≥ f (ε n ). By assumption, for all n ≥ N ,E[∆(A Tn , M εn , x, T n )] <T n 6 which contradicts (46) therefore concluding the proof.

Figure 6 :

 6 Figure 6: Three-state domain introduced in [6]

Figure 7 :

 7 Figure 7: Communicating three-state domain (δ = 0.005)

  where t k is the starting time of episode k.

	Input: Confidence δ ∈]0, 1[, rmax, S, A
	Initialization: Set N0(s, a) := 0 for any (s, a) ∈ S × A, t := 1 and observe s1.
	For episodes k = 1, 2, ... do
	1. Set t k = t and episode counters ν k (s, a) = 0
	2. Compute estimates p k (s |s, a), r k (s, a) and a set M k 3. Compute an rmax/ √ t k -approximation π k of Eq. 5
	4. While t k == t or	a∈As t	N k (st, a) > 0 and ν k (st, π k (st)) ≤ max {1, N k (st, π k (st))} do
	(a) Execute at = π k (st), obtain reward rt, and observe st+1
	(b) Set ν k (st, at) += 1 and set t += 1
	5. Set N k+1 (s, a) = N k (s, a) + ν k (s, a)
			Figure 2: TUCRL algorithm.
	is not possible. This strategy is based on the intuition that a transition either does not exist or it should
	have a sufficiently "big" mass. However, these transitions should be periodically reconsidered in
	order to avoid under-exploration issues. More formally, let (ρ t ) t∈N be a non-increasing sequence to be defined later, for all s ∈ S T k , s ∈ S C k and a ∈ A s , the empirical mean p k (s |s, a) and variance σ 2 p,k (s |s, a) are zero (i.e., this transition has never been observed so far), so the largest probability (most optimistic) of transition from s to s through any action a is p + k (s |s, a) = 49 3 b k,δ N ± k (s,a) . TUCRL compares p + k (s |s, a) to ρ t k and forces all transition probabilities below the threshold to zero, while the confidence intervals of transitions to states that have already been explored (i.e., in S C k ) are preserved unchanged. This corresponds to constructing the alternative confidence interval
	In order to avoid optimistic exploration attempts to unreachable states, we could simply execute
	UCRL on S C k , which is guaranteed to contain only states in the communicating set (since s 1 ∈ S C by Asm. 1, we have that S C k ⊆ S C ). Nonetheless, this algorithm could under-explore state-action pairs that would allow discovering other states in S C , thus getting stuck in a subset of the communicating states of the MDP and suffering linear regret. While the states in S C k are guaranteed to be in the communicating subset, it is not possible to know whether states in S T k are actually reachable from S C k or not. Then TUCRL first "guesses" a lower bound on the probability of transition from states s ∈ S C k to s ∈ S T k and whenever the maximum transition probability from s to s compatible with the confidence intervals (i.e., p k (s |s, a)+β sas p,k ) is below the lower bound, it assumes that such transition

  the true MDP is sufficiently explored, then the greedy policyπ k := π n w.r.t. v n is k -optimistic, i.e., g k := g n ≥ g * M *k (see Sec. 3.1 for details).The policy π k is then executed until the number of visits to a state-action pair is doubled or a new state is "discovered" (i.e., s t ∈ S T kt ). Note that the condition sp S EVI EVI k . Finally, notice that when the true MDP M * is communicating, there exists an episode k s.t. for all k ≥ k, S T k = ∅ and TUCRL can be reduced to UCRL by considering M k in place of M

k {v n+1v n } ≤ k is always met after a finite number of steps since the extended MDP M + k is communicating on the restricted state space S + k .

  1 , r 1 , . . . , s t+1 ). Since k t is F t-1 -measurable:E w kt (s t+1 )1{s t+1 ∈ S C kt }1 kt (s t , π kt (s t ))|F t-1 = |s t , π kt (s t ))w kt (s )1 kt (s t , π kt (s t )) |F t-1 ] = 0 and so (X t , F t ) t≥1 is a martingale difference sequence (MDS) with |X t | ≤ r max D C . We will bound[START_REF] Audibert | Tuning bandit algorithms in stochastic environments[END_REF] in the next section (Sec. D.4) using Azuma's inequality. Using the fact that 1 k (s t , π k

	s ∈S C k t	p(s Ft-1-measurable
	implying E[X t

  Therefore, (X t 1(k t ), F t ) t≥1 is also an MDS. By Azuma's inequality (see for

	D.5 Completing the regret bound
	By gathering (27), (34), (35), (36), (38) and (37) we conclude that with probability at least 1-δ 12T 5/4 :
	2	T ln	8T δ	w.p. ≥ 1 -	δ 12T 5/4	(38)

example [2, Lemma 10]):

T t=1 X t 1(k t ) ≤ r max D C 5 m k=1

We notice that the problem of weakly-communicating MDPs and misspecified states does not hold in the more restrictive setting of finite horizon [e.g., 8] since exploration is directly tailored to the states that are reachable within the known horizon, or under the assumption of the existence of a recurrent state [e.g., 16].

For policies whose associated Markov chain is aperiodic, the standard limit exists.

In the case of misspecified states, we implicitly define a multi-chain MDP, where each non-reachable state has a self-loop dynamics and it defines a "singleton" communicating subset.

Notice that M * ∈ M k is true w.h.p. since M k is obtained using non-truncated confidence intervals.

To the best of out knowledge, there exists no implementable algorithm to solve the optimization step of REGAL and REGAL.D.

The code is available on GitHub.

Acknowledgments

This research was supported in part by French Ministry of Higher Education and Research, Nord-Pasde-Calais Regional Council and French National Research Agency (ANR) under project ExTra-Learn (n.ANR-14-CE24-0010-01).