arXiv is now an independent nonprofit! Learn more
License: arXiv.org perpetual non-exclusive license
arXiv:2006.03947v2 [eess.SY] 23 Nov 2020

Neural Lyapunov Redesign

Arash Mehrjou Email: amehrjou@ethz.ch Affiliation: Max Planck Institute for Intelligent Systems & ETH Zürich and
Google Research and
Max Planck Institute for Intelligent Systems
   Mohammad Ghavamzadeh Email: ghavamza@google.com Affiliation:    Bernhard Schölkopf Email: bs@tue.mpg.de Affiliation:
Abstract

Learning controllers merely based on a performance metric has been proven effective in many physical and non-physical tasks in both control theory and reinforcement learning. However, in practice, the controller must guarantee some notion of safety to ensure that it does not harm either the agent or the environment. Stability is a crucial notion of safety, whose violation can certainly cause unsafe behaviors. Lyapunov functions are effective tools to assess stability in nonlinear dynamical systems. In this paper, we combine an improving Lyapunov function with automatic controller synthesis in an iterative fashion to obtain control policies with large safe regions. We propose a two-player collaborative algorithm that alternates between estimating a Lyapunov function and deriving a controller that gradually enlarges the stability region of the closed-loop system. We provide theoretical results on the class of systems that can be treated with the proposed algorithm and empirically evaluate the effectiveness of our method using an exemplary dynamical system.

keywords
Lyapunov function, Controller Synthesis, Actor-Critic, Neural Networks

1 Introduction

Studying the stability region of autonomous systems and designing controllers (policies) to drive a non-autonomous system towards a target behavior are of fundamental importance in many disciplines, such as aviations (Liao and Wang, 2004), autonomous driving (Wen-Xing and Li-Dong, 2018), and robotics (Pierson and Gashler, 2017). An indisputable goal for a controller is to stabilize the system. Unlike the global nature of linear systems, stability is a local property in nonlinear systems. Knowledge of the stability region is essential in many applications, such as stability of power systems (Xin et al., 2007), design of associative memory in artificial neural networks (Hopfield, 1994), robotics (Westervelt et al., 2003), and biology (Baer et al., 2006).

Controllers that enhance the stability region of a system, also known as Region of Attraction (RoA), are highly desired as they make more clever use of the inherent nonlinear structure of the system. For example, an autonomous driving system will remain safe under more diverse and potentially harsh conditions (Imani Masouleh and Limebeer, 2018).

A great number of methods for designing a controller for nonlinear systems and determining their RoA (Isidori, 2014; Khalil and Grizzle, 2002) have been proposed in the literature mainly based on Lyapunov’s theory of stability (Liapounoff, 1907). However, the design of a stabilizing controller has been ad-hoc for every class of nonlinear systems. Our work is inspired by a classic method called Lyapunov Redesign in control theory that uses a given Lyapunov function to design a controller such that the closed-loop system becomes stable when assessed by that Lyapunov function. Here, we relax the necessity to know the Lyapunov function by learning it together with the controller.

Machine learning and control theory have contributed to each other in various ways. Function approximators such as kernel methods (Pillonetto et al., 2014) and neural networks (Chu et al., 1990) have been successfully used for system identification. Moreover, ideas from information theory and statistics have been adopted for model selection in system identification (Solowjow et al., 2018; Mehrjou et al., 2018). Moreover, recent advances in implicit generative models have proven effective in filtering applications where the states of the system are inferred from noisy observations (Mehrjou and Schölkopf, 2018a). The development of automatic differentiation packages for machine learning has opened up a new approach to stability analysis and estimation of functions of interest in control theory such as Hamiltonian Greydanus et al. (2019) or Lyapunov function Mehrjou and Schölkopf (2019).

The analytical tools from control theory have helped to analyze the dynamics of machine learning algorithms. For example, the algorithms such as generative adversarial networks (Goodfellow et al., 2014) and nn-player cooperative games have been analyzed as dynamical systems to obtain some insight into the dynamics of learning (Mehrjou and Schölkopf, 2018b; Mehrjou, 2018; Mescheder et al., 2017; Mehrjou et al., 2019) and the emergence of the playing strategies (Balduzzi et al., 2018). In the present work, analytical tools from control theory are employed to study the strength of the learning signal during the course of training.

The popularity of multi-player learning algorithms in machine learning after Generative Adversarial Networks (Goodfellow et al., 2014) have been inspired in areas of control theory where such multi-player setting can be defined. Mehrjou et al. (2020) have proposed a two-player setting where one player learns the Lyapunov function and the region of attraction while the other player learns the governing equations of the system. These players inform each other and their collaboration gives a faster convergence compared with learning each of them separately. The present work can be seen as a two-player algorithm where one player learns the Lyapunov function and the stability region while the other player improves the controller. The information exchange between the two players is the key factor of the proposed algorithm.

As the Lyapunov function is one of the most important objects in control theory, machine learning tools have been employed to learn it for nonlinear systems (Richards et al., 2018). A given Lyapunov function is used in (Berkenkamp et al., 2016; Berkenkamp et al., 2017) to derive a controller with a safety guarantee. Chang et al. (2019) solve an optimization problem at every stage to find the states that violate the Lyapunov condition. Our work proposes improvements in various directions. We improve the Lyapunov learning algorithm of Richards et al. (2018) by a theoretically motivated method and show that hyperbolicity is a needed feature for nonlinear systems whose controllers are learned iteratively. Moreover, Berkenkamp et al. (2016); Berkenkamp et al. (2017) assume the Lyapunov function is given while our work co-learns the Lyapunov function and the controller. Chang et al. (2019)’s algorithm needs to be solved until the end that can be too costly as a global optimization problem has to be solved multiple times. However, our work is a growing method that improves the controller while the system is in action.

We bring together various tools from control theory and machine learning to build an iterative algorithm that redesigns both controller and the Lyapunov function to enlarge the stability region. Our contributions are as follows: 1) Improving the learning of the Lyapunov function, 2) Interlacing the Lyapunov learning with the policy update to enlarge the RoA iteratively, and 3) Providing theoretical results for the tractable class of systems and analyzing the learning signal. Section 2 goes over the preliminary materials and Section 3 describe the problem. The proposed algorithm and its theoretical discussions are presented in Section 4. Finally, empirical evaluation comes in Section 5, followed by related work and conclusion in Section 6. To stay within the space limit, some proofs, theoretical discussions, and extended experimental results are provided in the Appendix.

2 Preliminaries

Here we present the definitions, notations, and theoretical results that are used in later sections.

System: A discrete-time11 1 Including discretized continuous-time systems time-invariant disturbance-free nonlinear dynamical system is described by

𝐱k+1=f(𝐱k,𝐮k),\mathbf{x}_{k+1}=f(\mathbf{x}_{k},\mathbf{u}_{k}), (1)

where kk\in\mathbb{Z} is the discrete time index, 𝐱k𝒳d\mathbf{x}_{k}\in\mathcal{X}\subseteq\mathbb{R}^{d} and 𝐮k𝒰p\mathbf{u}_{k}\in\mathcal{U}\subseteq\mathbb{R}^{p} are the state and control signals. We consider a fully observable regime, where the states are available to a feedback controller, i.e., 𝐮k=π(𝐱k)\mathbf{u}_{k}=\pi(\mathbf{x}_{k}), and π\pi is the feedback law or policy. Hence, 1 can be written as a time-invariant autonomous (TIA) system 𝐱k+1=fπ(𝐱k)\mathbf{x}_{k+1}=f_{\pi}(\mathbf{x}_{k}) where fπf_{\pi} is the time-independent dynamics function. By assuming Lipschitz continuity for ff and π\pi, a unique solution to this system for every initial state exists that is captured by the so-called flow function Φ(𝐱,):𝒳\Phi(\mathbf{x},\cdot):\mathbb{Z}\to\mathcal{X}, with Φ(𝐱,0)=𝐱\Phi(\mathbf{x},0)=\mathbf{x}.

Sets: For a TIA system with dynamics function ff, a state vector 𝐱¯\bar{\mathbf{x}} is called an equilibrium point if it is a fixed-point for ff, i.e., x¯=f(x¯)\bar{x}=f(\bar{x}). A state vector is called a regular point if it is not an equilibrium point. Let Jf(𝐱)J_{f}(\mathbf{x}) be the Jacobian of ff at 𝐱\mathbf{x}. If Jf(𝐱)J_{f}(\mathbf{x}) has no eigenvalue with modulus one, 𝐱\mathbf{x} is called a hyperbolic equilibrium point. A hyperbolic equilibrium point is asymptotically stable when the eigenvalues of its corresponding Jacobian have modulus less than one; otherwise, it is an unstable equilibrium point. A system whose all equilibrium points are hyperbolic is called a hyperbolic system. A set M𝒳M\subseteq\mathcal{X} is called an invariant set, if f(M)=Mf(M)=M, i.e., every trajectory starting in MM remains in MM, for kk\in\mathbb{Z}. A point 𝐩d\mathbf{p}\in\mathbb{R}^{d} is said to be in the ω\omega-limit set (or α\alpha-limit set) of 𝐱\mathbf{x}, if for every ϵ>0\epsilon>0 and N>0N>0 (N<0N<0), there exists a k>Nk>N (k<Nk<N) such that 𝐱k𝐩<ϵ\lVert\mathbf{x}_{k}-\mathbf{p}\rVert<\epsilon. The stable and unstable manifolds of 𝐱¯\bar{\mathbf{x}} are defined as the set of points whose ω\omega-limit (α\alpha-limit) set is 𝐱¯\bar{\mathbf{x}} and denoted by WsW^{s}(WuW^{u}).

Both WsW^{s} and WuW^{u} are proved to be invariant sets (Palis and De Melo, 2012).

Stability: A fixed-point 𝐱¯\bar{\mathbf{x}} is said to be an asymptotically stable equilibrium, if limk𝐱k=𝐱¯\lim_{k\to\infty}\mathbf{x}_{k}=\bar{\mathbf{x}}. Nonlinear systems often have a local stability region (RoA) that is defined for the stable equilibrium 𝐱¯\bar{\mathbf{x}} as 𝐱¯={𝐱𝒳:limkΦ(𝐱,k)=𝐱¯}\mathcal{R}^{\bar{\mathbf{x}}}=\{\mathbf{x}\in\mathcal{X}:\lim_{k\to\infty}\Phi(\mathbf{x},k)=\bar{\mathbf{x}}\}. Topologically speaking, when ff is continuous, 𝐱¯\mathcal{R}^{\bar{\mathbf{x}}} is an open, invariant set (see Chiang and Alberto, 2015 for exact definitions). The stability boundary 𝐱¯\partial\mathcal{R}^{\bar{\mathbf{x}}} is a closed positively invariant set and is of dimension n1n-1, if 𝐱¯\mathcal{R}^{\bar{\mathbf{x}}} is not dense in n\mathbb{R}^{n}.

Lyapunov stability.

Let ff be a locally Lipschitz continuous dynamics function with an equilibrium point at the origin 𝐱¯=𝟎\bar{\mathbf{x}}=\mathbf{0}. Suppose there exists a locally Lipschitz continuous function V=𝒳V=\mathcal{X}\to\mathbb{R} and a domain 𝒟𝒳\mathcal{D}\subseteq\mathcal{X}, such that

V(𝟎)=0andV(𝐱)>0\displaystyle V(\mathbf{0})=0\quad\text{and}\quad V(\mathbf{x})>0\quad 𝐱𝒟\{𝟎}\displaystyle\forall\mathbf{x}\in\mathcal{D}\backslash\{\mathbf{0}\} (2)
ΔV(𝐱):=V(f(𝐱))V(𝐱)<0\displaystyle\Delta V(\mathbf{x}):=V(f(\mathbf{x}))-V(\mathbf{x})<0\quad 𝐱𝒟\{𝟎}\displaystyle\forall\mathbf{x}\in\mathcal{D}\backslash\{\mathbf{0}\} (3)

Then, 𝐱¯\bar{\mathbf{x}} is asymptotically stable and VV is a Lyapunov function (lf). The domain 𝒟\mathcal{D} in which (3) is satisfied is called the Lyapunov decrease region. Every sublevel set 𝒮c(V)={𝐱𝒳:V(𝐱)<c}{\mathcal{S}}_{c}(V)=\{\mathbf{x}\in\mathcal{X}:V(\mathbf{x})<c\}, for c+c\in\mathbb{R}_{+}, that is contained within 𝒟\mathcal{D} is invariant under the dynamics ff.

3 Problem Statement

We consider a discrete-time TIA system as in 1, where the control signal is produced by a feedback-controller π(,ψ):𝒳𝒰\pi(\cdot;\psi):\mathcal{X}\to\mathcal{U} parameterized by ψ\psi. Therefore, the closed-loop dynamics denoted by fπf_{\pi} is a functional of the controller and is consequently parameterized by ψ\psi as 𝐱k+1=f(𝐱k,π(𝐱k,ψ))=fπ(𝐱k,ψ)\mathbf{x}_{k+1}=f(\mathbf{x}_{k},\pi(\mathbf{x}_{k};\psi))=f_{\pi}(\mathbf{x}_{k};\psi). Without loss of generality, we assume that the equilibrium point of interest is located at the origin 𝐱¯=𝟎\bar{\mathbf{x}}=\mathbf{0}. The policy π\pi induces a RoA around the equilibrium point denoted by π\mathcal{R}_{\pi}.22 2 We drop 𝐱¯\bar{\mathbf{x}} from the superscript of π𝐱¯\mathcal{R}_{\pi}^{\bar{\mathbf{x}}}, since we always assume 𝐱¯=𝟎\bar{\mathbf{x}}=\mathbf{0}, unless otherwise stated.

Each control task can be broken down into two subtasks: 1) Controller synthesis and 2) Closed-loop response evaluation. The controller is designed to optimize some measure of performance. In this work, the performance measure is the size of the stability region.

We endow the state space 𝒳\mathcal{X} with a measure μ\mu to obtain the measure space (𝒳,(𝒳),μ)(\mathcal{X},\mathcal{B}(\mathcal{X}),\mu) with Borel sigma-algebra (𝒳)\mathcal{B}(\mathcal{X}). To prevent pathological cases, we assume 𝒳\mathcal{X} to be compact with μ(𝒳)<μ<\mu(\mathcal{X})<\mu_{\infty}<\infty. Let Π={π:𝒳𝒰:πC1and bounded}\Pi=\{\pi:\mathcal{X}\to\mathcal{U}:\pi\in C^{1}\;\text{and bounded}\} be the set of all functions from which the policy is chosen. The goal is to find a member π\pi^{*} of the equivalence class of optimal policies ΠΠ\Pi^{*}\subseteq\Pi, where Π\Pi^{*} is defined as Π={πΠ:μ(π)=maxπΠμ(π)}\Pi^{*}=\{\pi^{*}\in\Pi:\mu(\mathcal{R}_{\pi^{*}})=\max_{\pi\in\Pi}\mu(\mathcal{R}_{\pi})\}.

