Data-Efficient Reinforcement Learning with Probabilistic Model Predictive Control

Sanket Kamthe, Marc Peter Deisenroth

Introduction

Reinforcement learning (RL) is a principled mathematical framework for experience-based autonomous learning of control policies. Its trial-and-error learning process is one of the most distinguishing features of RL . Despite many recent advances in RL , a main limitation of current RL algorithms remains its data inefficiency, i.e., the required number of interactions with the environment is impractically high. For example, many RL approaches in problems with low-dimensional state spaces and fairly benign dynamics require thousands of trials to learn. This data inefficiency makes learning in real control/robotic systems without task-specific priors impractical and prohibits RL approaches in more challenging scenarios.

A promising way to increase the data efficiency of RL without inserting task-specific prior knowledge is to learn models of the underlying system dynamics. When a good model is available, it can be used as a faithful proxy for the real environment, i.e., good policies can be obtained from the model without additional interactions with the real system. However, modelling the underlying transition dynamics accurately is challenging and inevitably leads to model errors. To account for model errors, it has been proposed to use probabilistic models . By explicitly taking model uncertainty into account, the number of interactions with the real system can be substantially reduced. For example, in , the authors use Gaussian processes (GPs) to model the dynamics of the underlying system. The PILCO algorithm propagates uncertainty through time for long-term planning and learns parameters of a feedback policy by means of gradient-based policy search. It achieves an unprecedented data efficiency for learning control policies for from scratch.

While the PILCO algorithm is data efficient, it has few shortcomings: 1) Learning closed-loop feedback policies needs the full planning horizon to stabilise the system, which results in a significant computational burden; 2) It requires us to specify a parametrised policy a priori, often with hundreds of parameters; 3) It cannot handle state constraints; 4) Control constraints are enforced by using a differentiable squashing function that is applied to the RBF policy. This allows PILCO to explicitly take control constraints into account during planning. However, this kind of constraint handling can produce unreliable predictions near constraint boundaries .

In this paper, we develop an RL algorithm that is a) data efficient, b) does not require to look at the full planning horizon, c) handles constraints naturally, d) does not require a parametrised policy, e) is theoretically justified. The key idea is to reformulate the optimal control problem with learned GP models as an equivalent deterministic problem, an idea similar to . This reformulation allows us to exploit Pontryagin’s maximum principle to find optimal control signals while handling constraints in a principled way. We propose probabilistic model predictive control (MPC) with learned GP models, while propagating uncertainty through time. The MPC formulation allows to plan ahead for relatively short horizons, which limits the computational burden and allows for infinite-horizon control applications. Our approach can find optimal trajectories in constrained settings, offers an increased robustness to model errors and an unprecedented data efficiency compared to the state of the art.

Model-based RL: A recent survey of model based RL in robotics highlights the importance of models for building adaptable robots. Instead of GP dynamics model with a zero prior mean (as used in this paper) an RBF network and linear mean functions are proposed . This accelerates learning and facilitates transferring a learned model from simulation to a real robot. Even implicit model learning can be beneficial: The UNREAL learner proposed in learns a predictive model for the environment as an auxiliary task, which helps learning.

MPC with GP transition models: GP-based predictive control was used for boiler and building control , but the model uncertainty was discarded. In , the predictive variances were used within a GP-MPC scheme to actively reject periodic disturbances, although not in an RL setting. Similarly, in , the authors used a GP prior to model additive noise and model is improved episodically. In , the authors considered MPC problems with GP models, where only the GP’s posterior mean was used while ignoring the variance for planning. MPC methods with deterministic models are useful only when model errors and system noise can be neglected in the problem .

Optimal Control: The application of optimal control theory for the models based on GP dynamics employs some structure in the transition model, i.e., there is an explicit assumption of control affinity and linearisation via locally quadratic approximations . The AICO model uses approximate inference with (known) locally linear models. The probabilistic trajectories for model-free RL in are obtained by reformulating the stochastic optimal control problem as KL divergence minimisation. We implicitly linearise the transition dynamic via moment matching approximation.

