S AFER A UTONOMOUS D RIVING IN A S TOCHASTIC , P ARTIALLY -O BSERVABLE E NVIRONMENT BY H IERARCHICAL C ONTINGENCY P LANNING
Ugo Lecerf ∗
Renault Software Labs
EURECOM
Christelle Yemdji Tchassi
Renault Software Labs
Pietro Michiardi
EURECOM
A BSTRACT
When learning to act in a stochastic, partially observable environment, an intelligent agent should be prepared to anticipate a change in its belief of the environment state, and be capable of adapting its actions on-the-ﬂy to changing conditions.
As humans, we are able to form contingency plans when learning a task with the explicit aim of being able to correct errors in the initial control, and hence prove useful if ever there is a sudden change in our perception of the environment which requires immediate corrective action.
This is especially the case for autonomous vehicles (AVs) navigating real-world situations where safety is paramount, and a strong ability to react to a changing belief about the environment is truly needed.
In this paper we explore an end-to-end approach, from training to execution, for learning robust contingency plans and combining them with a hierarchical planner to obtain a robust agent policy in an autonomous navigation task where other vehicles’ behaviours are unknown, and the agent’s belief about these behaviours is subject to sudden, last-second change.
We show that our approach results in robust, safe behaviour in a partially observable, stochastic environment, generalizing well over environment dynamics not seen during training.
I NTRODUCTION
Developing a controller for AVs to be used in a real-life navigation environment poses a number of challenges including perception, and modeling environment dynamics (Michelmore et al., 2020;
Yurtsever et al., 2020).
The limitations in vehicle sensors, as well as the stochastic nature of intervehicle interactions, introduce a level of uncertainty in autonomous navigation tasks which hinders the ability to control an agent from the standpoint of both safety, and adequate performance.
Sensor information, as well as other drivers’ intentions, are subject to sudden change and a robust navigation algorithm must be able to safely adapt on-the-ﬂy to these unforeseen changes.
Stochastic environments can be modeled as Partially-Observable Markov Decision Processes (POMDPs) (Kochenderfer et al., 2015).
Solving POMDPs is challenging, yet possible, for example using methods combining learning and planning such as Brechtel et al.
; Hoel et al.
(2020a).
Having access to a model of the environment dynamics allows us to use planning algorithms, such as tree-search methods (Browne et al., 2012), alongside learning to both increase sample efﬁciency, and have access to a better representation of the environment’s state-space structure (Machado et al., 2017).
In cases where planning is possible it is much easier for an agent to predict the outcome of its actions and hence better adapt to eventual changes in the state-space (McAllister and Rasmussen, 2017).
However, a change in the values of the stochastic model parameters (e.g. a change in a vehicle’s sensor accuracy, unplanned scene obstruction, or simply an unforeseen behaviour from another vehicle) may induce a sharp drop in the agent’s performance due to its inability to generalize well to new environment parameters.
An approach for tackling this issue has been to design controllers to have a high capacity for generalization: instead of attempting to learn over the entire space of possible environments, we design an algorithm to act well enough over the whole space, having trained only on a tractable subset of environment conﬁgurations.
One such example is known as contingency planning, whereby contingency plans are put in place to speciﬁcally counter stochastic environments in which failing to prepare for possible problems in advance can be an expensive mistake (Pryor and Collins, 1996).
Our contribution.
In this work we make the following contributions:
• We introduce a method for learning a contingency policy concurrently to the optimal policy during training, such that the former is well-adapted to serve as a contingency plan.
• We combine learned policies with a high-level model based controller, and experimentally show through an autonomous navigation task that our approach is able to achieve a much safer agent performance in the case of a stochastic environment, while sacriﬁcing a minimal amount of performance.
B ACKGROUND
Deep reinforcement learning (RL) is a method for learning control algorithms in a weaklysupervised manner (by means of a reward signal).
Implementing an RL algorithm requires us to model the environment as a Markov Decision Process (MDP), deﬁned by the following elements:
A ﬁnite set of states s ∈ S , indexed by the timestep at which they are encountered: s t .
A ﬁnite set of actions a ∈ A , also indexed by their respective timesteps: a t .
A transition model
T ( s, a, s ′ ) :
S ×
A × S → [0 , 1] , representing the probability of passing from s to s ′ after taking action a t , P ( s t +1 = s ′
| s t = s, a t = a ) .
An immediate reward function R ( s, a, s ′ ) :
S×A×S → R and discount factor γ ∈ (0 , 1] , controlling the weight in value of states further along the Markov chain.
A POMDP is further augmented by an observation model O , when we no longer have access to the true state s t , but to an observation thereof o t ∼ O ( s t ) .
Actions in the POMDP are taken by a policy π : O → A mapping observations to actions.
The value of an observation under a policy π , is given by the value function V π : O → R , which represents the expected future discounted sum of rewards, if policy π is followed from the true state s , of which we have an observation o ∼ O ( s ) :
[Equation]
Actions are chosen by the policy π , so as to maximize the action-value function Q π : O × A → R which assigns values to actions according to the value of the states that are reached under π :
[Equation]
We use Q π in order to deﬁne the optimal policy, which we denote π ∗ , as the policy taking actions that maximizes Q π : π ∗ ( o ) :
= arg max a ∈A Q π ∗ ( o, a ) .
Equation (2) highlights that the action-value function is a sort of one-step look-ahead of the value of the next possible state s t +1 , in order to determine the value of actions in the current observation o t .
We denote the sequence of observations (trajectory through observation-space) visited by a policy π during an episode as:
[Equation] [Equation]
2. T RAINING AN O FF -P OLICY D EEP Q N ETWORK
The off-policy Q -learning algorithm (Mnih et al., 2015) is well-suited to learning a policy’s
Qfunction in the discrete action space which we consider.
Training off-policy allows us to train on past transitions stored in a replay buffer (Schaul et al., 2016) which both stabilizes training, and increases sample efﬁciency since a single transition sample may be used during multiple training steps.
We perform a stochastic gradient descent on the MSE between the Q -estimate for the current step, and the discounted 1-step ‘lookahead’ Q -estimate summed with the transition reward:
L ( o t , a t , r t , o t +1 ) = (cid:16)
Q θ ( o t , a t ) − h r t + γQ θ ′
( o t +1 , arg max a ′ Q
θ ( o t +1 , a ′ ) i(cid:17) 2 , where θ are the current parameters for the Q -network, and θ ′ are parameters that are ‘frozen’ for a certain amount of steps.
This is known as double Q -learning using target networks (Van Hasselt et al., 2016) and reduces the variance of gradient updates.
R ELATED W ORK
Hierarchical RL.
Hierarchical reinforcement learning (Dayan and Hinton, 1993; Sutton et al., 1999) is a promising approach for helping RL algorithms generalize better in increasingly complex environments.
Several works apply the hierarchical structure of control to navigation tasks, which lend themselves well to modular controllers (Fisac et al., 2018).
Approaches such as Andreas et al.
; Nachum et al.
(2018) use sub-task or goal labelling in order to explicitly learn policies that are able to generalize through goal-space.
Our approach differs where we don’t wish to learn different goals, rather striving to attain the same goal under modiﬁed environment conditions, moreover, we aim to learn alternative strategies without having to subtask or goal labels.
Works such as
Machado et al.
; Zhang et al.
(2021) also have the same aim of self-discovering strategies to be used in a hierarchical controller, though our method differs by targeting the value function of the agent, through additional reward terms.
Similar to our approach, Cunningham et al.
(2015) uses a form of voting through policy simulation, though our work also integrates training the contingency policy with robustness to environment modiﬁcations in mind.
Contingency planning.
Some approaches use an estimation of the conﬁdence of the actions proposed by an agent’s policy (Bouton et al., 2019; Clements et al., 2019; Hoel et al., 2020b) to determine whether or not an agent’s policy is sufﬁciently good in the current environment state.
When this is not the case, control is typically given to a separate, often open-loop controller looking to mitigate any possible negative behaviour if failure cannot be avoided otherwise (Dalal et al., 2018;
Filos et al., 2020).
One issue with open-loop contingency plans – or any open-loop policy in general – is that they do not take into account the closed-loop nature of most real-world environments, whose dynamics are dependent on the actions of the agent and may themselves fail if not implemented carefully.
Rhinehart et al.
; Killing et al.
(2021) tackle the problem of high environment uncertainty by prioritizing information gathering if the agent is too uncertain about its policy’s outcome.
These approaches choose to approach by default with caution, if ever there is missing or uncertain information in the agent’s input space.
Kumar et al.
(2020) seeks to learn a set of policies which are collectively robust to changes in environment dynamics, through the use of latentconditioned policies (Eysenbach et al., 2019).
Our approach is similar, though we use an explicit metric on trajectories to ensure diversity in contingency behaviour rather than a learnt descriminator function.
Furthurmore we train our contingency plan to perform well when environment parameters change during the execution phase, which couples well with an on-line high-level controller.
L EARNING C ONTINGENCY P OLICIES
Problem statement.
We wish to learn, on one hand, π ∗ , the optimal policy in our given environment, and on the other, π 1 , a contingency policy able to navigate more safely through the environment, at the cost of performance, if ever there is high uncertainty linked to following the optimal policy.
4. C ONTINGENCY P OLICIES
Given the nature of a contingency plan, it must aim to exploit trajectories through different areas of state-space than trajectories from the optimal policy.
Since we consider cases where typically local uncertainties in the navigation task disrupt the performance of the optimal policy, in order for the contingency plan to stay viable it should have trajectories through sufﬁciently different areas of state-space to avoid areas of high uncertainty.
For example a contingency plan to high-speed trajectories, will often be more conservative and favor low-speed policies.
Using reward augmentation.
Our approach for learning π ∗ and π 1 concurrently, is to augment the reward function by a term which we will refer to as a trajectory penalty , R pen , which is propor- tional to the similarity in expected observation-space trajectories between two policies.
The aim of augmenting the reward in this way is for the policy of the contingency agent to be incentivized to solve the environment through different areas of state-space than the optimal policy.
With this aim in mind we deﬁne a metric on agents’ observation trajectories:
[Equation]
where φ is an observation-feature function, and ν is the density function over observation features.
It is possible to remain the most general possible with φ ( o )
=
o , however with some domain knowledge we can modify φ to retain only the features which best deﬁne the ‘distinctness’ of an agent’s trajectory.
Designing the penalty term R pen to be inversely proportional to the trajectory metric with respect to a reference agent, we can deﬁne it as:
[Equation] [Equation]
where α and δ determine the relative weight of the trajectory penalty, with respect to the regular reward function R .
A lower value for α will hardly penalize the contingency policy for having a similar observation distribution to the reference agent, whereas higher weighting will make it seek a highly different trajectory, disregarding the original objective of the task given by the regular reward function.
The value function for π 1 becomes:
[Equation]
where τ ∼ π 1 is the expected observation-space trajectory under π 1 .
We denote Π , the set of all policies (optimal and contingency) learned in the POMDP.
Stochastic parameters for the POMDP are stored in a vector µ .
Appendix A.1 presents the pseudo-code for our proposed algorithm.
Contingency policy’s domain.
When building a hierarchical control framework, much of the generalization capabilities come from the correct identiﬁcation of the environment parameters, and then executing the relevant policy (Pateria et al., 2021)).
When a new objective is introduced to the agent or environment parameters change causing new environment dynamics, making the optimal policy unable to perform well, we must ensure that the contingency policy is able to compensate for the initial actions taken by the optimal policy.
When the observation-space gets more complex, we may no longer assume that the learned contingency policy has sufﬁcient knowledge over its domain such that it is able to correctly control the agent from any such ‘hand-off’ state.
This is linked to the exploration trade-off made during training, where we explicitly limit an agent’s exploration of the available state-space in the interest of making learning tractable (Sutton and Barto, 2018)).
Due to limited exploration by design, this limits the domain on which a policy’s Q -function is well-learnt.
This isn’t an issue for navigating from the starting state to each objective, however there will be some areas of state-space, less sampled by the agent, where the Q -function will have a greater error.
This may be equivalently seen as a lack of exploration and insufﬁcient training of the
RL agent, however in more complex environments time and computing constraints prevent us from training the Q -function over the policy’s entire domain.
To encourage good contingency policy performance in so-called ‘hand-off’ states, our approach is to modify the initial state distribution for the contingency agent.
We achieve this by sampling states from the optimal agent’s replay buffer, and adding them to the contingency agent’s initial state distribution.
Given the initial state distribution p ( s 0 ) , we deﬁne the new initial state distribution for the contingency agent as: p π 1 ( s 0 ) =
(1 − β ) p ( s 0 )
+ βp
(˜ s π ∗ ) , where p (˜ s π ∗ ) is the uniform distribution over states in π ∗ ’s replay buffer, and β ∈ [0 , 1] is a parameter controlling the ratio of initial states sampled from the regular task intialization to ones sampled from the optimal’s replay buffer.
Moreover, our aim with this replay buffer intialization is to help the robustness of the contingency agent over the most probable ‘hand-off’ points with the optimal agent when the latter is unable to handle the current environment parameters.
To this end, we may further use domain knowledge to constrain the states sampled from p (˜ s π ) such that they best represent these possible ‘hand-off’ points.
Appendix A.2 includes more details about the replay buffer initialization.
4. H IERARCHICAL C ONTROLLER
[Figure]
Contingency plans alone are not sufﬁcient: a higher-level controller is required, capable of selecting the best policy with respect to the current environment observation.
In our approach, we combine the learned optimal and contingency policies with a model-based planner, in order to increase the robustness and safety of the acting agent with respect to environment uncertainty.
Figure 1 shows the structure of the hierarchical controller, whose high-level policy selection is in fact the planner module responsible for estimating the safety of each of the available policies π ∈ Π , and selecting the one with the lowest estimated chance of failure.
A pseudo-code description for the hierarchical controller is provided in appendix A.3.
4. P LANNER
The planner’s role is to estimate the chance of failure for each π ∈ Π available to the controller.
The approach we retain for our purposes is straightforward: we perform roll-outs over the set of possible environment parameters µ for each π , and return an estimated failure rate based on those roll-outs which will deﬁne which policy is selected by the planner.
This process estimates the probability of policy failure given the current belief about environment stochastic parameters µ .
Let P ( s fail | π, µ ) denote the probability that policy π will fail for a given µ .
The planner’s goal is to select a policy according to:
[Equation]
where µ ∗ are the true (unknown) parameter values.
We may approximate it by sampling from a probability density function conditioned on the history of agent observations over the course of the episode µ i ∼ p ( µ | τ ) .
More details on sampling µ i ’s are given in appendix A.4.
Let C ( π, µ i ) ∈ [0 , 1] represent whether or not there is a failure (collision) from policy π , after roll-out.
Then:
[Equation]
for M samples of µ i .
We note that the quality of the approximation relies on how well the µ i ’s are sampled.
The closer they are to µ ∗ , the better the planner will be able to estimate the true probability of failure for each policy.
We use a simple approach consisting in eliminating µ i ’s from the sampling pool, if targets are observed behaving in contradiction to the considered environment parameters (based on vehicle speed, in our navigation task).
E XPERIMENTS 5. S IMULATION E NVIRONMENT
We evaluate our approach in a common autonomous navigation task (Brechtel et al., 2014;
Hubmann et al., 2018; Bouton et al., 2019; Bernhard et al., 2019;
Rhinehart et al., 2021)).
Figure 2 shows two frames of the environment with oncoming vehicles in the intersection.
In navigation tasks, the controllable agent is usually referred to as the ego whereas the other vehicles are referred
[Figure]
to as targets.
In this task the ego must adjust its speed in order to pass through the intersection without colliding with any of the oncoming targets.
The optimal policy with respect to the reward function (6) is to pass through the intersection as fast as possible while avoiding collisions.
We expect a contingency policy to be useful in this scenario, when there is a sudden change in estimated target behaviour by the planner and the ego will have to either slow down to let an aggressive target through, or speed up if it seems the target is slowing down too much which may also cause a collision.
Ego and target behaviours.
The ego’s action space is a set of longitudinal acceleration values: a ∈ A
= {− 4 , − 2 , − 1 , 0 , 1 , 2 } m/s 2 .
Target vehicles may have either a cooperative, or aggressive style of driving, this behaviour being unobservable by the ego.
An aggressive target will speed through the intersection disregarding the presence of the ego vehicle, whereas a cooperative target will slow down if ever the ego vehicle approaches the intersection, although it will not come to a complete stop if ever ego halts in the middle of the road.
Reward function.
To penalize collisions and encourage faster episode termination, the step-reward r t is set-up as follows per time step t :
[Equation]
Stochastic environment parameters.
The environment dynamics depend on the targets’ behaviours.
The behaviour for each target vehicle is a random variable B i representing degree of aggressiveness, which are collected in µ where µ | i
=
B i for i ∈ [1 , N ] for N targets.
In practice we use either b i = 0 for a cooperative target, or b i = 1 for an aggressive target.
5. I MPLEMENTATION D ETAILS
Target behaviours.
During training we set b i = 1 , ∀ i ∈ [1 , N ] .
Both optimal and contingency policies are trained on these environment parameters.
Trajectory penalty.
In practice we replace the expectation operator E [ τ π ] in (4) by the mean value over the last 100 samples of π ∗ ’s replay buffer.
In this environment we use the speed of the ego vehicle as an observation feature φ ( o ) = ˙ x ego .
Trajectory penalty scaling factors used are: α = 3 , δ = 0 .
1 , which are ﬁxed by a rough initial sweep.
Adjusting the return values for different initial states.
We use a modiﬁed initialization for the contingency agent to increase its capabilities for compensating erroneous behaviour from a previous policy.
We initialize 50% of the contingency agent’s episodes in this way, during the entire training phase.
Forcing the contingency policy to start the episode in states sampled from the optimal policy’s replay buffer will incur greater trajectory penalties due to the higher trajectory proximity.
However, we do not need to to add an explicit compensation term: the contingency agent is still learning its true action-value function Q π 1 .
We take into consideration that the trajectory penalty term R pen will reduce the mean computed performance score, so it is important to look at the training score and trajectory penalties separately when comparing performance from both policies.
To compensate for varying episode length due to a different initial state, the contingency policy is attributed the cumulated rewards corresponding to the sampled initial state from the replay buffer.
R ESULTS
[Figure]
Training a contingency policy with replay buffer.
Figure 3a shows the scores achieved by both the optimal and contingency policies during training.
We can see π ∗ learning until reaching its optimal performance score after approximately 200k training steps.
π 1 ’s optimization objective depends on an additional R pen term, which is not stable until the observation-density in the replay buffer of π ∗ becomes approximately static.
This is why we see the initial training curve of π 1 lag behind that of π ∗ .
Once π ∗ ’s expected observation trajectory, E [ τ π ∗ ] , has a low enough variance then π 1 can make some meaningful progress towards its contingency objective.
Looking at π 1 ’s training curve in our case this appears to happen around the 50k step mark.
Even once π 1 has reached its top performance, it continues to be more jittery than π ∗ .
This is due to the sampled replay buffer initializations.
Trajectory metric during training.
Figure 3b shows the evolution of the trajectory metric (4).
The values for π ∗ are shown for comparison, but not actually included in its reward during training.
The shape for π ∗ is to be expected, as the latest trajectory will initially be different from the mean trajectory sampled from its own replay buffer.
However as its parameters θ converge and exploration is weaned away, the episodic trajectory will get closer to the mean trajectory sampled from the replay buffer.
We notice that initially both policies have similar trajectories τ .
This is due to the high degree of initial random exploration.
There is a sharp rise in the metric for π 1 around the 150k mark, and we may deduce that at this point the most recent trajectories τ π 1 are sufﬁciently different to the observations present in π ∗ ’s replay buffer such that the metric between the two increases.
We may conclude that this is where the contingency policy is converging to a contingency plan that has a different trajectory from that of the optimal policy (notably lower-speed trajectories).
Hierarchical planner safety performance.
To evaluate the overall performance of our hierarchical controller, we compute the number of successes vs. failures on the navigation task, over a range of environment parameter values µ for different agents.
Table 1 compiles the results for each tested controller, over an environment parameter sample size of M = 200 .
From our results we clearly deduce that a single agent has a hard time generalizing to new target behaviours, even though it may have achieved optimal performance within its training environment.
Although π ∗ has the highest average score in cases when it does not fail, it does not generalize well
[Table]
and performs very poorly in unseen environment instances.
In our navigation task, the contingency policy that is learnt corresponds to the ego having a more conservative driving attitude; this explains why the success rate is higher for π 1 with respect to π ∗ , although the average score decreases due to sacriﬁcing performance for safer behaviour.
When adding the replay buffer initialization to π 1 , the success rate further increases due to the increased ability of the contingency agent to generalize to greater areas of observation-space.
Compared to the individual policies, we expect the hierarchical controller to perform better, due to its access to a model-based planner combined with both policies.
Interestingly, we ﬁnd that the contingency policy with replay buffer initialization has a higher success rate than the hierarchical controller using π 1 without the initialization.
This highlights the importance of generalization when designing safe, robust algorithms.
Finally, we see that the highest success rate is achieved by our proposed approach of combining optimal, and robust contingency policies.
More importantly, though success rates are similar with the single π 1 with replay buffer initialization, we are able to obtain a good performance score close to the optimal policy, due to π ∗ being available to the hierarchical controller.
This demonstrates how our approach is able to ensure much safer behaviour in unseen environment conﬁgurations than a single policy, without sacriﬁcing performance by being overly cautious.
C ONCLUSION
In conclusion, we have presented an approach for learning multiple policies in an autonomous navigation task and adapting the approach to speciﬁcally learn a robust contingency policy, which when combined with a model-based planner, is able to increase the robustness of the agent with respect to stochastic environment parameters.
In our intersection use-case, we are able to reach a rate of no collisions for any (sampled) environment conﬁguration, even when we only had access to a single one of these conﬁgurations during training.
We acknowledge that the planner module has a simple behavioural prediction for target vehicles, and although it is sufﬁcient in our simulation environment to obtain good performance, better detection of the environment’s stochastic parameters µ will increase the robustness of the overall agent, and ultimately the effectiveness of having an available contingency policy.
One main advantage of this hybrid approach is the ability to separate performance and safety in an
RL framework.
Whereas using a single reward function and relying on reward engineering to obtain the correct behaviour can be arbitrary, in this case we are able to optimize for performance in a complex environment, and ensure a high level safety in unseen instances of environment dynamics without having to tweak performance and safety terms in a single reward function.
A I MPLEMENTATION D ETAILS A. T RAINING A LGORITHM
Algorithm 1 gives an overview of the training regime used with the reward penalty, in order to learn contingency policies alongside the optimal.
Notably, we attribute r pen to the ﬁnal sample at the end of the episode played by the contingency agent.
1 [ π ==
π 1 ] stands for the indicator function, indicating whether the current training agent is the contingency agent π 1 , or not.
Both agents train concurrently, alternating training episodes.
However the contingency agent πstarts its training only when the replay buffer of π ∗ is full.
This is reﬂected in the training curves, though it is negligible with respect to the order of magnitude of total training samples.
Computing the value for R penπ ∗ ( τ π 1 ) before π ∗ ’s expected trajectory memory buffer has converged to a stable value means that the MDP being solved by π 1 is initially greatly changing, though we did not investigate the effects of different training scheduling for the contingency agent in this work.
In the initial state distribution p ( s 0 ) during training, the ego always starts at the same position, whereas the initial positions of the target vehicles are randomized.
Algorithm
1: Init Π = { π ∗ , π 1 } 2: while not converged do 3: for π ∈ Π do 4: s 0 ∼ p
π ( s 0 )
⊲ init.
episode state 5: o 0 ∼ O ( s 0 ) 6: τ π = { o 0 } 7: while episode not terminated do ⊲ play episode 8: a t = π ( o t ) 9: s t +1 ∼ T ( s t , a t )
⊲ environment step 10: r t =
R ( s t , a t , s t +1 )
⊲ step reward 11: o t +1 ∼ O
( s t +1 ) 12: τ π = τ π ∪ { o t +1 } 13: end while 14: r pen =
R penπ ∗ ( τ )
⊲ compute reward penalty according to (5) 15: r T = r T + 1 [ [Equation] == [Equation]
1 ] r pen ⊲ attribute r pen only to contingency agent 16: for t ∈ [0 , T ] do 17:
Memory ( π ) ← ( o t , a t , r t , o t +1 )
⊲ store samples in agent replay buffer 18: end for 19: end for 20: end while
A. R EPLAY B UFFER I NITIALIZATION
We mention in section 4.1 the need for a contingency plan to function well at potential ‘hand-off’ points, if the high-level controller switches to the contingency plan late in the episode.
To increase the likelihood that p (˜ s π ∗ ) well represents these states, using domain knowledge, we constrain it to have a uniform density only over states where the ego vehicle has not yet passed the intersection.
This avoids the contingency policy learning to act once the ego has passed the intersection which is not useful in our use-case:
[Equation]
where s | x ego < x int represents all states in which the ego has not yet crossed the intersection.
In practice we only have access to observations of states in the memory buffer hence we map the sampled observations, which contain the ego’s position, back onto environment states which would result in the sampled observation.
Even though we’re not assured to map back onto the exact same environment state as was encountered in the optimal agent’s state-space trajectory, this nevertheless increases the contingency agent’s ability to be robust to initial states sampled from the optimal agent’s trajectory.
The optimal agent π ∗ uses the standard environment initial state distribution: p π ∗ ( s 0 )
=
p ( s 0 ) .
In our experiments we found that a ratio of 50% between regular and optimal-replay-buffer episode initializations gave the best results.
lower values tended to decrease the contingency agent’s ability to function well at the ‘hand-off’ points, whereas higher values tended to overly impact the convergence of the contingency agent’s parameters; p (˜ s π ∗ ) adds a lot of variance in the state-space encountered by the contingency agent, and hence increases the complexity of correctly learning Q πover this larger domain.
Thus we use the value β = 0 .
[Equation]
A. H IERARCHICAL C ONTROLLER A LGORITHM
Algorithm 2 shows how the hierarchical controller chooses between available policies.
The idea is for it to choose the policy with the highest estimated safety in the environment, using estimates of the environment dynamics.
Algorithm
Executing Hierarchical Controller 1: Π = { π ∗ , π 1 } ⊲ available policies 2: Init o⊲ initial env observation 3: τ = { o 0 } 4: while episode not terminated do 5: for π ∈ Π do 6: for i in simulation budget M do 7: µ i ∼ p ( µ | τ )
⊲ sample dynamics given observation history 8:
C π µ i = Simulate ( π, µ i )
⊲ simulate env using µ i , and env model 9: end for 10: end for 11: π chosen = arg min π ∈ Π 1 M
P
Mi =1 C π µ i ⊲ choose estimated safest policy 12: a t = π chosen ( o t ) 13:
o t +1 ∼ Environment ( a t )
⊲ policy acts, env returns new observation 14: τ = τ ∪ { o t +1 } 15:
Update p ( µ | τ )
⊲ Update conditional probability on µ 16: end while
A. S AMPLING E NVIRONMENT D YNAMICS
The quality of our estimation of collision probability depends on the quality of estimation of environment parameters.
The estimation of the possible parameters is updated using the history of observations from the agent: p ( µ | τ ) .
We start with a uniform density on µ at the start of each episode, and with every new observation o t +1 , we compare the actions taken by target vehicles, with the actions according to either possible target behaviour model ( b i ∈ { 0 , 1 } ).
If the observed target speed v obs is within a certain threshold ε v of the simulated behaviour speeds v simb i , then that target behaviour is retained in p ( µ | τ ) .
Using a stricter notation we can write µ | i
=
b i , where:
[Equation]
where v sim, v simare the simulated speeds for a cooperative and aggressive target, respectfully.
All b i ’s are independent, meaning there is no correlation between target behaviours.
To obtain our success rate and average score results, we sample without replacement M = 200 values for µ , and average out both the success rate (i.e. how many times the ego successfully navigated the intersection without crashing), and the score (i.e. regular reward function in the environment).