The main challenge in this optimization problem is the fact that there is no analytical or straightforward way to infer how changing π\pi changes μ(π)\mu(\mathcal{R}_{\pi}). If there exists a differentiable map from π\pi to μ(π)\mu(\mathcal{R}_{\pi}), one could locally increase the stability region by perturbing the policy in the direction of μ(π)/π\partial\mu(\mathcal{R}_{\pi})/\partial\pi. However, except for extremely simple systems, such a map cannot be derived analytically. In this work, we construct a bridge between these two objects by an auxiliary function, which is an evolving Lyapunov function that is learned alongside the policy.

Our goal is to construct a sequence of policies (π1,π2,)(\pi_{1},\pi_{2},\ldots) that gives a sequence of RoAs (π1,π2,)(\mathcal{R}_{\pi_{1}},\mathcal{R}_{\pi_{2}},\ldots), such that πn𝜇¯\mathcal{R}_{\pi_{n}}\xrightarrow{\mu}\bar{\mathcal{R}} as nn\to\infty, where ¯𝒟\bar{\mathcal{R}}\subseteq\mathcal{D} is the largest achievable RoA that is constrained by the physical limitations of the system (see Appendix A for the characterization of ¯\bar{\mathcal{R}} using the concept of control Lyapunov function). To achieve this goal, we need to address two challenges: 1) Approximating πn\mathcal{R}_{\pi_{n}} for a fixed πn\pi_{n} and 2) Using (πn,fπn)(\mathcal{R}_{\pi_{n}},f_{\pi_{n}}) to find πn+1\pi_{n+1}. Next section, explains our proposed method to address these two challenges.

4 Proposed Method

For a function gg, let’s define its sublevel set with level value aa as 𝒮a(g):={𝐱d:g(𝐱)<a}{\mathcal{S}}_{a}(g):=\{\mathbf{x}\in\mathbb{R}^{d}:g(\mathbf{x})<a\}. The index n{0}n\in\mathbb{N}\cup\{0\} refers to a phase of the algorithm. At phase nn, let πn\mathcal{R}_{\pi_{n}} be the RoA of the closed-loop system 1 that is induced by the state-feedback policy πn\pi_{n}. It can be shown that there exists an optimal Lyapunov function VπnV_{\pi_{n}} with a level value cnc_{n}, such that πn=Scn(Vπn)\mathcal{R}_{\pi_{n}}=S_{c_{n}}(V_{\pi_{n}}) (Vannelli and Vidyasagar, 1985). Therefore, the information of πn\mathcal{R}_{\pi_{n}} is encoded in (Vπn,cn)(V_{\pi_{n}},c_{n}).

Starting with a conservative controller (e.g., a quadratic controller for the linearized system), our method inductively constructs a sequence of policies (π1,π2,)(\pi_{1},\pi_{2},\ldots) that eventually converges to a policy with maximal achievable RoA. See Figure 1(Left) for an overall schematic of the algorithm.

Each step of this inductive process is called a phase of the algorithm. Each phase consists of two sub-phases: 1) Learning the Lyapunov function and the RoA corresponding to the policy of that phase 2) Updating the policy to enlarge the RoA. The RoA estimation sub-phase finds a Lyapunov function VπnV_{\pi_{n}} and level value cnc_{n}, such that 𝒮cn(Vπn)=πn{\mathcal{S}}_{c_{n}}(V_{\pi_{n}})=\mathcal{R}_{\pi_{n}}. Then, the policy update sub-phase learns a new policy πn+1\pi_{n+1}, such that 𝒮cn(Vπn)πn+1{\mathcal{S}}_{c_{n}}(V_{\pi_{n}})\subseteq\mathcal{R}_{\pi_{n+1}}. These conditions need to be satisfied for every nn that consequently limits the class of treatable systems. Before delving into the algorithmic implementation, Section 4.1 provides necesary theoretical insights into this favorable class of systems along with other theoretical considertations for the proposed multi-phase growing algorithm.

4.1 Theoretical Discussion

We start with the assumptions that are necessary for the practical applicability of the method. Then, we show for which class of systems these assumptions are satisfied.

Assumption 1.

Let R:Π2𝒳R:\Pi\to 2^{\mathcal{X}} be a set-valued function defined as R(π)=πR(\pi)=\mathcal{R}_{\pi}. Let dΠ:Π×Π+d_{\Pi}:\Pi\times\Pi\to\mathbb{R}_{+} and d𝒳:2𝒳×2𝒳+d_{\mathcal{X}}:2^{\mathcal{X}}\times 2^{\mathcal{X}}\to\mathbb{R}_{+} be some specified metrics in the space of policies and the space of all subsets of the state space, respectively. Then, the map RR is assumed to be continuous with respect to the topologies induced by the metrics dπd_{\pi} and d𝒳d_{\mathcal{X}}.

This assumption indicates that a small change in the policy leads to a small change in the RoA that it induces. Formally speaking, let πn\mathcal{R}_{\pi_{n}} and πn\pi_{n} be the RoA and the policy of phase nn. Assumption 1 states that for every ϵ>0\epsilon>0, one can choose small enough δ>0\delta>0 such that if π\pi satisfies dΠ(πn,π)<δd_{\Pi}(\pi_{n},\pi)<\delta, then μ(πnπ)<ϵ\mu(\mathcal{R}_{\pi_{n}}\triangle\mathcal{R}_{\pi})<\epsilon. Next, we show that hyperbolic systems fulfill this assumption33 3 The operator \triangle shows the symmetric difference between two sets..

Theorem 2 (Persistance of the stability boundary with variations in the policy).

Consider the closed-loop hyperbolic system 𝐱k+1=fπ(𝐱k)\mathbf{x}_{k+1}=f_{\pi}(\mathbf{x}_{k}) with policy π\pi. For a certain policy π=π~\pi=\tilde{\pi}, let (𝐱¯π~𝐶𝐿𝑂𝑆𝐸(\bar{\mathbf{x}}_{\tilde{\pi}}, 𝑂𝑃𝐸𝑁π~)\mathcal{R}_{\tilde{\pi}}) be an asymptotically stable equilibrium point and its corresponding RoA. Then, for every ϵ>0\epsilon>0, there exists δ>0\delta>0 such that for every π\pi^{\prime} with dΠ(π~,π)<δd_{\Pi}(\tilde{\pi},\pi^{\prime})<\delta, we have μ(π~π)<ϵ\mu(\mathcal{R}_{\tilde{\pi}}\triangle\mathcal{R}_{\pi^{\prime}})<\epsilon.

Proof sketch.

The first step to prove this result is to characterize the RoA in terms of the properties of the dynamics function fπf_{\pi}. As π~\mathcal{R}_{\tilde{\pi}} is characterized by its boundary, we focus our attention on the stability boundary π~\partial\mathcal{R}_{\tilde{\pi}}. The critical elements44 4 For theoretical discussion, we focus on critical elements that are equilibrium points. Similar results exist for other types of critical elements such as limit cycles but are left out of this work for brevity of the dynamical system determine the structure of the stability boundary. Suppose fπf_{\pi} is a diffeomorphism and all equilibrium points on π~\partial\mathcal{R}_{\tilde{\pi}} are hyperbolic. Moreover, let the stable and unstable manifolds of the equilibrium points on π~\partial\mathcal{R}_{\tilde{\pi}} intersect transversally55 5 Roughly speaking, the manifolds intersect in a generic way.. Finally, assume that every trajectory on π~\partial\mathcal{R}_{\tilde{\pi}} approaches one of the equilibrium points. If {𝐱1,𝐱2,}\{\mathbf{x}_{1},\mathbf{x}_{2},\ldots\} are the hyperbolic equilibrium points on π~\partial\mathcal{R}_{\tilde{\pi}}, π~\partial\mathcal{R}_{\tilde{\pi}} is completely characterized by

π~=iWs(𝐱i).\partial\mathcal{R}_{\tilde{\pi}}=\cup_{i}W^{s}(\mathbf{x}_{i}). (4)

See Theorems 9-11 in Chiang and Alberto (2015) for the detailed proof. Hence, to show the persistance of π~\partial\mathcal{R}_{\tilde{\pi}}, it is enough to show the persistance of the equilibrium points that live on π~\partial\mathcal{R}_{\tilde{\pi}} and the persistance of their stability condition. As a result of the continuity of f(𝐱,π(𝐱))f(\mathbf{x},\pi(\mathbf{x})) and π(𝐱)\pi(\mathbf{x}) w.r.t. their arguments, implicit function theorem guarantees that small perturbations to π\pi cause small changes in the hyperbolic equilibrium points (Krantz and Parks, 2012). If 𝐱π~\mathbf{x}^{*}_{\tilde{\pi}} is a hyperbolic equilibrium point of 𝐱k+1=fπ(𝐱k)\mathbf{x}_{k+1}=f_{\pi}(\mathbf{x}_{k}) for the policy π=π~\pi=\tilde{\pi}, there exists a δ>0\delta>0 and a neighborhood UU of 𝐱π~\mathbf{x}^{*}_{\tilde{\pi}} that contains a unique hyperbolic equilibrium point 𝐱π\mathbf{x}^{*}_{\pi^{\prime}} for every π{πΠ:dΠ(π,π~)<δ}\pi^{\prime}\in\{\pi\in\Pi:d_{\Pi}(\pi,\tilde{\pi})<\delta\}. Similarly, the continuity of the eigenvalues of Jfπ(𝐱π)J_{f_{\pi}}(\mathbf{x}_{\pi}) w.r.t. π\pi affirms that the perturbed equilibrium point 𝐱π\mathbf{x}^{*}_{\pi^{\prime}} has the same stability condition as 𝐱π~\mathbf{x}^{*}_{\tilde{\pi}}.

As stated above, π~\partial\mathcal{R}_{\tilde{\pi}} is characterized by the stable manifolds of equilibrium points that live on it. It was also shown that the hyperbolic equilibrium points on π~\partial\mathcal{R}_{\tilde{\pi}} together with their stable and unstable manifolds change continuously with π~\tilde{\pi}. This results in a continuous change of π~\partial\mathcal{R}_{\tilde{\pi}}, and consequently π~\mathcal{R}_{\tilde{\pi}}, w.r.t. small variations in π~\tilde{\pi}. ∎

This result suggests restricting the change of the policy at the policy update sub-phase of each growing phase of the algorithm to bound the change of its induced RoA. For parametric policies such as neural networks, this is achieved by cropping parameter values after every phase of training.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 1: (Left) Illustration of the policy update sub-phase. Given the estimated RoA, the policy update sub-phase (yellow arrows) tries to pull the diverging trajectories towards the level sets of the estimated Lyapunov function that reside inside the RoA. (Right) Visualizing the true ROA which is enlarged by the improved policy and is chased by a learned Lyapunov function. Green boundary: True RoA, Blue: Scn(Vπn)S_{c_{n}}(V_{\pi_{n}}), Pink: Sγcn(Vπn)S_{\gamma c_{n}}(V_{\pi_{n}}) for γ=4\gamma=4. The pink area shows the region from which the samples outside the estimated RoA is taken for both estimating the RoA and updating the policy.

4.2 Algorithm

The implementation of the algorithm that was outlined in Section 4 comes in the following. Notice that the algorithm is a multi-phase inductive method. Hence, we only present two sub-phases of a single phase. The full algorithm consists of iterations over this phase.

RoA Estimation Sub-Phase: Learn πn\mathcal{R}_{\pi_{n}} from (πn1,fπn)(\mathcal{R}_{\pi_{n-1}},f_{\pi_{n}}).

This sub-phase takes the current policy πn{\pi_{n}} and the previous RoA estimate 𝒮cn1(Vπn1){\mathcal{S}}_{c_{n-1}}(V_{\pi_{n-1}}) and outputs 𝒮cn(Vπn){\mathcal{S}}_{c_{n}}(V_{\pi_{n}}) that approximates πn\mathcal{R}_{\pi_{n}}. For this sub-phase, we improve the growing algorithm of (Richards et al., 2018) to learn an inner estimate of RoA. Our RoA estimation algorithm takes advantage of the theoretical results of (Chiang and Thorp, 1989) to improve the stability of training. The proposed loss function is more robust against local minima observed by Richards et al. (2018) as is empirically shown in Section 5.

The learning algorithm is verbally described here and the pseudo-code can be seen in Algorithm 1 in the Appendix. It starts with an initial conservative estimate of RoA and grows it during multiple iterations (phases). A neural network, as a universal function approximator, is employed to estimate a Lyapunov function for the system. At each iteration, the Lyapunov function is improved such that one of its sublevel sets gives a better estimate of the RoA. For this purpose, a fixed number of initial states are taken from a gap surrounding the current estimate of the RoA. The initial states are integrated forward in time by the closed-loop dynamics to produce the solution Φ(𝐱,k)\Phi(\mathbf{x},k) for each initial state 𝐱\mathbf{x}. The final state of each trajectory determines the stability of its corresponding initial state. We train the Lyapunov function as a classifier. The current estimate of the RoA produced by the current Lyapunov function is called the largest stable sublevel set. The initial states are labelled stable if their trajectory enters the largest stable sublevel set and are labelled unstable otherwise. We denote these two sets of initial states as 𝕏IN\mathbb{X}^{\text{IN}} and 𝕏OUT\mathbb{X}^{\text{OUT}} respectively and minimize the loss function

(V)=𝐱𝕏IN[V(𝐱)c¯]𝐱𝕏OUT[V(𝐱)c¯]+λRoA𝐱𝕏INΔV(𝐱)+λmonot𝐱𝕏IN[V(𝐱)Vπn1(fπn1(𝐱))]2\mathcal{L}(V)=\sum_{\mathbf{x}\in\mathbb{X}^{\text{IN}}}[V(\mathbf{x})-\bar{c}]-\sum_{\mathbf{x}\in\mathbb{X}^{\text{OUT}}}[V(\mathbf{x})-\bar{c}]+\lambda_{\text{RoA}}\sum_{\mathbf{x}\in\mathbb{X}^{\text{IN}}}\Delta V(\mathbf{x})+\lambda_{\text{monot}}\sum_{\mathbf{x}\in\mathbb{X}^{\text{IN}}}[V(\mathbf{x})-V_{\pi_{n-1}}(f_{\pi_{n-1}}(\mathbf{x}))]^{2} (5)