The contributions of this paper are the following: 1) We propose a new ‘deterministic’ formulation for probabilistic MPC with learned GP models and uncertainty propagation for long-term planning. 2) This reformulation allows us to apply Pontryagin’s Maximum Principle (PMP) for the open-loop planning stage of probabilistic MPC with GPs. Using the PMP we can handle control constraints in a principled fashion while still maintaining necessary conditions for optimality. 3) The proposed algorithm is not only theoretically justified by optimal control theory, but also achieves a state-of-the-art data efficiency in RL while maintaining the probabilistic formulation. 4) Our method can handle state and control constraints while preserving its data efficiency and optimality properties.

Controller Learning via Probabilistic MPC

We consider a stochastic dynamical system with states x∈\mathdsRD\bm{x}\in\mathds{R}^{D} and admissible controls (actions) u∈U⊂\mathdsRU\bm{u}\in\mathcal{U}\subset\mathds{R}^{U}, where the state follows Markovian dynamics

with an (unknown) transition function ff and i.i.d. system noise w∼N(0,Q)\bm{w}\sim\mathcal{N}(\bm{0},\bm{Q}), where Q=diag(σ12,…,σD2)\bm{Q}=\text{diag}(\sigma_{1}^{2},\dotsc,\sigma_{D}^{2}). In this paper, we consider an RL setting where we seek control signals u0∗,…,uT−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{T-1}^{*} that minimise the expected long-term cost

For data efficiency, we follow a model-based RL strategy, i.e., we learn a model of the unknown transition function ff, which we then use to find open-loop‘Open-loop’ refers to the fact that the control signals are independent of the state, i.e., there is no state feedback incorporated. optimal controls u0∗,…,uT−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{T-1}^{*} that minimise (2). After every application of the control sequence, we update the learned model with the newly acquired experience and re-plan. Section 2.1 summarises the model learning step; Section 2.2 details how to obtain the desired open-loop trajectory.

We learn a probabilistic model of the unknown underlying dynamics ff to be robust to model errors . In particular, we use a Gaussian process (GP) as a prior p(f)p(f) over plausible transition functions ff.

A GP is a probabilistic non-parametric model for regression. In a GP, any finite number of function values is jointly Gaussian distributed . A GP is fully specified by a mean function m(⋅)m(\cdot) and a covariance function (kernel) k(⋅,⋅)k(\cdot,\cdot).

The inputs for the dynamics GP are given by tuples x~t:=(xt,ut)\widetilde{\bm{x}}_{t}:=(\bm{x}_{t},\bm{u}_{t}), and the corresponding targets are xt+1\bm{x}_{t+1}. We denote the collections of training inputs and targets by X~,y\widetilde{\bm{X}},\bm{y}, respectively. Furthermore, we assume a Gaussian (RBF, squared exponential) covariance function

where σf2\sigma_{f}^{2} is the signal variance and L=diag(l1,…,lD+U)\bm{L}=\text{diag}(l_{1},\dotsc,l_{D+U}) is a diagonal matrix of length-scales l1,…,lD+Ul_{1},\dotsc,l_{D+U}. The GP is trained via the standard procedure of evidence maximisation .

We make the standard assumption that the GPs for each target dimension of the transition function f:\mathdsRD×U→\mathdsRDf:\mathds{R}^{D}\times\mathcal{U}\to\mathds{R}^{D} are independent. For given hyper-parameters, training inputs X~\widetilde{\bm{X}}, training targets y\bm{y} and a new test input x~∗\widetilde{\bm{x}}_{*}, the GP yields the predictive distribution p(f(x~∗)∣X~,y)=N(f(x~∗)∣m(x~∗),Σ(x~∗))p(f(\widetilde{\bm{x}}_{*})|\widetilde{\bm{X}},\bm{y})=\mathcal{N}(f(\widetilde{\bm{x}}_{*})|m(\widetilde{\bm{x}}_{*}),\Sigma(\widetilde{\bm{x}}_{*})), where

