R EINFORCEMENT L EARNING WITH P ROBABILISTICALLY C OMPLETE E XPLORATION
Anonymous authors
Paper under double-blind review
A BSTRACT
Balancing exploration and exploitation remains a key challenge in reinforcement learning (RL).
State-of-the-art RL algorithms suffer from high sample complexity, particularly in the sparse reward case, where they can do no better than to explore in all directions until the ﬁrst positive rewards are found.
To mitigate this, we propose
Rapidly Randomly-exploring Reinforcement Learning (R3L).
We formulate exploration as a search problem and leverage widely-used planning algorithms such as
Rapidly-exploring Random Tree (RRT) to ﬁnd initial solutions.
These solutions are used as demonstrations to initialize a policy, then reﬁned by a generic RL algorithm, leading to faster and more stable convergence.
We provide theoretical guarantees of R3L exploration ﬁnding successful solutions, as well as bounds for its sampling complexity.
We experimentally demonstrate the method outperforms classic and intrinsic exploration techniques, requiring only a fraction of exploration samples and achieving better asymptotic performance.
I NTRODUCTION
Reinforcement Learning (RL) studies how agents can learn a desired behaviour by simply using interactions with an environment and a reinforcement signal.
Central to RL is the long-standing problem of balancing exploration and exploitation .
Agents must ﬁrst sufﬁciently explore the environment to identify high-reward behaviours, before this knowledge can be exploited and reﬁned to maximize long-term rewards.
Many recent RL successes have been obtained by relying on well-formed reward signals, that provide rich gradient information to guide policy learning.
However, designing such informative rewards is challenging, and rewards are often highly speciﬁc to the particular task being solved.
Sparse rewards, which carry little or no information besides binary success or failure, are much easier to design.
This simplicity comes at a cost; most rewards are identical, so that there is little gradient information to guide policy learning.
In this setting, the sample complexity of simple exploration strategies was shown to grow exponentially with state dimension in some cases (Osband et al., 2016b).
Intuition behind this phenomenon can be gained by inspecting in regions where the return surface is ﬂat leads to a random walk type search.
This inefﬁcient search continues until non-zero gradients are found, which can then be followed to a local optimum.
Planning algorithms can achieve much better exploration performance than random walk by taking search history into account (Lavalle, 1998).
These techniques are also often guaranteed to ﬁnd a solution in ﬁnite time if one exists (Karaman & Frazzoli, 2011).
In order to leverage the advantages of these methods, we formulate RL exploration as a planning problem in the state space.
Solutions found by search algorithms are then used as demonstrations for RL algorithms, initializing them in regions of policy parameter space where the return surface is not ﬂat.
Figure 1b shows the importance of such good initialization; surface gradients can be followed, which greatly facilitates learning.
This paper brings the following contributions.
We ﬁrst formulate RL exploration as a planning problem.
This yields a simple and effective method for automatically generating demonstrations without the need for an external expert, solving the planning problem by adapting the classic
Rapidly-exploring Random Tree algorithm (RRT) (Kuffner & LaValle, 2000).
The demonstrations are then used to initialize an RL policy, which can be reﬁned with a classic RL method such as TRPO (Schulman et al., 2015).
We call the proposed method Rapidly Randomly-exploring
Reinforcement Learning (R3L) 1 , provide theoretical guarantees for ﬁnding successful solutions
[Figure]
and derive bounds for its sampling complexity.
Experimentally, we demonstrate R3L improves exploration and outperforms classic and recent exploration techniques, and requires only a fraction of the samples while achieving better asymptotic performance.
Lastly, we show that R3L lowers the variance of policy gradient methods such as TRPO, and verify that initializing policies in regions with rich gradient information makes them less sensitive to initial conditions and random seed.
The paper is structured as follows: Section 2 analyzes the limitations of classic RL exploration.
Section 3 describes R3L and provides theoretical exploration guarantees.
Related work is discussed in
Section 4, followed by experimental results and comments in Section 5.
Finally, Section 6 concludes and gives directions for future work.
S PARSE -R EWARD RL AS R ANDOM W ALK
Many recent RL methods are based on a policy gradient optimization scheme.
This approach optimizes policy parameters θ with gradient descent, using a loss function L ( θ ) (e.g. expected return) and gradient g ( θ ) ≡ ∇ θ L ( θ ) .
Since computing L ( θ ) exactly is intractable, it is common to use unbiased empirical estimators ˆ L ( θ ) and ˆ g ( θ ) , estimated from samples acquired by executing the policy.
Optimization of θ then follows the common stochastic gradient descent (SGD) update-rule (Bottou, 2010; Robbins & Monro, 1951): θ n +1 = θ n − (cid:15)
ˆ g ( θ n ) , where (cid:15) is the learning rate.
The SGD update rule deﬁnes a discrete-time stochastic process (Mandt et al., 2017).
Note that ˆ g is the mean of n mb i.i.d.
samples.
Following the central limit theorem, the distribution over ˆ g is approximately ˆ g ( θ ) ∼ N ( g ( θ ) , 1 n mb C ( θ )) , meaning ˆ g is an unbiased estimator of g with covariance 1 n mb C ( θ ) .
Consequently, the update rule can be rewritten as (Mandt et al., 2017):
[Equation]
Here we assume that C ( θ ) =
C , i.e. approximately constant w.r.t.
θ , and factorizes as C = BB T .
SGD is efﬁcient for high-dimensional problems as it offers almost dimension independent convergence rates (Nesterov, 2018).
However, SGD requires non-zero gradients to guide the search towards the optimum θ ∗ , i.e. | g ( θ ) | > (cid:15) g , ∀ θ (cid:54)
= θ ∗ , (cid:15) g ∈ R .
In the case of sparse-reward RL problems, such as in
Figure 1, much of the loss surface is ﬂat.
This leads to inefﬁcient exploration of parameter space Θ , as the drift component in Eq.
(1) g ≈ 0 , turning the SGD to a random walk in Θ ; ∆ θ = (cid:15)n mb B ∆ W .
Random walk is guaranteed to wander to inﬁnity when dimensionality d Θ ≥ 3 (Pólya, 1921; Kakutani, 1944).
However, the probability of it reaching a desired region in Θ , e.g. where g (cid:54) = 0 , depends heavily on problem speciﬁc parameters.
The probability of θ n ever reaching a sphere of radius r centered at C such that
(cid:107)C − θ 0 (cid:107) =
R > r is (Dvoretzky & Erd˝os, 1951):
[Equation]
In sparse RL problems r < R , thus the probability of reaching a desired region by random walk is smaller than 1, i.e. there are no guarantees of ﬁnding any solution, even in inﬁnite time.
This is in stark contrast with the R3L exploration paradigm, as discussed in Section 3.5.
R3L: R APIDLY AND R ANDOMLY - EXPLORING R EINFORCEMENT L EARNING
R3L adapts RRT to the RL setting by formulating exploration as a planning problem in state space.
Unlike random walk, RRT encourages uniform coverage of the search space and is probabilistically complete, i.e. guaranteed to ﬁnd a solution (Kleinbort et al., 2019).
R3L is decomposed into three main steps: (i) exploration is ﬁrst achieved using RRT to generate a data-set of successful trajectories, described in Sections 3.2 and 3.3, (ii) successful trajectories are converted to a policy using learning from demonstrations (Section 3.4), and (iii) the policy is reﬁned using classic RL methods.
3. D EFINITIONS
This work is based on the Markov Decision Process (MDP) framework, deﬁned as a tuple < S , A , T, R, γ > .
S and A are spaces of states s and actions a respectively.
T : S×A×S → [0 , 1] is a transition probability distribution so that T ( s t , a t , s t +1 )
= p ( s t +1 | s t , a t ) , where the subscript t indicates the t th discrete timestep.
R : S×A×S → R is a reward function deﬁning rewards r t associated with transitions ( s t , a t , s t +1 ) .
γ ∈ [0 , 1) is a discount factor.
Solving a MDP is equivalent to ﬁnding the optimal policy π ∗ maximizing the expected return J ( π ∗ ) =
E T,π ∗ [ (cid:80) Ht
=
γ t R ( s t , a t , s t +1 )] for some time horizon H , where actions are chosen according to a t
= π ∗ ( s t ) .
Lastly, let S be a Euclidean space, equipped with the standard Euclidean distance metric with an associated norm denoted by (cid:107)·(cid:107) .
The space of valid states is denoted by F ⊆ S .
3. E XPLORATION AS A PLANNING PROBLEM WITH RRT
The RRT algorithm (LaValle & Kuffner, 2001) provides a principled approach for planning in problems that cannot be solved directly (e.g. using inverse kinematics), but where it is possible to sample transitions.
RRT builds a tree of valid transitions between states in F , grown from a root s 0 .
As such, the tree T maintains information over valid trajectories .
The exploration problem is deﬁned by the pair ( F , s 0 ) .
In RL environments with a known goal set F goal ⊆
F (e.g. MountainCar), the exploration problem is deﬁned by ( F , s 0 , F goal ) .
The RRT algorithm starts by sampling a random state s rand ∈ S , used to encourage exploration in a speciﬁc direction in the current iteration.
This necessitates the ﬁrst of two assumptions.
Assumption 1.
Random states can be sampled uniformly from the MDP state space S .
Sampled states are not required to be valid, thus sampling a random state is typically equivalent to trivially sampling a hyper-rectangle.
Then, the vertex s near = arg min s ∈ T (cid:107) s rand − s near (cid:107) is found.
RRT attempts to expand the tree T from s near toward s rand by sampling an action a ∈ A according to a steering function Υ : S × S
→ A .
In many planning scenarios, Υ samples randomly from A .
A forward step s new =
f ( s near , a ) is then simulated from s near using action a , where f is deﬁned by the transition dynamics.
Being able to expand the tree from arbitrary s near relies on another assumption.
Assumption 2.
The environment state can be set to a previously visited state s ∈ T .
Although this assumption largely limits the algorithm to simulators, it has previously been used in Florensa et al.
; Nair et al.
; Ecoffet et al.
(2019) for example; see discussion in
Section 6 on overcoming the limitation to simulated environments. s new is added as a new vertex of T , alongside an edge ( s near , s new ) with edge information a .
This process repeats until a sampling budget k is exhausted or the goal set is reached (i.e. s new ∈ F goal ).
Deﬁnition 1.
A valid trajectory is a sequence τ =
[ s 0 , a 0 , s 1 , . .
, s t τ − 1 , a t τ − 1 , s t τ ] such that ( s t , a t , s t +1 ) is a valid transition and s t ∈ F , ∀ t ∈ { 0 , 1 , . .
t τ } .
Whenever a goal set is deﬁned, a successful valid trajectory end state satisﬁes s t τ ∈ F goal .
Input: s 0 , k : sampling budget (optional) F goal , p g : goal sampling prob.
Output: τ : successful trajectory 2 Add root node s 0 to T 3 for i = 1 : k do s rand ← sample random state s rand ∈ S if u ∼ U (0 , 1) ≤ p g then s rand ← sample s rand from F goal end s near ← ﬁnd nearest node to s rand in T a ← sample π l ( s near , s rand − s near ) s new ← execute a in state s near update π l with ( { s near , s new − s near } , a )
Add node s new , a and edge ( s near , s new ) to T 13 end 14 τ ← trajectory in T with max.
cumulated reward
Once planning is ﬁnished, a successful valid trajectory can easily be generated from T by retrieving all nodes between the leaf s leaf ∈ F goal and the root.
Because tree T is grown from valid transitions between states in F , these trajectories are valid by construction.
3. R3L EXPLORATION : A DAPTING RRT TO RL
RRT is not directly applicable to RL problems.
This subsection presents the necessary adaptations to the exploration phase of R3L, summed up in Algorithm 1.
Figure 2 shows R3L’s typical exploration behaviour.
Local policy learning: In classic planning problems, selecting actions extending s near towards s rand is easy, as these have a geometric interpretation or there is a known steering function.
RL state spaces do not beneﬁt from the same geometric properties, and properly selecting actions can be challenging.
We solve this problem by deﬁning a local policy π l , which models the distribution of actions to transition from a state to a neighbouring goal state.
Actions to extend a tree branch are sampled as a ∼ π l ( s near , s rand − s near ) .
We formulate the problem of learning π l as supervised learning, where inputs are starting states s t augmented with the difference s t +1 − s t , and targets are actions.
The model is learned using transition data collected from previous tree expansion iterations.
Results in this paper use Bayesian linear regression to represent π l , but any supervised learning model can applied instead.
Unknown dynamics: RRT was designed for problems with known continuous dynamics f , but RL features unknown discrete transition dynamics.
In R3L, f is replaced with an environment interaction from s near , with selected action a , resulting in a new state s new .
Since ( s near , a, s new ) is a real transition, it must be valid, and s new can be added to the tree T .
Biasing search with F goal : Better exploration efﬁciency can be achieved if goal information is available.
Indeed, the RRT framework allows for biasing exploration towards F goal , often resulting in faster exploration.
This is achieved by sampling s rand from F goal instead of F with low probability p g , while the rest of the iteration remains unchanged.
Since R3L uses RRT to explore, the algorithm is most suitable for RL problems that are fully observable, exhibit sparse rewards and have continuous controls.
R3L is applicable to other RL problems, but may not perform as well as methods tailored to speciﬁc cases.
3. P OLICY INITIALIZATION FROM R3L DEMONSTRATIONS
Upon completion, R3L exploration yields a successful trajectory τ , which may not be robust to various starting conditions and/or stochastic transitions.
Converting successful trajectories into a policy is crucial to achieve robustness and enable further reﬁnement with RL.
Policy initialization is applied to a set of successful trajectories τ
= { τ i } N 1 generated using N runs of R3L exploration with different starting conditions.
An imitation policy π 0 is learned by supervised learning on transitions from τ .
Policy π 0 is then reﬁned using traditional RL algorithms like TRPO.
As shown in Figure 1, initializing policy parameters in the vicinity of a local optimum is crucial.
3. E XPLORATION GUARANTEES
The RL planning environment deﬁnes differential constraints of the form:
[Equation]
Therefore, starting at s 0 , the trajectory τ can be generated by forward integrating Eq.
(3) with the applied actions.
As with many RL problems, a ( t ) is time-discretized resulting in a piecewise constant control function.
This means τ is constructed of n τ segments of ﬁxed time duration ∆ t such that the overall trajectory duration t τ = n τ · ∆ t .
Thus, a ( t ) is deﬁned as a ( t ) =
a i ∈ A where t ∈ [( i − 1) · ∆ t, i · ∆ t ) and 1 ≤ i ≤ n τ .
Furthermore, as all transitions between states in τ are known, the trajectory return can be deﬁned as R τ = (cid:80) n τ t =
γ t R ( s t , a t , s t +1 ) .
R3L explores in state-action/trajectory space instead of policy parameter space.
Furthermore, it is an effective exploration framework which provides probabilistic completeness (PC):
Deﬁnition 2.
A probabilistically complete planner ﬁnds a feasible solution (if one exists) with a probability approaching 1 in the limit of inﬁnite samples.
With the aforementioned dynamic characteristics, we prove that R3L exploration under the RL setting is PC.
This is in stark contrast to the random walk exploration process, discussed in section 2, which is not PC.
We begin with the following theorem, a modiﬁcation of Theorem 2 from Kleinbort et al.
(2019), which is applied to kinodynamic RRT where a goal set F goal is deﬁned.
Theorem 1.
Suppose that there exists a valid trajectory τ from s 0 to F goal as deﬁned in deﬁnition 1, with a corresponding piecewise constant control.
The probability that R3L exploration fails to reach
F goal from s 0 after k iterations is bounded by ae − bk , for some constants a, b > 0 .
The proof, which is a modiﬁcation of Theorem 2 from Kleinbort et al. (2019), can be found in
Appendix S2.
It should be noted that R3L exploration does not require an explicit deﬁnition for F goal in order to explore the space.
While in some path planning variants of RRT, F goal is used to bias sampling, the main purpose of F goal is to indicate that a solution has been found.
Therefore, F goal can be replaced by another implicit success criterion.
In the RL setting, this can be replaced by a return-related criterion.
Theorem 2.
Suppose that there exists a trajectory with a return R τ ≥ ˆ R, ˆ R ∈ R .
The probability that R3L exploration fails to ﬁnd a valid trajectory from s 0 with R τ ≥ ˆ R after k iterations is bounded by ˆ ae − ˆ bk , for some constants ˆ a, ˆ b > 0 .
Proof.
The proof is straightforward.
We augment each state in τ with the return to reach it from s 0 :
[Equation]
where R s n = = (cid:80) n ≤ n τ t =
γ t R ( s t , a t , s t +1 ) .
For consistency we modify the distance metric by simply adding a reward distance metric.
With the above change in notation, we modify the goal set to
F RLgoal = { ( s, R s ) | s ∈ F goal , R s ≥ ˆ R } , such that there is an explicit criterion for minimal return as a goal.
Consequently, the exploration problem can be written for the augmented representation as ( F , s RL 0 , F RLgoal ) , where s RL= [ s 0 , 0] (cid:62) .
Theorem 1 satisﬁes that R3L exploration can ﬁnd a feasible solution to this problem within ﬁnite time, i.e. PC, and therefore the probability of not reaching F RLgoal after k iterations is upper-bounded by the exponential term
ˆ ae − ˆ bk , for some constants ˆ a, ˆ b >
We can now state our main result on the sampling complexity of the exploration process.
Theorem 3.
If trajectory exploration is probabilistically complete and satisﬁes an exponential convergence bound, the expected sampling complexity is ﬁnite and bounded such that
[Equation]
where ˆ a, ˆ b > 0 .
Proof.
Theorem 2 provides an exponential bound for the probability the planner will fail in ﬁnding a feasible path.
Hence, we can compute a bound for the expected number of iterations needed to ﬁnd a solution, i.e. sampling complexity:
[Equation]
where we used the relation (cid:80) ∞
[Equation]
It is worth noting that while the sample complexity is bounded, the above result implies that its complexity varies according to problem-speciﬁc properties, which are encapsulated in the value of ˆ a and ˆ b .
Intuitively, ˆ a depends on the scale of the problem. It grows as |F RLgoal | becomes smaller or as the length of the solution trajectory becomes longer.
ˆ b depends on the probability of sampling states that will expand the tree in the right direction.
It therefore shrinks as the dimensionality of S increases.
We refer the reader to Appendix S2 for more details on the meaning of ˆ a, ˆ b and the derivation of the tail bound in Theorem 1.
R ELATED WORK
Exploration in RL has been extensively studied.
Classic techniques typically rely on adding noise to actions (Mnih et al., 2015; Schulman et al., 2015) or to policy parameters (Plappert et al., 2018).
However, these methods perform very poorly in settings with sparse rewards.
Intrinsic motivation tackles this problem by deﬁning a new reward to direct exploration.
Many intrinsic reward deﬁnitions were proposed, based on information theory (Oudeyer & Kaplan, 2008), state visit count (Lopes et al., 2012;
Bellemare et al., 2016; Szita & L˝orincz, 2008;
Fox et al., 2018), value function posterior variance (Osband et al., 2016a;
Morere & Ramos, 2018), or model prediction error (Stadie et al., 2015; Pathak et al., 2017).
Methods extending intrinsic motivation to continuous state and action spaces were recently proposed (Houthooft et al., 2016; Morere & Ramos, 2018).
However, these approaches are less interpretable and offer no guarantees for the exploration of the state space.
Offering exploration guarantees, Bayesian optimization was adapted to RL in Wilson et al.
(2014), to search over the space of policy parameters in problems with very few parameters.
Recent work extends the method to functional policy representations (Vien et al., 2018), but results are still limited to toy problems and speciﬁc policy model classes.
Motion planning in robotics is predominantly addressed with sampling-based methods.
This type of approach offers a variety of methodologies for exploration and solution space representation (e.g.,
Probabilistic roadmaps (PRM) (Kavraki et al., 1996), Expansive space trees (ESP) (Hsu et al., 1997) and Rapidly-exploring random tree (RRT) (Kuffner & LaValle, 2000)), which have shown excellent performance in path planning in high-dimensional spaces under dynamic constraints (LaValle &
Kuffner, 2001; Hsu et al., 2002; Kavraki et al., 1996).
RL was previously combined with sampling-based planning to replace core elements of planning algorithms, such as PRM’s point-to-point connection (Faust et al., 2018), local RRT steering function (Chiang et al., 2019) or RRT expansion policy (Chen et al., 2019).
In contrast, the proposed method bridges the gap in the opposite direction, employing a sampling-based planner to generate demonstrations that kick-start RL algorithms and enhance their performance.
Accelerating RL by learning from demonstration was investigated in Niekum et al.
; Bojarski et al.
; Torabi et al.
However, these techniques rely on user-generated demonstrations or a-priori knowledge of environment parameters.
In contrast, R3L automatically generates demonstrations, with no need of an external expert.
E XPERIMENTS
In this section, we investigate (i) how learning a local policy π l and biasing search towards F goal with probability p g affects R3L exploration, (ii) whether separating exploration from policy reﬁnement
[Table]
a viable and robust methodology in RL, (iii) whether R3L reduces the number of exploration samples needed to ﬁnd good policies, compared with methods using classic and intrinsic exploration, and (iv) how R3L exploration can reduce the variance associated with policy gradient methods.
All experiments make use of the Garage (Duan et al., 2016) and Gym (Brockman et al., 2016) frameworks.
The experimental setup features the following tasks with sparse rewards: Cartpole
Swingup ( S ⊆ R 4 , A ⊆ R ), MountainCar ( S ⊆ R 2 , A ⊆ R ), Acrobot ( S ⊆ R 4 , A ⊆ R ), Pendulum ( S ⊆ R 2 , A ⊆ R ), Reacher ( S ⊆ R 6 , A ⊆ R 2 )
Fetch Reach ( S ⊆ R 13 , A ⊆ R 4 ), and Hand Reach ( S ⊆ R 78 , A ⊆ R 20 ).
The exact environment and reward deﬁnitions are described in Appendix S3.
R3L exploration analysis
We ﬁrst analyze the exploration performance of R3L in a limited set of
RL environments, to determine the impact that learning policy π l has on exploration speed.
We also investigate whether R3L exploration is viable in environments where no goal information is available.
Table 1 shows the results of this analysis.
Learning π l seems to greatly decrease the number of exploration timesteps needed on most environments.
However, it signiﬁcantly increases the number of timesteps on the acrobot and reacher environments.
Results also suggest that learning π l helps
R3L to ﬁnd shorter trajectories on the same environments, which is a desirable property in many RL problems.
Biasing R3L exploration towards the goal set F goal helps ﬁnding successful trajectories faster, as well as reducing their length.
However, R3L exploration without goal bias is still viable in all cases.
Although goal information is not given in the classic MDP framework, it is often available in real-world problems and can be easily utilized by R3L. Lastly, successful trajectory lengths have low variance, which suggests R3L ﬁnds consistent solutions.
Comparison to classic and intrinsic exploration on RL benchmarks We examine the rates at which R3L learns to solve several RL benchmarks, and compare them with state-of-the-art RL algorithms.
Performance is measured in terms of undiscounted returns and aggregated overrandom seeds, sampled at random for each environment.
We focus on domains with sparse rewards, which are notoriously difﬁcult to explore for traditional RL methods.
Our experiments focus on the widely-used methods TRPO (Schulman et al., 2015) and DDPG (Lillicrap et al., 2015).
R3L-TRPO and R3L-DDPG are compared to the baseline algorithms with Gaussian action noise.
As an additional baseline we include VIME-TRPO (Houthooft et al., 2016).
VIME is an exploration strategy based on maximizing information gain about the agent’s belief of the environment dynamics.
It is included to show that R3L can improve on state-of-the-art exploration methods as well as naive ones, even though the return surface for VIME-TRPO is no longer ﬂat, unlike Figure 1.
The exact experimental setup is described in Appendix S3.2.
The R3L exploration phase is ﬁrst run to generate training trajectories for all environments.
The number of environment interactions during this phase is accounted for in the results, displayed as an offset with a vertical dashed black line.
The average performance achieved by these trajectories is also reported as a guideline, with the exception of Cartpole Swingup where doing so does not make sense.
RL is then used to reﬁne a policy pretrained with these trajectories.
Figure 3 shows the median and interquartile range for all methods.
R3L is very competitive with both vanilla and VIME baselines.
It converges faster and achieves higher performance at the end of the experiment.
In most cases, the upper quartile for our method begins well above the minimum return, indicating that R3L exploration and pre-training are able to produce successful though not optimal policies.
R3L-DDPG performance, for the majority of problems, starts signiﬁcantly above the minimum return, plunges due to the inherent instability of DDPG, but eventually recovers, indicating that R3L pre-training can help mitigate the instability.
It is worth noting that R3L’s lower quartile is considerably higher than that of baselines.
Indeed, for many of the baselines the lower quartile takes a long time to improve on the minimum return, and in some cases it never manages to do so at all.
This is a common problem in sparse reward RL, where there is no alternative but to search the parameter space randomly until the ﬁrst successful trajectory is found, as explained in Section 2.
While a few random seeds will by chance ﬁnd a successful trajectory quickly (represented by the quickly rising upper quartile), others take a long time (represented by the much slower rise of the median and lower quartile).
In other words, R3L-TRPO/DDPG is much more robust to random policy initialization and to the random seed than standard RL methods.
This is because R3L is able to use automatically generated demonstrations to initialize RL policy parameters to a region with informative return gradients.
C ONCLUSION
We proposed Rapidly Randomly-exploring Reinforcement Learning (R3L), an exploration paradigm for leveraging planing algorithms to automatically generate successful demonstrations, which can be converted to policies then reﬁned by classic RL methods.
We provided theoretical guarantees of R3L ﬁnding solutions, as well as sampling complexity bounds.
Empirical results show that R3L outperforms classic and intrinsic exploration techniques, requiring only a fraction of exploration samples and achieving better asymptotic performance.
As future work, R3L could be extended to real-world problems by leveraging recent advances on bridging the gap between simulation and reality (Peng et al., 2018).
Respecting Assumption 2, a policy would ﬁrst be trained on a simulator and then transferred to the real-world.
Exploration in high-dimensional tasks is also challenging as stated in Theorem 3 and conﬁrmed experimentally by increased R3L exploration timesteps.
Exploiting external prior knowledge and/or the structure of the problem can beneﬁt exploration in high-dimensional tasks, and help make R3L practical for problems such as Atari games.
Lastly, recent advances in RRT (Chiang et al., 2019) and learning from demonstration (Torabi et al., 2018) could also improve R3L.
S A PPENDIX B: P ROOF OF T HEOREM
This appendix proves Theorem 1 which shows that planning using RRT under differential constraints is probabilistically complete.
The following proof is a modiﬁcation of Theorem 2 from Kleinbort et al.
(2019), where completeness of RRT in the RL setting is maintained without the need to explicitly sample a duration for every action.
Equation 3 deﬁnes the environment’s differential constraints.
In practice, Eq.
(3) is approximated by an Euler integration step.
With the interval [0 , t τ ] divided into l >> n τ equal time intervals of duration h with t τ = l · h .
Eq.
(3) is then approximated by an Euler integration step, where the transition between consecutive time steps is given by:
[Equation]
Furthermore, we deﬁne B r ( s ) as a ball with a radius r centered at s for any given state s ∈ S .
We assume that the planning environment is Lipschitz continuous in both state and action, constraining the rate of change of Eq. (S1).
Formally, there exists two positive constants K s , K a > 0 , such that
[Equation]
a 0 , a
[Equation]
A
[Equation]
Lemma 1.
For two trajectories τ , τ (cid:48) , where s
= τ (0) and s (cid:48)
= τ (cid:48) (0) such that (cid:107) s 0 − s (cid:48)
(cid:107) ≤ δ s with δ s a positive constant.
Suppose that for each trajectory a piecewise constant action is applied, so that Υ( t ) = a and Υ (cid:48) ( t )
= a (cid:48) is ﬁxed during a time period T ≥ 0 .
Then (cid:107) τ ( T ) − τ (cid:48)
( T ) (cid:107) ≤
e K s T δ s + TK a e K s T (cid:107) a − a (cid:48) (cid:107) .
The proof for Lemma 1 is given in Lemma 2 of (Kleinbort et al., 2019).
Intuitively, this bound is derived from compounding worst-case divergence between τ and τ (cid:48) at every Euler step along T which leads to an overall exponential dependence.
Using Lemma 1, we want to provide a lower bound on the probability of choosing an action that will expand the tree successfully.
We note that this scenario assumes that actions are drawn uniformly from A , i.e. there is no steering function 2 .
When better estimations of the steering function are available, as described in 3.3, the performance of RRT signiﬁcantly improves.
Deﬁnition 3.
A trajectory τ is deﬁned as δ -clear if for δ clear > 0 , B δ clear ( τ ( t ))
∈ F for all t ∈ [0 , t τ ] .
Lemma 2.
Suppose that τ is a valid trajectory from τ (0)
=
s 0 to τ ( t τ )
=
s goal with a duration of t τ and a clearance of δ .
Without loss of generality, we assume that actions are ﬁxed for all t ∈ [0 , t τ ] , such that Υ( t ) = a ∈ A .
Suppose that RRT expands the tree from a state s (cid:48)
∈ B ( κδ − (cid:15) ) ( s 0 ) to a state s (cid:48) goal , for any κ ∈ (0 , 1] and (cid:15) ∈ (0 , κδ ) we can deﬁne the following bound:
[Equation]
Here, ζ |S| = |B 1 ( · ) | is the Lebesgue measure for a unit circle in S .
Proof.
We denote τ (cid:48) a trajectory that starts from s (cid:48) 0 and is expanded with an applied random action a rand .
According to Lemma 1,
[Equation]
where δ s ≤ κδ − (cid:15) since s (cid:48)
0 ∈ B κδ − (cid:15) ( s 0 ) .
Now, we want to ﬁnd (cid:107) a − a rand (cid:107) such that the distance between the goal points of these trajectories, i.e. in the worst-case scenario, is bounded:
[Equation]
After rearranging this formula, we can obtain a bound for (cid:107) a − a rand (cid:107) :
[Equation]
Assuming that a rand is drawn out of a uniform distribution, the probability of choosing the proper action is
[Equation]
where ζ |S| is used to account for the degeneracy in action selection due to the dimensionality of S .
We note that (cid:15) ∈ (0 , κδ ) guarantees p a ≥ 0 , thus a valid probability>
Equation S4 provides a lower bound for the probability of choosing the suitable action.
The following lemma provides a bound on the probability of randomly drawing a state that will expand the tree toward the goal.
Lemma 3.
Let s ∈ S be a state with clearance δ , i.e. B δ ( s ) ∈ F .
Suppose that for an RRT tree T there exist a vertex v ∈ T such that v ∈ B 2 δ/ 5 ( s ) .
Following the deﬁnition in Section 3.2, we denote s near ∈ T as the closest vertex to s rand .
Then, the probability that s near ∈ B δ ( s ) is
at least |B δ/ 5 ( s ) | / | S | .
Proof.
Let s rand ∈ B δ/ 5 ( s ) .
Therefore the distance between s rand and v is upper-bounded by (cid:107) s rand − v (cid:107) ≤ 3 δ/ 5 .
If there exists a vertex s near such that s near (cid:54) =
v and (cid:107) s rand − s near (cid:107) ≤ (cid:107) s rand − v (cid:107) , then s near ∈ B 3 δ/ 5 ( s rand )
⊂
B δ ( s ) .
Hence, by choosing s rand ∈ B δ/ 5 ( s ) , we are guaranteed s near ∈ B δ ( s ) .
As s rand is drawn uniformly, the probability for s rand ∈ B δ/ 5 ( s ) is |B δ/ 5 ( s ) | / | S | .
We can now prove the main theorem.
Theorem 1.
Suppose that there exists a valid trajectory τ from s 0 to F goal as deﬁned in deﬁnition 1, with a corresponding piecewise constant control.
The probability that RRT fails to reach F goal from s 0 after k iterations is bounded by ae − bk , for some constants a, b > 0 .
Proof.
Lemma 2 puts bound on the probability to ﬁnd actions that expand the tree from one state to another in a given time.
As we assume that a valid trajectory exists, we can assume that the probability deﬁned in Lemma 2 is non-zero, i.e. p a > 0 , hence:
[Equation]
where we set κ = 2 / 5 and (cid:15) =
5 − 2 as was also done in (Kleinbort et al., 2019).
We additionally require that ∆ t , which is typically deﬁned as an RL environment parameter, is chosen accordingly so to ensure that Eq.
(S5) holds, i.e. K s ∆ t < log (cid:16) κδκδ −
[Equation]
(cid:17) .
We cover τ with balls of radius δ = min { δ goal , δ clear } , where B δ goal ⊆
F goal .
The balls are spaced equally in time with the center of the i th ball is in c i = τ (∆ t · i ) , ∀ i = 0 : m , where m = t τ / ∆ t .
Therefore, c
= s 0 and c m = s goal .
We now examine the probability of RRT propagating along τ .
Suppose that there exists a vertex v ∈ B 2 δ/ 5 ( c i ) , we need to bound the probability p that by taking a random sample s rand , there will be a vertex s near ∈ B δ ( c i ) such that s new ∈ B 2 δ/ 5 ( c i +1 ) .
Lemma 3 provides a lower bound for the probability that s near ∈ B
δ ( c i ) , given that there exists a vertex v ∈ B 2 δ/ 5 ( c i ) , of |B δ/ 5 ( s ) | / | S | .
Lemma 2 provide a lower bound for the probability of choosing an an action from s near to s new of ρ ≡ ζ |S|
[Equation]
> 0 , where we have substituted t τ with ∆ t .
Consequently, p ≥ ( |B δ/ 5 ( s ) | · ρ ) / | S | .
For RRT to recover τ , the transition between consecutive circles must be repeated m times.
This stochastic process can be described as a binomial distribution, where we perform k trials (randomly choosing s rand ), with m successes (transition between circles) and a transition success probability p .
The probability mass function of a binomial distribution is Pr( X = m ) =
Pr( m ; k, p ) = (cid:0) km (cid:1) p m (1 − p ) k − m .
We use the cumulative distribution function (CDF) to represent the upper bound for failure, i.e. the process was unable to perform m steps, which can be expressed as:
[Equation]
Using Chernoff’s inequality we derive the tail bounds of the CDF when m ≤ p · k :
[Equation]
X < m
[Equation]
In the other case, where p < m/k < 1 , the upper bound is given by (Arratia & Gordon, 1989):
[Equation]
where D is the relative entropy such that
[Equation]
Rearranging D , we can rewrite S10 as follows:
[Equation]
where (S14) is justiﬁed for worst-case scenario where p
= m/k , (S15) uses the fact
that p < m/k < 0 . 5 , hence 1 − m/k > 0 .
The last step, (S16) is derived from the ﬁrst term of the Taylor expansion of log (cid:16) 1 1 − p (cid:17) =
(cid:80)
[Equation]
As p and m are ﬁxed and independent of k , we show that the expression for Pr( X < m ) decays to zero exponentially with k , therefore RRT is probabilistically complete.
It worth noting that as expected the failure probability Pr( X < m ) depends on problem-speciﬁc properties, which give rise to the values of a and b .
Intuitively, a depends on the scale of the problem such as volume of the goal set |F RLgoal | and how complex and long the solution needs to be, as evident in Eq.
(S9).
More importantly, b depends on the probability p .
Therefore, it is a function of the dimensionality of S (through the probability of sampling s rand ) and other environment parameters such as clearance (deﬁned by δ ) and dynamics (via K s , K a ), as speciﬁed in Eq.
(S4).
S A PPENDIX C: EXPERIMENTAL SETUP
All experiments were run using a single 2 .
2 GHz core and a GeForce GTX 1080 Ti GPU.
S3. E NVIRONMENTS
All environments are made available in supplementary code.
Environments are based on Gym (Brockman et al., 2016), with modiﬁed sparse reward functions and state spaces.
All environments emit a − 1 reward per timestep unless noted otherwise.
The environments have been further changed from
Gym as follows:
• Cartpole Swingup -
The state space S ⊆
R 4 consists of states s = (cid:104) x, θ, ˙ x, ˙ θ (cid:105) where x is cart position, ˙ x is cart linear velocity, θ is pole angle (measuring from the y -axis) and ˙ θ pole angular velocity.
Actions A ⊆ R are force applied on the cart along the x -axis.
The goal space F goal is { s ∈ S | cos θ > 0 . 9 } .
Note that reaching the goal space does not terminate an episode, but yields a reward of cos θ .
Time horizon is H = 500 .
Reaching the bounds of the rail does not cause failure but arrests the linear movement of the cart.
• MountainCar - The state space S ⊆
R 2 consists of states s =
[ x, θ ] where x is car position and ˙ x is car velocity.
Actions A ⊆ R are force applied by the car engine.
The goal space F goal is { s ∈ S | x ≥ 0 . 45 } .
Time horizon is H = 200 .
• Acrobot - The state space S ⊆
R 4 consists of states s = (cid:104) θ 0 , θ 1 , ˙ θ 0 , ˙ θ 1 (cid:105) where θ 0 , θ 1 are the angles of the joints (measuring from the y -axis and from the vector parallel to the 1 st link, respectively) and ˙ θ 0 , ˙ θ 1 are their angular velocities.
Actions A ⊆ R are torque applied on the 2 nd joint.
The goal space F goal is { s ∈ S | − cos θ 0 − cos ( θ 0 + θ 1 ) > 1 . 9 } .
In other words, the set of states where the end of the second link is at a height y > 1 . 9 .
Time horizon is H = 500 .
• Pendulum - The state space S ⊆
R 2 consists of states s = (cid:104) θ, ˙ θ (cid:105) where θ is the joint angle (measured from the y -axis) and ˙ θ is the joint angular velocity.
Actions A ⊆ R are torque applied on the joint.
The goal space F goal is { s ∈ S | cos θ > 0 . 99 } .
Note that reaching the goal space does not terminate an episode, but yields a reward of cos θ .
Time horizon is H = 100 .
• Reacher - The state space S
⊆
R 6 consists of states s = (cid:104) θ 0 , θ 1 , x, y ˙ θ 0 , ˙ θ 1 (cid:105) where θ 0 , θare the angles of the joints, ( x, y ) are the coordinates of the target and ˙ θ 0 , ˙ θ 1 are the joint angular velocities.
Actions A ⊆ R 2 are torques applied at the 2 joints.
The goal space F goal is the set of states where the end-effector is within a distance of 0 .
01 from the target.
Time horizon is H = 50 .
• Fetch Reach - A high-dimensional robotic task where the state space S ⊆ R 13 consists of states s =
[ gripper _ pos, finger _ pos, gripper _ state, finger _ state, goal _ pos ] where gripper _ pos, gripper _ vel are the Cartesian coordinates and velocities of the Fetch robot’s gripper, finger _ state, finger _ vel are the two-dimensional position and velocity of the gripper ﬁngers, and goal _ pos are the Cartesian coordinates of the goal.
Actions A ⊆ R 4 are relative target positions of the gripper and ﬁngers, which the MuJoCo controller will try to achieve.
The goal space F goal is the set of states where the end-effector is within a distance of 0 .
from goal _ pos .
Time horizon is H = 50 .
Note that this problem is harder than the original version in OpenAI Gym, as we only sample goal _ pos that are far from the gripper’s initial position.
• Hand Reach - A high
-dimensional robotic task where the state space S ⊆ R 78 consists of states s =
[ joint _ pos, joint _ vel, fingertip _ pos, goal _ pos ] where joint _ pos, joint _ vel are the angles and angular velocities of the Shadow hand’s 24 joints, fingertip _ pos are the Cartesian coordinates of the 5 ﬁngertips, and goal _ pos are the Cartesian coordinates of the goal positions for each ﬁngertip.
Actions A ⊆ R 20 are absolute target angles of thecontrollable joints, which the MuJoCo controller will try to achieve.
The goal space F goal is the set of states where all ﬁngertips are simultaneously within a distance of 0 .
02 from their respective goals.
Time horizon is H = 50 .
S3. E XPERIMENTAL SETUP AND HYPER - PARAMETER CHOICES
All experiments feature a policy with 2 fully-connected hidden layers of 32 units each with tanh activation, with the exception of Reacher , for which a policy network of 4 fully-connected hidden layers of 128 units each with relu activation is used.
For all environments we use a linear feature baseline for TRPO.
Default values are used for most hyperparameters.
A discount factor of γ = 0 .
99 is used in all environments.
For VIME, hyperparameters values reported in the original paper are used, and the implementation published by the authors was used.
For TRPO, default hyperparameter values and implementation from Garage are used: KL divergence constraint δ = 10 − 2 , and Gaussian action noise N (0 , 0 . 3 2 ) .
In comparisons with VIME-TRPO and vanilla TRPO, the R3L goal sampling probability p g is set to 0 .
05 , as proposed in Urmson & Simmons (2003).
Goal sets F goal are deﬁned in Appendix S3. for each environment.
In all experiments, the local policy π l learned during R3L exploration uses Bayesian linear regression with prior precision 0 .
1 and noise precision 1 . 0 , as well as 300 random Fourier features (Rahimi & Recht, 2008) approximating a square exponential kernel with lengthscale 0 .