to update the Lyapunov function where c¯\bar{c} is fixed to a constant value (11 throughout this work). The idea is to absorb this degree of freedom in VV to ease training. The loss function is minimized by automatic differentiation and Stochastic Gradient Descent (SGD) with respect to the parameters of the neural network that realizes VV. Once it is minimized, a line search is carried out on the level value to obtain cnc_{n} such that 𝒮cn(Vπn){\mathcal{S}}_{c_{n}}(V_{\pi_{n}}) does not exceed the true RoA. The same process repeats for a certain number of iterations until a good inner estimate of the RoA is achieved. An important component in this process is the size of the gap around the largest stable sublevel set of each iteration of the algorithm. This gap is produced by 𝒢n=𝒮γrcn(Vπn)\𝒮cn(Vπn)\mathcal{G}_{n}={\mathcal{S}}_{\gamma_{r}c_{n}}(V_{\pi_{n}})\backslash{\mathcal{S}}_{c_{n}}(V_{\pi_{n}}) with γr>1\gamma_{r}>1. The size of this gap is controlled by γr\gamma_{r}. Larger values of γr\gamma_{r} gives a faster convergence but less stable training.

To give an intuitive idea of the terms in Equation 5, the first two terms encourage the Lyapunov function to change in a way that its sublevel set Sc¯(V)S_{\bar{c}}(V) includes the stable initial states 𝕏IN\mathbb{X}^{\text{IN}} and excludes the unstable initial states 𝕏OUT\mathbb{X}^{\text{OUT}}. The third term weighted by λRoA\lambda_{\rm RoA} encourages the negative definiteness of ΔV\Delta V on the RoA. The last term is inspired by the constructive method of (Chiang and Thorp, 1989) that accelerates capturing the entire RoA (see Appendix C). To satisfy Lyapunov conditions, VV needs to be positive definite on its domain. Rather than treating this condition in the loss function, we encode it in the architecture of the neural network using the construction proposed by Richards et al. (2018). Check Section G.1 for the detailed description of the architecture.

Policy Update Sub-Phase: Learn πn+1\pi_{n+1} from (πn,fπn)(\mathcal{R}_{\pi_{n}},f_{\pi_{n}}):

This sub-phase of the algorithm uses the estimated Lyapunov function VπnV_{\pi_{n}} to update the policy so that the new policy gives rise to a larger RoA. The idea is to change the policy in a way that the unstable trajectories starting from around the current RoA enter the RoA and become stable. Let 𝒟𝒳\mathcal{D}\subseteq\mathcal{X} be the working domain of the system around the equilibrium 𝐱¯\bar{\mathbf{x}}. Given a hypothesis class of feasible policies Π\Pi, only a subset of 𝒟\mathcal{D} is stabilizable. Assume ¯𝒟\bar{\mathcal{B}}\subseteq\mathcal{D} is the largest stabilizable subset with μ(¯)=μ¯\mu(\bar{\mathcal{B}})=\bar{\mu}. Therefore, an attempt to improve πn\pi_{n} amounts to appending points from ¯\πn\bar{\mathcal{B}}\backslash\mathcal{R}_{\pi_{n}} to πn\mathcal{R}_{\pi_{n}}. The set ¯\bar{\mathcal{B}} is not fully known in advance but some of its properties can be derived. Especially, for system 1, if f,πCf,\pi\in C^{\infty}, the maximum stabilizable set ¯\bar{\mathcal{B}} whose measure materializes as μ¯\bar{\mu} is compact and connected. Using this theoretical result, if πn¯\mathcal{R}_{\pi_{n}}\subsetneq\bar{\mathcal{B}}, the stabilizable states can be chosen from a gap around πn\mathcal{R}_{\pi_{n}}.

Because the RoA estimation sub-phase estimates it as a sublevel set of a Lyapunov function, i.e. πnScn(Vπn)\mathcal{R}_{\pi_{n}}\approx S_{c_{n}}(V_{\pi_{n}})), the sampling gap is constructed as 𝒢n=Sγpcn(Vπn)\Scn(Vπn)\mathcal{G}_{n}=S_{\gamma_{p}c_{n}}(V_{\pi_{n}})\backslash S_{c_{n}}(V_{\pi_{n}}) for a γp>1\gamma_{p}>1. To make sure the policy does not destabilize the regions that are already stabilized in the previous phases, the algorithm also samples initial states from within 𝒮cn(Vπn){\mathcal{S}}_{c_{n}}(V_{\pi_{n}}). All sampled initial states are integrated forward for LpL_{p} steps and the policy is updated via minimizing the loss function

(π)=𝐱𝒢nScn(Vπn)[1[Vπn(Φπ(𝐱,Lp))<cn]+λu1[Vπn(Φπ(𝐱,Lp))>cn]]Vπn(Φπ(𝐱,Lp)).\mathcal{L}(\pi)=\hskip-8.61108pt\sum_{\mathbf{x}\in\mathcal{G}_{n}\cup S_{c_{n}}(V_{\pi_{n}})}\hskip-20.00003pt[1_{[V_{\pi_{n}}(\Phi_{\pi}(\mathbf{x},L_{p}))<c_{n}]}+\lambda_{\rm u}1_{[V_{\pi_{n}}(\Phi_{\pi}(\mathbf{x},L_{p}))>c_{n}]}]V_{\pi_{n}}(\Phi_{\pi}(\mathbf{x},L_{p})). (6)

We implement the policy as a differentiable function such as a neural network and use automatic differentiation and SGD for minimization. The parameters of the policy appear in 6 via the end state Φπ(𝐱,Lp)\Phi_{\pi}(\mathbf{x},L_{p}) of the closed-loop trajectories. It is clear in 6 that minimizing (π)\mathcal{L}(\pi) with respect to π\pi while the Lyapunov function is fixed, pushes the trajectories towards the areas where the Lyapunov function assumes smaller values. This affects both stable and unstable trajectories while its influence on unstable trajectories can be magnified by λu>1\lambda_{u}>1. The detailed pseudo-code of this sub-phase can be found in Algorithm 2 in the Appendix. The quality of the training signal is analysed next.

Theoretical analysis of the learning signal— The effect of the policy π\pi on (π)\mathcal{L}(\pi) passes through the Lyapunov function VV as can be seen in 6. Unlike the conventional Lyapunov redesign method in control theory where the Lyapunov function is fixed, here the Lyapunov function itself is learned by the RoA estimation sub-phase of the algorithm. Hence, an ill-conditioned VV can harm the policy update phase. To take a closer look at this issue, we expand the learning signal analytically. Let the policy π\pi be a function of the states parameterised by ψ\psi. Let T=LpT=L_{p} be the time step of the final state of the trajectory. The learning signal to update the policy is proportional to /ψ\partial\mathcal{L}/\partial\psi expanded as

ψ=𝐱T1kT(𝐱T𝐱k+𝐱kψ).\frac{\partial\mathcal{L}}{\partial\psi}=\frac{\partial\mathcal{L}}{\partial\mathbf{x}_{T}}\sum_{1\leq k\leq T}\left(\frac{\partial\mathbf{x}_{T}}{\partial\mathbf{x}_{k}}\frac{\partial^{+}\mathbf{x}_{k}}{\partial\psi}\right). (7)

by applying the chain rule for differentiation.

The term +𝐱k/ψ\partial^{+}\mathbf{x}_{k}/\partial\psi is the single-step effect of ψ\psi on 𝐱k\mathbf{x}_{k} when 𝐱k1\mathbf{x}_{k-1} is fixed. We discuss every term in this equation in the following. Observe that /𝐱T\partial\mathcal{L}/\partial\mathbf{x}_{T} is multiplied the summation, i.e., its small value diminishes the entire signal. It can be expanded as

(𝐱)𝐱|𝐱=𝐱T=(V)V|V=V(𝐱T)V(𝐱)𝐱|𝐱=𝐱T.\frac{\partial\mathcal{L}(\mathbf{x})}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{T}}=\frac{\partial\mathcal{L}(V)}{\partial V}|_{V=V(\mathbf{x}_{T})}\frac{\partial V(\mathbf{x})}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{T}}. (8)

The first term on the r.h.s. does not vanish as it is 11 or λu\lambda_{u} for the loss function defined by Equation 6. The second term of the r.h.s depends on the slope of VV evaluated at the final state of the trajectory. One potential pathological condition occurs for stable and long trajectories. The reason is that 𝐱V(𝐱)\nabla_{\mathbf{x}}V(\mathbf{x}) continuously vanishes at the equilibrium (see Lemma 4 in the Appendix). Therefore, for long stable trajectories where 𝐱T\mathbf{x}_{T} is too close to the equilibrium, the learning signal to update the policy will be too small. Too long trajectories are detrimental for unstable trajectories as well because the states may grow exponentially and cause damages to the system. Hence, the length of the trajectory is an important design parameter that needs special attention when applying our proposed method in practice. The terms inside the sum only depend on the properties of the dynamics, not the Lyapunov function. Specifically, the first term shows how long the system keeps the memory of the past states and the second term shows how sensitive the system is with respect to the controller parameters. A more detailed discussion is deferred to Appendix F.

Before presenting the performance of the method empirically, it is important to note that our method assumes the model of the system is given. The following remark discusses to what extent the model of the system is needed and this requirement can be relaxed in the future.

Remark 3.

The RoA estimation phase does not need the model of the system. The system can be launched from sampled initial states and the generated trajectories are all we need in 5. The policy update phase of the algorithm requires a local estimate of the system to be able to compute V/π\partial V/\partial\pi. The locality of the model is inversely proportional to the length of the trajectory LpL_{p} in 6. A detailed theoretical discussion on this point is deferred to Appendix E.

5 Experiments

(a) Unimproved process
(b) Improved process
(c) Level values
(d) Policy parameters
Figure 2: (a), (b) The size of the RoA against the iterative stages (phases) of the Algorithms where (a) uses the RoA estimation method of Richards et al. (2018) while (b) uses ours. The fraction is computed with respect to a rectangular domain around the equilibrium point that is large enough to enclose the RoA. Green: size of the true RoA. Each jump corresponds to a policy update sub-phase that increases the size of the true RoA. Red: The size of sublevel set that the RoA estimation sub-phase learns to approximate the RoA. After each policy update, the RoA estimation sub-phase takes multiple growth iterations to capture the true RoA as close as possible. (c) The trace of the level values corresponding to every iteration of the RoA estimation sub-phase. (d) Red (Blue): The trace of the value of the upper (lower) threshold parameter of the policy during training. Each point corresponds to a policy update iteration.
(a) Unimproved process
(b) Improved process
(c) Level values
(d) Policy parameters
Figure 3: The same plots as Figure 2 with the exception that, here the threshold parameters are kept fixed at a=0.2a=0.2 and b=0.2b=-0.2 while the slopes mam_{a} and mbm_{b} are trainable parameters.

.

Figure 4: Loose saturation

We consider an inverted pendulum system defined as θ˙=ω\dot{\theta}=\omega and ω˙=glsin(θ)+uIμfωI\dot{\omega}=\frac{g}{l}\sin(\theta)+\frac{u}{I}-\mu_{f}\frac{\omega}{I} where the state vector 𝐱=(θ,ω)\mathbf{x}=(\theta,\omega) consists of the angle and angular velocity. Moreover (g=0.81,l=0.5,I=mass×l2=0.25,μf=0)(g=0.81,l=0.5,I={\rm mass}\times l^{2}=0.25,\mu_{f}=0) are the acceleration of gravity, length, inertia, and friction coefficient. The scalar uu is the input force. The open-loop system (with u=0u=0) has equilibrium points at (θ,ω)=(kπ,0)(\theta,\omega)=(k\pi,0) with kk\in\mathbb{Z}. We focus on the equilibrium point (0,0)(0,0) in the frictionless setting where the system shows oscillatory behavior and consequently is not asymptotically stable (see Section G.2 for system and modeling details). First, an LQR controller KK is designed for the linearized system around the origin (see the vector field and the initial RoA in Figure 5 in the Appendix). The control signal passes through a loose saturation function as u=π0(𝐱,ψ)=SATψ([θ,ω]𝖳K)u=\pi_{0}(\mathbf{x};\psi)={\rm SAT}_{\psi}([\theta,\omega]^{\mkern-1.5mu\mathsf{T}}K). The function SAT{\rm SAT} is parameterized by ψ=(a,b,ma,mb)\psi=(a,b,m_{a},m_{b}) as illustrated in Figure 4. In the first experiment, the slopes ma=0m_{a}=0 and mb=0m_{b}=0 are kept fixed where aa and bb are trainable parameters of the policy, i.e., ψ=(a,b)\psi=(a,b). The Lyapunov function V(,θ)V(\cdot;\theta) is realized by a 33-layer neural network parameterized by θ\theta. Each layer has 6464 neurons with a special architecture (see Section G.1) inspired by (Richards et al., 2018) followed by tanh activation function that imposes the positive definiteness of the entire network as is required by the Lyapunov conditions in 2. The chosen hyper-parameters for the SGD training can be found in Section G.3.

The initial controller gives a small RoA since it is designed for the local linear approximation of the system. As the initial policy is LQR designed for the locally linearized model, V(,θ)V(\cdot;\theta) is pre-trained by the quadratic function 0.1θ2+0.1ω20.1\theta^{2}+0.1\omega^{2}.

After pre-training, sub-phases of the algorithm of Section 4.2 are run alternately to capture the RoA and improve the policy. The green step-like plot in Figure 2(a) and Figure 2(b) shows the true size of the RoA. Each jump in the green plots shows one iteration of the policy update algorithm resulting in an increased RoA. The fluctuating red plot in Figure 2(a) shows the size of the estimated RoA without our improvement over the RoA estimation algorithm of Richards et al. (2018) while Figure 2(b) shows the outcome of the presence of our proposed additional term in the loss function 5. It shows that the added term results in a less fluctuating estimate of the RoA, and when combined with the policy update sub-phase, gives a faster convergence to a larger RoA (35.68% vs 27.50%35.68\%\text{ vs }27.50\% fraction of the domain volume after 77 policy updates).

As stated in Section 4.2, c¯=1\bar{c}=1 is not necessarily equal to cnc_{n}. After learning VnV_{n} with c¯\bar{c} in 5, the algorithm searches for a value of cnc_{n} such that the Lyapunov decrease condition is met for all states within the sublevel set 𝒮cn(Vn){\mathcal{S}}_{c_{n}}(V_{n}). It can be seen in Figure 2(c) that these values converge to c¯=1\bar{c}=1 that can be perceived as a sign of the stable training of the algorithm.