for all predictive dimensions d=1,…,Dd=1,\dotsc,D.

2 Open-Loop Control

To find the desired open-loop control sequence u0∗,…,uT−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{T-1}^{*}, we follow a two-step procedure proposed in . 1) Use the learned GP model to predict the long-term evolution p(x1),…,p(xT)p(\bm{x}_{1}),\dotsc,\bm{p}(\bm{x}_{T}) of the state for a given control sequence u0,…,uT−1\bm{u}_{0},\dotsc,\bm{u}_{T-1}. 2) Compute the corresponding expected long-term cost (2) and find an open-loop control sequence u0∗,…,uT−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{T-1}^{*} that minimises the expected long-term cost. In the following, we will detail these steps.

To obtain the state distributions p(x1),…,p(xT)p(\bm{x}_{1}),\dotsc,p(\bm{x}_{T}) for a given control sequence u0,…,uT−1\bm{u}_{0},\dotsc,\bm{u}_{T-1}, we iteratively predict

for t=0,…,T−1 ,t=0,\dotsc,T-1\,, by making a deterministic Gaussian approximation to p(xt+1∣ut)p(\bm{x}_{t+1}|\bm{u}_{t}) using moment matching . This approximation has been shown to work well in practice in RL contexts and can be computed in closed form when using the Gaussian kernel (3).

A key property that we exploit is that moment matching allows us to formulate the uncertainty propagation in (8) as a ‘deterministic system function’

where μt,Σt\bm{\mu}_{t},\bm{\Sigma}_{t} are the mean and the covariance of p(xt)p(\bm{x}_{t}). For a deterministic control signal ut\bm{u}_{t} we further define the moments of the control-augmented distribution p(xt,ut)p(\bm{x}_{t},\bm{u}_{t}) as

such that (9) can equivalently be written as the deterministic system equation

2.2 Optimal Open-Loop Control Sequence

To find the optimal open-loop sequence u0∗,…,uT−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{T-1}^{*}, we first compute the expected long-term cost JJ in (2) using the Gaussian approximations p(x1),…,p(xT)p(\bm{x}_{1}),\dotsc,p(\bm{x}_{T}) obtained via (8) for a given open-loop control sequence u0,…,uT−1\bm{u}_{0},\dotsc,\bm{u}_{T-1}. Second, we find a control sequence that minimises the expected long-term cost (2). In the following, we detail these steps.

To compute the expected long-term cost in (2), we sum up the expected immediate costs

Similar to (9), this allows us to define deterministic mappings

that map the mean and covariance of x~\widetilde{\bm{x}} onto the corresponding expected costs in (2).

The open-loop optimisation turns out to be sparse . However, optimisation via the value function or dynamic programming is valid only for unconstrained controls. To address this practical shortcoming, we define Pontryagin’s Maximum Principle that allows us to formulate the constrained problem while maintaining the sparsity. We detail this sparse structure for the constrained GP dynamics problem in section 3.

3 Feedback Control with MPC

Thus far, we presented a way for efficiently determining an open-loop controller. However, an open-loop controller cannot stabilise the system . Therefore, it is essential to obtain a feedback controller. MPC is a practical framework for this . While interacting with the system MPC determines an HH-step open-loop control trajectory u0∗,…,uH−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{H-1}^{*}, starting from the current state xt\bm{x}_{t}A state distribution p(xt)p(\bm{x}_{t}) would work equivalently in our framework.. Only the first control signal u0∗\bm{u}_{0}^{*} is applied to the system. When the system transitions to xt+1\bm{x}_{t+1}, we update the GP model with the newly available information, and MPC re-plans u0∗,…,uH−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{H-1}^{*}. This procedure turns an open-loop controller into an implicit closed-loop (feedback) controller by repeated re-planning HH steps ahead from the current state. Typically, H≪TH\ll T, and MPC even allows for T=∞T=\infty.

