S M Nahid Mahmud1, Scott A Nivison2, Zachary I Bell2, Rushikesh Kamalapurkar1. 1. School of Mechanical and Aerospace Engineering, Oklahoma State University, Stillwater, OK, United States. 2. Munitions Directorate, Air Force Research Laboratory, Eglin AFB, FL, United States.
Abstract
Reinforcement learning has been established over the past decade as an effective tool to find optimal control policies for dynamical systems, with recent focus on approaches that guarantee safety during the learning and/or execution phases. In general, safety guarantees are critical in reinforcement learning when the system is safety-critical and/or task restarts are not practically feasible. In optimal control theory, safety requirements are often expressed in terms of state and/or control constraints. In recent years, reinforcement learning approaches that rely on persistent excitation have been combined with a barrier transformation to learn the optimal control policies under state constraints. To soften the excitation requirements, model-based reinforcement learning methods that rely on exact model knowledge have also been integrated with the barrier transformation framework. The objective of this paper is to develop safe reinforcement learning method for deterministic nonlinear systems, with parametric uncertainties in the model, to learn approximate constrained optimal policies without relying on stringent excitation conditions. To that end, a model-based reinforcement learning technique that utilizes a novel filtered concurrent learning method, along with a barrier transformation, is developed in this paper to realize simultaneous learning of unknown model parameters and approximate optimal state-constrained control policies for safety-critical systems.
Reinforcement learning has been established over the past decade as an effective tool to find optimal control policies for dynamical systems, with recent focus on approaches that guarantee safety during the learning and/or execution phases. In general, safety guarantees are critical in reinforcement learning when the system is safety-critical and/or task restarts are not practically feasible. In optimal control theory, safety requirements are often expressed in terms of state and/or control constraints. In recent years, reinforcement learning approaches that rely on persistent excitation have been combined with a barrier transformation to learn the optimal control policies under state constraints. To soften the excitation requirements, model-based reinforcement learning methods that rely on exact model knowledge have also been integrated with the barrier transformation framework. The objective of this paper is to develop safe reinforcement learning method for deterministic nonlinear systems, with parametric uncertainties in the model, to learn approximate constrained optimal policies without relying on stringent excitation conditions. To that end, a model-based reinforcement learning technique that utilizes a novel filtered concurrent learning method, along with a barrier transformation, is developed in this paper to realize simultaneous learning of unknown model parameters and approximate optimal state-constrained control policies for safety-critical systems.
Due to advantages such as repeatability, accuracy, and lack of physical fatigue, autonomous systems have been increasingly utilized to perform tasks that are dull, dirty, or dangerous. Autonomy in safety-critical applications such as autonomous driving and unmanned flight relies on the ability to synthesize safe controllers. To improve robustness to parametric uncertainties and changing objectives and models, autonomous systems also need the ability to simultaneously synthesize and execute control policies online and in real time. This paper concerns reinforcement learning (RL), which has been established as an effective tool for safe policy synthesis for both known and uncertain dynamical systems with finite state and action spaces [see, e.g., Sutton and Barto (1998); Doya (2000)].RL typically requires a large number of iterations due to sample inefficiency [see, e.g., Sutton and Barto (1998)]. Sample efficiency in RL can be improved via model-based reinforcement learning (MBRL); however, MBRL methods are prone to failure due to inaccurate models [see, e.g., Kamalapurkar et al. (2016a,b, 2018)]. Online MBRL methods that handle modeling uncertainties are motivated by complex tasks that require systems to operate in dynamic environments with changing objectives and system models. Accurate models of the system and the environment are generally not available due to sparsity of data. In the past, MBRL techniques under the umbrella of approximate dynamic programming (ADP) have been successfully utilized to solve reinforcement learning problems online with model uncertainty [see, e.g., Modares et al. (2013); Kiumarsi et al. (2014); Qin et al. (2014)]. ADP utilizes parametric methods such as neural networks (NNs) to approximate the value function and the system model online. By obtaining an approximation of both the value function and the system model, a stable closed-loop adaptive control policy can be developed [see, e.g., Vamvoudakis et al. (2009); Lewis and Vrabie (2009); Bertsekas (2011); Bhasin et al. (2012); Liu and Wei (2014)].Real-world optimal control applications typically include constraints on states and/or inputs that are critical for safety [see, e.g., He et al. (2017)]. ADP was successfully extended to address input constrained control problems in Modares et al. (2013) and Vamvoudakis et al. (2016). The state-constrained ADP problem was studied in the context of obstacle avoidance in Walters et al. (2015) and Deptula et al. (2020), where an additional term that penalizes proximity to obstacles was added to the cost function. Since the added proximity penalty in Walters et al. (2015) was finite, the ADP feedback could not guarantee obstacle avoidance, and an auxiliary controller was needed. In Deptula et al. (2020), a barrier-like function was used to ensure unbounded growth of the proximity penalty near the obstacle boundary. While this approach results in avoidance guarantees, it relies on the relatively strong assumption that the value function is continuously differentiable over a compact set that contains the obstacles in spite of penalty-induced discontinuities in the cost function.Control Barrier Function (CBF) is another approach to guarantee safety in safety-critical systems [see e.g., Ames et al. (2017)], with recent applications to the safe reinforcement learning problems [see e.g., Choi et al. (2020); Cohen and Belta (2020); Marvi and Kiumarsi (2021)]. Choi et al. (2020) have addressed the issue of model uncertainty in safety-critical control with an RL-based data-driven approach. A drawback of this approach is that it requires a nominal controller that keeps the system stable during the learning phase, which may not be always possible to design. In Marvi and Kiumarsi (2021), the authors develop a safe off-policy RL scheme which trades-off between safety and performance. In Cohen and Belta (2020), the authors develop a safe RL scheme in which the proximity penalty approach from Deptula et al. (2020) is cast into the framework of CBFs. While the control barrier function results in safety guarantees, the existence of a smooth value function, in spite of a nonsmooth cost function, needs to be assumed. Furthermore, to facilitate parametric approximation of the value function, the existence of a forward invariant compact set in the interior of the safe set needs to be established. Since the invariant set needs to be in the interior of the safe set, the penalty becomes superfluous, and safety can be achieved through conventional Lyapunov methods.This paper is inspired by a safe reinforcement learning technique, recently developed in Yang et al. (2019), based on the idea of transforming a state and input constrained nonlinear optimal control problem into an unconstrained one with a type of saturation function, introduced in Graichen and Petit (2009), and Bechlioulis and Rovithakis (2009). In Yang et al. (2019), the state constrained optimal control problem is transformed using a barrier transformation (BT), into an equivalent, unconstrained optimal control problem. A learning technique is then used to synthesize the feedback control policy for the unconstrained optimal control problem. The controller for the original system is then derived from the unconstrained approximate optimal policy by inverting the barrier transformation. In Greene et al. (2020), the restrictive persistence of excitation requirement in Yang et al. (2019) is softened using model-based reinforcement learning (MBRL), where exact knowledge of the system dynamics is utilized in the barrier transformation.One of the primary contributions of this paper is a detailed analysis of the connection between the transformed dynamics and the original dynamics, which is missing from results such as Yang et al. (2019), Greene et al. (2020), and Yang et al. (2020). While the stability of the transformed dynamics under the designed controllers is established in results such as Yang et al. (2019), Greene et al. (2020), and Yang et al. (2020), the implications of the behavior of the transformed system on the original system are not examined. In this paper, it is shown that the trajectories of the original system are related to the trajectories of the transformed system via the barrier transformation as long as the trajectories of the transformed system are complete.While the transformation in Yang et al. (2019) and Greene et al. (2020) results in verifiable safe controllers, it requires exact knowledge of the system model, which is often difficult to obtain. Another primary contribution of this paper is the development of a novel filtered concurrent learning technique for online model learning, and its integration with the barrier transformation method, to yield a novel MBRL solution to the online state-constrained optimal control problem under parametric uncertainty. The developed MBRL method learns an approximate optimal control policy in the presence of parametric uncertainties for safety critical systems while maintaining stability and safety during the learning phase. The inclusion of filtered concurrent learning makes the controller robust to modeling errors and guarantees local stability under a finite (as opposed to persistent) excitation condition.In the following, the problem is formulated in Section 2 and the BT is described and analyzed in Section 3. A novel parameter estimation technique is detailed in Section 4 and a model-based reinforcement learning technique for synthesizing feedback control policy in the transformed coordinates is developed in Section 5. In Section 6, a Lypaunov-based analysis is utilized to establish practical stability of the closed-loop system resulting from the developed MBRL technique in the transformed coordinates, which guarantees that the safety requirements are satisfied in the original coordinates. Simulation results in Section 7 demonstrate the performance of the developed method and analyze its sensitivity to various design parameters, followed by a comparison of the performance of the developed MBRL approach to an offline pseudospectral optimal control method. Strengths and limitations of the developed method are discussed in Section 8, along with possible extensions.
2 Problem Formulation
2.1 Control Objective
Consider a continuous-time affine nonlinear dynamical system
where
is the system state,
are the unknown parameters,
is the control input, and the functions
and
are known, locally Lipschitz functions. In the following, [a; b] denotes the vector [a b]
and (v)
denotes the ith component of the vector v.The objective is to design a controller u for the system in (1) such that starting from a given feasible initial condition x
0, the trajectories x(⋅) decay to the origin and satisfy x
(t) ∈ (a
, A
), ∀t ≥ 0, where i = 1, 2, … , n and a
< 0 < A
. While MBRL methods such as those detailed in Kamalapurkar et al. (2018) guarantee stability of the closed loop, state constraints are typically difficult to establish without extensive trial and error. To achieve the stated objective, an MBRL framework (see Figure 1) is developed in this paper, where a BT is used to guarantee satisfaction of state constraints.
FIGURE 1
The developed BT MBRL framework. The control system consists of a model-based barrier-actor-critic-estimator architecture. In addition to the transformed state-action measurements, the critic also utilizes states, actions, and the corresponding state derivatives, evaluated at arbitrarily selected points in the state space, to learn the value function. In the figure, BT: Barrier Transformation; TS: Transformed State; BE: Bellman Error.
The developed BT MBRL framework. The control system consists of a model-based barrier-actor-critic-estimator architecture. In addition to the transformed state-action measurements, the critic also utilizes states, actions, and the corresponding state derivatives, evaluated at arbitrarily selected points in the state space, to learn the value function. In the figure, BT: Barrier Transformation; TS: Transformed State; BE: Bellman Error.
3 Barrier Transformation
3.1 Design
Let the function
, referred to as the barrier function (BF), be defined asDefine
as
with a = [a
1; …; a
] and A = [A
1; …; A
]. The inverse of (2) on the interval (a
, A
), is given byDefine
as
. Taking the derivative of (3) with respect to y yieldsConsider the BF based state transformation
where
denotes the transformed state. In the following derivation, whenever clear from the context, the subscripts a
and A
of the BF and its inverse are suppressed for brevity. The time derivative of the transformed state can be computed using the chain rule as
which yields the transformed dynamicsThe dynamics of the transformed state can then be expressed as
where F (s) := y(s)θ,
, and
.Continuous differentiability of b
−1 implies that F and G are locally Lipschitz continuous. Furthermore, f (0) = 0 along with the fact that b
−1 (0) = 0 implies that F (0) = 0. As a result, for all compact sets
containing the origin, G is bounded on Ω and there exists a positive constant L
such that ∀s ∈ Ω, ‖y(s)‖ ≤ L
‖s‖. The following section relates the solutions of the original system to the solutions of the transformed system.
3.2 Analysis
In the following lemma, the trajectories of the original system and the transformed system are shown to be related by the barrier transformation provided the trajectories of the transformed system are complete [see, e.g., Page 33 of Sanfelice (2021)]. The completeness condition is not vacuous, it is not difficult to construct a system where the transformed trajectories escape to infinity in finite time, while the original trajectories are complete. For example, consider the system
with
and
. All nonzero solutions of the corresponding transformed system
under the feedback
escape in finite time. However, all nonzero solutions of the original system under the feedback ξ(x, t) = ζ(b
(−0.5,0.5) (x), t) = − x converge to either −1 or 1.Lemma 1. If t ↦ Φ(t, b(x0), ξ) is a complete Carathéodory solution to (7)
, starting from the initial condition
b(x
0), under the feedback policy (s, t)↦ζ(s, t) and
t↦Λ(t, x
0, ξ) is a Carathéodory solution to
(1)
, starting from the initial condition
x
0
, under the feedback policy (x, t)↦ξ(x, t), defined as
ξ(x, t) = ζ(b(x), t), then Λ(⋅, x
0, ξ) is complete and
for all
.Proof. See Lemma 1 in the Supplementary Material.Note that the feedback ξ is well-defined at x only if b(x) is well-defined, which is the case whenever x is inside the barrier. As such, the main conclusion of Lemma 1 also implies that Λ(⋅, x
0, ξ) remains inside the barrier. It is thus inferred from Lemma 1 that if the trajectories of (7) are bounded and decay to a neighborhood of the origin under a feedback policy (s, t)↦ζ(s, t), then the feedback policy
, when applied to the original system in (1), achieves the control objective stated in Section 2.1.To achieve BT MBRL in the presense of parametric uncertainties, the following section develops a novel parameter estimator.
4 Parameter Estimation
The following parameter estimator design is motivated by the subsequent Lyapunov analysis, and is inspired by the finite-time estimator in Adetola and Guay (2008) and the filtered concurrent learning (FCL) method in Roy et al. (2016). Estimates of the unknown parameters,
, are generated using the filter
where
, and the update law
where β
1 is a symmetric positive definite gain matrix and
is a tunable upper bound on the filtered regressor Y
.Equations 7–12 constitute a nonsmooth system of differential equations
where
,
, and
. Since ‖Y
‖ is non-decreasing in time, it can be shown that (13) admits Carathéodory solutions.Lemma 2. If ‖Y
‖ is non-decreasing in time then
(13)
admits Carathéodory solutions.Proof. see Lemma 2 in Supplementary Material.Note that (9), expressed in the integral form
where
, along with (11), expressed in the integral form
and the fact that s(τ) − s
0 − G
(τ) = Y(τ)θ, can be used to conclude that X
(t) = Y
(t)θ, for all t ≥ 0. As a result, a measure for the parameter estimation error can be obtained using known quantities as
, where
. The dynamics of the parameter estimation error can then be expressed asThe filter design is thus motivated by the fact that if the matrix
is positive definite, uniformly in t, then the Lyapunov function
can be used to establish convergence of the parameter estimation error to the origin. Initially,
is a matrix of zeros. To ensure that there exists some finite time T such that
is positive definite, uniformly in t for all t ≥ T, the following finite excitation condition is imposed.Assumption 3. There exists a time instance T > 0 such that Y
(T) is full rank.Note that the minimum eigenvalue of Y
is trivially non-decreasing for t ≥ t
3 since Y
(t) is constant ∀t ≥ t
3. Indeed, for t
4 ≤ t
5 ≤ t
3,
. Since Y
(t
4) is positive semidefinite, and so is the integral
, we conclude that λ
min (Y
(t
5)) ≥ λ
min (Y
(t
4)), As a result, t↦λ
min (Y
(t)) is non-decreasing. Therefore, if Assumption 3 is satisfied at t = T, then Y
(t) is also full rank for all t ≥ T. Similar to other MBRL methods that rely on system identification [see e.g., Chapter 4 of Kamalapurkar et al. (2018)], the following assumption is needed to ensure boundedness of the state trajectories over the interval [0, T].Assumption 4. A fallback controller
that keeps the trajectories of (7) inside a known bounded set over the interval [0, T), without requiring the knowledge of θ
, is available.If a fallback controller that satisfies Assumption 4 is not available, then, under the additional assumption that the trajectories of (7) are exciting over the interval [0, T), such a controller can be learned online, while maintaining system stability, using model-free reinforcement learning techniques such as Bhasin et al. (2013); Vrabie and Lewis (2010), and Modares et al. (2014).. While the analysis of the developed technique dictates that a different stabilizing controller should be used over the time interval [0, T), typically, similar to the examples in Sections 7.1 and 7.2, the transient response of the developed controller provides sufficient excitation so that T is small (in the examples provided in Sections 7.1 and 7.2
,
T is the order of 10–5 and 10–6
, respectively), and a different stabilizing controller is not needed in practice.
5 Model-Based Reinforcement Learning
Lemma 1 implies that if a feedback controller that practically stabilizes the transformed system in (7) is designed, then the same feedback controller, applied to the original system by inverting the BT, also achieves the control objective stated in Section 2.1. In the following, a controller that practically stabilizes (7) is designed as an estimate of the controller that minimizes the infinite horizon cost.
over the set
of piecewise continuous functions t↦u(t), subject to (7), where ϕ(τ, s
0, u (⋅)) denotes the trajectory of (7), evaluated at time τ, starting from the state s
0 and under the controller u (⋅), r (s, u) := s
Qs + u
Ru, and
and
are symmetric positive definite (PD) matrices
.Assuming that an optimal controller exists, let the optimal value function, denoted by
, be defined as
where u
and
are obtained by restricting the domains of u and functions in
to the interval
, respectively. Assuming that the optimal value function is continuously differentiable, it can be shown to be the unique positive definite solution of the Hamilton-Jacobi-Bellman (HJB) equation [see, e.g., Theorem 1.5 of Kamalapurkar et al. (2018)].
where
. Furthermore, the optimal controller is given by the feedback policy u(t) = u
∗(ϕ(t, s, u
[0,)) where
defined as
. In the developed method, the cost function is selected to be quadratic in the transformed coordinates. However, a physically meaningful cost function is more likely to be available in the original coordinates. If such a cost function is available, it can be transformed from the original coordinates to the barrier coordinates using the inverse barrier function, to yield a cost function that is not quadratic in the state. While the analysis in this paper addresses the quadratic case, it can be extended to address the non-quadratic case with minimal modifications as long as s↦r(s, u) is positive definite for all
.
5.1 Value Function Approximation
Since computation of analytical solutions of the HJB equation is generally infeasible, especially for systems with uncertainty, parametric approximation methods are used to approximate the value function V
∗ and the optimal policy u
∗. The optimal value function is expressed as
where
is an unknown vector of bounded weights,
is a vector of continuously differentiable nonlinear activation functions such that
and
,
is the number of basis functions, and
is the reconstruction error.The basis functions are selected such that the approximation of the functions and their derivatives is uniform over the compact set
so that given a positive constant
, there exists
and known positive constants
and
such that
,
,
,
, and
[see, e.g., Sauvigny (2012)]. Using (19), a representation of the optimal controller, that uses the same basis as the optimal value function, is derived asSince the ideal weights, W, are unknown, an actor-critic approach is used in the following to estimate W. To that end, let the NN estimates
and
be defined as
where the critic weights,
and actor weights,
are estimates of the ideal weights, W.
5.2 Bellman Error
Substituting (23) and (24) into (19) results in a residual term,
, referred to as Bellman Error (BE), defined asTraditionally, online RL methods require a persistence of excitation (PE) condition to be able learn the approximate control policy [see, e.g., Modares et al. (2013); Kamalapurkar et al. (2016a); Kiumarsi et al. (2014)]. Guaranteeing PE a priori and verifying PE online are both typically impossible. However, using virtual excitation facilitated by model-based BE extrapolation, stability and convergence of online RL can be established under a PE-like condition that, while impossible to guarantee a priori, can be verified online by monitoring the minimum eigenvalue of a matrix in the subsequent Assumption 7 [see, e.g., Kamalapurkar et al. (2016b)]. Using the system model, the BE can be evaluated at any arbitrary point in the state space. Virtual excitation can then be implemented by selecting a set of states
and evaluating the BE at this set of states to yield
where,
, y
:= y(s
) and
. Defining the actor and critic weight estimation errors as
and
and substituting the estimates (21) and (22) into (19), and subtracting from (25) yields the analytical BE that can be expressed in terms of the weight estimation errors as
where
,
,
,
, and
. In (27) and the rest of the manuscript, the dependence of various functions on the state, s, is omitted for brevity whenever it is clear from the context. Similarly, (26) implies that
where, F
:= F(s
), ϵ
:= ϵ(s
), σ
:= σ(s
),
,
,
,
and
. Note that
and if s
∈ χ then
, for some constant d > 0. While the extrapolation states s
are assumed to be constant in this analysis for ease of exposition, the analysis extends in a straightforward manner to time-varying extrapolation states that are confined to a compact neighborhood of the origin.
5.3 Update Laws for Actor and Critic Weights
The actor and the critic weights are held at their initial values over the interval [0, T) and starting at t = T, using the instantaneous BE
from (25) and extrapolated BEs
from (26), the weights are updated according to.
with
, where
is a time-varying least-squares gain matrix,
,
,
is a constant forgetting factor, and
are constant adaptation gains. The control commands sent to the system are then computed using the actor weights as
where the controller ψ was introduced in Assumption 4. The following verifiable PE-like rank condition is then utilized in the stability analysis.Assumption 7. There exists a constant
such that the set of points
satisfiesSince ω
is a function of the weight estimates
and
, Assumption 7 cannot be guaranteed a priori. However, unlike the PE condition, Assumption 7 does not impose excitation requirements on the system trajectory, the excitation requirements are imposed on a user-selected set of points in the state space. Furthermore, Assumption 7 can be verified online. Since
is non-decreasing in the number of samples, N, Assumption 7 can be met, heuristically, by increasing the number of samples.
6 Stability Analysis
In the following theorem, the stability of the trajectories of the transformed system, and the estimation errors
,
, and
are shown.Theorem 8. Provided Assumptions 3, 4, and 7 hold, the gains are selected large enough based on (46) - (49) in Supplementary Material, and the weights
,
, Γ, and
are updated according to (12), (29), (30), and (31), respectively, then the estimation errors
,
, and
and the trajectories of the transformed system in (7) under the controller in (32) are locally uniformly ultimately bounded.Proof. See Theorem 8 in Supplementary Material.Using Lemma 1, it can then be concluded that the feedback control law
applied to the original system in (1), achieves the control objective stated in Section 2.1.
7 Simulation
To demonstrate the performance of the developed method, two simulation results, one for a two-state dynamical system, and one for a four-state dynamical system corresponding to a two-link planar robot manipulator, are provided.
7.1 Two State Dynamical System
The dynamical system is given by
where, and g(x) = [0; cos(2x
1) + 2]. The BT version of the system can be expressed in the form (7) with
and
, whereThe state x =
needs to satisfy the constraints x
1 ∈ (−7, 5) and x
2 ∈ (−5, 7). The objective for the controller is to minimize the infinite horizon cost function in (17), with Q = diag(10, 10) and R = 0.1. The basis functions for value function approximation are selected as
. The initial conditions for the system and the initial guesses for the weights and parameters are selected as x (0) = [ − 6.5; 6.5],
, Γ(0) = diag (1, 1, 1), and
. The ideal values of the unknown parameters in the system model are θ
1 = 1, θ
2 = − 1, θ
3 = − 0.5, θ
4 = 0.5, and the ideal values of the actor and the critic weights are unknown. The simulation uses 100 fixed Bellman error extrapolation points in a 4 × 4 square around the origin of the s − coordinate system.
7.1.1 Results for the Two State System
As seen from Figure 2, the system state stays within the user-specified safe set while converging to the origin. The results in Figure 3 indicate that the unknown weights for both the actor and critic NNs converge to similar values. As demonstrated in Figure 4 the parameter estimation errors also converge to a small neighborhood of the origin.
FIGURE 2
Phase portrait for the two-state dynamical system using MBRL with FCL in the original coordinates. The boxed area represents the user-selected safe set.
FIGURE 3
Estimates of the actor and the critic weights under nominal gains for the two-state dynamical system.
FIGURE 4
Estimates of the unknown parameters in the system under the nominal gains for the two-state dynamical system. The dash lines in the figure indicates the ideal values of the parameters.
Phase portrait for the two-state dynamical system using MBRL with FCL in the original coordinates. The boxed area represents the user-selected safe set.Estimates of the actor and the critic weights under nominal gains for the two-state dynamical system.Estimates of the unknown parameters in the system under the nominal gains for the two-state dynamical system. The dash lines in the figure indicates the ideal values of the parameters.Since the ideal actor and critic weights are unknown, the estimates cannot be directly compared against the ideal weights. To gauge the quality of the estimates, the trajectory generated by the controller
where
is the final value of the critic weights obtained in Figure 3, starting from a specific initial condition, is compared against the trajectory obtained using an offline numerical solution computed using the GPOPS II optimization software [see, e.g., Patterson and Rao (2014)]. The total cost, generated by numerically integrating (17), is used as the metric for comparison. The costs are computed over a finite horizon, selected to be roughly 5 times the time constant of the optimal trajectories. The results in Table 1 indicate that while the two solution techniques generate slightly different trajectories in the phase space (see Figure 5) the total cost of the trajectories is similar.
TABLE 1
Comparison of costs for a single barrier transformed trajectory of (35), obtained using the optimal feedback controller generated via the developed method, and obtained using pseudospectral numerical optimal control software.
Method
Cost
BT MBRL with FCL
71.8422
GPOPS II (Patterson and Rao (2014))
72.9005
FIGURE 5
Comparison of the optimal trajectories obtained using GPOPS II and using BT MBRL with FCL and fixed optimal weights for the two-state dynamical system.
Comparison of costs for a single barrier transformed trajectory of (35), obtained using the optimal feedback controller generated via the developed method, and obtained using pseudospectral numerical optimal control software.Comparison of the optimal trajectories obtained using GPOPS II and using BT MBRL with FCL and fixed optimal weights for the two-state dynamical system.
7.1.2 Sensitivity Analysis for the Two State System
To study the sensitivity of the developed technique to changes in various tuning parameters, a one-at-a-time sensitivity analysis is performed. The parameters k
, k
, k
, k
, β, and v are selected for the sensitivity analysis. The costs of the trajectories, under the optimal feedback controller obtained using the developed method, are presented in Table 2 for five different values of each parameter. The parameters are varied in a neighborhood of the nominal values (selected through trial and error) k
= 0.3, k
= 5, k
= 180, k
= 0.0001, β = 0.03, and v = 0.5. The value of β
1 is set to be diag(50, 50, 50, 50). The results in Table 2 indicate that the developed method is robust to small changes in the learning gains.
TABLE 2
Sensitivity Analysis for the two state system.
kc1 =
0.01
0.05
0.1
0.2
0.3
Cost
72.7174
72.6919
72.5378
72.3019
72.1559
kc2 =
2
3
5
10
15
Cost
71.7476
72.3198
72.1559
71.8344
71.7293
ka1 =
175
180
250
500
1,000
Cost
72.1568
72.1559
72.1384
72.1085
72.0901
ka2 =
0.0001
0.0009
0.001
0.005
0.01
Cost
72.1559
72.1559
72.1559
72.1559
72.1559
β =
0.001
0.005
0.01
0.03
0.04
Cost
72.2141
72.1559
72.1958
72.1559
72.1352
v =
0.5
1
10
50
100
Cost
72.1559
72.4054
72.6582
79.1540
81.32
Sensitivity Analysis for the two state system.
7.2 Four State Dynamical System
The four-state dynamical system corresponding to a two-link planar robot manipulator is given by
where
with s
2 = sin(x
2), c
2 = cos(x
2), p
1 = 3.473, p
2 = 0.196, and p
3 = 0.242. The state x =
, that corresponds to angular positions and the angular velocities of the two links, needs to satisfy the constraints x
1 ∈ (−7, 5), x
2 ∈ (−7, 5), x
3 ∈ (−5, 7), and x
4 ∈ (−5, 7). The objective for the controller is to minimize the infinite horizon cost function in (17), with Q = diag(1, 1, 1, 1) and R = diag(1, 1) while identifying the unknown parameters
that correspond to static and dynamic friction coefficients in the two links. The ideal values of the unknown parameters are θ
1 = 5.3, θ
2 = 1.1, θ
3 = 8.45, and θ
4 = 2.35. The basis functions for value function approximation are selected as
. The initial conditions for the system and the initial guesses for the weights and parameters are selected as x (0) = [−5; −5; 5; 5],
, Γ(0) = diag(10, 10, 10, 10, 10, 10, 10, 10, 10, 10), and
. The ideal values of the actor and the critic weights are unknown. The simulation uses 100 fixed Bellman error extrapolation points in a 4 × 4 square around the origin of the s − coordinate system.
7.2.1 Results for the Four State System
As seen from Figure 6, the system state stays within the user specified safe set while converging to the origin. As demonstrated in Figures 7 and 8, the actor and the critic weights converge, and estimates of the unknown parameters in the system model converge to their true values. Since the true actor and critic weights are unknown, the learned optimal controller is compared with an offline numerical optimal controller. The results of the comparison (see Table 3) indicate that the two solution techniques generate slightly different trajectories in the state space (see Figure 9) and that the total cost resulting from the learned controller is higher. We hypothesize that the difference in costs can be attributed to the exact basis for value function approximation being unknown.
FIGURE 6
State trajectories for the four-state dynamical system using MBRL with FCL in the original coordinates. The dash lines represent the user-selected safe set.
FIGURE 7
Estimates of the critic weights under nominal gains for the four-state dynamical system.
FIGURE 8
Estimates of the unknown parameters in the system under the nominal gains for the four-state dynamical system. The dash lines in the figure indicates the ideal values of the parameters.
TABLE 3
Costs for a single barrier transformed trajectory of (37), obtained using the developed method, and using pseudospectral numerical optimal control software.
Method
Cost
BT MBRL with FCL
95.1490
GPOPS II
57.8740
FIGURE 9
Comparison of the optimal angular position (top) and angular velocity (bottom) trajectories obtained using GPOPS II and BT MBRL with fixed optimal weights for the four-state dynamical system.
State trajectories for the four-state dynamical system using MBRL with FCL in the original coordinates. The dash lines represent the user-selected safe set.Estimates of the critic weights under nominal gains for the four-state dynamical system.Estimates of the unknown parameters in the system under the nominal gains for the four-state dynamical system. The dash lines in the figure indicates the ideal values of the parameters.Costs for a single barrier transformed trajectory of (37), obtained using the developed method, and using pseudospectral numerical optimal control software.Comparison of the optimal angular position (top) and angular velocity (bottom) trajectories obtained using GPOPS II and BT MBRL with fixed optimal weights for the four-state dynamical system.In summary, the newly developed method can achieve online optimal control thorough a BT MBRL approach while estimating the value of the unknown parameters in the system dynamics and ensuring safety guarantees in the original coordinates during the learning phase.The following section details a one-at-a-time sensitivity analysis and study the sensitivity of the developed technique to changes in various tuning parameters.
7.2.2 Sensitivity Analysis for the Four State System
The parameters k
, k
, k
, k
, β, and v are selected for the sensitivity analysis. The costs of the trajectories under the optimal feedback controller, obtained using the developed method, are presented in Table 4 for five different values of each parameter.
TABLE 4
Sensitivity Analysis for the four state system.
kc1 =
0.01
0.05
0.1
0.5
1
Cost
95.91
95.4185
95.1490
94.1607
93.5487
kc2 =
1
5
10
20
30
Cost
304.4
101.0786
95.1490
92.7148
93.729
ka1 =
5
10
20
30
50
Cost
94.9464
95.1224
95.1490
95.1736
95.1974
ka2 =
0.05
0.1
0.2
0.5
1
Cost
95.2750
95.2480
95.1490
94.9580
94.6756
β =
0.1
0.5
0.8
0.9
0.95
Cost
125.33
109.7721
95.1490
92.91
93.7231
v =
50
70
100
125
150
Cost
92.2836
93.34
95.1490
96.1926
97.9870
Sensitivity Analysis for the four state system.The parameters are varied in a neighborhood of the nominal values (selected through trial and error) k
= 0.1, k
= 10, k
= 20, k
= 0.2, β = 0.8, and v = 100. The value of β
1 is set to be diag(100, 100, 100, 100).The results in Tables 2 and 4, indicate that the developed method is not sensitive to small changes in the learning gains. While reduced sensitivity to gains simplifies gain selection, as indicated by the local stability result, the developed method is sensitive to selection of basis functions and initial guesses of the unknown weights. Due to high dimensionality of the vector of unknown weights, a complete characterization of the region of attraction is computationally difficult. As such, the basis functions and the initial guess were selected via trial and error.
8 Conclusion
This paper develops a novel online safe control synthesis technique which relies on a nonlinear coordinate transformation that transforms a constrained optimal control problem into an unconstrained optimal control problem. A model of the system in the transformed coordinates is simultaneously learned and utilized to simulate experience. Simulated experience is used to realize convergent RL under relaxed excitation requirements. Safety of the closed-loop system, expressed in terms of box constraint, regulation of the system states to a neighborhood of the origin, and convergence of the estimated policy to a neighborhood of the optimal policy in transformed coordinates is established using a Lyapunov-based stability analysis.While the main result of the paper states that the state is uniformly ultimately bounded, the simulation results hint towards asymptotic convergence of the part of the state that corresponds to the system trajectories, x (⋅). Proving such a result is a part of future research.Limitations and possible extensions of the ideas presented in this paper revolve around two key issues: (a) safety, and (b) online learning and optimization. The barrier function used in the BT to address safety can only ensure a fixed box constraint. A more generic and adaptive barrier function, constructed, perhaps, using sensor data is a subject for future research.For optimal learning, parametric approximation techniques are used to approximate the value functions in this paper. Parametric approximation of the value function requires selection of appropriate basis functions which may be hard to find for the barrier-transformed dynamics. Developing techniques to systematically determine a set of basis functions for real-world systems is a subject for future research.The barrier transformation method to ensure safety relies on knowledge of the dynamics of the system. While this paper addresses parametric uncertainties, the BE method could potentially result in a safety violation due to unmodeled dynamics. In particular, the safety guarantees developed in this paper rely on the relationship (Lemma 1) between trajectories of the original dynamics and the transformed system, which holds in the presence of parametric uncertainty, but fails if a part of the dynamics is not included in the original model. Further research is needed to establish safety guarantees that are robust to unmodeled dynamics (for a differential games approach to robust safety, see Yang et al. (2020)).