The trace of the parameters of the policy is shown in Figure 2(d). As these policy’s trainable parameters represent the upper and lower limits of the loose threshold function, the policy learning algorithm updates them in the directions that decrease their suppressing effect. This is what we also expect from the physics of the system. Graphical visualization of the policy update and RoA estimation sub-phase is shown in Figure 1(Right). Each row shows one phase of the algorithm. The policies are updated along the rows from top to bottom. Within one row, the policy is fixed and RoA is estimated from left to right (See Figure 7 in the appendix for a larger visualization).

In the second experiment, the threshold limits a=0.2a=-0.2 and b=0.2b=0.2 are kept fixed while the slopes ψ=(ma,mb)\psi=(m_{a},m_{b}) are trainable parameters. The rest of the training setting remains the same as the previous experiment. Figures 3(a) and 3(b) shows that the policy update sub-phase enlarges the RoA (green plot) of the system while the RoA estimation sub-phase (red plot) manages to follow the new RoA after each policy update. Our improved RoA estimation algorithm results in a more monotonic convergence of the estimated RoA that ultimately learns a controller that induces a larger RoA (24.86% vs 22.11%24.86\%\text{ vs }22.11\%). Similar to Figure 2(c), convergence of cnc_{n} values to c¯=1\bar{c}=1 can be seen in Figure 3(c). The trace of the upper and lower slopes are shown in Figure 3(d). Almost equal learned values for upper and lower slopes are expected due to the structural symmetry of the saturation function (Figure 4) that appears in the closed-loop system.

6 Related Work and Conclusions

We have proposed a two-player collaborative and iterative algorithm that iterates over two sub-phases that learn the Lyapunov function and use it to learn a controller to enlarge the RoA of the system.

The existing approaches that are close to the purpose of this paper are those that simultaneously synthesize a controller and maximize the stability region. Our work does not put any limit on the class of considered systems except the generic condition of hyperbolicity. For restricted classes such as polynomial systems, Sums-of-Squares (SOS) method leads to a bilinear optimization that is solved by some form of alternation (Jarvis-Wloszek et al., 2003; Majumdar et al., 2013). As a dual to Lyapunov-based methods, Majumdar et al. (2014) uses the notion of occupation measure to optimize a feedback controller for a polynomial system, but it has scalability issues due to its reliance on SDP optimization toolbox. Our work is different from this class of methods as our method is not limited to polynomial systems. Moreover, our method uses automatic differentiation that is naturally combined with neural networks to enjoy their superior scalability combined with SGD optimization.

Among data-driven approaches, Berkenkamp et al. (2017) use statistical models of the system to learn a controller with the assumption that the Lyapunov function is given. Our method is different as we learn the Lyapunov function and the controller together in an alternating fashion. Neural Lyapunov Control by Chang et al. (2019) is closer to our work while their approach is different from our method in multiple ways: They need to solve a costly global optimization problem for a component called falsifier to find the states on which the Lyapunov conditions are violated. We rather use the geometric properties of the level sets of the Lyapunov function to find the potentially unstable states that are chosen from a ring around the current stable sublevel set. In addition, Unlike Chang et al. (2019)’s method that needs to be done until the end to be usable on the system, the growing nature of our work allows the system be in action while the controller keeps improving.

In the context of reinforcement learning, our method can be seen as an actor-critic approach (Grondman et al., 2012; Bhasin et al., 2013; Lillicrap et al., 2015) where the actor tries to stabilize the system while the critic estimates the size of the RoA induced by the controller. The actor is the policy network and the critic is the network that implements the Lyapunov function.

In control theory, as the title of our work suggests, the proposed algorithm can be seen as an automatic version of the celebrated Lyapunov redesign method (Khalil and Grizzle, 2002; Hwang et al., 2013) where the Lyapunov function and the closed-loop system are re-designed together iteratively with the purpose of enlarging the stability region.

In this work, we assume the model of the system is given. This condition can be relaxed as suggested by Remark 3. Investigating this relaxation can be considered for the future. For example, learning a local model that adapts at each iteration could be one solution that adds another component to the algorithm and turns it into a three-player collaborative game.

Appendix A Control Lyapunov Function and Maximal Stabilizable Set

The use of the Lyapunov theory to guide designing the input of a system has been made precise with the introduction of control Lyapunov function (clf). A clf for a system of the form 𝐱k+1=f(𝐱k,𝐮k)\mathbf{x}_{k+1}=f(\mathbf{x}_{k},\mathbf{u}_{k}) is a C1C^{1}, radially unbounded function V:𝒳+V:\mathcal{X}\to\mathbb{R}_{+} if

V(𝟎)=0andV(𝐱)>0\displaystyle V(\mathbf{0})=0\quad\text{and}\quad V(\mathbf{x})>0\quad 𝐱𝒟\{𝟎}\displaystyle\forall\mathbf{x}\in\mathcal{D}\backslash\{\mathbf{0}\} (9)
inf𝐮U[V(𝐱)V(f(𝐱,𝐮))]0\displaystyle\inf_{\mathbf{u}\in U}[V(\mathbf{x})-V(f(\mathbf{x},\mathbf{u}))]\leq 0\quad 𝐱𝒟\{𝟎}\displaystyle\forall\mathbf{x}\in\mathcal{D}\backslash\{\mathbf{0}\} (10)

Just as the existence of a Lyapunov function is necessary and sufficient conditions for the stability of an autonomous system, the existence of a clf is a necessary and sufficient condition for stabilizability of a system with control input. In other words, the existence of clf guarantees the existence of a controller that stabilizes the system for all initial states within a neighborhood around the equilibrium point.

According to the definition of Lyapunov function in Section 2 and clf above, Lyapunov function assess the stability of a closed-loop system for a fixed controller while clf investigates the existence of a control signal that stabilizes the system in a domain 𝒟\mathcal{D}. In the definition of clf, no functional limitation is assumed for the control signal 𝐮k\mathbf{u}_{k}. In practice, 𝐮k\mathbf{u}_{k} is produced by a state-feedback controller via the policy function πΠ\pi\in\Pi. Moreover, due to the implementation constraints, only a subset Π~Π\tilde{\Pi}\subseteq\Pi of these functions can be realized. Therefore, it is quite likely that μ(π)<μ(𝒟)\mu(\mathcal{R}_{\pi^{*}})<\mu(\mathcal{D}) with μ\mu be the Lebesgue measure, i.e., the best feasible controller cannot expand the RoA of the system to the entire 𝒟\mathcal{D}. Let U(𝐱)U(\mathbf{x}) be the values that the control signal can take at state 𝐱\mathbf{x}. Then, we define

¯=sup𝒟such thatclf V on  and a πΠ~ materializes the RoA ¯\bar{\mathcal{R}}=\sup_{\mathcal{B}\subseteq\mathcal{D}}\mathcal{B}\quad\text{such that}\quad\exists\penalty\ \text{clf $V$ on $\mathcal{B}$ and a $\pi\in\tilde{\Pi}$ \text{materializes the RoA} $\bar{\mathcal{R}}$} (11)

where ¯\bar{\mathcal{R}} is the maximal stabilizable set as was used in Section 3.

Appendix B Proofs

In this section, a more detailed theoretical exposition of some of the material that is dropped from the main text due to space limitation is presented.

The following lemma shows that the derivative of a Lyapunov function vanishes at the equilibrium point. One can see the Lyapunov redesign method as an actor-critic algorithm where the Lyapunov function plays the role of the critic. As the learning signal for updating the actor (policy) passes through the derivative of the critic (Lyapunov function) due to the chain rule, the following lemma implies that getting closer to the equilibrium will weaken the information content of the signal for learning the policy.

Lemma 4.

Derivative of a Lyapunov function at the origin: Let 𝒳d\mathcal{X}\subseteq\mathbb{R}^{d} be a dd-dimensional vector space and V:𝒳V:\mathcal{X}\to\mathbb{R} be a continuous positive definite function, i.e., V(𝐱)>0V(\mathbf{x})>0 for 𝐱𝟎\mathbf{x}\neq\mathbf{0} and V(𝟎)=0V(\mathbf{0})=0. Then, 𝐱V(𝐱)|𝐱=𝟎=0\nabla_{\mathbf{x}}V(\mathbf{x})|_{\mathbf{x}=\mathbf{0}}=0.

Proof sketch.

We use the technique of proof by contradiction. Let 𝐠=[g1,g2,,gd]𝖳=𝐱V(𝐱)|x=𝟎0\mathbf{g}=[g_{1},g_{2},\ldots,g_{d}]^{\mkern-1.5mu\mathsf{T}}=\nabla_{\mathbf{x}}V(\mathbf{x})|_{x=\mathbf{0}}\neq 0. Suppose there exists an index i{1,2,,d}i\in\{1,2,\ldots,d\} such that gi0g_{i}\neq 0. Due to the continuity of VV, we expand V(𝐱)V(\mathbf{x}) at 𝐱=𝟎\mathbf{x}=\mathbf{0} in the direction of gig_{i} as

V(0,,xi=c,,0)=V(𝟎)+cV(𝐱)xi|𝐱=𝟎+o(xi)V(0,\ldots,x_{i}=c,\ldots,0)=V(\mathbf{0})+c\frac{\partial V(\mathbf{x})}{\partial x_{i}}|_{\mathbf{x}=\mathbf{0}}+o(x_{i})

for an arbitrary value of cc close to 00. Since cc is arbitrary, we choose c=ϵV(𝐱)xi|𝐱=𝟎=ϵgic=-\epsilon\frac{\partial V(\mathbf{x})}{\partial x_{i}}|_{\mathbf{x}=\mathbf{0}}=-\epsilon g_{i}. As we assumed V(𝟎)=0V(\mathbf{0})=0, for ϵ\epsilon sufficiently close to 00, we can write

V(0,,xi=c,,0)=ϵgi2<0forgi0V(0,\ldots,x_{i}=c,\ldots,0)=-\epsilon g_{i}^{2}<0\;\;\text{for}\;\;g_{i}\neq 0\

which is in contrast with the positive definiteness of VV. Therefore, gig_{i} cannot be nonzero. As ii is chosen arbitrarily from {1,2,,d}\{1,2,\ldots,d\}, the derivative of VV with respect to any of its arguments is zero at the origin, meaning that, 𝐱V(𝐱)|𝐱=𝟎=0\nabla_{\mathbf{x}}V(\mathbf{x})|_{\mathbf{x}=\mathbf{0}}=0. ∎

Each iteration of the RoA estimation algorithm expands the level set of the estimated Lyapunov function to sample from the gap 𝒢=Sαc(V)\Sc(V)\mathcal{G}=S_{\alpha c}(V)\backslash S_{c}(V) surrounding the current estimate of the RoA for a α>1\alpha>1. Both too small and too large gaps are harmful to the stability of the growing RoA estimation algorithm. A too small gap results in too few samples and prolongs the number of growth phases. Moreover, if the gap is too small, it is more likely that all initial states taken from the gap either converges to the equilibrium or diverges. Therefore, the dataset for the optimization problem 5 will be highly skewed that slows down the learning process even further. A too large gap is also harmful as it may advance far beyond the true RoA of the system and many sampled initial states can diverge to unknown and potentially dangerous regions of the state space. As a result, investigating the growth rate of the gap 𝒢\mathcal{G} as a function of the properties of VV is desirable to regularize or prevent harmful sampling behaviors. The following theorem sheds light on this matter.

Theorem 5.

Growth rate of sublevel sets: Assume V:𝒳V:\mathcal{X}\to\mathbb{R} is a positive definite Lipschitz continuous function on 𝒳d\mathcal{X}\subseteq\mathbb{R}^{d}. Let 𝒮c(V)={𝐱𝒳:V(𝐱)c}{\mathcal{S}}_{c}(V)=\{\mathbf{x}\in\mathcal{X}:V(\mathbf{x})\leq c\} be the region enclosed by the level set 𝒮c(V)={𝐱𝒳:V(𝐱)=c}\partial{\mathcal{S}}_{c}(V)=\{\mathbf{x}\in\mathcal{X}:V(\mathbf{x})=c\} at the level value cc. If G𝐱V(𝐱)G\leq\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert for G>0G\in\mathbb{R}^{>0} and 𝐱𝒮c(V)\mathbf{x}\in{\mathcal{S}}_{c}(V), then μ(𝒮c(V))\cG1\partial\mu({\mathcal{S}}_{c}(V))\backslash\partial c\propto G^{-1}.

Proof sketch.

Let 𝐳=z𝐱V(𝐱)/𝐱V(𝐱)\mathbf{z}=z\nabla_{\mathbf{x}}V(\mathbf{x})/\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert be a tiny perturbation in the direction of the normal to the level set. VV is expanded around 𝐱𝒮c(V)\mathbf{x}\in\partial{\mathcal{S}}_{c}(V) as

V(𝐱+𝐳)\displaystyle V(\mathbf{x}+\mathbf{z}) =V(𝐱)+𝐱V(𝐱)𝖳𝐳+O(z2)\displaystyle=V(\mathbf{x})+\nabla_{\mathbf{x}}V(\mathbf{x})^{\mkern-1.5mu\mathsf{T}}\mathbf{z}+O(z^{2})
=V(𝐱)+z𝐱V(𝐱)+O(z2)\displaystyle=V(\mathbf{x})+z\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert+O(z^{2})

where O(z2)O(z^{2}) can be ignored for sufficiently small z=𝐳z=\lVert\mathbf{z}\rVert. For α>1\alpha\in\mathbb{R}^{>1} and sufficiently close to 11,

𝒮αc(V)\displaystyle{\mathcal{S}}_{\alpha c}(V) ={𝐱+𝐳:𝐱𝒮c(V)andV(𝐱)+𝐱V(𝐱)𝖳𝐳αc}\displaystyle=\{\mathbf{x}+\mathbf{z}:\mathbf{x}\in\partial{\mathcal{S}}_{c}(V)\;\text{and}\;V(\mathbf{x})+\nabla_{\mathbf{x}}V(\mathbf{x})^{\mkern-1.5mu\mathsf{T}}\mathbf{z}\leq\alpha c\}
={𝐱+𝐳:𝐱𝒮c(V)andz𝐱V(𝐱)(α1)c}.\displaystyle=\{\mathbf{x}+\mathbf{z}:\mathbf{x}\in\partial{\mathcal{S}}_{c}(V)\;\text{and}\;z\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert\leq(\alpha-1)c\}.

As GG is assumed to be a lower bound of 𝐱V(𝐱)\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert, z𝐱V(𝐱)(α1)cz\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert\leq(\alpha-1)c implies zc(α1)𝐱V(𝐱)1c(α1)G1z\leq c(\alpha-1)\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert^{-1}\leq c(\alpha-1)G^{-1}.

