S HORTEST -P ATH C ONSTRAINED R EINFORCEMENT L EARNING FOR S PARSE R EWARD T ASKS
Anonymous authors
Paper under double-blind review
A BSTRACT
We propose the k -Shortest-Path ( k -SP) constraint: a novel constraint on the agent’s trajectory that improves the sample-efﬁciency in sparse-reward MDPs.
We show that any optimal policy necessarily satisﬁes the k -SP constraint.
Notably, the k -SP constraint prevents the policy from exploring state-action pairs along the non- k -SP trajectories ( e.g ., going back and forth).
However, in practice, excluding state-action pairs may hinder convergence of RL algorithms.
To overcome this, we propose a novel cost function that penalizes the policy violating SP constraint, instead of completely excluding it.
Our numerical experiment in a tabular RL setting demonstrate that the SP constraint can signiﬁcantly reduce the trajectory space of policy.
As a result, our constraint enables more sample efﬁcient learning by suppressing redundant exploration and exploitation.
Our experiments on MiniGrid and DeepMind Lab show that the proposed method signiﬁcantly improves proximal policy optimization (PPO) and outperforms existing novelty-seeking exploration methods including count-based exploration, indicating that it improves the sample efﬁciency by preventing the agent from taking redundant actions.
I NTRODUCTION
Recently, deep reinforcement learning (RL) has achieved a large number of breakthroughs in many domains including video games (Mnih et al., 2015; Vinyals et al., 2019), and board games (Silver et al., 2017).
Nonetheless, a central challenge in reinforcement learning (RL) is the sample efﬁciency (Kakade et al., 2003); it has been shown that the RL algorithm requires a large number of samples for successful learning in MDP with large state and action space.
Moreover, the success of
RL algorithm heavily hinges on the quality of collected samples; the RL algorithm tends to fail if the collected trajectory does not contain enough evaluative feedback ( e.g ., sparse or delayed reward).
To circumvent this challenge, planning-based methods utilize the environment’s model to improve or create a policy instead of interacting with environment.
Recently, combining the planning method with an efﬁcient path search algorithm, such as Monte-Carlo tree search (MCTS) (Norvig, 2002;
Coulom, 2006), has demonstrated successful results (Guo et al., 2016; Vodopivec et al., 2017; Silver et al., 2017).
However, such tree search methods would require an accurate model of MDP and the complexity of planning may grow intractably large for complex domain.
Model-based RL methods attempt to learn a model instead of assuming that model is given, but learning an accurate model also requires a large number of samples, which is often even harder to achieve than solving the given task.
Model-free RL methods can be learned solely from the environment reward, without the need of a (learned) model.
However, both value-based and policy-based methods suffer from poor sample efﬁciency especially in sparse-reward tasks.
To tackle sparse reward problems, researchers have proposed to learn an intrinsic bonus function that measures the novelty of the state that agent visits (Schmidhuber, 1991; Oudeyer & Kaplan, 2009; Pathak et al., 2017; Savinov et al., 2018b; Choi et al., 2018; Burda et al., 2018).
However, when such intrinsic bonus is added to the reward, it often requires a careful balancing between environment reward and bonus and scheduling of the bonus scale in order to guarantee the convergence to optimal solution.
To tackle aforementioned challenge of sample efﬁciency in sparse reward tasks, we introduce a constrained-RL framework that improves the sample efﬁciency of any model-free RL algorithm in sparse-reward tasks, under the mild assumptions on MDP (see Appendix G).
Of note, though our framework will be formulated for policy-based methods, our ﬁnal form of cost function (Eq.
(10) in Section 4) is applicable to both policy-based and value-based methods.
We propose a novel k - shortest-path ( k -SP) constraint (Deﬁnition 7) that improves sample efﬁciency of policy learning (See Figure 1).
The k -SP constraint is applied to a trajectory rolled out by a policy; all of its sub-path
Roll-outTree
MDP
Rewarding state:
Initial state:
Non-rewarding state:
Allowed transition:
BA
BA -
A
BB - ...
A
B
B ...
- t=0~
RNet
Unconstrained
RNet
RNetConstrained -
A
SP
Path: t=1~
Sub-paths t=0~ t=1~ -
A
Non-SP
Sub-paths
RNet:
AND:
Path Path
SP
N/A
False k-shortest-path (k-SP) constraint (k=2) k-SP constraint
True k-SP?
k-SP?
RNet of length k is required to be a shortest-path under the π -distance metric which we deﬁne in Section 3.1.
We prove that applying our constraint preserves the optimality for any MDP (Theorem 3), except the stochastic and multi-goal MDP which requires additional assumptions.
We relax the hard constraint into a soft cost formulation (Tessler et al., 2019), and use a reachability network (Savinov et al., 2018b) (RNet) to efﬁciently learn the cost function in an off-policy manner.
We summarize our contributions as the following: (1) We propose a novel constraint that can improve the sample efﬁciency of any model-free RL method in sparse reward tasks.
(2) We present several theoretical results including the proof that our proposed constraint preserves the optimal policy of given MDP.
(3) We present a numerical result in tabular RL setting to precisely evaluate the effectiveness of the proposed method.
(4) We propose a practical way to implement our proposed constraint, and demonstrate that it provides a signiﬁcant improvement on two complex deep RL domains.
(5) We demonstrate that our method signiﬁcantly improves the sample-efﬁciency of PPO, and outperforms existing novelty-seeking methods on two complex domains in sparse reward setting.
P RELIMINARIES
Markov Decision Process (MDP).
We model a task as an MDP tuple M =
( S , A , P , R , ρ, γ ) , where S is a state set, A is an action set, P is a transition probability, R is a reward function, ρ is an initial state distribution, and γ ∈ [0 , 1) is a discount factor.
For each state s , the value of a policy π is denoted by V π ( s ) =
E [Equation] [Equation] | s 0 = s ] .
Then, the goal is to ﬁnd the optimal policy π ∗ that maximizes the expected return:
[Equation]
Constrained MDP.
A constrained Markov Decision Process (CMDP) is an MDP with extra constraints that restrict the domain of allowed policies (Altman, 1999).
Speciﬁcally, CMDP introduces a constraint function C ( π ) that maps a policy to a scalar, and a threshold α ∈ R .
The objective of CMDP is to maximize the expected return R ( τ )
= (cid:80) t γ t r t of a trajectory τ = { s 0 , a 0 , r 1 , s 1 , a 1 , r 2 , s 2 , . . .
} subject to a constraint: π ∗ = arg max π E τ ∼ π
[ R ( τ )] ,
s.t. C ( π ) ≤ α.
A popular choice of constraint is based on the transition cost function (Tessler et al., 2019)
c
( s, a, r, s (cid:48) )
∈ R which assigns a scalar-valued cost to each transition.
Then the constraint function for a policy π is deﬁned as the discounted sum of the cost under the policy: C ( π ) =
E τ ∼ π
[ (cid:80) t γ t c ( s t , a t , r t +1 , s t +1 )] .
In this work, we propose a shortest-path constraint, that provably preserves the optimal policy of the original unconstrained MDP, while reducing the trajectory space.
We will use a cost function-based formulation to implement our constraint (see Section 3 and 4).
F ORMULATION : k - SHORTEST PATH CONSTRAINT
We deﬁne the k -shortest-path (k-SP) constraint to remove redundant transitions ( e.g ., unnecessarily going back and forth), leading to faster policy learning.
We show two important properties of our constraint: (1) the optimal policy is preserved, and (2) the policy search space is reduced.
In this work, we limit our focus to MDPs satisfying R ( s )+ γV ∗ ( s ) > 0 for all initial states s ∈ ρ and all rewarding states that optimal policy visits with non-zero probability s ∈ { s | r ( s ) (cid:54) = 0 , π ∗ ( s ) > 0 } .
We exploit this mild assumption to prove that our constraint preserves optimality.
Intuitively, we exclude the case when the optimal strategy for the agent is at best choosing a “lesser of evils” ( i.e ., largest but negative value) which often still means a failure.
We note that this is often caused by unnatural reward function design; in principle, we can avoid this by simply offsetting reward function by a constant −| min s ∈{ s | π ∗ ( s ) > 0 } V ∗ ( s ) | for every transition, assuming the policy is proper 1 .
Goalconditioned RL (Nachum et al., 2018) and most of the well-known domains such as Atari (Bellemare et al., 2013), DeepMind Lab (Beattie et al., 2016), MiniGrid (Chevalier-Boisvert et al., 2018), etc., satisfy this assumption.
Also, for general settings with stochastic MDP and multi-goals, we require additional assumptions to prove the optimality guarantee (See Appendix G for details).
3. S HORTEST - PATH POLICY AND S HORTEST - PATH CONSTRAINT
Let τ be a path deﬁned by a sequence of states: τ = { s 0 , . . .
, s (cid:96) ( τ ) } , where (cid:96) ( τ ) is the length of a path τ
( i.e ., (cid:96) ( τ ) =
| τ | − 1 ).
We denote the set of all paths from s to s (cid:48) by T s,s (cid:48) .
A path τ ∗ from s to s (cid:48) is called a shortest path from s to s (cid:48)
if (cid:96) ( τ ) is minimum, i.e ., (cid:96) ( τ ∗ ) =
min τ ∈T s,s (cid:48) (cid:96) ( τ ) .
Now we will deﬁne similar concepts (length, shortest path, etc .) with respect to a policy.
Intuitively, a policy that rolls out shortest paths (up to some stochasticity) to a goal state or between any state pairs should be a counterpart.
We consider a set of all admissible paths from s to s (cid:48) under a policy π :
Deﬁnition 1 (Path set) .
T πs,s (cid:48)
= { τ | s
=
s, s (cid:96) ( τ )
=
s (cid:48) , p π ( τ ) > 0 , { s t } t<(cid:96) ( τ ) (cid:54) =
s (cid:48) } .
That is, T πs,s (cid:48) is a set of all paths that policy π may roll out from s and terminate once visiting s (cid:48) .
If the MDP is a single-goal task, i.e ., there exists a unique (rewarding) goal state s g ∈ S such that s g is a terminal state, and R ( s ) >
if and only if s = s g , any shortest path from an initial state to the goal state is the optimal path with the highest return R ( τ ) , and a policy that rolls out a shortest path is therefore optimal (see Lemma 4).
This is because all states except for s g are non-rewarding states, but in general MDPs this is not necessarily true.
However, this motivates us to limit the domain of shortest path to among non-rewarding states .
We deﬁne non-rewarding paths from s to s (cid:48) as follows:
Deﬁnition
[Equation]
(cid:48) , { r t } t<(cid:96) ( τ ) = 0 } .
In words, T πs,s (cid:48) , nr is a set of all non-rewarding paths from s to s (cid:48) rolled out by policy π ( i.e ., τ ∈ T πs,s (cid:48) ) without any associated reward except the last step ( i.e ., { r t } t< | τ | = 0 ).
Now we are ready to deﬁne a notion of length with respect to a policy and shortest path policy:
Deﬁnition 3 ( π -distance from s to s (cid:48) ) .
D π nr ( s, s (cid:48) )
= log γ (cid:0) E τ ∼ π : τ ∈T πs,s (cid:48) , nr (cid:2) γ (cid:96) ( τ ) (cid:3) (cid:1)
Deﬁnition 4 (Shortest path distance from s to s (cid:48) ) .
D nr ( s, s (cid:48) )
=
min π D π nr ( s, s (cid:48) ) .
We deﬁne π -distance to be the log-mean-exponential of the length (cid:96) ( τ ) of non-rewarding paths τ ∈ T πs,s (cid:48) , nr .
When there exists no admissible path from s to s (cid:48) under policy π , the path length is deﬁned to be ∞ : D π nr ( s, s (cid:48) )
= ∞ if T πs,s (cid:48) , nr = ∅ .
We note that when both MDP and policy are deterministic, D π ( s, s (cid:48) ) recovers the natural deﬁnition of path length, D π nr ( s, s (cid:48) )
= (cid:96) ( τ ) .
We call a policy a shortest-path policy from s to s (cid:48) if it roll outs a path with the smallest π -distance:
Deﬁnition 5 (Shortest path policy from s to s (cid:48) ) .
π ∈ Π SP s → s (cid:48)
= { π ∈ Π | D π nr ( s, s (cid:48) )
=
D nr ( s, s (cid:48) ) } .
Finally, we will deﬁne the shortest-path (SP) constraint.
Let S IR
= { s | R ( s ) > 0 or ρ ( s ) > 0 } be the union of all initial and rewarding states, and Φ π
=
( s, s (cid:48) ) | s, s (cid:48)
∈ S IR , ρ ( s ) > 0 , T πs,s (cid:48) , nr (cid:54) = ∅} be the subset of S IR such that agent may roll out.
Then, the SP constraint is applied to the nonrewarding sub-paths between states in Φ π : T π Φ , nr = (cid:83) ( s,s (cid:48) ) ∈
Φ π T πs,s (cid:48) , nr .
We note that these deﬁnitions are used in the proofs (Appendix G).
Now, we deﬁne the shortest-path constraint as follows:
Deﬁnition 6 (Shortest-path constraint) .
A policy π satisﬁes the shortest-path (SP) constraint if π ∈ Π SP , where Π SP =
{ π | For all s, s (cid:
) ∈ T π Φ , nr , it holds π ∈ Π SP s → s (cid:48) } .
Intuitively, the SP constraint forces a policy to transition between initial and rewarding states via shortest paths.
The SP constraint would be particularly effective in sparse-reward settings, where the distance between rewarding states is large.
Given these deﬁnitions, we can show that an optimal policy indeed satisﬁes the SP constraint in a general MDP setting.
In other words, the shortest path constraint should not change optimality:
Theorem 1.
For any MDP, an optimal policy π ∗ satisﬁes the shortest-path constraint: π ∗ ∈ Π SP .
Proof.
See Appendix G for the proof.
3. R ELAXATION : k -S HORTEST -P ATH C ONSTRAINT
Implementing the shortest-path constraint is, however, intractable since it requires a distance predictor
D nr ( s, s (cid:48) ) .
Note that the distance predictor addresses the optimization problem, which might be as difﬁcult as solving the given task.
To circumvent this challenge, we consider its more tractable version, namely a k -shortest path constraint, which reduces the shortest-path problem D nr ( s, s (cid:48) ) to a binary decision problem — is the state s (cid:48) reachable from s within k steps? — also known as k -reachability (Savinov et al., 2018b).
The k -shortest path constraint is deﬁned as follows:
Deﬁnition 7 ( k -shortest-path constraint) .
A policy π satisﬁes the k -shortest-path constraint
if π ∈ Π SP k , where
[Equation]
Note that the SP constraint (Deﬁnition 6) is relaxed by adding a condition D π nr ( s, s (cid:48) ) ≤ k .
In other words, the k -SP constraint is imposed only for s, s (cid:48) -path whose length is not greater than k .
From
Eq.
(2), we can prove an important property and then Theorem 3 (optimality):
Lemma 2.
For an MDP M , Π SP m ⊂ Π SP k
if k < m .
Proof.
It is true since { ( s, s (cid:48) )
| D π nr ( s, s (cid:48) )
≤ k } ⊂ { ( s, s (cid:48) )
| D π nr ( s, s (cid:48) ) ≤ m } for k < m .
Theorem 3.
For an MDP M and any k ∈ R , an optimal policy π ∗ is a k -shortest-path policy.
Proof.
Theorem 1 tells π ∗ ∈ Π SP .
Eq.
(2) tells Π SP
= Π SP ∞ and Lemma 2 tells Π SP ∞ ⊂
Π SP k .
Collectively, we have π ∗ ∈ Π SP =
Π SP ∞ ⊂
Π SP k .
In conclusion, Theorem 3 states that the k -SP constraint does not change the optimality of policy, and
Lemma 2 states a larger k results in a larger reduction in policy search space.
Thus, it motivates us to apply the k -SP constraint in policy search to more efﬁciently ﬁnd an optimal policy.
For the numerical experiment on measuring the reduction in the policy roll-outs space, please refer to Section 6.4.
SPRL: S HORTEST -P ATH R EINFORCEMENT L EARNING
k -Shortest-Path Cost.
The objective of RL with the k -SP constraint Π SP k can be written as:
[Equation]
where Π SP k = { π | ∀ ( s, s (cid:48) ∈ T π Φ , nr ) , D π nr ( s, s (cid:48) )
≤ k, it holds π ∈ Π SP s → s (cid:48) }
(Deﬁnition 7).
We want to formulate the constraint π ∈ Π SP k in the form of constrained MDP (Section 2), i.e ., as C ( π ) ≤ α .
We begin by re-writing the k -SP constraint into a cost-based form: Π SP k
= { π | C SP k
( π ) = 0 } , where C SP k ( π )
[Equation]
Note that I [ D nr ( s, s (cid:48) ) <
D π nr ( s, s (cid:48) )]
= {+
+}
↔ D nr ( s, s (cid:48) )
=
D π nr ( s, s (cid:48) ) since D nr ( s, s (cid:48) )
≤ D π nr ( s, s (cid:48) ) from Deﬁnition 4.
Similar to Tessler et al.
(2019), we apply the constraint to the on-policy trajectory τ =
( s 0 , s 1 , . . . )
with discounting by replacing ( s, s (cid:48) ) with ( s t , s t + l ) where [ t, t + l ] represents each segment of τ with length l : [Equation] = E
[Equation]
(cid:104)(cid:80) ( [Equation] l [Equation]
s
[Equation]
s
[Equation]
<
[Equation]
E
[Equation]
st
[Equation]
l
[Equation]
nr (cid:2)
[Equation]
(cid:3)(cid:17)(cid:105) ·
[Equation] (cid:2) { r j } t + l − 1 j = t [Equation] ≤ E τ ∼ π (cid:104)(cid:80) ( t,l ): t ≥ 0 ,l ≤ k γ t · I [ D nr
[Equation]
Require:
Hyperparameters: k ∈ N , λ >1: for n = 1 , . .
, N policy do 2:
Rollout transitions τ = { s t , a t , r t } | τ | t =1 ∼ π 3:
Compute the cost term { c t } | τ | t =1 as Eq.
Update policy π to maximize the objective as Eq.
(10) (e.g., run PPO train steps).
Update Rnet training-buffer B = B ∪ { τ } .
6: if n % T Rnet =
then (cid:46) Periodically train Rnet for N Rnet times 7: for m = 1 , . .
. , N Rnet do 8:
Sample triplet ( s anc , s + , s − ) ∼ B .
(cid:46) See Appendix D.3 for detail 9:
Update Rnet to minimize L Rnet as Eq.
Note that it is sufﬁcient to consider only the cases l = k (because for l < k , given D nr ( s t , s t + k ) <
k , we have D ( s t , s t + l ) ≤ l < k ).
Then, we simplify ˆ C SP k
( π ) as ˆ C SP k ( π ) = E τ ∼ π (cid:2)(cid:80) [Equation] γ t I
[ D nr ( s t
[Equation]
s t + k ) <
k ] ·
[Equation]
(cid:2) { r j } t + k − 1 j = t = 0 (cid:3)(cid:3) (6) =
E τ ∼ π (cid:104)(cid:80)
[Equation]
[Equation]
[Equation]
[Equation]
[Equation]
t
[Equation]
s
[Equation]
) <
[Equation]
[Equation]
(cid:104) { r j } t − 1 j = t − k
= 0 (cid:105)(cid:105) .
Finally, the per-time step cost c t is given as:
[Equation]
where ˆ C SP k ( π ) =
E τ ∼ π
[ (cid:80) t γ t c t ] .
Note that ˆ C SP k
( π ) is an upper bound of C SP k ( π ) , which will be minimized by the bound to make as little violation of the shortest-path constraint as possible.
Intuitively speaking, c t penalizes the agent from taking a non- k -shortest path at each step, so minimizing such penalties will make the policy satisfy the k -shortest-path constraint.
In Eq.
(8), c t depends on the previous k steps; hence, the resulting CMDP becomes a ( k + 1) -th order MDP.
In practice, however, we empirically found that feeding only the current time-step observation to the policy performs better than stacking the previous k -steps of observations (See Appendix A. for details).
Thus, we did not stack the observation in all the experiments.
We use the Lagrange multiplier method to convert the objective (3) into an equivalent unconstrained problem as follows:
[Equation]
[Equation]
where L is the Lagrangian, θ is the parameter of policy π , and λ > 0 is the Lagrangian multiplier.
Since Theorem 3 shows that the shortest-path constraint preserves the optimality, we are free to set any λ > 0 .
Thus, we simply consider λ as a tunable positive hyperparameter, and simplify the min-max problem (9) to an RL objective with costs c t being added:
[Equation]
Practical implementation of the cost function.
We implement the binary distance discriminator
I ( D nr [Equation] s [Equation]
[Equation]
k ) in Eq.
(8) using k -reachability network (Savinov et al., 2018b).
The kreachability network Rnet k ( s, s (cid:48) ) is trained to output 1 if the state s (cid:48) is reachable from the state s with less than or equal to k consecutive actions, and 0 otherwise.
Formally, we take the functional form:
Rnet k
( s, s (cid:48) )
(cid:39) I ( D nr ( s, s (cid:48) ) <
k
+ 1) .
We then estimate the cost term c t using ( k − 1) -reachability network as follows:
[Equation]
Intuitively speaking, if the agent takes a k -shortest path, then the distance between s t − k and s t is k , hence c t = 0 .
If it is not a k -shortest path, c t > 0 since the distance between s t − k and s t will be less than k .
In practice, due to the error in the reachability network, we add a small tolerance ∆ t ∈ N to ignore outliers.
It leads to an empirical version of the cost as follows:
[Equation]
[Equation] In our experiment, we found that a small tolerance ∆ t (cid:39) k/ 5 works well in general.
Similar to Savinov et al.
(2018b), we used the following contrastive loss for training the reachability network:
[Equation]
where s anc , s + , s − are the anchor, positive, and negative samples, respectively (See Appendix D.3 for the detail of training).
R ELATED W ORK
Connection between shortest-path problem and planning.
Many early works (Bellman, 1958;
Ford Jr, 1956; Bertsekas & Tsitsiklis, 1991; 1995) have discussed (stochastic) shortest path problems in the context of MDP.
They viewed the shortest-path problem as planning problem and proposed a dynamic programming-based algorithm similar to the value iteration (Sutton & Barto, 2018) to solve it.
Our main idea is inspired by (but not based on) this viewpoint.
Speciﬁcally, our method does not directly solve the shortest path problem via planning; hence, our method does not require model.
Our method only exploits the optimality guarantee of the shortest-path under the π -distance to prune out sub-optimal policies ( i.e ., non-shortest paths).
Distance metric in goal-conditioned RL.
In goal-conditioned RL, there has been a recent surge of interest on learning a distance metric in state (or goal) space for to construct a high-level MDP graph and perform planning to ﬁnd a shortest-path to the goal state.
Huang et al.
; Laskin et al.
(2020) used the universal value function (UVF) (Schaul et al., 2015) with a constant step penalty as a distance function.
Zhang et al.
; Laskin et al.
(2020) used the success rate of transition between nodes as distance and searched for the longest path to ﬁnd the plan with highest success rate.
SPTM (Savinov et al., 2018a) deﬁned a binary distance based on reachability network (RNet) to connect near by nodes in the graph.
However, the proposed distance metrics and methods can be used only for the goal-conditioned task and lacks the theoretical guarantee in general MDP, while our theory and framework are applicable to general MDP (see Section 3.1).
Reachability network.
The reachability network (RNet) was ﬁrst proposed by Savinov et al.
(2018b)
as a way to measure the novelty of a state for exploration .
Intuitively, if current state is not reachable from previous states in episodic memory, it is considered to be novel.
SPTM (Savinov et al., 2018a) used RNet to predict the local connectivity ( i.e ., binary distance) between observations in memory for graph-based planning in navigation task.
On the other hand, we use RNet for constraining the policy ( i.e ., removing the sub-optimal policies from policy space).
Thus, in ours and in other two compared works, RNet is being employed for fundamentally different purposes.
More related works.
Please refer to Appendix H for further discussions about other related works.
E XPERIMENTS
6. S ETTINGS
Environments.
We evaluate our SPRL on two challenging domains: MiniGrid (Chevalier-Boisvert et al., 2018) and DeepMind Lab (Beattie et al., 2016).
MiniGrid is a 2D grid world environment with challenging features such as pictorial observation, random initialization of the agent and the goal, complex state and action space where coordinates, directions, and other object statuses ( e.g ., key-door) are considered.
We conducted experiments on four standard tasks: FourRooms-7 × 7 , FourRooms-11 × 11 , KeyDoors-7 × 7 , and KeyDoors-11 × 11 .
DeepMind Lab is a 3D environment with ﬁrst person view.
Along with the nature of partially-observed MDP, at each episode, the agent’s initial and the goal location are reset randomly with a change of texture, maze structure, and colors.
We conducted experiments on three standard tasks:
GoalSmall , GoalLarge 3 , and ObjectMany .
We refer the readers to Figure 2 for examples of observations.
Baselines.
We compared our methods with four baselines:
PPO (Schulman et al., 2017), episodic curiosity ( ECO ) (Savinov et al., 2018b), intrinsic curiosity module ( ICM ) (Pathak et al., 2017), and GT-Grid (Savinov et al., 2018b).
The PPO is used as a baseline RL algorithm for all other agents.
The ECO agent is rewarded when it visits a state that is not reachable from the states in episodic memory within a certain number of actions; thus the novelty is only measured within an episode.
Following Savinov et al. (2018b), we trained RNet in an off-policy manner from the agent’s experience and used it for our SPRL and ECO on both MiniGrid (Section 6.2) and DeepMind Lab (Section 6.3). For the accuracy of the learned RNet on each task, please refer to the Appendix B.
The GT-Grid agent has access to the agent’s ( x , y ) coordinates.
It uniformly divides the world in 2D grid cells, and the agent is rewarded for visiting a novel grid cell.
The ICM agent learns a forward and inverse dynamics model and uses the prediction error of the forward model to measure the novelty.
We used the publicly available codebase (Savinov et al., 2018b) to obtain the baseline results.
We used the same hyperparameter for all the tasks for a given domain — the details are described in the
Appendix.
We used the standard domain and tasks for reproducibility.
6. R ESULTS ON MiniGrid
[Figure]
Figure 3 shows the performance of compared methods on MiniGrid domain.
SPRL consistently outperforms all baseline methods over all tasks.
We observe that exploration-based methods ( i
[Figure]
e .,
ECO , ICM , and GT-Grid ) perform similarly to the PPO in the tasks with small state space ( e [Figure] g ., FourRooms-7 × 7 and KeyDoors-7 × 7 ).
However, SPRL demonstrates a signiﬁcant performance gain since it improves the exploitation by avoiding sub-optimality caused by taking a non-shortest-path [Figure]
6. R ESULTS ON DeepMind Lab
[Figure]
Figure 4 summarizes the performance of all the methods on DeepMind Lab tasks.
Overall, our
SPRL method achieves superior results compared to other methods.
By the design of the task, the difﬁculty of exploration in each task increases in the order of GoalSmall , ObjectMany , and
GoalLarge tasks [Figure] and we observe a coherent trend in the result.
For harder exploration tasks, the exploration-based methods ( GT-Grid , ICM and ECO ) achieve a larger improvement over PPO : e.g ., 20%, 50%, and 100% improvement in GoalSmall , ObjectMany [Figure] and GoalLarge , respectively.
As shown in Lemma 2, our SPRL is expected to have larger improvement for larger trajectory space (or state and action space) and sparser reward settings.
We can verify this from the result:
SPRL has the largest improvement in GoalLarge task, where both the map layout is largest and the reward is most sparse.
Interestingly, SPRL even outperforms GT-Grid which simulates the upperbound performance of novelty-seeking exploration method.
This is possible since SPRL improves the exploration by suppressing unnecessary explorations, which is different from novelty-seeking methods, and also improves the exploitation by reducing the policy search space.
6. A NALYSIS ON k - SHORTEST - PATH CONSTRAINT
In this section, we numerically evaluate the effect of our k -shortest path constraint in tabular-RL setting.
Speciﬁcally, we study the following questions: (1) Does the k -SP constraint with larger k results in more reduction in trajectory space?
( i.e ., validation of Lemma 2) (2) How much reduction in trajectory space does k -SP constraint provide with different k and tolerance ∆ t ?
[Figure]
tab-
7 × 7 Four-rooms domain to a unique ( x, y ) location of the agent can take up, down, to move to the neighboring state, set to
We computed the ground-truth distance between a pair of states to implement the k -shortest path constraint.
We used the ground-truth distance function instead of the learned RNet to implement the exact SPRL agent.
Results.
Figure 5 summarizes the reduction in the trajectory space size.
We searched over all possible trajectories of length 14 using breadth-ﬁrst-search (BFS).
Then we counted the number trajectories satisfying our k -SP constraint with varying parameters k and tolerance ∆ t and divided by total number of trajectories ( i.e ., 4 14 = 268 M).
The result shows that our k -SP constraint drastically reduces the trajectory space even in a simple 2D grid domain; with very small k = 3 and no tolerance ∆ t = 2 , we get only 24 / 268 M size of the original search space.
As we increase k , we can see more reduction in the trajectory space, which is consistent with Lemma 2.
Also, increasing the tolerance ∆ t slightly hurts the performance, but still achieves a large reduction (See Appendix A for more analysis on effect of k and tolerance).
6. Q UALITATIVE RESULT ON MiniGrid
[Figure]
We qualitatively study what type of policy is learned with the k -SP constraint with the ground-truth RNet in NineRooms domain of MiniGrid .
Figure 6 (a-c) shows the converged behavior of our SPRL ( k = 15 ), the ground-truth count-based exploration (Lai & Robbins, 1985) agent ( GT-UCB ) and uniformly random policy ( Random ) in a reward-free setting.
We counted all the state transitions ( s t → s t +1 ) of each agent’s roll-out and averaged over 4 random seeds.
Random relies on the random walk and cannot explore further than the initial few rooms.
GT-UCB seeks for a novel states, and visits all the states uniformly.
SPRL learns to take a longest possible shortest path, which results in a “straight” path across the rooms.
Note that this only represents a partial behavior of SPRL , since our cost also considers the existence of non-zero reward (see Eq.
Thus, in (d), we tested SPRL while providing only the existence of non-zero reward (but not the reward magnitude).
SPRL learns to take a shortest path between rewarding and initial states that is consistent with the shortest-path deﬁnition in Deﬁnition 7.
C ONCLUSION
We presented the k -shortest-path constraint, which can improve the sample-efﬁciency of any modelfree RL method by preventing the agent from taking a sub-optimal transition.
We empirically showed that our SPRL outperforms vanilla RL and strong novelty-seeking exploration baselines on two challenging domains.
We believe that our framework develops a unique direction for improving the sample efﬁciency in reinforcement learning; hence, combining our work with other techniques for better sample efﬁciency will be interesting future work that could beneﬁt many practical tasks.
Appendix: Shortest-path reinforcement learning A M ORE ABLATION STUDY
[Figure] [Figure]
A. E FFECT OF k
As proven in Lemma 2 and shown in Section 6.
[Figure]
the larger k
[Figure]
the k -shortest constraint promises a larger reduction in policy space, which results in a faster learning.
However, with our practical implementation of SPRL with a learned (imperfect) reachability network, overly large k has a drawback.
Intuitively speaking, it is harder for policy to satisfy the k -shortest constraint, and the supervision signal given by our cost function becomes sparser ( i.e ., almost always penalized).
Figureand 8 shows the performance of SPRL on DeepMind Lab and MiniGrid domains with varying k .
In both domains we can see that there exists a “sweet spot” that balances between the reduction in policy space and sparsity of the supervision ( e.g ., k = 10 for DeepMind Lab and k = 5 for MiniGrid ).
[Figure]
A. E FFECT OF TOLERANCE ∆ t
Adding the tolerance ∆ t to our k -SP constraint makes it “softer” by allowing ∆ t -steps of redundancy in transition (See Eq.
Intuitively, a small tolerance may improve the stability of RNet by incorporating a possible noise in RNet prediction, but too large tolerance will make it less effective on removing sub-optimality in transition.
Figure 9 and 10 show the performance of SPRL on DeepMind
Lab and MiniGrid domains with varying tolerance ∆ t .
Similar to k , we can see that there exists a [Figure] “sweet spot” that balances between the reduction in policy space and stabilization of noisy RNet output ( e.g ., ∆ t = 25 ) in MiniGrid .
Note that the best tolerance values for DeepMind Lab and MiniGrid are vastly different.
This is mainly because we used multiple tolerance sampling (See Appendix D) for DeepMind Lab but not for MiniGrid .
Since the multiple tolerance sampling also improves the stability of RNet, larger tolerance has less beneﬁt compared to its disadvantage.
[Figure]
1, 5, 10 as a function of environment steps for DeepMind Lab tasks. Other hyper-parameters are kept same as the best hyper-parameter. The best performance is obtained without stacking ( i.e ., #stack=0).
[Figure]
A. S TACKING OBSERVATION
The CMDP with k -SP constraint becomes the ( k + 1)
-th order MDP as shown in Eq.
Thus, in theory, the policy should take currrent state s t augmented by stacking the k previous states as input: [ s t − k , s t − k +1 . . .
, s t ] , where [ · ] is a stacks the pixel observation along the channel ( i.e ., color) dimension.
However, stacking the observation may not lead to the best empirical results in practice.
Figure 11 and 12 show the performance of SPRL on DeepMind Lab and MiniGrid domains with varying stacking dimension.
For stack= m , we stacked the observation from t − m to t : [ s t − m , s t − m +1 , . . .
, s t ] .
We experimented up to m =
k : up to m = 10 for DeepMind Lab and m = 5 for MiniGrid .
The result shows that stacking the observation does not necessarily improves the performance for MDP order greater than 1, which is often observed when the function approximation is used ( e.g ., Savinov et al.
(2018b)).
Thus, we did not augment the observation in all the experiments.
B A NALYSIS ON THE REACHABILITY NETWORK (RN ET ) B. A CCURACY OF THE REACHABILITY NETWORK
We measured the accuracy of reachability network on DeepMind Lab and MiniGrid in Figureand Figure 13. The accuracy was measured on the validation set; we sampled 15,000 positive and negative samples respectively from the replay buffer of size 60,000. Speciﬁcally, for an anchor s t , we sample the positive sample s t (cid:48) from t (cid:48) ∈
[ t + 1 , t + k + ∆ t ]
[Figure]
and the negative sample s t (cid:48)(cid:48) from t (cid:48)(cid:48) ∈
[ t + k + ∆ t + ∆ − , t + k + ∆ t + 2∆ − ] .
The RNet reaches the accuracy higher than 80% in
[Figure]
[Figure]
only 0.4M steps in both MiniGrid and DeepMind Lab .
We note that this is quite high considering the unavoidable noise in the negative samples;
i
[Figure]
e ., since the negative samples are sampled based on the temporal distance, not based on the actual reachability, they have non-zero probability of being reachable, in which case they are in fact the positive samples.
B. A BLATION STUDY : COMPARISON BETWEEN THE LEARNED RN ET AND THE GT-RN ET
In this section, we study the effect of RNet’s accuracy on the SPRL ’s performance.
To this end, we implement and compare the ground-truth reachability network by computing the ground-truth distance between a pair of states in MiniGrid .
Ground-truth reachability network was implemented by computing the distance between the two state inputs, and comparing with k .
For the state inputs s and s (cid:48)
[Figure]
we roll out all possible k -step trajectories starting from the state
s using the ground-truth single-step forward model.
If s (cid:48) is ever visited during the roll-out, the output of k -reachability network is 1 and otherwise, the output is 0.
[Figure]
Result.
We compared the performance of our SPRL with the learned RNet and the ground-truth
RNet ( GT-SPRL ) in Figure 15 with the best hyperparameters.
Overall, the performance of SPRL and GT-SPRL are similar.
This is partly because the learned RNet achieves a quite high accuracy in early stage of learning (see Figure 13).
Interestingly, we can observe that our SPRL with learned
RNet performs better than SPRL with GT-RNet on FourRooms-7 × 7 and KeyDoors-7 × 7 .
This is possible since a small noise in RNet output can have a similar effect to the increased tolerance ∆ t on
RNet, which makes the resulting cost more dense, which may be helpful depending on the tasks and hyperparameters.
B. A BLATION STUDY : CURRICULUM LEARNING OF RN ET
We applied the linear scheduling of k to see if curriculum learning can improve the RNet training, and eventually improve our SPRL performance.
For example, in case of FourRooms-7 × 7 , we used k = 1 until 0.1M steps, and k = 2 until 0.2M steps, and so on, and ﬁnally k = 5 from 0.4M steps to 0.5M steps.
Figure 16 compares the performance of SPRL on four MiniGrid tasks with and without curriculum learning applied.
The result shows that, however, the curriculum learning is not helpful for RNet training.
We conjecture that changing k during training RNet makes the learning unstable since changing k completely ﬂips the learning target for some inputs; e.g, the two states that aresteps away are unreachable for k = 1 but reachable for k = 2 .
[Figure]
C E XPERIMENT DETAILS OF MiniGrid DOMAIN C. E NVIRONMENT
MiniGrid is a 2D grid-world environment with diverse predeﬁned tasks (Chevalier-Boisvert et al., 2018).
It has several challenging features such as pictorial observation, random initialization of the agent and the goal, complex action space and transition dynamics involving agent’s orientation of movement and changing object status via interaction (e.g., key-door).
State Space.
An observation s t is represented as H × W × C tensor, where H and W are the height and width of map respectively, and C is features of the objects in the grid.
The ( h, w ) -th element of observation tensor is ( type, color, status ) of the object and for the coordinate of agent, the ( h, w ) -th element is ( type, 0 , direction ) .
The map size ( i.e ., H × W ) varies depending on the task; e.g ., for FourRooms-7 × 7 task, the map size is 7 × 7 .
Action Space and transition dynamics
The episode terminates in 100 steps, and the episode may terminate earlier if the agent reaches the goal before 100 steps.
The action space consists of seven discrete actions with the following transitions.
• Turn-Counter-Clockwise : change the direction counter-clockwise by 90 degree. • Turn-Clockwise : change the direction clockwise by 90 degree.
• Move-Forward : move toward direction by 1 step unless blocked by other objects.
• Pick-up-key : pickup the key if the key is in front of the agent.
• Drop-the-key : drop the key in front of the agent.
• Open/Close-doors : open/close the door if the door is in front of the agent.
• Optional-action : not used
Reward function.
The reward is given only if the agent reaches the goal location, and the reward magnitude is 1 − 0 .
9( length of episode / maximum step for episode ) .
Thus, the agent can maximize the reward by reaching to the goal location in shortest time.
C. T ASKS
In FourRooms-7 × 7 and FourRooms-11 × 11 , the map structure has four large rooms, and the agent needs to reach to the goal.
In KeyDoors-7 × 7 and KeyDoors-11 × 11 , the agent needs to pick up the key, go to the door, and open the door before reaching to the goal location.
C. A RCHITECTURE AND HYPER - PARAMETERS
We used a simple CNN architecture similar to (Mnih et al., 2015) for policy network.
The network consists of Conv1(16x2x2-1/SAME) - CReLU - Conv2(8x2x2-1/SAME) - CReLUConv3(8x2x2-1/SAME) - CReLU - FC(512) - FC(action-dimension) , where
SAME padding ensures the input and output have the same size ( i.e ., width and height) and CReLU (Shang et al., 2016) is a non-linear activation function applied after each layer.
We used Adam (Kingma &
Ba, 2014) optimizer to optimize the policy network.
For hyper-parameter search, we swept over a set of hyper-parameters speciﬁed in Table 1, and chose the best one in terms of the mean AUC over all the tasks, which is also summarized in Table 1. [Table]
D E XPERIMENT DETAILS OF DeepMind Lab DOMAIN D. E NVIRONMENT
DeepMind Lab is a 3D-game environment with ﬁrst-person view.
Along with random initialization of the agent and the goal, complex action space including directional change, random change of texture, color and maze structure are features that make tasks in DeepMind Lab hard to be learned.
State Space.
An observation s t has the dimension of 120 × 160 × 3 tensor.
Observation is given as a ﬁrst-person view of the map structure.
Action Space and transition dynamics
The episode terminates after the ﬁxed number of steps regardless of goal being achieved.
The original action space consists of seven discrete actions:
Move-Forward , Move-Backward , Strafe Left , Strafe Right , Look Left , Look Right , Look Left and Move-Forward , Look Right and Move-Forward .
In our experiment, we used eight discrete actions with the additional action Fire as in (Higgins et al., 2017;
Vezhnevets et al., 2017;
Savinov et al., 2018b; Espeholt et al., 2018; Khetarpal & Precup, 2018).
D. T ASKS
We tested our agent and compared methods on three standard tasks in DeepMind Lab : GoalSmall , GoalLarge , and ObjectMany which correspond to explore goal locations small , explore goal locations large , and explore object rewards many , respectively.
GoalSmall and GoalLarge has a single goal in the maze, but the size of the maze is larger in
GoalLarge than GoalSmall .
The agent and goal locations are randomly set in the beginning of the episode and the episode length is ﬁxed to 1,350 steps for GoalSmall and 1,800 steps for GoalLarge .
When the agent reaches the goal, it positively rewards the agent and the agent is re-spawned in a random location without terminating the episode, such that the agent can reach to the goal multiple times within a single episode.
Thus, the agent’s goal is to reach to the goal location as many times as possible within the episode length.
ObjectMany has multiple objects in the maze, where reaching to the object positively rewards the agent and the object disappears.
The episode length is ﬁxed to 1, steps.
The agent’s goal is to gather as many object as possible within the episode length.
D. R EACHABILITY NETWORK T RAINING
Similar to Savinov et al.
(2018b), we used the following contrastive loss for training the reachability network:
[Equation]
where s anc , s + , s − are the anchor, positive, and negative samples, respectively.
The anchor, positive and negative samples are sampled from the same episode, and their time steps are sampled according to Algorithm 2.
The RNet is trained in an off-policy manner from the replay buffer with the size of 60K environment steps collecting agent’s online experience.
We found that adaptive scheduling of
RNet is helpful for faster convergence of RNet.
Out of 20M total environment steps, for the ﬁrst 1M, 1M, and 18M environment steps, we updated RNet
every 6 K , 12 K , and 36 K environment steps, respectively.
For all three environments of DeepMind Lab , RNet accuracy was ∼ 0 .
9 after 1M steps.
Multiple tolerance.
In order to improve the stability of Reachability prediction, we used the statistics over multiple samples rather than using a
As a choice of sampling method, we simply used multiples of tolerance.
In other words, given s t − ( k +∆ t ) and s t as inputs for reachability network, we instead used s t − ( k + n ∆ t ) and s t where 1 ≤ n ≤ N ∆ t , n ∈ N and N ∆ t is the number of tolerance samples.
We used 90-percentile of N ∆ t outputs of reachability network, Rnet k − 1 ( s t − ( k + n ∆ t ) , s t ) , as in (Savinov et al., 2018b) to get the representative of the samples.
D. A RCHITECTURE AND HYPER - PARAMETERS
Following (Savinov et al., 2018b), we used the same CNN architecture used in (Mnih et al., 2015).
To ﬁt the architecture, we resized the input observation image into 84 × 84 × 3 image, and normalized by dividing the pixel value by 255.
For SPRL , we used a smaller reachability network (RNet) architecture compared to ECO to reduce the training time.
The RNet is based on siamese architecture with two branches.
Following (Savinov et al., 2018b), ECO used Resnet-18 (He et al., 2016) architecture with 2-2-2-2 residual blocks and 512-dimensional output fully-connected layer to implement each branch.
For SPRL , we used
Resnet-12 with 2-2-1 residual blocks and 512-dimensional output fully-connected layer to implement each branch.
The RNet takes two states as inputs, and each state is fed into each branch.
The outputs of the two branches are concatenated and forwarded to three 4 512-dimensional fully-connected layers to produce one-dimensional sigmoid output, which predicts the reachability between two state inputs.
We also resized the observation to the same dimension as policy ( i.e ., 84 × 84 × 3 , which is smaller than the original 120 × 160 × 3 used in (Savinov et al., 2018b)).
For all the baselines ( i.e ., PPO , ECO , ICM , and GT-Grid ), we used the best hyperparameter used in (Savinov et al., 2018b).
For SPRL , we searched over a set of hyperparameters speciﬁed in Table 2, and chose the best one in terms of the mean AUC over all the tasks, which is also summarized in Table
[Table]
Hyperparameters for SPRL
[Table]
E O PTION FRAMEWORK - BASED FORMULATION E. P RELIMINARY : OPTION FRAMEWORK
Options framework (Sutton, 1998) deﬁnes options as a generalization of actions to include temporally extended series of action.
Formally, options consist of three components: a policy π : S ×A → [0 , 1] , a termination condition β : S + → [0 , 1] , and an initiation set I ⊆ S .
An option (cid:104)I , π, β (cid:105) is available in state s if and only if s ∈ I .
If the option is taken, then actions are selected according to π until the option terminates stochastically according to β .
Then, the option-reward and option-transition models are deﬁned as
[Equation]
where t + k is the random time at which option o terminates, E ( o, s, t ) is the event that option o is initiated in state s at time t , and p ( s (cid:48) , k ) is the probability that the option terminates in s (cid:48) after k steps.
Using the option models [Equation] we can re-write Bellman equation as follows:
[Equation]
where t + k is the random time at which option o terminates and E ( o, s ) is the event that option o is initiated in state s .
E. O PTION - BASED VIEW - POINT OF SHORTEST - PATH CONSTRAINT
In this section, we present an option framework-based viewpoint of our shortest-path (SP) constraint.
We will ﬁrst show that a (sparse-reward)
MDP can be represented as a weighted directed graph where nodes are rewarding states, and edges are options.
Then, we show that a policy satisfying SP constraint also maximizes the option-transition probability P oss (cid:48) .
For a given MDP M = ( S , A , R , P , ρ, ¯ S ) , let S R =
{ s | R ( s ) (cid:54) = 0 } ⊂ S be the set of all rewarding states, where R ( s ) is the reward function upon arrival to state s .
In sparse-reward tasks, it is assumed that |S R | << |S| .
Then, we can form a weighted directed graph G π =
( V , E ) of policy π and given
MDP.
The vertex set is deﬁned as V = S R ∪ ρ 0 ∪ ¯ S where S R is rewarding states, ρ 0 is the initial states, and ¯ S is the terminal states.
Similar to the path set in Deﬁnition 2, let T s → s (cid:48) denotes a set of paths transitioning from one vertex s ∈ V to another vertex s (cid:48) ∈ V :
[Equation]
Then, the edge from a vertex s ∈ V to another vertex s (cid:48) ∈ V is deﬁned by an (implicit) option tuple: o ( s, s (cid:48) )
=
( I , π, β ) ( s,s (cid:48) ) , where I = { s } , β ( s ) =
I ( s = s (cid:48) ) , and π ( s,s (cid:48) )
( τ ) =
(cid:26) 1 Z π ( τ ) for τ ∈ T s → s (cid:48) otherwise ,
[Equation]
21) where Z is the partition function to ensure ( cid:82) π
( s,s (cid:48) )
( τ ) dτ
= 1 .
Following Eq.
(16), the option-reward is given as
[Equation]
where t + k is the random time at which option o ( s, s (cid:48) )
terminates, and E ( o, s, t ) is the event that option
o ( s, s (cid:48) ) is initiated in state s at time t .
Note that in the last equality, r t +1 = · · · = r t + k − 1 =holds since { s t +1 , . . .
, s t + k − 1 } ∩ V = ∅ from the deﬁnition of option policy π
( s,s (cid:48) ) .
Following
Eq.
(17), the option transition is given as
[Equation]
26) where p ( s (cid:48) , k ) is the probability that the option terminates in s (cid:48) after k steps, and D π nr ( s, s (cid:48) ) is the π -distance in Deﬁnition 3.
Then, we can re-write the shortest-path constraint in terms of P πs,s (cid:48) as follows:
[Equation]
Thus, we can see that the policy satisfying SP constraint also maximizes the option-transition probability.
We will use this result in Appendix F.
F S HORTEST -P ATH C ONSTRAINT : A S INGLE - GOAL C ASE
In this section, we provide more discussion on a special case of the shortest-path constraint (Section 3.1), when the (stochastic)
MDP deﬁnes a single-goal task: i.e ., there exists a unique initial state s init ∈ S and a unique goal state s g ∈ S such that s g is a terminal state, and R ( s ) >
if and only if s = s g .
We ﬁrst note that the non-rewarding path set is identical to the path set in such a setting, because the condition r t =
( t < (cid:96) ( τ )) from Deﬁnition 2 is always satisﬁed as R ( s ) > 0 ⇔ s = s g and s (cid:96) ( τ ) =
s g :
[Equation]
Again, T πs,s (cid:48) is a set of all path starting from s ( i.e ., and ending at s (cid:48)
( i.e ., s (cid:96) ( τ ) =
s (cid:48) ) where the agent visits s (cid:48) only at the end ( i.e ., { s t } t<(cid:96) ( τ ) (cid:54) =
s (cid:48) ), that can be rolled out by policy with a non-zero probability ( i.e ., p π ( τ ) > 0 ).
We now claim that an optimal policy satisﬁes the shortest-path constraint.
The idea is that, since s g is the only rewarding and terminal state, maximizing R ( τ ) =
γ T R ( s g ) where s T = s g corresponds to minimizing the number of time steps T to reach s g .
In this setting, a shortest-path policy is indeed optimal.
Lemma 4.
For a single-goal MDP, any optimal policy satisﬁes the shortest-path constraint.
Proof.
Let s init be the initial state and s g be the goal state.
We will prove that any optimal policy is a shortest-path policy from the initial state to the goal state.
We use the fact that s g is the only rewarding state, i.e ., R ( s ) > 0 entails s = s g .
[Equation]
where Eq.
(33) holds since R ( s g ) > 0 from our assumption that R ( s ) + V ∗ ( s ) > 0 .
G P ROOF OF T HEOREM
We make the following assumptions on the Markov Decision Process (MDP) M : namely mild stochasticity (Deﬁnitions 8 and 9).
Deﬁnition 8 (Mild stochasticity (1)) .
In MDP M , there exists an optimal policy π ∗ and the corresponding shortest-path policy π sp ∈ Π SP such that for all s, s (
cid:48) ∈
Φ π , it holds p π ∗ (
¯ s = s (cid:48) | s 0 = s )
= p π sp (¯ s = s (cid:48) | s
= s ) .
Deﬁnition 9 (Mild stochasticity (2)) .
In MDP M , the optimal policy π ∗ does not visit the same state more than once: For all s ∈ S such that ρ π ∗ ( s ) > 0 , it holds ρ π ∗ ( s ) = 1 , where ρ π ( s ) (cid:44)
E s 0 ∼ ρ 0 ( S ) ,a ∼ π ( A | s ) ,s (cid:48) ∼ ( S | s,a ) (cid:104)(cid:80)
Tt =
I ( s t = s ) (cid:105) is the state-visitation count.
In other words, we assume that the optimal policy does not have a cycle.
One common property of
MDP that meets this condition is that the reward disappearing after being acquired by the agent.
We note that this assumption holds for many practical environments.
In fact, in many cases as well as
Atari , DeepMind Lab , etc.
Theorem 1.
For any MDP with the mild stochasticity condition, an optimal policy π ∗ satisﬁes the shortest-path constraint: π ∗ ∈ Π SP .
Proof.
For simplicity, we prove this based on the option-based view point (see Appendix E).
By plugging Eq.
(23) and Eq.
(25) into Eq.
(19), we can re-write the Bellman equation of the value function V π ( s ) as follows:
[Equation]
where ¯ s is the ﬁrst rewarding state that agent encounters.
Intuitively, p π (¯ s = s
[Equation]
| s 0 = s ) means the probability that the s (cid:48) is the ﬁrst rewarding state that policy π encounters when it starts from s .
From Eq.
(28), our goal is to show:
[Equation]
[Equation]
where P ∗ s,s (cid:48)
=
max π P πs,s (cid:48) .
We will prove Eq.
(40) by contradiction.
Suppose π ∗ is an optimal policy such that π ∗ (cid:54)∈ Π SP .
Then,
[Equation] [Equation]
Recall the deﬁnition: P ∗ s,s (cid:48)
=
max π P πs,s (cid:48) .
Then, for any π , the following statement is true.
[Equation]
Thus, we have
[Equation]
Let π sp ∈ Π SP be a shortest path policy that preserves stochastic dynamics from Deﬁnition 8.
Then, we have
[Equation]
Then, let’s compose a new policy ˆ π :
[Equation]
Now consider a path τ
ˆ s → ˆ s (cid:48) that agent visits ˆ s at time t
= i and transitions to ˆ s (cid:48) at time t =
j > i while not visiting any rewarding state from t
= i to t =
j with non-zero probability ( i.e ., p π sp ( τ ) > 0 ).
We can deﬁne a set of such paths as follows:
[Equation]
To reiterate the deﬁnitions from Deﬁnition 6: S IR
=
{ s | R ( s ) > 0 or ρ ( s ) > 0 } is the union of all initial and rewarding states, and
Φ π
=
( s, s (cid:48) ) | s, s (cid:48)
∈ S IR , ρ ( s ) > 0 , T πs,s (cid:48) , nr (cid:54) = ∅} is the subset of
S IR such that agent may roll out.
From Deﬁnition 9 and Eq.
(45), the likelihood of a path τ under policy ˆ π is given as follows:
[Equation]
otherwise
[Equation]
where p ˆ π ( τ ) is the likelihood of trajectory τ under policy
ˆ π , p ˆ
[Equation]
dτ ensures the likelihood ˆ π ( τ ) to be a valid probability density function ( i.e ., (cid:82) p ˆ π ( τ ) dτ = 1 ).
From the path τ ˆ s → ˆ s (cid:48) and i, j , we will choose two states s ir , s (cid:48)
ir ∼ τ ˆ s → ˆ s (cid:48) , where
[Equation]
Note that such s ir and s (cid:48) ir always exist in τ ˆ s → ˆ s (cid:48) since the initial state and the terminal state satisfy the condition to be s ir and s (cid:48) ir .
Then, we can show that the path between s ir and s (cid:48) ir is not a shortest-path.
Recall the deﬁnition of
D π nr ( s, s (cid:48) )
(Deﬁnition 3):
[Equation]
 [Equation] [Equation] where we will use ♣ := γ (cid:96) ( τ ) | τ ∈ T π ∗ s ir ,s (cid:48) ir , nr for a shorthand notation.
Then, we have
[Equation]
(From Deﬁnition 5) < p
[Equation]
(From Eq. [Equation]
[Equation]
where Ineq.
(56) is given by the fact that γ < 1 .
Then, P π ∗ s ir ,s (cid:48)
ir <
P ˆ πs ir ,s (cid:48) ir
[Equation]
From Eq.
(39), we have
[Equation]
where Eq.
(59) holds from the mild-stochasticity (1) and mild-stochasticity (2) assumption, and
Ineq.
(60) holds because P ˆ πs ir ,s (cid:48)
ir > P π ∗ s ir ,s
[Equation]
ir and R ( s (cid:48) )
+ γV π ∗ ( s (cid:48) ) > 0 from the non-negative optimal value assumption (See Section 2).
Finally, this is a contradiction since the optimal value function
V ∗ ( s ) should be the maximum.
H E XTENDED RELATED WORKS
Approximate state abstraction.
The approximate state abstraction approaches investigate partitioning an MDP’s state space into clusters of similar states while preserving the optimal solution.
Researchers have proposed several state similarity metrics for MDPs.
Dean et al.
(2013) proposed to use the bisimulation metrics (Givan et al., 2003; Ferns et al., 2004), which measures the difference in transition and reward function.
Bertsekas et al.
(1988) used the magnitude of Bellman residual as a metric.
Abel et al.
; Li et al.
(2006) used the different types of distance in optimal
Q-value to measure the similarity between states to bound the sub-optimality in optimal value after the abstraction.
Recently, Castro (2019) extended the bisimulation metrics to the approximate version for deep-RL setting where tabular representation of state is not available.
Our shortest-path constraint can be seen as a form of state abstraction, in that ours also aim to reduce the size of MDP ( i.e ., state and action space) while preserving the “solution quality”.
However, our method does so by removing sub-optimal policies, not by aggregating similar states (or policies).
Connection to Option framework Our shortest-path constraint constrains the policy space to a set of shortest-path policies (See Deﬁnition 5 for deﬁnition) between initial and rewarding states.
It can be seen as a set of options (Sutton, 1998) transitioning between initial and rewarding states.
We refer the readers to Appendix E for the detailed description about option framework-based formulation of our framework.