In this section, we provided an algorithmic framework for probabilistic MPC with learned GP models for the underlying system dynamics, where we explicitly use the GP’s uncertainty for long-term predictions (8). In the following section, we will justify this using optimal control theory. Additionally, we will discuss how to account for constrained control signals in a principled way without the necessity to warp/squash control signals as in .

Theoretical Justification

Bellman’s optimality principle yields a recursive formulation for calculating the total expected cost (2) and gives a sufficient optimality condition. PMP provides the corresponding necessary optimality condition. PMP allows us to compute gradients ∂J/∂ut\partial J/\partial\bm{u}_{t} of the expected long-term cost w.r.t. the variables that only depend on variables with neighbouring time index, i.e., ∂J/∂ut\partial J/\partial\bm{u}_{t} depends only variables with index tt and t+1t+1. Furthermore, it allows us to explicitly deal with constraints on states and controls. In the following, we detail how to solve the optimal control problem (OCP) with PMP for learned GP dynamics and deterministic uncertainty propagation. We additionally provide a computationally efficient way to compute derivatives based on the maximum principle.

To facilitate our discussion we first define some notation. Practical control signals are often constrained. We formally define a class of admissible controls U\mathcal{U} that are piecewise continuous functions defined on a compact space U⊂\mathdsRUU\subset\mathds{R}^{U}. This definition is fairly general, and commonly used zero-order-hold or first-order-hold signals satisfy this requirement. Applying admissible controls to the deterministic system dynamics fMMf_{MM} defined in (11) yields a set Z\mathcal{Z} of admissible controlled trajectories. We define the tuple (Z,fMM,U)(\mathcal{Z},f_{MM},\mathcal{U}) as our control system. For a single admissible control trajectory u0:H−1\bm{u}_{0:H-1}, there will be a unique trajectory z0:H\bm{z}_{0:H}, and the pair (z0:H,u0:H−1)(\bm{z}_{0:H},\bm{u}_{0:H-1}) is called an admissible controlled trajectory .

We now define the control-Hamiltonian for this control system as

This formulation of the control-Hamiltonian is the centre piece of the Pontryagin’s approach to the OCP. The vector λt+1\bm{\lambda}_{t+1} can be viewed as a Lagrange multiplier for dynamics constraints associated with the OCP .

To successfully apply PMP we need the system dynamics to have a unique solution for a given control sequence. Traditionally, this is interpreted as the system is ‘deterministic’. This interpretation has been considered a limitation of PMP . In this paper, however, we exploit the fact that the moment-matching approximation (8) is a deterministic operator, similar to the projection used in EP . This yields the ‘deterministic’ system equations (9), (11) that map moments of the state distribution at time tt to moments of the state distribution at time t+1t+1.

To apply the PMP we need to extend some of the important characteristics of ODEs to our system. In particular, we need to show the existence and uniqueness of a (local) solution to our difference equation (11).

For existence of a solution we need to satisfy the difference equation point-wise over the entire horizon and for uniqueness we need the system to have only one singularity. For our discrete-time system equation (via the moment-matching approximation) in (9) we have the following

The moment matching mapping fMMf_{MM} is Lipschitz continuous for controls defined over a compact set U\mathcal{U}.

The proof is based on bounding the gradient of fMMf_{MM} and detailed in the supplementary material. Existence and uniqueness of the trajectories for the moment matching difference equation are given by

A solution of zt+1=fMM(zt,ut)\bm{z}_{t+1}=f_{MM}(\bm{z}_{t},\bm{u}_{t}) exists and is unique.