Notice that 𝒮c(V)\partial{\mathcal{S}}_{c}(V) is a (d1)(d-1)-dimensional surface that encloses 𝒮c(V){\mathcal{S}}_{c}(V) an dd-dimensional volume that are both embedded in a dd-dimensional embedding space 𝒳\mathcal{X}. We are interested in the volume of 𝒢:=𝒮αc(V)\𝒮c(V)\mathcal{G}:={\mathcal{S}}_{\alpha c}(V)\backslash{\mathcal{S}}_{c}(V). Assume d𝝎\operatorname{d}\!{{\bm{\omega}}} is the differential form for 𝒢\mathcal{G}. We can write d𝝎=d𝐬𝐳=zd𝐬\operatorname{d}\!{{\bm{\omega}}}=\operatorname{d}\!{\mathbf{s}}\lVert\mathbf{z}\rVert=z\operatorname{d}\!{\mathbf{s}} where d𝐬\operatorname{d}\!{\mathbf{s}} is the surface differential form for 𝒮c(V)\partial{\mathcal{S}}_{c}(V). Hence,

μ(𝒢)=dμ(𝒮c(V))=𝒢d𝝎=𝒮c(V)zd𝐬c(α1)G1𝒮c(V)d𝐬.\mu(\mathcal{G})=\operatorname{d}\!{\mu}({\mathcal{S}}_{c}(V))=\int_{\mathcal{G}}\operatorname{d}\!{{\bm{\omega}}}=\int_{\partial{\mathcal{S}}_{c}(V)}z\operatorname{d}\!{\mathbf{s}}\leq c(\alpha-1)G^{-1}\int_{\partial{\mathcal{S}}_{c}(V)}\operatorname{d}\!{\mathbf{s}}. (12)

where 𝒮c(V)d𝐬\int_{\partial{\mathcal{S}}_{c}(V)}\operatorname{d}\!{\mathbf{s}} does not depend on α\alpha or GG. Hence, by pushing α0\alpha\to 0, μ(𝒮c(V))\α=cμ(𝒮c(V))G1G1\partial\mu({\mathcal{S}}_{c}(V))\backslash\partial\alpha=c\mu(\partial{\mathcal{S}}_{c}(V))G^{-1}\propto G^{-1} that completes the proof. ∎

As a result of this theorem, in some applications, one may need to control 𝐱V(𝐱)\lVert\nabla_{\mathbf{x}}V(\mathbf{x})\rVert for 𝐱𝒮c(V)\mathbf{x}\in\partial{\mathcal{S}}_{c}(V) to prevent sampling from a too large or too small gap.

Appendix C Theoretical Motivation of [V(𝐱)Vπn1(fπ(𝐱))]2[V(\mathbf{x})-V_{\pi_{n-1}}(f_{\pi}(\mathbf{x}))]^{2} in Equation 5

In this section we discuss the theory behind the term [V(𝐱)Vπn1(fπ(𝐱))]2[V(\mathbf{x})-V_{\pi_{n-1}}(f_{\pi}(\mathbf{x}))]^{2} in Equation 5 that we added as an improvement to (Richards et al., 2018) to facilitate learning the RoA. The objective function for the RoA estimation sub-phase is restated here:

(V)=𝐱𝕏IN[V(𝐱)c¯]𝐱𝕏OUT[V(𝐱)c¯]+λRoA𝐱𝕏INΔV(𝐱)+λmonot𝐱𝕏IN[V(𝐱)Vπn1(fπn1(𝐱))]2.\mathcal{L}(V)=\sum_{\mathbf{x}\in\mathbb{X}^{\text{IN}}}[V(\mathbf{x})-\bar{c}]-\sum_{\mathbf{x}\in\mathbb{X}^{\text{OUT}}}[V(\mathbf{x})-\bar{c}]+\lambda_{\text{RoA}}\sum_{\mathbf{x}\in\mathbb{X}^{\text{IN}}}\Delta V(\mathbf{x})+\lambda_{\text{monot}}\sum_{\mathbf{x}\in\mathbb{X}^{\text{IN}}}[V(\mathbf{x})-V_{\pi_{n-1}}(f_{\pi_{n-1}}(\mathbf{x}))]^{2}.

The first two terms construct a classifier objective. The third term is added to conform with the Lyapunov decrease conditions. Here, we focus on the last term, i.e., [V(𝐱)Vπn1(fπ(𝐱))]2[V(\mathbf{x})-V_{\pi_{n-1}}(f_{\pi}(\mathbf{x}))]^{2}. The motivation behind adding this term comes from the constructive method proposed by Chiang and Thorp (1989).

The idea of the constructive methodology of Chiang and Thorp (1989) is to construct a sequence of functions V0,V1,V_{0},V_{1},\ldots for the autonomous dynamical system 𝐱k+1=f(𝐱k)\mathbf{x}_{k+1}=f(\mathbf{x}_{k}) in order to use the level sets of the accumulating function of this sequence for estimating the RoA of the vector field ff. The theory is developed for a class of functions more general than Lyapunov functions that are called energy-like functions. An energy-like function decreases over the trajectories of the system (see Chiang and Alberto (2015) for a precise definition). Given an energy-like function V0V_{0} for the vector field ff, the following sequence of functions is constructed

V1(𝐱)\displaystyle V_{1}(\mathbf{x}) =V0(𝐱+ϵ1f(𝐱))\displaystyle=V_{0}(\mathbf{x}+\epsilon_{1}f(\mathbf{x})) (13)
V2(𝐱)\displaystyle V_{2}(\mathbf{x}) =V1(𝐱+ϵ2f(𝐱))\displaystyle=V_{1}(\mathbf{x}+\epsilon_{2}f(\mathbf{x}))
\displaystyle\ldots
Vn(𝐱)\displaystyle V_{n}(\mathbf{x}) =Vn1(𝐱+ϵnf(𝐱))\displaystyle=V_{n-1}(\mathbf{x}+\epsilon_{n}f(\mathbf{x}))

where di,i=1,2,,nd_{i},i=1,2,\cdots,n are positive numbers. Two facts about this sequence must be proved: 1) All functions produced in this sequence are energy-liked functions. 2) For a fixed positive cc, Sc(Vi)Sc(Vi+1)S_{c}(V_{i})\subset S_{c}(V_{i+1}). The following two theorems guarantee these points.

Theorem 6 (Energy-like functions, lemma 4.24.2 in Chiang and Thorp (1989)).

Let V:dV:\mathbb{R}^{d}\to\mathbb{R} be an energy-like function for the nonlinear autonomous system 𝐱k+1=f(𝐱k)\mathbf{x}_{k+1}=f(\mathbf{x}_{k}) with the equilibrium point 𝐱¯=𝟎\bar{\mathbf{x}}=\mathbf{0}. Let 𝒟\mathcal{D} be a compact set around 𝐱¯\bar{\mathbf{x}} that contains no other equilibrium points. Then, there exists an ϵ~>0\tilde{\epsilon}>0 such that for ϵ<ϵ^\epsilon<\hat{\epsilon}, the function V1=V(𝐱+ϵf(𝐱))V_{1}=V(\mathbf{x}+\epsilon f(\mathbf{x})) is also an energy-like function on the compact set 𝒟\mathcal{D} for the vector field ff.

This theorem guarantees that all functions in the constructive process 13 are energy-like functions.

Theorem 7 (Monotonic sublevel sets, lemma 4.14.1 in Chiang and Thorp (1989)).

Let V:dV:\mathbb{R}^{d}\to\mathbb{R} be an energy-like function for the nonlinear autonomous system 𝐱k+1=f(𝐱k)\mathbf{x}_{k+1}=f(\mathbf{x}_{k}) with the equilibrium point x¯=𝟎\bar{x}=\mathbf{0}. Let 𝒟\mathcal{D} be a compact set around 𝐱¯\bar{\mathbf{x}} that contains no other equilibrium points. Assume the set Sc(V):={𝐱:V(𝐱)c and 𝐱𝒟}S_{c}(V):=\{\mathbf{x}:V(\mathbf{x})\leq c\text{ and }\mathbf{x}\in\mathcal{D}\} is non-empty for some constant cc. Then there exists an ϵ~>0\tilde{\epsilon}>0 such that for the set characterized by Sc(V1):={𝐱:V1(𝐱)c and 𝐱𝒟}S_{c}(V_{1}):=\{\mathbf{x}:V_{1}(\mathbf{x})\leq c\text{ and }\mathbf{x}\in\mathcal{D}\} where V1(𝐱)=V(𝐱+ϵf(𝐱))V_{1}(\mathbf{x})=V(\mathbf{x}+\epsilon f(\mathbf{x})) and ϵ<ϵ~\epsilon<\tilde{\epsilon}, the following holds

Sc(V)Sc(V1).S_{c}(V)\subset S_{c}(V_{1}). (14)

This theorem guarantees that the sequence built by the constructive process 13 gives a monotonically increasing sequence of sublevel sets.

Now, we get back to the addded term to the objective function, i.e., [V(𝐱)Vπn1(fπn1(𝐱))]2[V(\mathbf{x})-V_{\pi_{n-1}}(f_{\pi_{n-1}}(\mathbf{x}))]^{2}. Notice that Vπn1()V_{\pi_{n-1}}(\cdot) is fixed and the minimization is performed with respect to V()V(\cdot). Hence, minimizing the above term at each phase of the algorithm emulates the above constructive process and encourages the learned Lyapunov functions to be monotonic in the sense that their sublevel sets 𝒮c(Vn){\mathcal{S}}_{c}(V_{n}) tend to become a monotonically increasing sequence that covers more and more space of the true RoA.

Appendix D Algorithms

The proposed algorithms in this work are verbally described in Section 4.2. To facilitate implementation, the detailed pseudo-code of the algorithms come here. The RoA estimation sub-phase is realized as Algorithm 1 and the policy update sub-phase is realized as Algorithm 2. \RestyleAlgoboxed

Algorithm 1 RoA estimation: Learn πn\mathcal{R}_{\pi_{n}} from (πn1,fπn)(\mathcal{R}_{\pi_{n-1}},f_{\pi_{n}})
\SetKwInOut

Inputinput\SetKwInOutOutputoutput \Input(Vπn1,cn1)(V_{\pi_{n-1}},c_{n-1}): The Lyapunov function and level value of phase nn where | πn1=𝒮cn1(Vπn1)\mathcal{R}_{\pi_{n-1}}={\mathcal{S}}_{c_{n-1}}(V_{\pi_{n-1}}) | fπnf_{\pi_{n}}: Closed-loop system vector field | γr>1\gamma_{r}>1: Level value multiplicative factor | NN\in\mathbb{N}: Number of sampled states | MM\in\mathbb{N}: Number of phases | 0βr10\leq\beta_{r}\leq 1: Mixture parameter | LrL_{r}\in\mathbb{N}: Trajectory length | 𝒟\mathcal{D}: Domain | λRoA\lambda_{\rm RoA}: Negative definiteness weighting factor | λmonot\lambda_{\rm monot}: Monotonicity weighting factor

\Output

(Vπn,cn)(V_{\pi_{n}},c_{n}) Init V^\hat{V} to Vπn1V_{\pi_{n-1}} and c^\hat{c} to cn1c_{n-1}
Init the sampling distribution prp_{r} to U(𝒟)U(\mathcal{D}), i.e., uniform distribution over the domain 𝒟\mathcal{D}
\Form=1,,Mm=1,\ldots,M 𝒢𝒮γrc^(V^)\𝒮c^(V^)\mathcal{G}\leftarrow{\mathcal{S}}_{\gamma_{r}\hat{c}}(\hat{V})\backslash{\mathcal{S}}_{\hat{c}}(\hat{V})
prβrU(𝒢)+(1βr)U(𝒟)p_{r}\leftarrow\beta_{r}U(\mathcal{G})+(1-\beta_{r})U(\mathcal{D})
𝕏0\mathbb{X}_{0}\leftarrow Generate NN samples from prp_{r}
𝕏Lr\mathbb{X}_{L_{r}}\leftarrow Run fπnf_{\pi_{n}} on 𝕏0\mathbb{X}_{0} for LrL_{r} steps
𝕏0IN{(𝐱,1):𝐱𝕏0,Φ(𝐱,Lr)𝒮c^(V^)}\mathbb{X}_{0}^{\text{IN}}\leftarrow\{(\mathbf{x},1):\mathbf{x}\in\mathbb{X}_{0},\Phi(\mathbf{x},L_{r})\in{\mathcal{S}}_{\hat{c}}(\hat{V})\}
𝕏0OUT{(𝐱,0):𝐱𝕏0,Φ(𝐱,Lr)𝒮c^(V^)}\mathbb{X}_{0}^{\text{OUT}}\leftarrow\{(\mathbf{x},0):\mathbf{x}\in\mathbb{X}_{0},\Phi(\mathbf{x},L_{r})\notin{\mathcal{S}}_{\hat{c}}(\hat{V})\}
VV^{*}\leftarrow Optimize for VV in the objective function 5 using the dataset {𝕏0IN,𝕏0OUT}\{\mathbb{X}_{0}^{\text{IN}},\mathbb{X}_{0}^{\text{OUT}}\}
c^argmaxc{c:Δfπn1(𝐱)<0for𝐱𝒮c(V)}\hat{c}\leftarrow\mathop{\mathrm{argmax}}_{c}\{c\in\mathbb{R}:\Delta f_{\pi_{n-1}}(\mathbf{x})<0\;{\rm for}\;\mathbf{x}\in{\mathcal{S}}_{c}(V^{*})\}
V^V\hat{V}\leftarrow V^{*} (Vπn,cn)(V^,c^)(V_{\pi_{n}},c_{n})\leftarrow(\hat{V},\hat{c})

Algorithm 2 Policy update: Learn πn+1\pi_{n+1} from (πn,fπn)(\mathcal{R}_{\pi_{n}},f_{\pi_{n}})
\SetKwInOut

