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 first 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 =
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 efficiently 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 infinite-horizon communicating Markov Decision Processes with long-term average constraints.
They provide an optimism based algorithm where confidence bounds on each transition probabilities p ( s ′ | 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, finding 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 infinite-horizon ergodic MDP [Tarbouriech and Lazaric,
[Equation] 2019, Gattami et al., 2021] with long-term average constraints.
We use ℓ 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 find 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 first work to obtain O ( √ T ) regret guarantees for the infinite 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 find 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 finite 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 infinite 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 infinite 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 infinite-horizon long-term average constraints.
Inspired by the finite-time performance analysis of reinforcement learning algorithm for unconstrained problems, there has been a significant thrust in understanding the finitetime 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 infinite 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 infinite horizon discounted setup with constraints and obtain global convergence using policy gradient algorithms.
[Ding et al., 2020] also considers an infinite 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 infinitehorizon 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 infinite horizon discounted Markov decision process (MDP) M , defined by the tuple (cid:0)
S , A , P, r, c 1 , · · · , c k (cid:1) .
S denotes a finite set of state space with |S| = S , and A denotes a finite set of actions with |A| =
A .
P : S ×
A → ∆( S ) denotes the probability
P ( s ′ | s, a ) of transitioning to state s ′ 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 define the mixing time of MDP.
Definition 1 (Mixing Time) .
Consider the Markov Chain induced by the policy π on the MDP M .
Let T πs → s ′ be a random variable that denotes the first time step when this
Markov Chain enters state s ′ starting from state s .
Then, the mixing time of the MDP M is defined 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 first assumption on the MDP allows any policy to reach any state s ′ 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 ∥ P tπ ( s ) −
P π ∥ TV ≤ Cρ t with P π being the long-term steady state distribution induced by policy π , and C > 0 and ρ <are problem specific constants.
And, the mixing time of the
MDP M is finite 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 justified 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] λ [Equation]
{+s 0 ∼ ρ 
 ( s 0 ) , a t ∼ π ( a t | s t ) , s t +1 ∼ P ( s t +1 | s t , a t )+} 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 find 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] M [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 define 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 define 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
[Equation]
11) 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 infinite 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 ′ ∈ 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 defined 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 ′ | 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 specified 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.
, s ′ )
= 1 ∀ ( s, a, s ′ )
∈ 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 ′ 7: ν
e ( s, a )+ = 1 , N ( s, a, s ′ )
+ =8: if ν e ( s, a ) ≥ max(1 , N e ( s, a )) for any s, a then 9: ˜ P e ( s ′ | a, s ) ∼ Dir ( N ( s, a, s ′ ))
∀ ( s, a, s ′ ) 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 ′ ν
e ′ ( s, a ) ∀
( s, a ) 15: end
if 16: end for
ANALYSIS
We first 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 satisfies 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]
exists a policy π which satisfies,
[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 satisfies 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.
The complete proof is provided in the supplementary material.
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 first 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 first 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 the supplementary material.
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 ′
[Equation]
h
[Equation]
P
[Equation]
r
[Equation]
s
[Equation] )) ) which may be large for the sampled MDP. For this, we consider an MDP for the transition probability P re satisfies
[Equation]
where
[Equation]
where ¯ P t e ( ·| s, a ) is the estimated transition probability given s, a at time t e .
We now have,
[Equation]
The first 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 the supplementary material.
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 satisfied by the policy for the sampled MDP.
This allows us to obtain:
[Equation]
The first 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 satisfies 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 first 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: (cid:32)(cid:88)
[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 Lemma 1 as
[Equation]
when t e > √ T and Equation (35)
[Figure]
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 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 flow and service control in a singleserve queue, which is introduced in [Altman and Schwartz,
[Figure]
A discrete-time single-server queue with a buffer of finite 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 actions, service and flow, are considered in the problem and control the number of customers together.
The action space for service is a finite subset A in [ a min , a max ] , where 0 < a min ≤ a max < 1 .
Given a specific service action a , the service a customer is successfully finished with the probability b .
If the service is successful, the length of the queue will reduce by 1.
Similarly, the space for flow is also a finite subsection B in [ b min , b max ] .
In contrast to the service action, flow action will increase the queue by 1 with probability b if the specific flow 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 flow 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 service and flow as c 1 ( s, a, b ) and c 2 ( s, a, b ) , respectively, and stationary policies for service and flow as π a and π b , respectively, the problem can be defined as
[Equation]
According to the discussion in [Altman and Schwartz, 1991], we define 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 define c 1 ( s, a, b ) =
− 10 a + 6 and c 2 = − 8 ∗ (1 − b ) 2 + 2 , which are dependent only on service and flow action, respectively.
Higher constraint value is given if the probability for the service and flow 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 flow 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 flow 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 significantly worse compared to our algorithm.
We account this poor performance on two accounts.
An optimistic algorithm does not find a policy for transition probabilities close to P for significantly large time.
The other issue is because they consider confidence interval for each P ( s ′ | 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 significantly more time to solve for optimistic setup.
However, the variance of their optimistic algorithm is significantly lower compared to the variance of our CMDP-PSRL algorithm.
CONCLUSION
This paper, considers the setup of reinforcement learning in ergodic infinite-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 flow control problem for single queue and show that the proposed algorithm performs empirically well.
This paper is the first 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 infinite horizon long-term average constraints remains an open problem.
A 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) T t =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 efficiently balancing exploration of state-space 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 infinite-horizon communicating Markov Decision Processes with long-term average constraints.
They provide an optimism based algorithm where confidence bounds on each transition probabilities p ( s ′ | 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, finding 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 infinite-horizon ergodic MDP [Tarbouriech and Lazaric, 2019,
Gattami et al., 2021] with long-term average constraints.
We use ℓ 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 find 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 first work to obtain O ( √ T ) regret guarantees for the infinite horizon long-term average constraint setup with posterior sampling.
B 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 find 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 finite 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 infinite 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 infinite 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 infinite-horizon long-term average constraints.
Inspired by the finite-time performance analysis of reinforcement learning algorithm for unconstrained problems, there has been a significant thrust in understanding the finite-time 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 infinite 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 infinite horizon discounted setup with constraints and obtain global convergence using policy gradient algorithms. [Ding et al., 2020] also considers an infinite 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 infinite-horizon 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.
C PROBLEM FORMULATION
We consider an infinite horizon discounted Markov decision process (MDP) M , defined by the tuple (cid:0) S , A , P, r, c 1 , · · · , c k (cid:1) .
S denotes a finite set of state space with |S| = S , and A denotes a finite set of actions with |A| =
A .
P : S ×
A → ∆( S ) denotes the probability P ( s ′ | s, a ) of transitioning to state s ′ 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 define the mixing time of MDP.
Definition 2 (Mixing Time) .
Consider the Markov Chain induced by the policy π on the MDP M .
Let T πs → s ′ be a random variable that denotes the first time step when this Markov Chain enters state s ′ starting from state s .
Then, the mixing time of the MDP M is defined 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 first assumption on the MDP allows any policy to reach any state s ′ starting from any state s , and to converge to a steady state.
We formalize the result in the following assumption:
Assumption 4.
The MDP M is ergodic, or ∥ P tπ ( s )
− P π ∥ TV ≤ Cρ t with P π being the long-term steady state distribution induced by policy π , and C > 0 and ρ < 1 are problem specific constants.
And, the mixing time of the MDP M is finite or
T M < ∞ .
After discussing the transition dynamics of the system, we move to the rewards and costs of the MDP M .
Assumption 5.
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 justified 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 find 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 6.
{+There exists a policy π , and one constant κ ≥ 2 ST M (cid:113) 
+}
A log( AT ) / √ T + CST M / ((1 − ρ ) √ T ) 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 define 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 define 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
[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.
D THE CMDP-PSRL ALGORITHM
For infinite 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 ′ ∈ 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,
[Equation] ) as, [Equation] [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 defined 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 ′ | 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 specified 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. E ANALYSIS
We first 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 satisfies the constraint in Equation (17). We formalize this intuition in the following result.
Lemma 2. Following Algorithm 1, if t e +1 − t e ≥ √ T and ∥ ˜ P e ( ·| s, a ) − P ( ·| s, a ) ∥ 1 {+≤ (cid:113) 14 S log(
 At )+} N e ( s,a ) ∀ s, a there exists a policy π which satisfies, [Equation]
(55) 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 satisfies 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. The complete proof is provided in the supplementary material.
1: Input: S , A , r, c 1 , · · · , c K 2: Initialize N ( s, a, s ′ ) = 1 ∀ ( s, a, s ′ ) ∈ S ×
A × S , π e ( a | s ) = 1 |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 ′ 7: ν
e ( s, a )+ = 1 , N ( s, a, s ′ ) + =8: if ν e ( s, a ) ≥ max(1 , N e ( s, a )) for any s, a then 9: ˜ P e ( s ′ | a, s ) ∼ Dir ( N ( s, a, s ′ ))
∀ ( s, a, s ′ ) 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)
e e ′ ν
e ′ ( s, a ) ∀
( s, a ) 15: end
if 16: end for
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 long-term 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 first 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 long-term 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 first 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 the supplementary material.
Theorem 2.
The expected reward regret E [ R ( T )] , and the expected constraint regret E [ R k ( T )] ∀ k ∈
[ K ] of Algorithmare 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 ′ ( h ˜ P e ,r π ( s ) − h ˜ P e ,r π ( s ′ )) ) which may be large for the sampled MDP. For this, we consider an MDP for the transition probability P re satisfies
[Equation]
where
[Equation]
s
[Equation]
where ¯ P t e ( ·| s, a ) is the estimated transition probability given s, a at time t e .
We now have,
[Equation] [Equation]
The first 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 the supplementary material.
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 satisfied by the policy for the sampled MDP.
This allows us to obtain:
[Equation] [Equation]
The first 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 satisfies 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 first 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 [Figure] infeasible
[Equation] 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 Lemma 1 as (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 of UCRL 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].
F 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 flow and service control in a single-serve queue, which is introduced in [Altman and Schwartz, 1991]. A [Figure]
discrete-time single-server queue with a buffer of finite 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 actions, service and flow, are considered in the problem and control the number of customers together.
The action space for service is a finite subset A in [ a min , a max ] , where 0 < a min ≤ a max < 1 .
Given a specific service action a , the service a customer is successfully finished with the probability b .
If the service is successful, the length of the queue will reduce by 1.
Similarly, the space for flow is also a finite subsection B in [ b min , b max ] .
In contrast to the service action, flow action will increase the queue bywith probability b if the specific flow 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 flow probability, the transition probability can be computed and is given in the Table 1.
[Table]
P ( x t +1 = x
t − 1) P ( x t +1 = x t )
P ( x t +1 = x t + 1) 1 ≤ x t ≤ L −a (1 − b ) ab + (1 − a )(1 − b ) (1 − a ) b x t =
L a 1 − a x t = 1 − b (1 − a ) b (1 − a )
For the reward function as r ( s, a, b ) and the constraints for service and flow as c 1 ( s, a, b ) and c 2 ( s, a, b ) , respectively, and stationary policies for service and flow as π a and π b , respectively, the problem can be defined as
[Equation]
According to the discussion in [Altman and Schwartz, 1991], we define 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 define c 1 ( s, a, b ) =
− 10 a + 6 and c 2 = − 8 ∗ (1 − b ) 2 + 2 , which are dependent only on service and flow action, respectively.
Higher constraint value is given if the probability for the service and flow 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 flow 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 flow constraints converge to 0 as expected.
We note that the reward of the proposed CMDP-PSRL 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 significantly worse compared to our algorithm.
We account this poor performance on two accounts.
An optimistic algorithm does not find a policy for transition probabilities close to P for significantly large time.
The other issue is because they consider confidence interval for each P ( s ′ | 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 significantly more time to solve for optimistic setup.
However, the variance of their optimistic algorithm is significantly lower compared to the variance of our CMDP-PSRL algorithm.
G CONCLUSION
This paper, considers the setup of reinforcement learning in ergodic infinite-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 flow control problem for single queue and show that the proposed algorithm performs empirically well. This paper is the first 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 infinite horizon long-term average constraints remains an open problem. A.1 VARIABLE DEFINITIONS
We first define some important variables required for the proof. We define value V P,rγ,π , V P,kγ,π function for rewards r and cost c k as: [Equation]
We also define Q-value Q P,rγ,π , Q P,kγ,π function for rewards r and cost c k as: [Equation] Based on this, we define Bellman error B P ′ ,r π [Equation]
k
[Equation]
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 first lemma obtains concentration bounds for the sampled MDP.
We have:
Lemma 3.
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 ? , the ℓ 1 distance of a probability distribution over S events with n samples is bounded as:
[Equation]
Thus, for ϵ = (cid:113)
[Equation]
) ≤
[Equation]
log(2 AT )
[Equation]
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 4.
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 definition 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 definition 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 first bound the Bellman error for a particular state action pair s, a in the form of following lemma.
We have,
Lemma 5.
For an MDP with rewards r ( s, a ) and transition probability ˜ P ( s ′ | s, a ) such that ∥ ˜ P ( ·| s, a ) − P ( ·| s, a ) ∥ 1 ≤ ϵ s,a , the Bellman error B ˜ P,rπ e
( s, a ) for state-action pair s, a is upper bounded as
[Equation]
[Equation]
where ∥ h ˜ P,r π ( · ) ∥ ∞ is the bias-span of the MDP with transition probability ˜ P .
Proof.
Starting with the definition of Bellman error in Equation (41), we get
[Equation]
(cid:32)(cid:88)
[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 definition 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 ℓ 1 norm of probability vector difference is bounded from the definition.
Additionally, note that the ℓ 1 norm in Equation (73) is bounded by 2 .
Thus the Bellman error is loose upper bounded by 2 ∥ h ˜ P,rπ ( · ) ∥ ∞ for all state-action pairs.
Lemma 6 (Bounded Span of optimal MDP in confidence 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 ′ , is upper bounded by the mixing time of the true MDP T M as:
[Equation]
Proof.
Note that λ P re ,r π e ≥ λ P ′ ,r π e for all P ′ ∈
P t e .
Now, consider the following Bellman equation:
[Equation]
112) where r π e ( s ) =
(cid:80) a π e ( a | s ) r
( s, a ) and P rπ e ,e ( s ′ | s )
= (cid:80) a π ( a | s ) P re ( s ′ | s, a ) .
Consider two states s, s ′ ∈ S .
Also, let τ be a random variable defined as:
[Equation]
We also define another operator,
[Equation]
h
[Equation]
s
[Equation]
[Equation]
where P π e ( ·| s )
= (cid:80) a π e ( a | s ) P ( s ′ | 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 ′ )
− T M , completing the proof.
A.3 PROOF OF RESULTS FROM MAIN TEXT
After stating the necessary lemmas, we can now prove Lemma 1 and Theorem 1.
Proof of Theorem 1.
We continue our proof from Equation (25).
We had:
[Equation]
where R 1 ( T ) and R 2 ( T ) are:
[Equation]
We first consider R 2 ( T ) term.
We start by defining filtration 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]
+ (cid:0) E ( s,a ) ∼ π e ,P [ r ( s, a )] − E ( s t ,a t ) ∼ π e ,P [ r ( s t , a t ) |H
t e − 1 ] (cid:1) (127) ≤ E ( s t ,a t ) ∼ π e ,P [ t ( s t , a t ) |H
t e − 1 ] + 2 (cid:16) ∥
π e ( a | s ) d π e ( s ) − π e ( a | s ) P t − t e +1 π,s te − 1 ( s ) ∥ TV (cid:17) (128) ≤ E ( s t ,a t ) ∼ π e ,P [ r ( s t , a t ) |H
t e − 1 ] + 2 CSρ t − t e (129)
Hence, we have,
[Equation]
Using Azuma-Hoeffding’s inequality, we get,
[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]
[Equation]
Combining R 1 ( T ) and R 2 ( T ) we get the required bound on regret.
The bound on constraint violations follows similarly.
Proof of Lemma 1.
We begin with considering the policy π in Assumption 3.
We now prove the result for one k ∈
[ K ] and the result follows for all k ∈
[ K ] .
We consider an MDP with transition dynamics P ke which maximizes ζ P ′ ,k π for all
[Equation]
for all s, a . Consider the difference between the average cost k incurred from following policy π on the MDP with true transition probabilities P and the average cost k incurred from following policy π on the MDP with transition probabilities P ke and using Lemma 3.
We have:
[Equation]
where the of Bellman error B P ke ,k π ( s, a ) is of the following form,
[Equation]
and the value function, V ˜ P,kγ,π ( s ) and Q -value, Q ˜ P,kγ,π ( s, a ) , function become:
[Equation]
We bound the expectation using Azuma-Hoeffdings inequality as follows:
[Equation]
E (cid:104) B P ke ,k π ( s t , a t ) |H
t e − 1 (cid:105)(cid:17) + CS ∥
h P e ,k π ( · ) ∥ ∞ (1 − ρ )( t e +1 − t e ) (160) ≤ t e +1 − t e (cid:32)
T M (cid:112) 14 S log AT (cid:88) s,a ν e ( s, a ) (cid:112)
N e ( s, a ) + 4 T M (cid:112) 7( t e +1 − t e ) log( t e +1 − t e ) (cid:33) +
CST M (1 − ρ )( t e +1 − t e ) (161) ≤ t e +1 − t e (cid:32)
T M (cid:112) 14 S log AT (cid:88) s,a (cid:112) ν
e ( s, a ) + 4 T M (cid:112) 7( t e +1 − t e ) log( t e +1 − t e ) (cid:33) +
CST M (1 − ρ )( t e +1 − t e ) (162) ≤ t e +1 − t e   T M S (cid:112)
14 A log AT (cid:115)(cid:88) s,a ν e
( s, a ) + 4 T M (cid:112) 7( t e +1 − t e ) log( t e +1 − t e ) 
 +
CST M (1 − ρ )( t e +1 − t e ) (163) ≤ t e +1 − t e (cid:16) T M S (cid:112)
14 A log AT (cid:112) ( t e +1 − t e ) + 4 T M (cid:112) 7( t e +1 − t e ) log( t e +1 − t e ) (cid:17) +
CST M (1 − ρ )( t e +1 −
[Equation]
where Equation (123) is obtained by summing both sides from t
= t e to t = t e +1 .
Equation (124) is obtained by summing over the geometric series with ratio ρ .
Equation (125) comes from analysis used in the proof of Theorem 1.
Equation (126) comes from the fact that N e ( s, a ) ≥ ν
e ( s, a ) for all s, a , and then replacing the lower bound of N e ( s, a ) .
Equation (127) follows from the Cauchy Schwarz inequality.
Equation (128) follows from the fact that the epoch length t e +1 − t e is same as the number of visitations to all state action pairs in an epoch.
Combining Equation (129) with Equation (121), we obtain the required result as follows:
[Equation]
where Equation (132) comes from the fact that we consider epoch length t e +1 − t e ≥ √ T and Equation (133) comes from
Assumption 3 and Equation (134) comes from the value of Slater’s constant κ in Assumption 3.
Replicating the analysis for all k ∈ [ K ] , for the policy π , ζ ˜ P e ,k π satisfy the constraint for all k ∈ [ K ] and hence, the optimization problem in Equation (14)-(17) is feasible.