Difference equations always yield an answer for a given input. Therefore, a solution trivially exists. Uniqueness directly follows from the Picard-Lindelöf theorem, which we can apply due to Lemma 1. This theorem requires the discrete-time system function to be deterministic (see Appendix B of ). Due to our re-formulation of the system dynamics (9), this follows directly, such that the z1:T\bm{z}_{1:T} for a given control sequence u0:T−1\bm{u}_{0:T-1} are unique.

2 Pontryagin’s Maximum Principle for GP Dynamics

With Lemmas 1 2 and the definition of the control-Hamiltonian 15 we can now state PMP for the control system (Z,fMM,U)(\bm{Z},f_{MM},\mathcal{U}) as follows:

Let (zt∗,ut∗)(\bm{z}_{t}^{*},\bm{u}_{t}^{*}), 0≤t≤H−10\leq t\leq H-1 be an admissible controlled trajectory defined over the horizon HH. If (z0:H∗,u0:H−1∗)(\bm{z}_{0:H}^{*},\bm{u}_{0:H-1}^{*}) is optimal, then there exists an ad-joint vector λt∈\mathdsRD∖{0}\bm{\lambda}_{t}\in\mathds{R}^{D}\setminus\{\bm{0}\} satisfying the following conditions:

Ad-joint equation: The ad-joint vector λt\bm{\lambda}_{t} is a solution to the discrete difference equation

Transversality condition: At the endpoint the ad-joint vector λH\bm{\lambda}_{H} satisfies

Minimum Condition: For t=0,…,H−1t=0,\dotsc,H-1, we have

The minimum condition (18) can be used to find an optimal control. The Hamiltonian is minimised point-wise over the admissible control set U\mathcal{U}: For every t=0,…,H−1t=0,\dotsc,H-1 we find optimal controls ut∗∈arg⁡min⁡νH(λt+1,zt∗,ν)\bm{u}_{t}^{*}\in\arg\min_{\bm{\nu}}\mathcal{H}(\bm{\lambda}_{t+1},\bm{z}_{t}^{*},\bm{\nu}). The minimisation problem possesses additional variables λt+1\bm{\lambda}_{t+1}. These variables can be interpreted as Lagrange multipliers for the optimisation. They capture the impact of the control ut\bm{u}_{t} over the whole trajectory and, hence, these variables make the optimisation problem sparse . For the GP dynamics we compute the multipliers λt\bm{\lambda}_{t} in closed form, thereby, significantly reducing the computational burden to minimise the expected long-term cost JJ in (2). We detail this calculation in section 3.3.

In the optimal control problem, we aim to find an admissible control trajectory that minimizes the cost subject to possibly additional constraints. PMP gives first-order optimality conditions over these admissible controlled trajectories and can be generalised to handle additional state and control constraints .

The Hamiltonian H\mathcal{H} in (18) is constant for unconstrained controls in time-invariant dynamics and equals everywhere when the final time HH is not fixed .

3 Efficient Gradient Computation

With the definition of the Hamiltonian H\mathcal{H} in (15) we can efficiently calculate the gradient of the expected total cost JJ. For a time horizon HH we can write the accumulated cost as the Bellman recursion

for t=H−1,…,0t=H-1,\dotsc,0. Since the (open-loop) control ut\bm{u}_{t} only impacts the future costs via zt+1=fMM(zt,ut)\bm{z}_{t+1}=f_{MM}(\bm{z}_{t},\bm{u}_{t}) the derivative of the total cost with ut\bm{u}_{t} is given by

Comparing this expression with the definition of the Hamiltonian (15), we see that if we make the substitution λt+1T=∂Jt+1∂zt+1\bm{\lambda}_{t+1}^{T}=\frac{\partial J_{t+1}}{\partial\bm{z}_{t+1}} we obtain