Inputinput\SetKwInOutOutputoutput \Input(Vπn,cn)(V_{\pi_{n}},c_{n}): The Lyapunov function and level value of phase nn where πn=𝒮cn(Vπn)\mathcal{R}_{\pi_{n}}={\mathcal{S}}_{c_{n}}(V_{\pi_{n}}) | Closed-loop system vector field fπnf_{\pi_{n}} | γp>1\gamma_{p}>1: Level value multiplicative factor | NN\in\mathbb{N}: Number of sampled states | 0βp10\leq\beta_{p}\leq 1: Mixture parameter | LpL_{p}\in\mathbb{N}: Trajectory length | λu\lambda_{u}: Unstable states weighting factor \Outputπn+1\pi_{n+1} Init sampling distribution ppp_{p} to U(𝒮cn(Vπn))U({\mathcal{S}}_{c_{n}}(V_{\pi_{n}})), i.e., uniform distribution over 𝒮cn(Vπn){\mathcal{S}}_{c_{n}}(V_{\pi_{n}})
𝒢𝒮γpcn(Vπn)\𝒮cn(Vπn)\mathcal{G}\leftarrow{\mathcal{S}}_{\gamma_{p}c_{n}}(V_{\pi_{n}})\backslash{\mathcal{S}}_{c_{n}}(V_{\pi_{n}})
ppβpU(𝒢)+(1βp)U(𝒮cn(Vπn))p_{p}\leftarrow\beta_{p}U(\mathcal{G})+(1-\beta_{p})U({\mathcal{S}}_{c_{n}}(V_{\pi_{n}}))
𝕏0\mathbb{X}_{0}\leftarrow Generate NN samples from ppp_{p}
πn+1\pi_{n+1}\leftarrow Optimize for π\pi in the objective function 6 using the dataset {𝕏0}\{\mathbb{X}_{0}\}

Appendix E Model-Based Assumption

The model of the system is used to produce the trajectories of the system which is needed in evaluating both objective functions in 6 and 5. However, the information needed to compute 5 can also be obtained by experimentation with the physical system without requiring the dynamics function of the system. In the following, we show that the knowledge of the model of the system can be relaxed in both sub-phases of the algorithm.

E.1 RoA Estimation Sub-Phase

As can be seen in Equation 5 and Algorithm 1, in this sub-phase, the model is used to produce trajectories starting from the sampled initial states from the gap around the current estimate of the RoA or from withing the RoA. In both cases, as also suggested by Richards et al. (2018), instead of the model, the real system can be used to produce the trajectories. Assume γr\gamma_{r} in Algorithm 1 satisfies the conditions of Theorem 5 of the Appendix. Therefore, the gap from which the initial states are sampled is not too large and a hyperbolic physical system does not exhibit a drastically different and potentially dangerous behavior when it is launched from initial states sampled from this surrounding gap. Hence, in an approach similar to active learning, the real system can be used to produce the trajectories and label them based on whether they enter the current target level set of the estimated Lyapunov function or not. In conclusion, in this sub-phase, there will be no need to know the model of the system or estimate it.

E.2 Policy Update Sub-Phase

The model requirement is a bit different in this sub-phase compared with the RoA estimation sub-phase. As we need to update the policy, information on the way the behavior of the system changes with respect to a change in the policy is required. However, looking at 6, it is observed that the behavior of the system influences the objective function only via the Lyapunov function V(Φ(𝐱,Lp))V(\Phi(\mathbf{x},L_{p})). Suppose the policy is parameterized as π(𝐱,ϕ)\pi(\mathbf{x};\phi). Then, the closed-loop system becomes 𝐱k+1=f(𝐱k,π(𝐱k))\mathbf{x}_{k+1}=f(\mathbf{x}_{k},\pi(\mathbf{x}_{k})). The required gradient to update the policy parameters contains the term V(𝐱k)/ψ\partial V(\mathbf{x}_{k})/\partial\psi where the information of ψ\psi is encoded in 𝐱k=Φ(𝐱0,k)\mathbf{x}_{k}=\Phi(\mathbf{x}_{0},k). The derivative decomposes as

V(𝐱k)ψ=V(𝐱k)𝐱k𝐱kψ.\frac{\partial V(\mathbf{x}_{k})}{\partial\psi}=\frac{\partial V(\mathbf{x}_{k})}{\partial\mathbf{x}_{k}}\frac{\partial\mathbf{x}_{k}}{\partial\psi}. (15)

where the knowledge of the model is required to compute 𝐱k/ψ\partial\mathbf{x}_{k}/\partial\psi that will be a matrix of size dim(𝒳)×dim(ψ)\dim(\mathcal{X})\times\dim(\psi). When the model is not given, one must instead try to estimate the model of the system f^:dd\hat{f}:\mathbb{R}^{d}\to\mathbb{R}^{d}. However, this vector-valued function is difficult to estimate unless in very limited cases. Instead, one can try to directly estimate VV rather than ff as a function of ψ\psi. As VV is a scalar-valued function, it takes fewer trajectories to obtain a decent estimate of V/ψ\partial V/\partial\psi. Hence, even though the model of the system is needed for this sub-phase, there are two factors that relaxes this requirement: 1) As the trajectories are integrated forward only for LpL_{p} steps in Algorithm 2, a local estimation would be sufficient. 2) Even in the local estimatation regime, one does not need to estimate the nonlinear vector field as an d\mathbb{R}^{d} to d\mathbb{R}^{d} function. What matters is how the vector field looks like through the lens of the Lyapunov function that is a scalar-valued function. Hence, an dd\mathbb{R}^{d}\to\mathbb{R}^{d} estimation problem can be replaced by an d\mathbb{R}^{d}\to\mathbb{R} estimation problem.

Appendix F Weak Learning Signal

In this section, we take a closer look at the occasions that the learning signal for the policy update sub-phase of the algorithm (Section 4.2) is weak. We discuss the problem for a general setting and show that the setting of this paper is a special case.

Problem Statement.

Assume the discrete-time time-invariant non-autonomous dynamical system 𝐱k+1=f(𝐱k,𝐮k)\mathbf{x}_{k+1}=f(\mathbf{x}_{k},\mathbf{u}_{k}). The goal is to design 𝐮k\mathbf{u}_{k} for 0kT0\leq k\leq T such that 𝐱k\mathbf{x}_{k} meets some specified conditions for 0kT0\leq k\leq T. In the Lyapunov stability analysis, these conditions are assessed by a function V:𝒳0V:\mathcal{X}\to\mathbb{R}^{\geq 0}, i.e., after rolling out the starting state 𝐱0\mathbf{x}_{0} for TT steps by the dynamics ff controlled by 𝐮k\mathbf{u}_{k}, V(𝐱T)𝒮V(\mathbf{x}_{-T})\in{\mathcal{S}} where 𝒮{\mathcal{S}} encapsulates the desired conditions for the trajectory 𝐱T=(𝐱0,𝐱1,,𝐱T)\mathbf{x}_{-T}=(\mathbf{x}_{0},\mathbf{x}_{1},\ldots,\mathbf{x}_{T}) of the system. Assume the deviation of V(𝐱T)V(\mathbf{x}_{-T}) from its desired set 𝒮{\mathcal{S}} is measured by a deviation metric (V(𝐱T),𝒮)\mathcal{L}(V(\mathbf{x}_{-T}),{\mathcal{S}}). In many control tasks such as tracking, the entire trajectory matters, and \mathcal{L} will be a function of every state in the trajectory. However, in control tasks such as reaching, only the final state 𝐱T\mathbf{x}_{T} matters; consequently the objective function \mathcal{L} only depends on 𝐱T\mathbf{x}_{T}. Stability, in the presence of a Lyapunov function, can be seen as an example of the second class of tasks where the relative position of 𝐱T\mathbf{x}_{T} compared to the level sets of the Lyapunov function is sufficient to decide the convergence of that trajectory. In practice, the control signal 𝐮k\mathbf{u}_{k} is produced as a parametric function, i.e. 𝐮k=π(𝐱k,ψ)\mathbf{u}_{k}=\pi(\mathbf{x}_{k};\psi). Therefore, the entire trajectory 𝐱T(ψ)\mathbf{x}_{-T}(\psi) is now parameterised by ψ\psi and so is the loss function (ψ)\mathcal{L}(\psi). The class of algorithms known as policy gradient uses (ψ)/ψ\partial\mathcal{L}(\psi)/\partial\psi to learn the controller π(,ψ)\pi(\cdot;\psi). In this section, we study the condition of this gradient and show under which circumstances it vanishes and results in slow convergence.

In a general case where VV in (V(𝐱T),𝒮)\mathcal{L}(V(\mathbf{x}_{-T}),{\mathcal{S}}) is a function of the entire trajectory 𝐱T\mathbf{x}_{-T}, the gradient w.r.t. the controller parameters is written as:

ψ\displaystyle\frac{\partial\mathcal{L}}{\partial\psi} =1pTpψ\displaystyle=\sum_{1\leq p\leq T}\frac{\partial\mathcal{L}_{p}}{\partial\psi} (16)
kψ\displaystyle\frac{\partial\mathcal{L}_{k}}{\partial\psi} =1pk(𝐱k𝐱k𝐱p+𝐱kψ)\displaystyle=\sum_{1\leq p\leq k}\left(\frac{\partial\mathcal{L}}{\partial\mathbf{x}_{k}}\frac{\partial\mathbf{x}_{k}}{\partial\mathbf{x}_{p}}\frac{\partial^{+}\mathbf{x}_{k}}{\partial\psi}\right) (17)
𝐱k𝐱p\displaystyle\frac{\partial\mathbf{x}_{k}}{\partial\mathbf{x}_{p}} =p<ik𝐱i𝐱i1=p<ik(f𝐱|𝐱=𝐱i1+f𝐮|𝐮=π(𝐱i1)π(𝐱)𝐱|𝐱=𝐱i1)\displaystyle=\prod_{p<i\leq k}\frac{\partial\mathbf{x}_{i}}{\partial\mathbf{x}_{i-1}}=\prod_{p<i\leq k}\left(\frac{\partial f}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{i-1}}+\frac{\partial f}{\partial\mathbf{u}}|_{\mathbf{u}=\pi(\mathbf{x}_{i-1})}\frac{\partial\pi(\mathbf{x})}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{i-1}}\right) (18)

The gradients are derived as sum-of-products and +𝐱kψ\frac{\partial^{+}\mathbf{x}_{k}}{\partial\psi} refers to the immediate partial derivate of state 𝐱k\mathbf{x}_{k} with respect to ψ\psi when 𝐱k1\mathbf{x}_{k-1} is considered as a constant.

In the special case where VV is the Lyapunov function in (V(𝐱T),𝒮)\mathcal{L}(V(\mathbf{x}_{-T}),{\mathcal{S}}) and the concern is the stability of the system, V(𝐱T)=V(𝐱T)V(\mathbf{x}_{-T})=V(\mathbf{x}_{T}), meaning that the sum on the r.h.s of 16 will only have one term T/ψ\partial\mathcal{L}_{T}/\partial\psi and 17 will transform to

Tψ=𝐱T1kT(𝐱T𝐱k+𝐱kψ).\frac{\partial\mathcal{L}_{T}}{\partial\psi}=\frac{\partial\mathcal{L}}{\partial\mathbf{x}_{T}}\sum_{1\leq k\leq T}\left(\frac{\partial\mathbf{x}_{T}}{\partial\mathbf{x}_{k}}\frac{\partial^{+}\mathbf{x}_{k}}{\partial\psi}\right). (19)

In the following, we analyse the role of each term that contributes to this gradient.

F.1 The Component 𝐱T\frac{\partial\mathcal{L}}{\partial\mathbf{x}_{T}}

This term concerns the differential condition of (𝐱)=(V(𝐱),𝒮)\mathcal{L}(\mathbf{x})=\mathcal{L}(V(\mathbf{x}),{\mathcal{S}}) at 𝐱=𝐱T\mathbf{x}=\mathbf{x}_{T} as

(𝐱)𝐱|𝐱=𝐱T=(V)V|V=V(𝐱T)V(𝐱)𝐱|𝐱=𝐱T\frac{\partial\mathcal{L}(\mathbf{x})}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{T}}=\frac{\partial\mathcal{L}(V)}{\partial V}|_{V=V(\mathbf{x}_{T})}\frac{\partial V(\mathbf{x})}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{T}} (20)

If any of these terms gets too smalll, the overall gradient gets small too resulting in a vanishing gradient issue. To avoid this, the algorithm must ensure that these terms remain sufficiently large. For the first term (V)/V\partial\mathcal{L}(V)/\partial V, this condition is normally fulfilled if the deviation metric (,)\mathcal{L}(\cdot,\cdot) is designed properly. For example, one cadidate function for \mathcal{L} would be a signed distance function that measures how far 𝐱T\mathbf{x}_{T} is from the maximal stable sublevel set Scmax(V)\partial S_{c_{\mathrm{max}}}(V), e.g., (V(𝐱T),Scmax(V))=V(𝐱T)cmax\mathcal{L}(V(\mathbf{x}_{T}),S_{c_{\mathrm{max}}}(V))=V(\mathbf{x}_{T})-c_{\mathrm{max}}. Another candidate deviation metric could be (V(𝐱T),Scmax(V))=max((V(𝐱T)cmax),0)\mathcal{L}(V(\mathbf{x}_{T}),S_{c_{\mathrm{max}}}(V))=\max((V(\mathbf{x}_{T})-c_{\mathrm{max}}),0) that does not care about the actual value of V(𝐱T)V(\mathbf{x}_{T}) as long as 𝐱T\mathbf{x}_{T} lives within the sublevel set Scmax(V)S_{c_{\mathrm{max}}}(V). For the former case, /V=V\partial\mathcal{L}/\partial V=V meaning that the gradient does not vanish as long as 𝐱T𝐱¯\mathbf{x}_{T}\neq\bar{\mathbf{x}}.

The second term of the r.h.s of 20 depends on the slope of the function VV evaluated at the final state of the trajectory. If VV is a candidate Lyapunov function, 𝐱V(𝐱)\nabla_{\mathbf{x}}V(\mathbf{x}) vanishes at the equilibrium as we proved in Lemma 4. Therefore, if 𝐱T\mathbf{x}_{T} is too close to the equilibrium (i.e., the system converges), the learning signal to update the policy will vanish. This point is formalized in the following remark.

Remark 8.

Consider the closed-loop system 𝐱k+1=f(𝐱k,π(𝐱k))\mathbf{x}_{k+1}=f(\mathbf{x}_{k},\pi(\mathbf{x}_{k})). Let 𝐱0\mathbf{x}_{0} be the initial state of a trajectory that starts from within the RoA of the equilibrium point 𝐱¯\bar{\mathbf{x}} of the closed-loop system denoted by π𝐱¯\mathcal{R}^{\bar{\mathbf{x}}}_{\pi}. Let VV be the Lyapunov function and the objective function (Vπ(𝐱T),𝒮)\mathcal{L}(V_{\pi}(\mathbf{x}_{-T}),{\mathcal{S}}) is optimized to update the policy π\pi. One must be careful not to let the trajectories roll out for too long (T1T\gg 1). As 𝐱T\mathbf{x}_{T} gets too close to the equilibrium, the information of the trajectory degenerates (see Theorem 9) and the gradient to update the controller vanishes (see Lemma 4). On the other hand, If 𝐱0\mathbf{x}_{0} does not belong to the RoA of 𝐱¯\bar{\mathbf{x}}, it can go too far from π𝐱¯\mathcal{R}^{\bar{\mathbf{x}}}_{\pi} and may escape the validity domain of the Lyapunov function VV. Hence, in either case, the length TT of the trajectory influences the information content of the trajectory for updating the policy. Both too large and too small values of TT must be avoided when the trajectories pass through the Lyapunov function and the Lyapunov function acts as a critic in the algorithm for learning the policy. Too small values of TT are non-informative due to the continuity of VV. Too large values of TT, on the other hand, is non-informative as the trajectory enters the flat regions of VV or escape the domain of validity of VV.

