Regret Guarantees for Model-Based Reinforcement Learning with Long-Term Average Constraints
Abstract
We consider the problem of constrained Markov
Decision Process (CMDP) where an agent interacts with an ergodic Markov Decision Process.
At every interaction, the agent obtains a reward and incurs
K costs.
The agent aims to maximize the longterm average reward while simultaneously keeping the K long-term average costs lower than a certain threshold.
In this paper, we propose CMDPPSRL, a posterior sampling based algorithm using which the agent can learn optimal policies to interact with the CMDP.
We show that with the assumption of slackness, characterized by κ , the optimization problem is feasible for the sampled MDPs.
Further, for MDP with S states, A actions, and mixing time T M , we prove that following CMDPPSRL algorithm, the agent can bound the regret of not accumulating rewards from an optimal policy by ˜ O
( T M S √ AT ) .
Further, we show that the violations for any of the K constraints is also bounded by ˜ O
( T M S √ AT ) .
To the best of our knowledge, this is the ﬁrst work that obtains a ˜ O ( √ T ) regret bounds for ergodic MDPs with long-term average constraints using a posterior sampling method.
INTRODUCTION
Consider a wireless sensor network where the devices aim to update a server with sensor values.
At time t , the device can choose to send a packet to obtain a reward of 1 unit or to queue the packet and obtain 0 reward.
However, communicating a packet results in p t power consumption.
At time t , if the wireless channel condition, s t , is weak and the device chooses to send a packet, the resulting instantaneous power consumption, p t , is high.
The goal is to send as many packets as possible while keep the average power consumption, (cid:80)
Tt =1 p t /T , within some limit, say C .
This environment has state ( s t , q t ) as the channel condition and queue length at time t .
To limit the power consumption, the agent may choose to send packets when the channel condition is good or when the queue length grows beyond a certain threshold.
The agent aims to learn the policies in an online manner which requires efﬁciently balancing exploration of statespace and exploitation of the estimated system dynamics [Singh et al., 2020].
Similar to the example above, many applications require to keep some costs low while simultaneously maximizing the rewards [Altman, 1999].
Owing to the importance of this problem, in this paper, we consider the problem of constrained Markov Decision Processes (CMDP).
We aim to develop a reinforcement learning algorithm following which an agent can bound the constraint violations and the regret in obtaining the optimal reward to o ( T ) .
The problem setup, where the system dynamics are known, is extensively studied [Altman, 1999].
For a constrained setup, the optimal policy is possibly stochastic
[Altman, 1999, Puterman, 2014].
In the domain where the agent learns the system dynamics and aims to learn good policies online, there has been work where to show asymptotic convergence to optimal policies [Gattami et al., 2021], or even provide regret guarantees when the MDP is episodic [Zheng and
Ratliff, 2020, Ding et al., 2021].
Recently, [Singh et al., 2020] considered the problem of online optimization of inﬁnite-horizon communicating Markov Decision Processes with long-term average constraints.
They provide an optimism based algorithm where conﬁdence bounds on each transition probabilities p ( s (cid:48) | s, a ) is constructed.
Using this, they obtain a regret bound of ˜ O (cid:16) √ SAT + T M T 2 / 3 (cid:17) 1 .
Additionally, ﬁnding the optimistic policy is a computationally intensive task as the number of optimization variables become S 2 × A for MDP with S states and A actions.
In this paper, we consider the reinforcement learning an inﬁnite-horizon ergodic MDP [Tarbouriech and Lazaric,
2019, Gattami et al., 2021] with long-term average constraints.
We use (cid:96) 1 deviation bounds [Jaksch et al., 2010] and use a Bellman error analysis to bound the reward regret of the MDP as ˜ O
( T M S √ AT ) .
Additionally, we also bound the constraint violations as ˜ O
( T M S √ AT ) .
We propose a posterior sampling based algorithm where we sample the transition dynamics using a Dirichlet distribution [Osband et al., 2013], which achieves this regret bound.
Unlike optimistic algorithms, the sampled MDP may not be infeasible for the constrained optimization. Hence, we consider slackness characterized by Slater’s parameter Ding et al. [2020], which allows us to prove that the optimization problem is feasible even with the sampled MDPs.
Posterior sampling also helps to reduces the optimization variables, to ﬁnd only the optimal policy for the sampled MDP, to only S × A variables.
Finally, we provide numerical examples where the algorithm converges to the calculated optimal policies.
To the best of our knowledge, this is the ﬁrst work to obtain O ( √ T ) regret guarantees for the inﬁnite horizon long-term average constraint setup with posterior sampling.
RELATED WORK
Stochastic Optimization using Markov Decision Processes has very rich roots
[Howard, 1960].
There have been work in understanding convergence of the algorithm to ﬁnd optimal policies for known MDPs [Bertsekas and Tsitsiklis, 1996,
Altman, 1999].
Also, when the MDP is not known, there are algorithms with asymptotic guarantees for learning the optimal policies [Watkins and Dayan, 1992] which maximize an objective without any constraints.
Recent algorithms even achieve ﬁnite time near-optimal regret bounds with respect to the number of interactions with the environment [Jaksch et al., 2010, Osband et al., 2013, Agrawal and Jia, 2017, Jin et al., 2018].
Jaksch et al.
[2010] uses the optimism principle for minimizing regret for weakly communicating inﬁnite horizon MDPs with bounded diameter.
Osband et al. [2013] extended the analysis of Jaksch et al. [2010] to posterior sampling for episodic MDPs and bounded the Bayesian regret and further improved the regret bounds Osband and Van Roy [2017].
Agrawal and Jia [2017] uses a posterior sampling based approach and obtains a frequentist regret for the inﬁnite horizon MDPs with bounded diameter.
In many reinforcement learning settings, the agent not only wants to maximize the rewards but also satisfy certain cost constraints
[Altman, 1999].
Early works in this area were pioneered by [Altman and Schwartz, 1991].
They provided an algorithm which combined forced explorations and following policies optimized on empirical estimates to obtain an asymptotic convergence.
[Borkar, 2005] studied the constrained RL problem using actor-critic and a two time-scale framework [Borkar, 1997] to obtain asymptotic performance guarantees.
Very recently, [Gattami et al., 2021] analyzed the asymptotic performance for Lagrangian based algorithms for inﬁnite-horizon long-term average constraints.
Inspired by the ﬁnite-time performance analysis of reinforcement learning algorithm for unconstrained problems, there has been a signiﬁcant thrust in understanding the ﬁnitetime performances of constrained MDP algorithms.
[Zheng and Ratliff, 2020] considered an episodic CMDP and use an optimism based algorithm to bound the constraint violation as ˜ O ( √ T 1 . 5 ) with high probability.
[Kalagarla et al., 2020] also considered the episodic setup to obtain PAC-style bound for an optimism based algorithm.
[Ding et al., 2021] considered the setup of H -episode length episodic CMDPs with d -dimensional linear function approximation to bound the constraint violations as ˜ O
( d √ H 5 T ) by mixing the optimal policy with an exploration policy.
[Efroni et al., 2020] proposes a linear-programming and primal-dual policy optimization algorithm to bound the regret as O ( S √ H 3 T ) .
[Qiu et al., 2020] proposed an algorithm which obtains a regret bound of ˜ O
( S √ AH 2 T ) for the problem of adversarial stochastic shortest path.
Compared to these works, we focus on setting with inﬁnite horizon long-term average constraints.
After developing a better understanding of the policy gradient algorithms [Agarwal et al., 2020], there has been theoretical work in the area of model-free policy gradient algorithms for constrained MDP and safe reinforcement learning as well.
[Xu et al., 2020] consider an inﬁnite horizon discounted setup with constraints and obtain global convergence using policy gradient algorithms.
[Ding et al., 2020] also considers an inﬁnite horizon discounted setup.
They use a natural policy gradient to update the primal variable and sub-gradient descent to update the dual variable.
Recently [Singh et al., 2020] considered the setup of inﬁnitehorizon CMDPs with long-term average constraints and obtain a regret bound of ˜ O
( T 2 / 3 ) using an optimism based algorithm and forced explorations.
We consider a similar setting with ergodic CMDP and propose a posterior sampling based algorithm to bound the regret as ˜ O
( poly ( DSA ) √ T ) using explorations assisted by the ergodicity of the MDP.
PROBLEM FORMULATION
We consider an inﬁnite horizon discounted Markov decision process (MDP) M , deﬁned by the tuple (cid:0) S , A , P, r, c 1 , · · · , c k (cid:1) .
S denotes a ﬁnite set of state space with |S| = S , and A denotes a ﬁnite set of actions with |A| =
A .
P : S ×
A → ∆( S ) denotes the probability
P ( s (cid:48) | s, a ) of transitioning to state s (cid:48) from state s after taking action a .
r : S × A → [0 , 1] denotes the average reward in state s after taking action a . c k : S ×
A → [0 , 1] denotes average cost incurred by the agent for constraint k ∈ [ K ] = { 1 , 2 , · · · , K } after taking action a in state s .
We use a stochastic policy π : S → ∆( A ) , such that given state s , π ( a | s ) is the probability of selecting action a .
Note that the a policy π induces a Markov chain over the state space of the MDP.
Pertaining to the Markov chains generated by the policies for M , we now deﬁne the mixing time of MDP.
Deﬁnition 1 (Mixing Time) .
Consider the Markov Chain induced by the policy π on the MDP M .
Let T πs → s (cid:48) be a random variable that denotes the ﬁrst time step when this Markov Chain enters state s (cid:48) starting from state s .
Then, the mixing time of the MDP M is deﬁned as:
[Equation]
Similar to Singh et al.
[2020], let P tπ ( s ) be the t step state distribution starting from state s following policy π and P π be the steady-state state distribution generated by policy π .
Our ﬁrst assumption on the MDP allows any policy to reach any state s (cid:48) starting from any state s , and to converge to a steady state.
We formalize the result in the following assumption:
Assumption 1. The MDP M is ergodic, or (cid:107) P tπ ( s ) −
P π (cid:107) TV ≤ Cρ t with P π being the long-term steady state distribution induced by policy π , and C > 0 and ρ <are problem speciﬁc constants.
And, the mixing time of the
MDP M is ﬁnite or T M < ∞ .
After discussing the transition dynamics of the system, we move to the rewards and costs of the MDP M .
Assumption 2.
The reward function r ( s, a ) and the costs c k ( s, a ) , k ∈ [ K ] are known to the agent.
We note that in most of the problems, rewards are engineered.
Hence, Assumption 2 is justiﬁed in many setups.
However, the system dynamics are stochastic and typically not known.
Following a policy π , the expected long-term average cost are given by ζ P,kπ .
Also, we denote the average long-term reward using ζ P,kπ .
Formally, we have:
[Equation]
For brevity, in the rest of the paper, E s t ,a t ,s t +1 ; t ≥ 0 [ · ] will be denoted as E ρ,π,P [ · ] , where s 0 ∼ ρ 0 ( s 0 ) , a t ∼ π ( s t | a t ) , s t +1 ∼ P ( s t +1 | s t , a t ) .
Both, ζ P,kπ and λ P,rπ satisfy the following form of Bellman equation:
[Equation]
where h P,rπ ( s ) is the bias for reward and h P,kπ is the bias for cost k ∈ [ K ] .
The objective is ﬁnd a policy π ∗ which is the solution of the following optimization problem.
[Equation]
where C k ∀ k ∈ [ K ] are the bounds on the average costs which the agent needs to satisfy.
After formulating the optimization problem, we now state our next assumption characterizing the slackness.
Assumption 3.
There exists a policy π , and one constant
[Equation]
such that [Equation] The slackness assumption is mild because, in various applications some a priori knowledge about a strictly feasible policy is available. Hence, this assumption is again a standard assumption in the constrained RL literature Efroni et al.
[2020], Ding et al.
κ is referred as Slater’s constant.
Ding et al.
[2021] assumes that the Slater’s constant κ is known.
Any online algorithm starting with no prior knowledge will require to obtain estimates of transition probabilities P and obtain reward r and costs c k ,
∀ k ∈
[ K ] for each state action pair.
Initially, when algorithm does not have good estimates of the model, it accumulates a regret as well as violates constraints as it does not know the optimal policy.
We deﬁne reward regret R ( T ) as the difference between the cumulative reward obtained r t vs the expected rewards from running the optimal policy π ∗ for T steps, or
[Equation]
Additionally, we deﬁne constraint regret R k ( T ) for each constraint k ∈
[ K ] as the gap between the cumulative cost incurred c kt , k ∈ [ K ] and constraint bounds, or R k ( T [Equation]
=
[Equation]
where ( x ) + = max(0 , x ) .
In the following section, we present a model-based algorithm to obtain this policy π ∗ , and reward regret and the constraint regret accumulated by the algorithm.
THE CMDP-PSRL ALGORITHM
For inﬁnite horizon optimization problems (or τ → ∞ ), we can use steady state distribution of the state to obtain expected long-term rewards or costs [Puterman, 2014].
We use
[Equation]
where d Pπ ( s, a ) is the steady state joint distribution of the state and actions under policy π .
Based on the above formulation, we can solve the joint optimization problem of following form
[Equation]
with the following set of constraints,
[Equation]
for all s (cid:48) ∈ S , ∀ s ∈ S , and ∀ a ∈ A .
Equation (15) denotes the constraint on the transition structure for the underlying
Markov Process.
Equation (16) ensures that the solution is a valid probability distribution.
Finally, Equation (17) are the constraints for the constrained MDP setup which the policy must satisfy.
Note that arguments in Equation (14) are linear, and the constraints in Equation (15) and Equation (16) are linear, this is a linear programming problem.
Since convex optimization problems can be solved in polynomial time [Potra and Wright, 2000], we can use standard approaches to solve
Equation (14).
After solving the optimization problem, we obtain the optimal policy from the obtained steady state distribution d ∗ ( s, a ) as,
[Equation]
Since we assumed that the CMDP is ergodic, the Markov
Chain induced from policy π is ergodic.
Hence, every state is reachable following the policy π ∗ , we have P ( s ) > 0 and Equation (18) is deﬁned for all states s ∈ S .
Further, since we assumed that the induced Markov Chain is irreducible for all stationary policies, we assume Dirichlet distribution as prior for the state transition probability
P ( s (cid:48) | s, a ) .
Dirichlet distribution is also used as a standard prior in literature [Agrawal and Jia, 2017, Osband et al., 2013].
Further, there exists a steady state distribution when the transition probability is sampled from a Dirichlet distribution [Agarwal et al., 2022, Proposition 1].
The complete constrained posterior sampling based algorithm, which we name CMDP-PSRL, is described in Algorithm 1.
The algorithm proceeds in epochs, and a new epoch is started whenever the visitation count in epoch e ,
ν e
( s, a ) , is at least the total visitations before episode e , N e ( s, a ) , for any state action pair (Line 8).
In Line 9, we sample transition probabilities ˜ P using the updated posterior and in Line 10, we update the policy using the optimization problem speciﬁed in Equation (14)-(17) for P = ˜ P e .
Further, if the sampled MDP does not satisfy the cost constraint in
Equation (17), we ignore that constraint 2 for that epoch.
1: Input: S , A , r, c 1 , · · · , c K 2: Initialize N ( s, a, s (cid:48) )
= 1 ∀ ( s, a, s (cid:48) )
∈ S×A×S , π e ( a | s )
=|A| ∀ ( a, s ) ∈
A × S , e = 0 , ν e ( s, a ) =
N e ( s, a ) =
∀
( s, a ) ∈ S
×
A 3: for time index t = 1 , 2 , · · · do 4:
Observe state s 5:
Play action a ∼ π ( ·| s ) 6:
Observe rewards { r k } and next state s (cid:48) 7: ν e ( s, a )+ = 1 , N ( s, a, s (cid:48) )
+ =8: if ν e ( s, a ) ≥ max(1 , N e ( s, a )) for any s, a then 9: ˜
P e ( s (cid:48) | a, s ) ∼ Dir ( N ( s, a, s (cid:48) )) ∀ ( s, a, s (cid:48) ) 10:
Solve steady state distribution d ( s, a ) as the solution of the optimization problem in Equations (14-17) for ˜ P e .
Obtain optimal policy for next epoch, e + 1 , π e +1 as π e +1 ( a | s ) =
d ( s, a ) (cid:80) a ∈A d ( s, a ) 12: e = e +13: t e = t 14: ν e ( s, a ) = 0 , N e
( s, a ) =
(cid:80) ee (cid:48) ν e (cid:48) ( s, a ) ∀
( s, a ) 15: end if 16: end for
ANALYSIS
We ﬁrst obtain the feasibility of the optimization problem Equation (14)-(17) for the sampled MDP. We note that we assumed slackness in the true MDP with transition probabilities P . Hence, if the the sampled MDP is close to the true
MDP, the deviation in the cost will be less and there will be a policy which satisﬁes the constraint in Equation (17).
We formalize this intuition in the following result.
Lemma 1.
Following Algorithm 1, if t e +1 − t e ≥ √ T and
[Equation]
a policy π which satisﬁes,
[Equation]
and the optimization problem in Equation (14) - (17) is feasible, where t e is the start time of epoch e .
Proof Outline.
We consider the policy π which satisﬁes the
Slater’s condition in Equation (9).
We then consider the
Bellman error of taking one step in MDP with transition probabilities ˜
P e
and then following policy π on the MDP with transition probabilities P .
Now, using [Agarwal et al., 2022, Lemma 1] relating the average costs following policy π with P and ˜ P e ( ζ P,kπ , and ζ ˜ P e ,k π for all k ∈
[ K ] respectively) with the Bellman error gives the required result.
After obtaining a feasible policy π e maximizing rewards for the sampled MDP, we now quantify is regret.
We note that when optimizing for long-term average rewards and long-term average constraints, we want to simultaneously minimize the reward regret and the constraint regrets.
Further, if we know the optimal policy π ∗ before hand, the deviations resulting from the stochasticity of the process can still result in some constraint violations.
Also, since we sample a MDP, the policy which is feasible for the MDP may violate constraints on the true MDP.
We want to bound this gap between K costs for the two MDPs as well.
We aim to quantify the regret from (R.1) deviation of longterm average rewards of the optimal policy because of incorrect knowledge of the MDP ( λ P,rπ ∗ − λ ˜ P e ,r π e ), (R.2) deviation of the long-term average rewards generated by the optimal policy for the sampled MDP on the sampled MDP and the long-term average rewards generated by the optimal policy for the sampled MDP on the true MDP ( λ ˜ P e ,r π e − λ P,rπ e ), and (R.3) deviation of the expected rewards from following the optimal policy of the sampled MDP ( λ P,rπ e − r ( s t , a t ) ).
Similarly, the constraint violations for each k ∈ [ K ] are incurred from (C.1) deviation of long-term average rewards of the optimal policy because of incorrect knowledge of the MDP ( C k − ζ ˜ P e ,k π e ), (C.2) deviation of the long-term average costs generated by the optimal policy for the sampled MDP on the sampled MDP and the long-term average costs generated by the optimal policy for the sampled MDP on the true MDP ( ζ ˜ P e ,r π e − λ P,rπ e ), and (C.3) deviation of the expected costs from following the optimal policy of the sampled MDP ( ζ P,rπ e − c k ( s t , a t ) ).
We now prove the regret bounds for Algorithm 1.
We ﬁrst give the high level ideas used in obtaining the bounds on regret.
We divide the regret into regret incurred in each epoch e .
Then, we use the posterior sampling lemma
[Osband et al., 2013, Lemma 1] to obtain the equivalence between the longterm average rewards of the true MDP M and the long-term average rewards for the optimal value of the sampled MDP (cid:99) M .
This step allows us to deal with the regret from (R.1) . Then we use the Bellman error formulation to relate average rewards for the policy π e on P and ˜ P e [Agarwal et al., 2022].
Combining this with Azuma’s concentration inequality for Martingales allows us to bound the regret from (R.2) and (R.3) . Bounding constraint violations requires similar considerations for (C.2) and (C.3) .
Further, (C.1) becomes zero if Equation (17) is feasible for the sampled MDP.
However, if Equation (17) is not feasible, the cost may be as high as 1 ( c k ( s, a ) ≤ 1 ∀ k ∈
[ K ] ). We bound the violations by bounding the time-steps for which the optimal policy for unconstrained optimization runs.
To obtain bounds on the regret, we ﬁrst note that the total number of epochs, E , for which the Algorithm 1 runs is bounded by O (1 + 2 SA + SA log( T ) from [Jaksch et al., 2010, Proposition 1].
We formally state the regret bounds and constraint violation bounds in Theorem 1 which we prove rigorously in
Appendix A.
Theorem 1.
The expected reward regret E [ R ( T )] , and the expected constraint regret E [ R k ( T )] ∀ k ∈ [ K ] of Algorithm 1 are bounded as
[Equation]
Proof Outline.
We break the cumulative regret into the regret incurred in each epoch e .
This gives us:
[Equation]
The Equation (22) follows from [Osband et al., 2013, Lemma 1] for regret each each epoch of Equation (21). Proceeding from Equation (23) requires additional consideration. Typical proof techniques to bound regret requires a bounded bias-span ( max s,s (cid:48)
( h ˜ P e ,r π [Equation] ( s [Equation]
)) ) which may be large for the sampled MDP. For this, we consider an MDP for the transition probability P re satisﬁes λ P re [Equation]
e
[Equation] , where [Equation] [Equation]
where ¯ P t e ( ·| s, a ) is the estimated transition probability given s, a at time t e . We now have, [Equation] The ﬁrst term of Equation (25) is bounded by bounding the expected Bellman error.
The second term is converted to a Martingale sequence by conditioning it on the state s t e and is bounded using the ergodicity of the MDP M and
Azuma’s concentration inequality.
The complete proof on bounding the regret is provided in Appendix A.
Regarding the constraint violations, for each k ∈ [ K ] , we want to bound,
[Equation]
We divide the constraint violation regret into regret over epochs as well.
Now, for each epoch, we know that the constraint is satisﬁed by the policy for the sampled MDP.
This allows us to obtain:
[Equation]
[Table]
[Equation]
The ﬁrst term in Equation (28) denotes the difference between the incurred costs and the expected costs from following policy π e . The second term denotes the difference between the expected costs from policy π e on the true MDP and on the sampled MDP.
The third terms denotes the violations of the policy π e which would be zero if the policy π e satisﬁes constraint Eqution (17) for the sampled MDP.
Equation (29) is obtained from the fact max(0 , x + y ) ≤ max(0 , x ) + max(0 , y ) and Equation (28) is obtained from the fact max(0 , x ) ≤ | x | .
The ﬁrst and second term in Equation (28) are bounded similar to Equation (23), and we focus our attention to the third term. If the optimization problem in Equation (14)-(17) is feasible, the term ( ζ ˜ P e ,k π e − C k ) ≤ 0 and if the optimization equation is infeasible, the term is upper bounded by 1 as
C k ≥ 0 and ζ ˜ P e π e ≤ 1 . Hence, we get:
[Equation]
where Equation (31) follows from the fact that total violations are less than the cumulative violations are considered per epoch. Equation (33) follows from Lemmaas (cid:16) ζ ˜ P e ,k π e − C k (cid:17) ≤ 0 when t e > √ T and Equation (35) comes from [Jaksch et al., 2010, Proposition 1].
We note that the fundamental setup of unconstrained optimization ( K = 0 ), the bound is loose compared to that [Figure] compared to which our algorithm extremely well. of UCRL2 algorithm Jaksch et al.
This is because we use a stochastic policy instead of a deterministic policy.
Recall that the optimal policy for CMDP setup is possibly stochastic Altman [1999].
EVALUATION OF THE PROPOSED ALGORITHM
To validate the performance of the proposed CDMP-PSRL algorithm and the understanding of our analysis, we run the simulation on the ﬂow and service control in a singleserve queue, which is introduced in [Altman and Schwartz, 1991].
A discrete-time single-server queue with a buffer of ﬁnite size L is considered in this case.
The number of the customer waiting in the queue is considered as the state in this problem and thus | S | =
L + 1 .
Two kinds of the [Figure] actions, service and ﬂow, are considered in the problem and control the number of customers together.
The action space for service is a ﬁnite subset A in [ a min , a max ] , where 0 < a min ≤ a max < 1 .
Given a speciﬁc service action a , the service a customer is successfully ﬁnished with the probability b .
If the service is successful, the length of the queue will reduce by 1.
Similarly, the space for ﬂow is also a ﬁnite subsection B in [ b min , b max ] .
In contrast to the service action, ﬂow action will increase the queue by 1 with probability b if the speciﬁc ﬂow action b is given.
Also, we assume that there is no customer arriving when the queue is full.
The overall action space is the Cartesian product of the
A and B .
According to the service and ﬂow probability, the transition probability can be computed and is given in the
Table 1.
For the reward function as r ( s, a, b ) and the constraints for Current [Equation] ab
[Equation]
[Equation]
[Equation] (1 − a [Equation] a 1 − a
[Equation]
[Equation]
[Equation]
a
[Equation] b ( [Equation] a ) service and ﬂow as c 1 ( s, a, b ) and c 2 ( s, a, b ) , respectively, and stationary policies for service and ﬂow as π a and π b , respectively, the problem can be deﬁned as
[Equation]
According to the discussion in [Altman and Schwartz, 1991], we deﬁne the reward function as r ( s, a, b ) = 5 − s , which is an decreasing function only dependent on the state.
It is reasonable to give higher reward when the number of customer waiting in the queue is small.
For the constraint function, we deﬁne c 1 ( s, a, b )
= − 10 a + 6 and c 2 = − 8 ∗ (1 − b ) 2 + 2 , which are dependent only on service and ﬂow action, respectively.
Higher constraint value is given if the probability for the service and ﬂow are low and high, respectively.
In the simulation, the length of the buffer is set as L = 5 .
The service action space is set as [0 . 2 , 0 . 4 , 0 . 6 , 0 . 8] and the ﬂow action space is set as [0 . 4 , 0 . 5 , 0 . 6 , 0 .
We use the length of horizon T = 50000 and run 50 independent simulations of the proposed CMDP-PSRL algorithm.
We also plot the standard deviation around the mean value in the shadow to show the random error. In order to compare this result to the optimal, we assume that the full information of the transition dynamics is known and then use Linear
Programming to solve the problem.
The optimal cumulative reward from LP is shown to be 4 . 47 .
The reward performance of the CMDP-PSRL algorithm is shown in the Figure 1 where we observe that the reward converges towards the optimal value. We also plot the constraint violations in
Figure 2.
The service and ﬂow constraints converge to 0 as expected.
We note that the reward of the proposed CMDPPSRL algorithm becomes closer the optimal reward as the algorithm proceeds, and to further increase the reward, it does not violates the constraint.
We also compared our algorithm against the optimistic algorithm of Singh et al. We note that their algorithm performs signiﬁcantly worse compared to our algorithm. We account this poor performance on two accounts.
An optimistic algorithm does not ﬁnd a policy for transition probabilities close to P for signiﬁcantly large time. The other issue is because they consider conﬁdence interval for each P ( s (cid:48) | s, a ) .
This also shows in their analysis and hence they obtain a O ( T 2 / 3 ) regret bound. Further, the optimization problem takes a signiﬁcantly more time to solve for optimistic setup. However, the variance of their optimistic algorithm is signiﬁcantly lower compared to the variance of our CMDP-PSRL algorithm.
CONCLUSION
This paper, considers the setup of reinforcement learning in unichain inﬁnite-horizon constrained Markov Decision
Processes with K long-term average constraint.
We propose a posterior sampling based algorithm, CMDP-PSRL, which proceeds in epochs.
At every epoch, we sample a new CMDP and generate a solution for the constraint optimization problem.
A major advantage of the posterior sampling based algorithm over an optimistic approach is, that it reduces the complexity of solving for the optimal solution of the constraint problem.
We also study the proposed CMDP-PSRL algorithm from regret perspective.
We bound the regret of the reward collected by the CMDP-PSRL algorithm as ˜ O ( T M S √ AT + CS 2 A/ (1 − ρ )) .
Further, we bound the gap between the long-term average costs of the sampled MDP and the true MDP to bound the K constraint violations as ˜ O ( T M S √ AT
+ CS 2 A/ (1 − ρ )) .
Finally, we evaluate the proposed CMDP-PSRL algorithm on a ﬂow control problem for single queue and show that the proposed algorithm performs empirically well.
This paper is the ﬁrst work which obtains a ˜ O ( √ T ) regret bounds for ergodic MDPs with long-term average constraints using a posterior sampling algorithm.
A model-free algorithm that obtains similar regret bounds for inﬁnite horizon long-term average constraints remains an open problem.
A
We now complete the proof of Theorem 1 here.
A.1 VARIABLE DEFINITIONS
We ﬁrst deﬁne some important variables required for the proof.
We deﬁne value V P,rγ,π , V P,kγ,π function for rewards r and cost c k as:
[Equation]
We also deﬁne Q-value Q P,rγ,π , Q P,kγ,π function for rewards r and cost c k as:
[Equation]
[Equation]
[Equation]
Based on this, we deﬁne Bellman error B P (cid:48) ,r π , B P (cid:48) ,k π function for rewards r and cost c k as:
[Equation]
A.2 AUXILIARY LEMMAS
We now state and prove various lemmas required to complete the proof of Theorem 1.
The ﬁrst lemma obtains concentration bounds for the sampled MDP.
We have:
Lemma 2.
The probability that the event
[Equation]
fails to occur for any t ≤ T is bounded by 1 T 5 .
Proof Outline.
From the result of Weissman et al.
[Equation]
the (cid:96) 1 distance of a probability distribution over S events with n samples is bounded as:
[Equation]
[Equation]
Thus, for (cid:15) =
(cid:113)
[Equation]
) log(2 AT )
, we have
[Equation]
We sum over the all the possible values of n ( s, a ) till t time-step to bound the probability that the event E t does not occur as:
[Equation]
Finally, summing over all the s, a , we get
[Equation]
Further, using union bounds and summing over all the t ≤ T , we get
[Equation]
The next lemma relates the difference between average per step reward λ P,rπ (or cost λ P,kπ ) for following policy π on true MDP with transition probabilities and average per step reward λ ˜ P,rπ for following policy π on MDP with transition probabilities ˜ P with the Bellman error B ˜ P,r π ( s, a ) as:
Lemma 3.
The difference of long-term average rewards for running the policy π on the MDP, λ ˜ P,rπ , and the average long-term average rewards for running the policy π on the true MDP, λ ˜ P,rπ , is the long-term average Bellman error as
[Equation]
Proof.
Note that for all s ∈ S , we have:
[Equation]
where Equation (54) follows from the deﬁnition of the Bellman error for state action pair s, a . Similarly, for the true MDP, we have,
[Equation] Subtracting Equation (56) from Equation (54), we get:
[Equation] Using the vector format for the value functions, we have, [Equation] Now, converting the value function to average per-step reward we have,
[Equation]
where the last equation follows from the deﬁnition of occupancy measures by Puterman [2014], and the existence of the limit lim γ → 1 B ˜ P,rγ,π in Equation (72).
After relating the gap between the long-term average rewards of policy π e on the two MDPs, we now want to bound the sum of Bellman error over an epoch.
For this, we ﬁrst bound the Bellman error for a particular state action pair s, a in the form of following lemma. We have, Lemma 4. For an MDP with rewards r ( s, a ) and transition probability ˜ P ( s (cid:48) | s, a ) such that (cid:107) ˜ P ( ·| s, a ) − P ( ·| s, a ) (cid:107) 1 ≤ (cid:15)
s,a , the Bellman error B ˜ P,rπ e
( s, a ) for state-action pair s, a is upper bounded as
[Equation]
(63) where (cid:107) h ˜ P,r π ( · ) (cid:107) ∞ is the bias-span of the MDP with transition probability ˜ P . Proof. Starting with the deﬁnition of Bellman error in Equation (41)
[Equation]
we get
[Equation]
where Equation (67) comes from the assumption that the rewards are known to the agent. Equation (71) follows from the fact that the difference between value function at two states is bounded.
Equation (72) comes from the deﬁnition of bias term
Puterman [2014] where h is the bias of the policy π when run on the sampled MDP.
Equation (73) follows from Hölder’s inequality.
In Equation (74), the (cid:96) 1 norm of probability vector difference is bounded from the deﬁnition. Additionally, note that the (cid:96) 1 norm in Equation (73) is bounded by 2 .
Thus the Bellman error is loose upper bounded by 2 (cid:107) h ˜ P,rπ ( · ) (cid:107) ∞ for all state-action pairs. Lemma 5 (Bounded Span of optimal MDP in conﬁdence interval) .
For a MDP with rewards r ( s, a ) and transition probabilities P re = arg max P e ∈P te λ P e ,r π e , for policy π e , the difference of bias of any two states s , and s (cid:48) , is upper bounded by the mixing time of the true MDP T M as:
[Equation]
Proof.
Note that λ P re ,r π e ≥ λ P (cid:48) ,r π e for all P (cid:48)
∈
P t e .
Now, consider the following Bellman equation:
[Equation]
[Equation]
where r π e ( s ) = (cid:80) a π e ( a | s ) r
( s
[Table]
[Table]
[Table]
[Table]
[Table]
[Table]
Consider two states s, s (cid:48) ∈ S . Also, let τ be a random variable deﬁned as:
[Equation]
We also deﬁne another operator,
[Equation]
where P π e ( ·| s )
= (cid:80) a π e ( a | s ) P ( s (cid:48) | s, a ) .
Now, note that
[Equation]
Further, for any two vectors u, v , where all the elements of u are not smaller than w we have ¯ Tu ≥ ¯ Tw . Hence, we have ¯
T n h P,rπ ( s ) ≤ h P,rπ ( s ) for all s .
Unrolling the recurrence, we have
[Equation]
For lim n → ∞ , we have h P re ,r π ( s ) ≥ h P re ,r π ( s
[Equation]
− T M , completing the proof. A.3 PROOF OF THEOREM
After stating the necessary lemmas, we can now prove the regret bound.
Proof.
We continue our proof from Equation (25).
We had:
[Equation]
where R 1 ( T ) and R 2 ( T ) are:
[Equation]
We ﬁrst consider R 2 ( T ) term. We start by deﬁning ﬁltration H t = { s 0 , a 0 , · · · , s t , a t } as the set of of observed states and played actions.
Further, we have λ P,rπ e as
[Equation]
[Equation]
We have,
[Equation]
[Equation]
Hence, we have, [Equation] Using Azuma-Hoeffding’s inequality, we get,
[Equation] [Equation] with probability at least 1 − 1 /T .
Summing over all the epochs and using Cauchy-Schwarz inequality, we get:
[Equation]
with probability at least 1 − E/T .
Further
[Equation]
the maximum value of the sum is bounded by T and that event occurs with probability less than 1 /T which gives,
[Equation] We can now focus on the R 1 ( T ) term. We have: [Equation]
Similar to Equations (90)-(93), we have:
[Equation]
Again, using Azuma-Hoeffding’s inequality, with probability at least 1 − 1 /T
we have:
[Equation]
Summing over all the epochs, we get, with probability at least 1 − E/T :
[Equation]
where Equation (113) follows from Lemma 4.
Equation (114) follows from Lemma 2 with probability 1 − 1 /T 5 . Equation (115) comes from Lemma 5.
Equation (116) follows from [Jaksch et al., 2010, Lemma 19] and Equation (117) follows from Cauchy-Schwarz inequality.
Together with Equation (108), we get:
[Equation]
Combining R 1 ( T ) and R 2 ( T ) we get the required bound on regret. The bound on constraint violations follows similarly.