This implies that the gradient of the expected long-term cost w.r.t. ut\bm{u}_{t} can be efficiently computed using the Hamiltonian . Next we show that the substitution λt+1T=∂Jt+1∂zt+1\bm{\lambda}_{t+1}^{T}=\frac{\partial J_{t+1}}{\partial\bm{z}_{t+1}} is valid for the entire horizon HH. For the terminal cost ΦMM(zH)\Phi_{MM}(\bm{z}_{H}) this is valid by the transversality condition (17). For other time steps we differentiate (19) w.r.t. zt\bm{z}_{t}, which yields

which is identical to the ad-joint equation (16). Hence, in our setting, PMP implies that gradient descent on the Hamiltonian H\mathcal{H} is equivalent to gradient descent on the total cost (2) .

Algorithmically, in an RL setting, we find the optimal control sequence u0∗,…,uH−1∗\bm{u}_{0}^{*},\dotsc,\bm{u}_{H-1}^{*} as follows:

For a given initial (random) control sequence u0:H−1\bm{u}_{0:H-1} we follow the steps described in section 2.2.1 to determine the corresponding trajectory z1:H\bm{z}_{1:H}. Additionally, we compute Lagrange multipliers λt+1T=∂Jt+1∂zt+1\bm{\lambda}_{t+1}^{T}=\frac{\partial J_{t+1}}{\partial\bm{z}_{t+1}} during the forward propagation. Note that traditionally ad-joint equations are propagated backward to find the multipliers .

We use Sequential Quadratic Programming (SQP) with BFGS for Hessian updates . The Lagrangian of SQP is a partially separable function . In the PMP, this separation is explicit via the Hamiltonians, i.e., the Ht\mathcal{H}_{t} is a function of variables with index tt or t+1t+1. This leads to a block-diagonal Hessian of SQP Lagrangian . The structure can be exploited to approximate the Hessian via block-updates within BFGS

Experimental Results

We evaluate the quality of our algorithm in two ways: First, we assess whether probabilistic MPC leads to faster learning compared with PILCO, the current state of the art in terms of data efficiency. Second, we assess the impact of state constraints while performing the same task.

We consider two RL benchmark problems: the under-actuated cart-pole-swing-up and the fully actuated double-pendulum swing-up. In both tasks, PILCO is the most data-efficient RL algorithm to date .

For the state-space constraint experiment we place a wall on the track near the target, see Fig. 1(a). The wall is at -70 cm, which, along with force limitations, requires the system to swing from the right side.

The double-pendulum has a constraint on the angle of the inner pendulum, so that it only has a 340∘340^{\circ} motion range, i.e., it cannot spin through, see Fig. 1(b). The constraint blocks all clockwise swing-ups. The system is underpowered, and it has to swing clockwise first for a counter-clockwise swing-up without violating the constraints.

The general setting is as follows: All RL algorithms start off with a single short random trajectory, which is used for learning the dynamics model. As in the GP is used to predict state differences xt+1−xt\bm{x}_{t+1}-\bm{x}_{t}. The learned GP dynamics model is then used to determine a controller based on iterated moment matching (8), which is then applied to the system, starting from x0∼p(x0)\bm{x}_{0}\sim p(\bm{x}_{0}). Model learning, controller learning and application of the controller to the system constitute a ‘trial’. After each trial, the hyper-parameters of the model are updated with the newly acquired experience and learning continues.

We compare our GP-MPC approach with the following baselines: the PILCO algorithm and a zero-variance GP-MPC algorithm (in the flavour of ) for RL, where the GP’s predictive variances are discarded. Due to the lack of exploration, such a zero-variance approach within PILCO (a policy search method) does not learn anything useful as already demonstrated in , and we do not include this baseline.

We average over 10 independent experiments, where every algorithm is initialised with the same first (random) trajectory. The performance differences of the RL algorithms are therefore due to different approaches to controller learning and the induced exploration.

1 Data Efficiency

In both benchmark experiments (cart-pole and double pendulum), we use the exact saturating cost from , which penalises the Euclidean distance of the tip of the (outer) pendulum from the target position, i.e., we are in a setting in which PILCO performs very well.