Theorem 9.

Consider the dynamical system 𝐱k+1=f(𝐱k,𝐮k)\mathbf{x}_{k+1}=f(\mathbf{x}_{k},\mathbf{u}_{k}) where the control signal is issued by the policy function 𝐮k=π(𝐱k,ψ)\mathbf{u}_{k}=\pi(\mathbf{x}_{k};\psi) that is parameterised by ψ\psi. Let 𝐱¯=𝟎\bar{\mathbf{x}}=\mathbf{0} be an asymptotic equilibrium point of this system. If 𝐱0π𝟎\mathbf{x}_{0}\in\mathcal{R}_{\pi}^{\mathbf{0}} and V:𝒳0V:\mathcal{X}\to\mathbb{R}^{0\geq} is a CrC^{r} Lyapunov function with r1r\geq 1, then

ϵ>0,T>0such thatV(𝐱)ψ|𝐱=𝐱T<ϵ\forall\epsilon>0,\exists T>0\;\;\text{such that}\;\;\lVert\frac{\partial V(\mathbf{x})}{\partial\psi}|_{\mathbf{x}=\mathbf{x}_{T}}\rVert<\epsilon (21)
Proof sketch.

It can be seen in 19 that 𝐱V\nabla_{\mathbf{x}}V appears multiplicatively in ψV\nabla_{\psi}V. As stated in Lemma 4, 𝐱V(𝐱)=0\nabla_{\mathbf{x}}V(\mathbf{x})=0 at 𝐱¯=𝟎\bar{\mathbf{x}}=\mathbf{0} that makes ψV\nabla_{\psi}V vanish as well at the equilibrium point. Now suppose VCr(r1)V\in C^{r}(r\geq 1) with respect to both its arguments 𝐱\mathbf{x} and 𝐮\mathbf{u}. Moreover, π(,ψ)\pi(\cdot,\psi) is assumed to be smooth with respect to its parameters ψ\psi. Therefore, the map ψψV\psi\to\nabla_{\psi}V is continuous. Furthermore, 𝐱k𝟎\mathbf{x}_{k}\to\mathbf{0} as kk\to\infty because 𝐱0π𝟎\mathbf{x}_{0}\in\mathcal{R}_{\pi}^{\mathbf{0}}. The continouity of the map ψψV\psi\to\nabla_{\psi}V together with the above result on vanishing ψV\nabla_{\psi}V at the equilibrium point completes the proof. ∎

The effect of the other terms of Equation 19 on the learning signal is discussed below.

F.2 The Component 𝐱k𝐱p\frac{\partial\mathbf{x}_{k}}{\partial\mathbf{x}_{p}}

This term determines how state information propagates forward through the trajectory. More precisely, it shows how perturbing a state at time pp affects the downstream state 𝐱k\mathbf{x}_{k} after kpk-p time steps when the parameters of the system are kept fixed. In the following, we take a closer look at the constituent terms of 18. We first define the function

Ji(𝐱i,𝐮i)=[f𝐱|𝐱=𝐱i,f𝐮|𝐮=𝐮i]𝖳J_{i}(\mathbf{x}_{i},\mathbf{u}_{i})=[\frac{\partial f}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{i}},\frac{\partial f}{\partial\mathbf{u}}|_{\mathbf{u}=\mathbf{u}_{i}}]^{\mkern-1.5mu\mathsf{T}} (22)

that is different form 18 in the sense that 𝐮i\mathbf{u}_{i} is not necessarily a function of 𝐱i\mathbf{x}_{i}. Due to the fact that 𝐱k/𝐱p\partial\mathbf{x}_{k}/\partial\mathbf{x}_{p} equals the product of Ji=Ji(𝐱i,𝐮i)J_{i}=J_{i}(\mathbf{x}_{i},\mathbf{u}_{i}) along the trajectoy {(𝐱i,𝐮i)}i=1i=k1\{(\mathbf{x}_{i},\mathbf{u}_{i})\}_{i=1}^{i=k-1}, a measure of the size of JiJ_{i} would be informative about the influence of 𝐱p\mathbf{x}_{p} on 𝐱k\mathbf{x}_{k}. First, we consider the vanishing gradient issue when the influence becomes too small. Notice that the size of JiJ_{i} as defined in 22 is determined by two terms as (we drop the index ii for convenience)

J(𝐱,𝐮)f𝐱+f𝐮.\lVert J(\mathbf{x},\mathbf{u})\rVert\leq\lVert\frac{\partial f}{\partial\mathbf{x}}\rVert+\|\frac{\partial f}{\partial\mathbf{u}}\rVert. (23)

Let ff be the dynamics of the closed-loop system, i.e., f=fπf=f_{\pi}. If ff is Lipschitz continuous (as it is assumed in Section 2 to ensure the existence and uniqueness of the solution), both terms on the r.h.s. of the inequality 23 will be bounded. However, the condition of Equation 22 is a more general case when 𝐮\mathbf{u} is not necessarily a function of the states. In this case, ff must be Lipschitz in both 𝐱\mathbf{x} and 𝐮\mathbf{u}, that is, there exists positive constants Lf𝐱L_{f_{\mathbf{x}}} and Lf𝐮L_{f_{\mathbf{u}}} such that:

f(𝐱,𝐮)/𝐱Lf𝐱,𝐮𝒰and𝐱𝒳\displaystyle\lVert\partial f(\mathbf{x},\mathbf{u})/\partial\mathbf{x}\rVert\leq L_{f_{\mathbf{x}}},\;\forall\mathbf{u}\in\mathcal{U}\;\text{and}\;\forall\mathbf{x}\in\mathcal{X} (24)
f(𝐱,𝐮)/𝐮Lf𝐮,𝐮𝒰and𝐱𝒳.\displaystyle\lVert\partial f(\mathbf{x},\mathbf{u})/\partial\mathbf{u}\rVert\leq L_{f_{\mathbf{u}}},\;\forall\mathbf{u}\in\mathcal{U}\;\text{and}\;\forall\mathbf{x}\in\mathcal{X}. (25)

Intuitively, this means that the open-loop dynamics f(𝐱,𝐮)f(\mathbf{x},\mathbf{u}) rolls out smoothly and does not respond too harshly to the changes in the control input. If a component of the system breaks down under some control input, 𝐮𝒰\mathbf{u}\in\mathcal{U}, the above conditions do not hold. In addition, it might be the case that the dynamics of the system show high-frequency vibrations under some specific control inputs (e.g., when the controller excites the natural frequency of the system). These conditions occur rarely in physical systems when the controller remain within a reasonable working regime but may happen frequently under adversarial regimes when the system is intentionally attacked by un unauthorized user. Such regimes are beyond the scope of this paper. Hence, we can reasonably assume that JiJ_{i} is upper bounded by 2×max(Lf𝐱i,Lf𝐮i)2\times\max(L_{f_{\mathbf{x}_{i}}},L_{f_{\mathbf{u}_{i}}}).

A more general control signal consists of two parts. The first part is a function of states and the second part is open-loop. Therefore, we have:

𝐮i=π(𝐱i,ψ)+𝐮~iwith𝐮~i𝐱i=0.\mathbf{u}_{i}=\pi(\mathbf{x}_{i};\psi)+\tilde{\mathbf{u}}_{i}\;\;\text{with}\;\;\frac{\partial\tilde{\mathbf{u}}_{i}}{\partial\mathbf{x}_{i}}=0.

We can write the overall dynamics as 𝐱i+1=f(𝐱i,𝐮i)=f(𝐱i,(π(𝐱i),𝐮~i))=f(𝐱i,𝐮~i)\mathbf{x}_{i+1}=f(\mathbf{x}_{i},\mathbf{u}_{i})=f(\mathbf{x}_{i},(\pi(\mathbf{x}_{i}),\tilde{\mathbf{u}}_{i}))=f(\mathbf{x}_{i},\tilde{\mathbf{u}}_{i}) which transforms to the case of 22 with the difference that the policy function π(𝐱)\pi(\mathbf{x}) is now absorbed in the first component of 22. Hence, Ji(𝐱i,𝐮~i)J_{i}(\mathbf{x}_{i},\tilde{\mathbf{u}}_{i}) decomposes as

Ji(𝐱i,𝐮~i)=[f𝐱|𝐱=𝐱i+fπ(𝐱)|π(𝐱)=π(𝐱i),f𝐮~|𝐮~=𝐮~i]𝖳J_{i}(\mathbf{x}_{i},\tilde{\mathbf{u}}_{i})=[\frac{\partial f}{\partial\mathbf{x}}|_{\mathbf{x}=\mathbf{x}_{i}}+\frac{\partial f}{\partial\pi(\mathbf{x})}|_{\pi(\mathbf{x})=\pi(\mathbf{x}_{i})},\frac{\partial f}{\partial\tilde{\mathbf{u}}}|_{\tilde{\mathbf{u}}=\tilde{\mathbf{u}}_{i}}]^{\mkern-1.5mu\mathsf{T}}

Observe that Equation 18 depends only on the first block of Ji(𝐱i,𝐮~i)J_{i}(\mathbf{x}_{i},\tilde{\mathbf{u}}_{i}) and f/𝐮~\partial f/\partial\tilde{\mathbf{u}} does not affect the gradient even though it affects the trajectory of the system. As a result, the influence of the open-loop control signal 𝐮~t\tilde{\mathbf{u}}_{t} on /ψ\partial\mathcal{L}/\partial\psi is via the final states of the trajectory 𝐱T\mathbf{x}_{T} as well as /𝐱T\partial\mathcal{L}/\partial\mathbf{x}_{T} in 19.

F.3 The Component +𝐱kψ\frac{\partial^{+}\mathbf{x}_{k}}{\partial\psi}

This component captures the effect of the policy parameters on the next state of the system when the current state is kept fixed. Using chain rule we have

+𝐱kψ=f(𝐱k,π)π|π=π(𝐱k,ψ)×π(𝐱k,ψ)ψ.\frac{\partial^{+}\mathbf{x}_{k}}{\partial\psi}=\frac{\partial f(\mathbf{x}_{k},\pi)}{\partial\pi}|_{\pi=\pi(\mathbf{x}_{k};\psi)}\times\frac{\partial\pi(\mathbf{x}_{k};\psi)}{\partial\psi}. (26)

The first term in the r.h.s. depends on how sensitive is the dynamics function ff with respect to its control argument. Lower bounding this sensitivity can ensure that the effect of the controller remains visible throughout the trajectory. More rigorously, we assume there exists sufficiently large κ>0\kappa>0 such that

f(𝐱,π)π|π=π(𝐱,ψ)>κ, for every x𝒟\lVert\frac{\partial f(\mathbf{x},\pi)}{\partial\pi}|_{\pi=\pi(\mathbf{x};\psi)}\rVert>\kappa,\quad\text{ for every $x\in\mathcal{D}$}

where 𝒟\mathcal{D} is the domain of interest in which the system operates.

The second term on the r.h.s of Equation 26 is independent from the rest of the system and shows the sensitivity of the control signal with respect to the parameters of the controller. For example, if the controller is implemented by a neural network with tanh activation functions in the hidden layers, this term can vanish if the weights diverge and push the activation values towards the saturation regimes of tanh.

Appendix G Training Details

G.1 Lyapunov Function

A parametric candidate Lyapunov function V(,θ)V(\cdot;\theta) must satisfies the conditions of 2. It must be positive definite on a domain 𝒟\mathcal{D} and its value must decrease along the trajectories of the system. As the second condition depends on the system, it is embedded in the optimization loss function 5. The first condition (positive definiteness) though does not depend on the system. It must be enforced for every 𝐱𝒟\mathbf{x}\in\mathcal{D}. Rather than including it in the loss function, we restrict the hypothesis set V(,θ)V(\cdot;\theta)\in\mathcal{H} to the class of positive definite functions. In kernel methods, this property can be achieved by a proper choice of kernels. With neural networks, V(,θ)V(\cdot;\theta) can be represented by V(𝐱,θ)=v(𝐱,θ)𝖳v(𝐱,θ)V(\mathbf{x};\theta)=v(\mathbf{x};\theta)^{\mkern-1.5mu\mathsf{T}}v(\mathbf{x};\theta) as a Lyapunov candidate function where v(𝐱,θ)v(\mathbf{x};\theta) is a multilayer perceptron. This guarantees the non-negativeness of V(,θ)V(\cdot;\theta). To ensure V(𝐱,θ)V(\mathbf{x};\theta) does not vanish at any point other than the origin, first suppose 𝐳\mathbf{z}_{\ell} and 𝐳+1\mathbf{z}_{\ell+1} are the input and output of the th\ell^{\rm th} layer respectively, i.e., 𝐳+1=ζ(W𝐳)\mathbf{z}_{\ell+1}=\zeta_{\ell}(W\mathbf{z}_{\ell}) where WW is the weight matrix and ζ()\zeta_{\ell}(\cdot) is the activation function. To guarantee the strict positiveness of v(𝐱,θ)v(\mathbf{x};\theta) for 𝐱𝟎\mathbf{x}\neq\mathbf{0}, both activation function ζ\zeta_{\ell} and weight matrix Wd×d+1W_{\ell}\in\mathbb{R}^{d_{\ell}\times d_{\ell+1}} must have trivial nullspaces. Activation functions such as tanh and ReLU meet this condition. The weight matrix can be constructed as the following:

𝐖=[𝐆1𝐆1+ε𝐈d1𝐆2]\mathbf{W}_{\ell}=\left[\begin{array}[]{c}\mathbf{G}_{\ell 1}^{\top}\mathbf{G}_{\ell 1}+\varepsilon\mathbf{I}_{d_{\ell-1}}\\ \mathbf{G}_{\ell 2}\end{array}\right] (27)