In both experiments, our proposed GP-MPC requires only 60% of PILCO’s experience, such that we report an unprecedented learning speed for these benchmarks, even with settings for which PILCO performs very well.

We identify two key ingredients that are responsible for the success and learning speed of our approach: the ability to (1) immediately react to observed states by adjusting the long-term plan and (2) augment the training set of the GP model on the fly as soon as a new state transition is observed (hyper-parameters are not updated at every time step). These properties turn out to be crucial in the very early stages of learning when very little information is available. If we ignored the on-the-fly updates of the GP dynamics model, our approach would still successfully learn, although the learning efficiency would be slightly decreased.

2 State Constraints

A scenario in which PILCO struggles is a setting with state space constraints. We modify the cart-pole and the double-pendulum tasks to such a setting. Both tasks are symmetric, and we impose state constraints in such a way that only one direction of the swing-up is feasible. For the cart-pole system, we place a wall near the target position of the cart, see Fig. 1(a); the double pendulum has a constraint on the angle of the inner pendulum, so that it only has a 340∘340^{\circ} motion range, i.e., it cannot spin through, see Fig. 1(b). These constraints constitute linear constraints on the state.

We use a quadratic cost that penalises the Euclidean distance between the tip of the pendulum and the target. This, along with the ‘implicit’ linearisation, makes the optimal control problem an ‘implicit’ QP. If a rollout violates the state constraint we immediately abort that trial and move on to the next trial. We use the same experimental set-up as data efficiency experiments.

The state constraints are implemented as expected violations, i.e., \mathdsE[xt]<xlimit\mathds{E}[\bm{x}_{t}]<\bm{x}_{\text{limit}} and chance constraints p(xt<xlimit)≥0.95p(\bm{x}_{t}<\bm{x}_{\text{limit}})\geq 0.95. Fig. 1(a) shows that our MPC-based controller with chance constraint (blue) successfully completes the task with a small acceptable number of violations, see Table 1. The expected violation approach, which only considers the predicted mean (yellow) fails to complete the task due to repeated constraint violations. PILCO uses its saturating cost (there is little hope for learning with quadratic cost ) and has partial success in completing the task, but it struggles, especially during initial trials due to repeated state violations.

One of the key points we observe from the Table 1 is that the incorporation of uncertainty into planning is again crucial for successful learning. If we use only predicted means to determine whether the constraint is violated, learning is not reliably ‘safe’. Incorporation of the predictive variance, however, results in significantly fewer constraint violations.

Conclusion and Discussion

We proposed an algorithm for data-efficient RL that is based on probabilistic MPC with learned transition models using Gaussian processes. By exploiting Pontryagin’s maximum principle our algorithm can naturally deal with state and control constraints. Key to this theoretical underpinning of a practical algorithm was the re-formulation of the optimal control problem with uncertainty propagation via moment matching into an deterministic optimal control problem. MPC allows the learned model to be updated immediately, which leads to an increased robustness with respect to model inaccuracies. We provided empirical evidence that our framework is not only theoretically sound, but also extremely data efficient, while being able to learn in settings with hard state constraints.

One of the most critical components of our approach is the incorporation of model uncertainty into modelling and planning. In complex environments, model uncertainty drives targeted exploration. It additionally allows us to account for constraints in a risk-averse way, which is important in the early stages of learning.

References

Appendix

The moment matching mapping fMMf_{MM} is Lipschitz continuous for controls defined over a compact set U\mathcal{U}.

Proof: Lipschitz continuity requires that the gradient ∂fMM/∂ut{\partial f_{MM}}/{\partial\bm{u}_{t}} is bounded. The gradient is

The derivatives [∂μt+1∂ut,∂Σt+1∂ut]\left[\frac{\partial\bm{\mu}_{t+1}}{\partial\bm{u}_{t}},\frac{\partial\bm{\Sigma}_{t+1}}{\partial\bm{u}_{t}}\right] can be computed analytically .

We first show that the derivative ∂μt+1/∂ut\partial\bm{\mu}_{t+1}/\partial\bm{u}_{t} is bounded. Defining βd:=(Kd+σfd2I)−1yd\bm{\beta}_{d}:=(\bm{K}_{d}+\sigma_{f_{d}}^{2}\bm{I})^{-1}\bm{y}_{d}, from , we obtain for all state dimensions d=1,…,Dd=1,\dotsc,D

where NN is the size of the training set of the dynamics GP and x~i\widetilde{\bm{x}}_{i} the iith training input. The corresponding gradient w.r.t. ut\bm{u}_{t} is given by the last FF elements of

Let us examine the individual terms in the sum on the rhs in (30): For a given trained GP ∥βd∥<∞\|\bm{\beta}_{d}\|<\infty is constant. The definition of qdiq_{d_{i}} in (28) contains an exponentiated negative quadratic term, which is bounded between $.Since. Since\bm{I}+\bm{L}_{d}^{-1}\widetilde{\bm{\Sigma}}_{t}ispositivedefinite,theinversedeterminantisdefinedandbounded.Finally,is positive definite, the inverse determinant is defined and bounded. Finally,\sigma_{f_{d}}^{2}<\infty,whichmakes, which makesq_{d_{i}}<\infty.Theremainingtermin(30)isavector−matrixproduct.Thematrixisregularanditsinverseexistsandisbounded(andconstantasafunctionof. The remaining term in (30) is a vector-matrix product. The matrix is regular and its inverse exists and is bounded (and constant as a function of\bm{u}_{t}.Since. Since\bm{u}_{t}\in\mathcal{U}wherewhere\mathcal{U}iscompact,wecanalsoconcludethatthevectordifferencein(30)isfinite,whichoverallprovesthatis compact, we can also conclude that the vector difference in (30) is finite, which overall proves thatf_{MM}$ is (locally) Lipschitz continuous and Lemma 3.

Sequential Quadratic Programming

We can use SQP for solving non-linear optimization problems (NLP) of the form,

The Lagrangian L\mathcal{L} associated with the NLP is

where, λ\bm{\lambda} and σ\bm{\sigma} are Lagrange multipliers. Sequential Quadratic Programming (SQP) forms a quadratic (Taylor) approximation of the objective and linear approximation of constraints at each iteration kk

The Lagrange multipliers λ\bm{\lambda} associated with the equality constraint are same as the ones defined in the control Hamiltonian H\mathcal{H} 15. The Hessian matrix ∇xx2\bm{\nabla}_{xx}^{2} can be computed by exploiting the block diagonal structure introduced by the Hamiltonian .

1 Moment Matching Approximation [1]

Following the law of iterated expectations, for target dimensions a=1,…,D,a=1,\dotsc,D, we obtain the predictive mean

with qa=[qa1,…,qan]T\bm{q}_{a}=[q_{a_{1}},\ldots,q_{a_{n}}]^{T}. The entries of qa∈\mathdsRn\bm{q}_{a}\in\mathds{R}^{n} are computed using standard results from multiplying and integrating over Gaussians and are given by

Computing the predictive covariance matrix Σt∈\mathdsRD×D\bm{\Sigma}_{t}\in\mathds{R}^{D\times D} requires us to distinguish between diagonal elements and off-diagonal elements: Using the law of total (co-)variance, we obtain for target dimensions a,b=1,…,Da,b=1,\dotsc,D

Using standard results from Gaussian multiplications and integration, we obtain the entries QijQ_{ij} of Q∈\mathdsRn×n\bm{Q}\in\mathds{R}^{n\times n}

with νi\bm{\nu}_{i} taken from (39). Hence, the off-diagonal entries of Σt\bm{\Sigma}_{t} are fully determined by (36)–(39), (41), (43), (44), and (45).

References