where 𝐆1q×d1\mathbf{G}_{\ell 1}\in\mathbb{R}^{q_{\ell}\times d_{\ell-1}} for some q1,𝐆2(dd1)×d1,𝐈d1d1×d1q_{\ell}\in\mathbb{N}_{\geq 1},\mathbf{G}_{\ell 2}\in\mathbb{R}^{\left(d_{\ell}-d_{\ell-1}\right)\times d_{\ell-1}},\mathbf{I}_{d_{\ell-1}}\in\mathbb{R}^{d_{\ell-1}\times d_{\ell-1}} is the identity matrix, and ϵ+\epsilon\in\mathbb{R}_{+} is a positive constant to ensure the upper block has full rank. See Remark 1 in the appendix of (Richards et al., 2018) for further details.

In our experiments, v(𝐱,θ)v(\mathbf{x};\theta) is represented by a 33-layer multilayer perceptron each layer of dimension 6464 followed by tanh activation functions and a linear last layer.

G.2 Discretized Time and State Space

We discretize the dynamics of the inverted pendulum with time resolution of ΔT=0.01\Delta T=0.01. The state space is also discretized in the rectangle [θmin,θmax]=[π/2,π/2],[ωmin,ωmax]=[2π,2π][\theta_{\min},\theta_{\max}]=[-\pi/2,\pi/2],[\omega_{\min},\omega_{\max}]=[-2\pi,2\pi]. Each dimension is divided equally into 100100 sections to form a 22-dimensional grid. Therefore, all the computations of Section 5 takes place with a finite set of states. For example, the true RoA denoted by the green plot in Figure 1(Right) is computed by integrating forward all states of the state space grid. If the resolution of the grid is too coarse, the bound on the negative definiteness of ΔV(𝐱)\Delta V(\mathbf{x}) must change from 00 to a more conservative negative value in order to make sure the critical Lyapunov decrease condition will not be violated. The new bound depends on the Lipschitz constants of VV and ff (see Richards et al. (2018) for the detailed derivation of the bound).

G.3 Hyper-parameters

The pre-training phase is performed with the learning rate 0.0010.001 and 10k10k training steps. Each run of the RoA estimation algorithm is performed with the learning rate 0.010.01 and 10k10k training steps. Each run of the policy update sub-phase is performed with the learning rate 0.010.01 with 100100 steps. The number of learning steps in the policy update sub-phase is a proxy to the distance between the current policy and the updated policy. Hence, by keeping this number fairly small, we make sure the condition of Assumption 1 is likely to be fulfilled.

In Equation 5, λRoA\lambda_{\rm RoA} is set to 10001000 to enforce the Lyapunov decrease condition. In the same equation, λmonot\lambda_{\rm monot} is set to 0.01 to encourage to monotonicity of the RoA estimation algorithm. In Equation 6, λu\lambda_{u} is set to 1010 to put more emphasis on stabilizing the unstable states compared with keeping stable the already stable states.

The sampling mixture parameters βr\beta_{r} and βp\beta_{p} are both set to 0.60.6 in Algorithms 1 and 2 respectively.

The length of the integrated trajectories (Lr,LpL_{r},L_{p}) is set to 1010 for both RoA estimation (see Algorithm 1) and policy update (see Algorithm 2) sub-phases.

The multiplication constants γr\gamma_{r} and γp\gamma_{p} for both RoA estimation and policy update sub-phases is set to 44.

The number of RoA estimation sub-phases mm in Algorithm 1 is set to 2020. The total number of policy update sub-phases is also set to 2020. One can alternatively use a context-aware stopping criterion. For instance, updating the policy can be stopped when no significant change in the RoA or the policy parameters is observed.

The number of sampled initial states NN is initialized to 1010 in Algorithms 1 and 2 and increases by 1010 after each update of the policy. The heuristic reason is that after each policy update, the RoA enlarges and it takes more samples to obtain a good representative of the gap surrounding the RoA.

Appendix H More Experimental Results

Refer to caption
(a) Phase portrait
Refer to caption
(b) RoA
Figure 5: Dynamics of the inverted pendulum and its initial RoA for an LQR controller
(a) Untrained
(b) Quadratic
(c) Trained
Figure 6: Pre-training the neural network with a quadratic Lyapunov function. The background heatmap represents the value of the underlying function. Lighter regions correspond to larger values.(a) The level sets of the untrained initialized neural network. (b) The target quadratic function (2) The level sets of the neural network pre-trained with the quadratic function of Figure 6(b).
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 7: Visualizing the true ROA which is enlarged by the improved policy and is chased by a learned Lyapunov function. Each row corresponds to a policy update sub-phase and each column corresponds to a RoA estimation sub-phase. At each row, from left to right, the policy is fixed that results in a fixed true RoA (green plot). The columns from left to right are the internal iterations of the RoA estimation sub-phase (see Algorithm 1). The blue color is the estimated RoA Scn(Vπn)S_{c_{n}}(V_{\pi_{n}}) and the pink color shows the gap 𝒢=Sγcn(Vπn)\Scn(Vπn)\mathcal{G}=S_{\gamma c_{n}}(V_{\pi_{n}})\backslash S_{c_{n}}(V_{\pi_{n}}) that is used in Algorithms 1 and 2 for sampling the initial states. After the RoA estimation sub-phase is done (the rightmost figure of each row), the policy update sub-phase is performed. The leftmost figure in the next row shows that the true RoA enlarges as a result of the policy update. The RoA estimation sub-phase continues from its latest iteration which is a decent initial approximate for the enlarged RoA. As a result of the alternate application of RoA estimation and policy update sub-phases, the bottom rightmost figure shows a significantly larger RoA compared with the top leftmost figure (see the green boundary of the true RoA around the blue region that is the estimated RoA by the learned Lyapunov function). Note that the Lyapunov function is also learned such that its sublevel set (blue region) almost perfectly matches the true RoA (green boundary) in the bottom rightmost figure.

References

  • Baer et al. (2006) Steven M Baer, Bingtuan Li, and Hal L Smith. Multiple limit cycles in the standard model of three species competition for three essential resources. Journal of mathematical biology, 52(6):745–760, 2006.
  • Balduzzi et al. (2018) David Balduzzi, Sebastien Racaniere, James Martens, Jakob Foerster, Karl Tuyls, and Thore Graepel. The mechanics of n-player differentiable games. arXiv preprint arXiv:1802.05642, 2018.
  • Berkenkamp et al. (2016) Felix Berkenkamp, Angela P Schoellig, and Andreas Krause. Safe controller optimization for quadrotors with gaussian processes. In 2016 IEEE International Conference on Robotics and Automation (ICRA), pages 491–496. IEEE, 2016.
  • Berkenkamp et al. (2017) Felix Berkenkamp, Matteo Turchetta, Angela Schoellig, and Andreas Krause. Safe model-based reinforcement learning with stability guarantees. In Advances in neural information processing systems, pages 908–918, 2017.
  • Bhasin et al. (2013) Shubhendu Bhasin, Rushikesh Kamalapurkar, Marcus Johnson, Kyriakos G Vamvoudakis, Frank L Lewis, and Warren E Dixon. A novel actor–critic–identifier architecture for approximate optimal control of uncertain nonlinear systems. Automatica, 49(1):82–92, 2013.
  • Chang et al. (2019) Ya-Chien Chang, Nima Roohi, and Sicun Gao. Neural lyapunov control. In Advances in Neural Information Processing Systems, pages 3245–3254, 2019.
  • Chiang and Thorp (1989) H-D Chiang and James S Thorp. Stability regions of nonlinear dynamical systems: A constructive methodology. IEEE Transactions on Automatic Control, 34(12):1229–1241, 1989.
  • Chiang and Alberto (2015) Hsiao-Dong Chiang and Luís FC Alberto. Stability regions of nonlinear dynamical systems: theory, estimation, and applications. Cambridge University Press, 2015.
  • Chu et al. (1990) S Reynold Chu, Rahmat Shoureshi, and Manoel Tenorio. Neural networks for system identification. IEEE Control systems magazine, 10(3):31–35, 1990.
  • Goodfellow et al. (2014) Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014.
  • Greydanus et al. (2019) Samuel Greydanus, Misko Dzamba, and Jason Yosinski. Hamiltonian neural networks. In Advances in Neural Information Processing Systems, pages 15353–15363, 2019.
  • Grondman et al. (2012) Ivo Grondman, Lucian Busoniu, Gabriel AD Lopes, and Robert Babuska. A survey of actor-critic reinforcement learning: Standard and natural policy gradients. IEEE Transactions on Systems, Man, and Cybernetics, Part C (Applications and Reviews), 42(6):1291–1307, 2012.
  • Hopfield (1994) John J Hopfield. Neurons, dynamics and computation. Physics Today, 47(2):40–47, 1994.
  • Hwang et al. (2013) Eun-Ju Hwang, Hyo-Seok Kang, Chang-Ho Hyun, and Mignon Park. Robust backstepping control based on a lyapunov redesign for skid-steered wheeled mobile robots. International Journal of Advanced Robotic Systems, 10(1):26, 2013.
  • Imani Masouleh and Limebeer (2018) Mehdi Imani Masouleh and David JN Limebeer. Region of attraction analysis for nonlinear vehicle lateral dynamics using sum-of-squares programming. Vehicle System Dynamics, 56(7):1118–1138, 2018.
  • Isidori (2014) Alberto Isidori. Nonlinear Control Systems Design 1989: Selected Papers from the IFAC Symposium, Capri, Italy, 14-16 June 1989. Elsevier, 2014.
  • Jarvis-Wloszek et al. (2003) Zachary Jarvis-Wloszek, Ryan Feeley, Weehong Tan, Kunpeng Sun, and Andrew Packard. Some controls applications of sum of squares programming. In 42nd IEEE international conference on decision and control (IEEE Cat. No. 03CH37475), volume 5, pages 4676–4681. IEEE, 2003.
  • Khalil and Grizzle (2002) Hassan K Khalil and Jessy W Grizzle. Nonlinear systems, volume 3. Prentice hall Upper Saddle River, NJ, 2002.
  • Krantz and Parks (2012) Steven G Krantz and Harold R Parks. The implicit function theorem: history, theory, and applications. Springer Science & Business Media, 2012.
  • Liao and Wang (2004) F Liao and JL Wang. Analysis and synthesis of reliable flight control systems via parameter-dependent lyapunov functions. Proceedings of the Institution of Mechanical Engineers, Part I: Journal of Systems and Control Engineering, 218(6):433–450, 2004.
  • Liapounoff (1907) Alexandre Liapounoff. Problème général de la stabilité du mouvement. In Annales de la Faculté des sciences de Toulouse: Mathématiques, volume 9, pages 203–474, 1907.
  • Lillicrap et al. (2015) Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
  • Majumdar et al. (2013) Anirudha Majumdar, Amir Ali Ahmadi, and Russ Tedrake. Control design along trajectories with sums of squares programming. In 2013 IEEE International Conference on Robotics and Automation, pages 4054–4061. IEEE, 2013.
  • Majumdar et al. (2014) Anirudha Majumdar, Ram Vasudevan, Mark M Tobenkin, and Russ Tedrake. Convex optimization of nonlinear feedback controllers via occupation measures. The International Journal of Robotics Research, 33(9):1209–1230, 2014.
  • Mehrjou (2018) Arash Mehrjou. Analysis of nonautonomous adversarial systems. arXiv preprint arXiv:1803.05045, 2018.
  • Mehrjou and Schölkopf (2018a) Arash Mehrjou and Bernhard Schölkopf. Deep nonlinear non-gaussian filtering for dynamical systems. arXiv preprint arXiv:1811.05933, 2018a.
  • Mehrjou and Schölkopf (2018b) Arash Mehrjou and Bernhard Schölkopf. Nonstationary gans: Analysis as nonautonomous dynamical systems. In Workshop on Theoretical Foundations and Applications of Deep Generative Models at ICML, 2018b.
  • Mehrjou and Schölkopf (2019) Arash Mehrjou and Bernhard Schölkopf. Deep lyapunov function: Automatic stability analysis for dynamical systems. arXiv preprint arXiv:1901.08403, 2019.
  • Mehrjou et al. (2018) Arash Mehrjou, Friedrich Solowjow, Sebastian Trimpe, and Bernhard Schölkopf. A local information criterion for dynamical systems. arXiv preprint arXiv:1805.10615, 2018.
  • Mehrjou et al. (2019) Arash Mehrjou, Wittawat Jitkrittum, Krikamol Muandet, and Bernhard Schölkopf. Kernel-guided training of implicit generative models with stability guarantees. arXiv preprint arXiv:1910.14428, 2019.
  • Mehrjou et al. (2020) Arash Mehrjou, Andrea Iannelli, and Bernhard Schölkopf. Learning dynamical systems using local stability priors. arXiv preprint arXiv:2008.10053, 2020.
  • Mescheder et al. (2017) Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. The numerics of gans. In Advances in Neural Information Processing Systems, pages 1825–1835, 2017.
  • Palis and De Melo (2012) J Jr Palis and Welington De Melo. Geometric theory of dynamical systems: an introduction. Springer Science & Business Media, 2012.
  • Pierson and Gashler (2017) Harry A Pierson and Michael S Gashler. Deep learning in robotics: a review of recent research. Advanced Robotics, 31(16):821–835, 2017.
  • Pillonetto et al. (2014) Gianluigi Pillonetto, Francesco Dinuzzo, Tianshi Chen, Giuseppe De Nicolao, and Lennart Ljung. Kernel methods in system identification, machine learning and function estimation: A survey. Automatica, 50(3):657–682, 2014.
  • Richards et al. (2018) Spencer M Richards, Felix Berkenkamp, and Andreas Krause. The lyapunov neural network: Adaptive stability certification for safe learning of dynamic systems. arXiv preprint arXiv:1808.00924, 2018.
  • Solowjow et al. (2018) Friedrich Solowjow, Arash Mehrjou, Bernhard Schölkopf, and Sebastian Trimpe. Minimum information exchange in distributed systems. In 57th IEEE Conference on Decision and Control (CDC).[Electronic resource], 2018.
  • Vannelli and Vidyasagar (1985) Anthony Vannelli and Mathukumalli Vidyasagar. Maximal lyapunov functions and domains of attraction for autonomous nonlinear systems. Automatica, 21(1):69–80, 1985.
  • Wen-Xing and Li-Dong (2018) Zhu Wen-Xing and Zhang Li-Dong. A new car-following model for autonomous vehicles flow with mean expected velocity field. Physica A: Statistical Mechanics and its Applications, 492:2154–2165, 2018.
  • Westervelt et al. (2003) Eric R Westervelt, Jessy W Grizzle, and C Canudas De Wit. Switching and pi control of walking motions of planar biped walkers. IEEE Transactions on Automatic Control, 48(2):308–312, 2003.
  • Xin et al. (2007) H Xin, D Gan, J Qiu, and Z Qu. Methods for estimating stability regions with applications to power systems. European transactions on electrical power, 17(2):113–133, 2007.