Sequentially learning regions of attraction from data Oumayma Khattabi, Matteo Tacchi-Bénard, Sorin Olaru Abstract The paper is dedicated to data-driven analysis of dynamical systems. It deals with certifying the basin of attraction of a stable equilibrium for an unknown dynamical system. It is supposed that point-wise evaluation of the right-hand side of the ordinary differential equation governing the system is available for a set of points in the state space. Technically, a Piecewise Affine Lyapunov function will be constructed iteratively using an optimisation-based technique for the effective validation of the certificates. As a main contribution, whenever those certificates are violated locally, a refinement of the domain and the associated tessellation is produced, thus leading to an improvement in the description of the domain of attraction. Keywords : Data-driven, Piecewise affine, Lyapunov function, Optimisation, Region of attraction, Iterative learning. 1 Introduction The ongoing rapid increase in data and computing capacity has led to significant advances in control theory, mainly with approaches exploiting data, gaining traction after important achievements in stabilising dynamical systems. Stability analysis follows two main currents: model-based and data-driven. While model-based methods (e.g. model-based predictive control (MPC), adaptive control, Lyapunov direct methods, etc.) have strong stability guarantees, data-driven control laws bypass the model identification step. They are directly building on to real system behaviour, a feature that promotes them as versatile alternatives in stabilising complex systems. However, the critical issue of control stability certification arises, hindering their applicability. Traditionally, one of the key frameworks used in stability analysis is Lyapunov stability theory [ 1 ] . It is based on finding a function/functional related to the dynamical system, called the Lyapunov candidate, that decreases along trajectories of the system and converges to zero as the system converges to a given attractor (e.g. an equilibrium point). Constructing an adequate Lyapunov function using analytical methods for systems with simple models is moderately easy, but challenging for systems with complex and non-linear models. Some alternative solutions have been proposed; for example, in [ 2 ] , the system function in question is represented by a piecewise affine (PWA) approximation for which a PWA Lyapunov candidate is computed using linear programming. In [ 3 ] , on the other hand, a neural Lyapunov function is constructed to identify positively invariant sets using a PWA activation function. Neural Lyapunov functions are also used in [ 4 ] to certify regions of attraction of the controlled system. There are other methods than constructing Lyapunov functions, like the interval-based method in [ 5 ] and the interval Lyapunov equation test of [ 6 ] , which are also used for stability analysis of complex systems. Many works in the literature propose data-based methods to prove the stability of the equilibrium point of the system. A prominent method involves the use of deep neural networks. This can be found in [ 7 ] where a neural Lyapunov function is learnt along with the system’s dynamics to ensure stability guarantees. Another example is [ 8 ] , where a neural network-based control law is used and is constrained with a Lyapunov function learnt online. In [ 9 ] , a neural Lyapunov candidate is constructed while trying to avoid the curse of dimensionality related to neural networks. Another notable stability analysis approach is the continuous piecewise affine (CPA) method by [ 10 ] , where data points are taken on vertices of a space partition and are used to construct the Lyapunov function. Beyond the approaches above, [ 11 ] focuses on Taylor polynomials and utilises piecewise polynomial approximations based on noisy data to study system dissipativity. Other recent research includes [ 12 ] , where a safe stabilising control law is generated along with its Lyapunov function for discrete systems using a noisy dataset. Existing data-driven stability analysis approaches provide various frameworks for studying system behaviour. This paper will examine one such approach, presented in [ 13 ] , which seeks to find PWA Lyapunov functions for non-linear systems using data. The present contribution is organised as follows: After introducing the mathematical framework, the optimisation problem at the procedure’s core is recalled, and as a contribution, an iterative implementation scheme is proposed. The advantage of such a parsimonious treatment of the Lyapunov candidate construction is that it provides patchy Lyapunov functions [ 14 ] and thus allows for the certification of the domain of attraction in cases that are difficult to validate over the entirety of the region. We propose a technique that targets the uncertified area iteratively and identifies invariant sets based on the learnt Lyapunov functions. Finally, we present a successful resolution of the previous problematic case as a numerical application. Notation: \mathbb{R}^{+} is defined as the set \{x\in\mathbb{R}|x\geq 0\} . For a topological space \mathcal{X} , int (\mathcal{X}) , \overline{\mathcal{X}} , and \partial\mathcal{X} denote its interior, closure, and boundary, respectively. A polyhedron is the intersection of a finite number of half-spaces. A polyunion is a bounded, finite union of polyhedra (not necessarily convex). The convex hull of a polyunion is denoted as conv(.). For a set S , its cardinal is denoted as |S| . This notation is extended for a polyhedron P so that |P| is the number of vertices in P . For x\in\mathbb{R}^{n} and r\in\mathbb{R} , \mathcal{B}(x,r) is used to denote a ball in \mathbb{R}^{n} of center x and radius r . The Euclidean norm is denoted as ||.|| . Let f be a function from \mathcal{X}\subset\mathbb{R}^{n} to \mathbb{R}^{n} , it is Lipschitz continuous, and M is its Lipschitz constant, if for all x,y\in\mathcal{X},\ \ ||f(x)-f(y)||\ \leq\ M||x-y|| . The strict sub-level set of a function V for a certain level \alpha\in\mathbb{R} is defined as \mathbf{L}_{\alpha}^{V}:=\{x\in\mathbb{R}^{n}|V(x)<\alpha\} . An N_{c} -piece tessellation \{Y_{c}\}_{1\leq c\leq N_{c}} of a subspace \mathcal{X}\subset\mathbb{R}^{n} is defined as \bigcup_{c=1}^{N_{c}}Y_{c}=\overline{\mathcal{X}} , such that \forall c,c^{\prime}\in\{1,...,N_{c}\}\ ,\ \ c\neq c^{\prime}\Rightarrow\mathrm{int}(Y_{c})\cap\mathrm{int}(Y_{c^{\prime}})=\varnothing , with Y_{c} convex polyunions which will be called simplexes. In the 2D case, the one-dimensional common facet between two simplices is called an edge, and a singular point of contact between edges is called a vertex. The set of vertices of the tessellation will be denoted \{v_{i,c}\}^{1\leq i\leq|Y_{c}|}_{1\leq c\leq N_{c}} . 2 Problem Statement This section establishes the theoretical framework necessary for our stability analysis approach. First, we present the fundamental mathematical assumptions to lay the groundwork. Second, we reintroduce the optimisation problem given in [ 13 ] that constitutes the basis of our methodology. Last, we define the objectives and difficulties to tackle. 2.1 Framework Our study addresses the challenge of analysing the domain of attraction of the system with unknown dynamics : \dot{x}=f(x) (1) In order to set up a framework that allows a feasible solution, a series of hypotheses have to be imposed with respect to the family of dynamics and the region over which the analysis will be carried out. Assumption 1 . The system under study has a minimal state space realisation. For such a minimal state space realisation, the following hold: • the dimension n of the state vector is known; • the right-hand side f(.) of ( 1 ) is accessible for evaluation either via measurements or through simulation; • the function f:\mathbb{R}^{n}\rightarrow\mathbb{R}^{n} is Lipschitz continuous, and an upper bound M for its Lipschitz constant is known a priori. Analysing dynamical systems can reveal complex behaviours, including multiple equilibria and chaotic trajectories. To maintain focus within our study’s scope, we introduce additional constraints defining the solution space and the qualitative/quantitative structure of the solutions to ( 1 ). Assumption 2 . The analysis will be carried on on a bounded set \mathcal{X}\subset\mathbb{R}^{n} of the state space. It is assumed that there is one locally asymptotically stable equilibrium \bar{x}=0\in int(\mathcal{X}) , and no other equilibrium point exists in \overline{\mathcal{X}} . Based on Assumption 1 , we can have access to a dataset \mathcal{D}:=\{(x_{d},f_{d})\}_{1\leq d\leq N_{d}} , with f_{d}=f(x_{d}) and N_{d} the number of data points, and we can choose the position of the state samples x_{d} when generating data. The aim is to be able to certify the stability of system ( 1 ) in \mathcal{X} based on the dataset \mathcal{D} and the Lipschitz constant M . 2.2 Data-driven Lyapunov stability analysis This work is based on the method presented by Tacchi et al. in [ 13 ] , in which we identify regions of attraction by constructing certified and robust Lyapunov functions consistent with the available data. The following Assumptions provide two additional technical conditions to avoid singularities in the numerical implementation: Assumption 3 . The following information is available with respect to ( 1 ): • a neighbourhood \mathcal{A} of the equilibrium point is known to be attracted to \bar{x}=0 ; • a fixed dataset \mathcal{D} of the system is available ; • \overline{\mathcal{X}} and \mathcal{A} are polyunions ; Let the region \overline{\mathcal{X}\setminus\mathcal{A}} be subdivided into an N_{c} -piece tessellation \{Y_{c}\}_{1\leq c\leq N_{c}} , with N_{c} the number of cells Y_{c} . We set each cell Y_{c} to be a convex polyunion with vertices \{v_{1,c},\ldots,v_{|Y_{c}|,c}\}. To each cell Y_{c} , an affine Lyapunov function V_{c}(x):=g_{c}^{\top}x+b_{c} is assigned. These functions are continuously merged together and constitute one global PWA Lyapunov candidate V on \mathcal{X} defined as follows : \forall c\in\{1,...,N_{c}\},\ \forall x\in Y_{c}\subset\overline{\mathcal{X}\setminus\mathcal{A}},\ \ V(x)=g_{c}^{\top}x+b_{c} (2) Based on these elements, and according to [ 13 , Proposition 6] , if the upper bound on \nabla V^{\top}f based on data is negative at all points in \overline{\mathcal{X}\setminus\mathcal{A}} where \nabla V exists, then for all \alpha\in\mathbb{R} such that \mathbf{L}_{\alpha}^{V}\subset\mathcal{X} , \mathbf{L}_{\alpha}^{V} is include in the region of attraction. The following optimisation problem is a formulation of the conditions to find a PWA Lyapunov function V : \displaystyle\mathbf{s}_{\alpha,\mu}:=\min_{\{\gamma_{d,c},g_{c},b_{c},s_{i,c}\}}\ \sum_{c=1}^{N_{c}}\sum_{i=1}^{|Y_{c}|} \displaystyle s_{i,c} (3a) \displaystyle\forall\ c,c^{\prime}\in\{{\scriptstyle 1,...,N_{c}}\},\ i\in\{{\scriptstyle 1,...,|Y_{c}|}\},\ \ s_{i,c} \displaystyle\geq-\mu (3b) \displaystyle v_{i,c}\in Y_{c^{\prime}}\ \Rightarrow\ (g_{c}-g_{c^{\prime}})^{\top}v_{i,c} \displaystyle=b_{c^{\prime}}-b_{c} (3c) \displaystyle\sum_{d=1}^{N_{d}}\gamma_{d,c} \displaystyle=g_{c} (3d) \displaystyle\sum_{d=1}^{N_{d}}\gamma_{d,c}^{\top}f_{d}+||\gamma_{d,c}||M||v_{i,c}-x_{d}|| \displaystyle\leq s_{i,c} (3e) with \{s_{i,c}\}^{1\leq i\leq|Y_{c}|}_{1\leq c\leq N_{c}} some slack variables to minimise (one per vertex of each cell of the tessellation), \{\gamma_{d,c}\}^{1\leq d\leq N_{d}}_{1\leq c\leq N_{c}} data dependent variables that tune \{g_{c}\}_{1\leq c\leq N_{c}} using constraints ( 3d ), and \mu\in\mathbb{R}^{+} defining the lower bound of the slack variables. The constraints ( 3c ) represent the continuity of the Lyapunov function V between neighbouring cells Y_{c} and Y_{c^{\prime}} . The negativity of \nabla V^{\top}f is ensured by constraint ( 3e ). Once the function is obtained, a level \alpha should be found such that \mathbf{L}^{V}_{\alpha}\subset\mathcal{X} with \mathcal{A}\subset\mathbf{L}^{V}_{\alpha} , proving that \mathbf{L}^{V}_{\alpha} is attracted to the equilibrium. The learned function V is a certified Lyapunov function if all slack variables \{s_{i,c}\}^{1\leq i\leq|Y_{c}|}_{1\leq c\leq N_{c}} are negative. The negativity of \nabla V^{\top}f is thus guaranteed, making the resulting V a valid Lyapunov function. To avoid the problem of infeasibility, [ 13 ] provides a necessary condition to be validated by the dataset : \{v_{i,c}\}^{1\leq i\leq|Y_{c}|}_{1\leq c\leq N_{c}}\subset\bigcup_{d=1}^{N_{d}}\mathcal{B}\left(x_{d},r_{d}=\frac{||f_{d}||}{M}\right) (4) This implies that data should provide at least some minimal information relevant to each vertex of the tessellation. 2.3 Advantages, challenges and objectives This method is a promising alternative to the state of the art, where the common practice is to use semi-definite programming (SDP) [ 11 , 12 ] . In contrast, the optimisation problem ( 3 ) is based on second-order cone programming (SOCP) and linear constraints, which makes it more scalable to higher dimensions. Also, unlike neural networks that train on big datasets, it does not need ample datasets to give satisfying results. Moreover, there is no binding relation between the position of the data points and the tessellation except for the learnability condition ( 4 ), which is quite flexible. This gives more freedom to adjust the dataset and vertices depending on the system at hand. It should be mentioned that optimisation problem ( 3 ) gives satisfying results when applied to various nonlinear systems with nonconvex regions of attraction, like the Van Der Pol oscillator (see numerical results in [ 13 ] ). In some cases, constraints ( 3b ) are not saturated, but all slack variables are negative, which is enough to certify attractivity. However, there are exceptional cases where numerical computations provide (according to the chosen tessellation) a Lyapunov function certified in only part of the set considered initially. An example of one such case is the damped pendulum with the following state space representation: \dot{x}=\left(\begin{array}[]{c}\dot{\theta}\\ \dot{\omega}\end{array}\right)=\left(\begin{array}[]{c}\omega\\ -\sin(\theta)-2\omega\end{array}\right) (5) For a randomly chosen Delaunay triangulation and dataset as displayed in Figure 1(a) , the stability is, on average, not certified by the algorithms of [ 13 ] in the diagonal central part of the region (see figure 1(b) ), even though it is attracted to the equilibrium. The expected result was a Lyapunov function covering the entirety of the tessellation. However, the optimisation problem could not provide negative slack variables and thus valid affine functions in some of the simplexes. These simplexes get eliminated as they don’t validate the Lyapunov function criteria, which leaves a considerable area of the initial set uncovered and thus uncertified by the PWA Lyapunov candidate. This result is hypothesised to be caused by the drastic variation of the values of \{f_{d}\}_{1\leq d\leq Nd} (represented by orange arrows in 1(a) ), where data points with larger image values (big arrows in the corners) exert significant influence on the optimisation process but fail to sufficiently contribute information on the images of the vertices in areas where f_{d} takes on smaller absolute values. Consequently, these areas with lower function absolute values are under-represented and inaccurately characterised, eventually affecting the overall accuracy of the optimisation. (a) Data and tessellation (b) Result of the optimisation Figure 1 : Example case of the simple pendulum According to [ 13 , Appendix B] , a dataset and a tessellation providing enough covering of the set \overline{\mathcal{X}\setminus\mathcal{A}} are bound to bring forth a certified Lyapunov function. However, there is no sufficient condition for the density and distribution of the data and vertices to allow the algorithm’s convergence to optimality. Moreover, the complexity of the computations explodes as the number of constraints is of the order of \mathcal{O}((3|Y_{c}|+1)\cdot N_{c}) and the number of optimisation variables is around \mathcal{O}((|Y_{c}|+2N_{d}+3)\cdot N_{c}) , which makes it difficult to boundlessly increase N_{d} and N_{c} until optimality is reached. The objective of this work is to solve the non-certifiability of the Lyapunov function in parts of the region and to overcome the complexity issue to ensure that solving this optimisation problem can effectively establish the stability of the equilibrium point of the system in \mathcal{X} , using the example of the pendulum of system ( 5 ) as validation. 3 Proposed Approach To overcome the challenges encountered when implementing this stability analysis method and demonstrate the practical applicability of the mathematical theory, we propose in this section an iterative approach using the optimisation problem, where we iteratively adapt the data and tessellation to deploy to get a Lyapunov function certifying the largest region of attraction to the equilibrium point in the set \mathcal{X} . 3.1 The principle of the iterative construction Since one of the core issues lies in the uncertainty regarding the existence of a PWA function solution for the optimisation problem with all slacks negative, a first sanity check is needed to ascertain that a PWA Lyapunov candidate exists. Note that this sanity check uses the full knowledge of the system model ( 5 ), while usually, the dynamics f are unknown. However, our iterative construction still applies in the unknown setting, provided one can refine their tessellation and data distribution. For this, we consider a quadratic Lyapunov function V_{Q} of the system ( 5 ): \forall x\in\mathbb{R}^{2}\ \text{ s.t. }\ ||x||_{\infty}\leq 1\ ,\quad V_{Q}(x)=\frac{1}{2}x^{T}Qx (6) with Q=\left(\begin{array}[]{cc}10&3\\ 3&4\end{array}\right) . Next, a PWA approximation \hat{V}_{Q} of V_{Q} is computed. If \hat{V}_{Q} is a Lyapunov candidate, then we have proven the existence of a PWA Lyapunov function and a tessellation/subdivision \{Y_{c}\}_{1\leq c\leq N_{c}} corresponding to the affine pieces of \hat{V}_{Q} . Since we know the model and a PWA Lyapunov function here, we can use the corresponding subdivision as our initial tessellation for faster convergence. In the general case, when the dynamics are unknown, using a Delaunay triangulation also works [ 15 ] , but it only takes more iterations to converge. Next, we generate data points that offer a covering of the tessellation so that learnability condition ( 4 ) is met. Then, we solve optimisation problem ( 3 ) for the constructed inputs, obtain a Lyapunov candidate V , and look for non-negative slack variables. If none exist, then the largest \alpha with \mathcal{A}\subset\mathbf{L}^{V}_{\alpha}\subset\mathcal{X} defines a region attracted to 0 along system trajectories. Else, we identify the uncertified points \mathcal{N}=\{(i,c)\in\mathbb{N}^{2}\mid 1\leq c\leq N_{c},1\leq i\leq|Y_{c}|,s_{i,c}\geq 0\} from which we deduce a convex uncertified region: \mathcal{C}=\mathrm{conv}(\mathcal{A}\cup\{v_{i,c}\}_{(i,c)\in\mathcal{N}}). (7) By design of constraint ( 3e ) (see [ 13 , Appendix A] for details), we can certify that \forall x\in\mathcal{X}\setminus\mathcal{C} , \nabla V(x)^{\top}f(x)<0 . The problem is that, contrary to the setting in [ 13 , Appendix A] , the case \mathcal{C}\nsubseteq\mathcal{A} can occur, preventing us from concluding anything of significance on whether \mathcal{C} is part of the region of attraction to the equilibrium. In that case, one can study the stability in \mathcal{C} by iterating as follows: • suppose a first iteration k failed to compute V_{k} , \alpha_{k} and \mathcal{C}_{k} based on \mathcal{X}_{k} , \mathcal{A}_{k} and \mathcal{D}_{k} such that \mathcal{C}_{k}\nsubseteq\mathcal{A} . Define \mathcal{X}_{k+1}=\beta_{k+1}\cdot\mathcal{C}_{k} , where \beta_{k+1}\geq 1 is the highest upscaling parameter with \mathcal{X}_{k+1}\subset\mathbf{L}^{V_{k}}_{\alpha_{k}} still verified; if no such \beta_{k+1}\geq 1 exists, it means that the uncertified area intersects or is outside of the level set limit where V_{k}=\alpha_{k} , meaning this particular iteration failed and should be restarted with a finer tessellation and more data points until a better and valid result is generated. • Introduce a smaller \mathcal{A}_{k+1}\subset\mathcal{A}_{k}\subset\mathcal{C}_{k} ( \mathcal{A}_{0}=\mathcal{A} ensures all such sets are attracted to the equilibrium, and non-negative slacks are often in the neighbourhood of the exclusion zone \mathcal{A}_{k} , so taking a smaller \mathcal{A}_{k+1} can validate the condition \mathcal{C}_{k+1} in \mathcal{A} ). • Compute a tessellation of \mathcal{P}=\mathcal{X}_{k+1}\setminus\mathcal{A}_{k+1} by adding vertices to make it denser, and refine the dataset \mathcal{D}_{k} into some \mathcal{D}_{k+1} accordingly by removing some data points and adding others while maintaining learnability condition ( 4 ). • Solve optimisation problem ( 3 ) for the new input to obtain a new V_{k+1} . Find \alpha_{k+1} such that \mathcal{C}_{k}\subset\mathbf{L}^{V_{k+1}}_{\alpha_{k+1}}\subset\mathcal{X}_{k+1} ; if no \alpha_{k+1} such that \mathcal{C}_{k}\subset\mathbf{L}^{V_{k+1}}_{\alpha_{k+1}} exists, the new Lyapunov candidate fails to cover all uncertified points and the iteration fails. This iteration needs to be done again in this case with refined tessellation and richer data. Otherwise, define \mathcal{C}_{k+1} and proceed. • If \mathcal{C}_{k}\subset\mathcal{A} or k=k_{\max} (max number of iterations reached), stop iterating; else, start again from the first step with k\longleftarrow k+1 . The iterative method consists of repeating all the steps, from choosing the parameters, data and tessellation to testing if the uncertified area is contained in \mathcal{A} , until this last condition is verified. It works following Algorithm 1 . Algorithm 1 Input: \mathcal{X} , \mathcal{A} , \mu , M Output: \{\mathbf{L}^{V_{k}}_{\alpha_{k}}\} \mathcal{P}\leftarrow\mathcal{X}\setminus\mathcal{A} while number of iterations k < k_{\max} do Generate tessellation \{Y_{c}\}_{1\leq c\leq N_{c_{k}}} with \mathcal{P}=\cup_{c=1}^{N_{c_{k}}}Y_{c} Generate dataset \mathcal{D}_{k} verifying condition ( 4 ) Run optimisation problem ( 3 ) and obtain V_{k} if all slack variables are negative then Break else Identify the non-certified polyunion \mathcal{C}_{k} Identify the corresponding level set \mathbf{L}^{V_{k}}_{\alpha_{k}} of V_{k} if \mathcal{C}_{k-1}\nsubseteq\mathbf{L}^{V_{k}}_{\alpha_{k}} then Iteration failed, restart with a more refined tessellation and dataset else if \mathcal{C}_{k}\subseteq\mathcal{A}_{k} then Break else if \beta_{k+1} exists such that \beta_{k+1}\cdot\mathcal{C}_{k}\subset\mathbf{L}^{V_{k}}_{\alpha_{k}} then Choose \mathcal{A}_{k+1}\subset\mathcal{A}_{k} Accept \beta_{k+1} and \mathcal{X}_{k+1}=\beta_{k+1}\cdot\mathcal{C}_{k} \mathcal{P}\leftarrow\mathcal{X}_{k+1}\setminus\mathcal{A}_{k+1} end if end while Algorithm 1 comes with a certification result, which we state in Theorem 1 . Theorem 1 . Let \mathcal{X}=\mathcal{X}_{0}\supset\mathcal{X}_{1}\supset\ldots\supset\mathcal{X}_{K} , \mathcal{A}=\mathcal{A}_{0}\supset\mathcal{A}_{1}\supset\ldots\supset\mathcal{A}_{K} , \mathcal{D}=\mathcal{D}_{0},\ldots,\mathcal{D}_{K} defining ambient sets, prior attracted sets and datasets of instances of problem ( 3 ). Let V_{0},\ldots,V_{K} be the patchy PWA Lyapunov candidates associated to feasible solutions of the corresponding problem instances, with uncertified regions \mathcal{C}_{0},\ldots,\mathcal{C}_{K} and levels \alpha_{0},\ldots,\alpha_{K} (in particular, \forall k\in\{0,\ldots,K\} , \mathbf{L}^{V_{k}}_{\alpha_{k}}\subset\mathcal{X}_{k} ). Suppose that: • \forall k\in\{1,\ldots,K\} , \mathcal{C}_{k-1}\subset\mathbf{L}^{V_{k}}_{\alpha_{k}}\subset\mathcal{X}_{k}\subset\mathbf{L}^{V_{k-1}}_{\alpha_{k-1}} • \mathcal{C}_{K}=\mathcal{A}_{K} (no non-negative slack variable) or \mathcal{C}_{K}\subset\mathcal{A}_{0} Then, \mathbf{L}^{V_{0}}_{\alpha_{0}} is attracted to 0 along the unknown dynamics, i.e. V_{0}(x(0))\leq\alpha_{0}\quad\Longrightarrow\quad x(t)\underset{t\to\infty}{\longrightarrow}0. (8) Proof. Suppose that K=0 . Then, \mathcal{C}_{0}=\mathcal{A}_{0} i.e. all slack variables in problem ( 3 ) are negative, and [ 13 , Theorem 8] ensures that ( 8 ) holds. Suppose that V_{k}(x(0))\leq\alpha_{k}\Longrightarrow\lim_{t\to\infty}x(t)=0 . Then, since \mathcal{C}_{k-1}\subset\mathbf{L}^{V_{k}}_{\alpha_{k}}\subset\mathcal{X}_{k-1} and V_{k-1} is a feasible solution for problem ( 3 ), \nabla V_{k-1}(x)^{\top}f(x)<0 is certified for all x\in\mathcal{X}_{k-1}\setminus\mathbf{L}^{V_{k}}_{\alpha_{k}} and according to [ 13 , Proposition 6] , it holds V_{k-1}(x(0))\leq\alpha_{k-1}\Longrightarrow\lim_{t\to\infty}x(t)=0 . By induction, since \mathbf{L}^{V_{0}}_{\alpha_{0}}\supset\mathbf{L}^{V_{1}}_{\alpha_{1}}\supset\ldots\supset\mathbf{L}^{V_{K}}_{\alpha_{K}} , it is therefore enough to prove that V_{K}(x(0))\leq\alpha_{K}\Longrightarrow\lim_{t\to\infty}x(t)=0, which is done by noticing that, since \mathcal{C}_{K}\subset\mathcal{A}_{0} (because \mathcal{C}_{K}\subseteq\mathcal{A}_{k}\subset\mathcal{A}_{0} ), \nabla V_{K}(x)^{\top}f(x)<0 is certified for all x\in\mathcal{X}_{K}\cap(\mathcal{X}_{0}\setminus\mathcal{A}_{0}) and by reusing [ 13 , Proposition 6] . ∎ 3.2 Implementation and practical challenges In [ 13 ] , the last algorithm proposed (Algorithm 3) bears some similarity to our proposed Algorithm 1 as it is also an iterative approach, but they are fundamentally different. In [ 13 , Algorithm 3] , the iterations start from the smallest region to the largest to build one continuous Lyapunov function covering the union of the areas. It also stops if it cannot generate a certified Lyapunov function in the region. Our algorithm, on the other hand, starts from the global region and certifies a region of attraction towards an inner region. If the inner region is not included in \mathcal{A} , it repeats the same step while covering smaller and smaller areas in each iteration. The goal is not to build a global Lyapunov function, but to prove the region’s attraction iteratively by constructing patchy Lyapunov functions in the region such that each function defines an invariant set based on its sublevel set. To provide greater flexibility in the optimisation problem and ensure the validation of continuity constraints, all the tessellations are taken so that the cells are triangular. As for the dataset, considering that the region that proved difficult for the algorithm has data that can’t be informative enough for all the vertices, we include data from neighbouring areas outside of the tessellation until condition ( 4 ) is satisfied. Some data points are also taken on the vertices for even better coverage. 4 Numerical Results In this part, we present the implementation of the iterative method of the optimisation problem described in Algorithm 1 on the damped pendulum with the mathematical model ( 5 ). The tessellation used is ensured to contain a PWA Lyapunov function. We seek to retrieve the attractivity of the origin as the equilibrium in the chosen region using Lyapunov candidates computed from data measurements, ignoring the full model ( 5 ). It should be mentioned that even if the next simulation results shown are informed of the model solely in establishing the tessellation, a simulation that respects the assumption of the unavailability of the model at all times is also successful, albeit it needs more iterations. The results are shown for comparison in Figure 7 . For the first implementation, we use the parameters described in Table 1 such that the initial set \mathcal{X} is bounded by l_{\mathcal{X}} and the neighbourhood \mathcal{A} of the equilibrium point is bounded by l_{\mathcal{A}} . Table 1 : Initial optimization parameters Parameter Value l_{\mathcal{X}} [-1,1;-1,1] l_{\mathcal{A}} 0.1.l_{\mathcal{X}} \mu 5 M 2.5 The algorithm was coded using YALMIP and MPT3 toolboxes [ 16 , 17 ] , was run on a laptop with 32GB memory and AMD Ryzen 7 7735U, and the solver used was MOSEK. The problem was solved in five iterations. Figures 2 to 6 show the results of each iteration. (a) N_{d_{k}}=300 , N_{v_{k}}=252 (b) \alpha_{k}=111 Figure 2 : k=0 (a) N_{d_{k}}=349 , N_{v_{k}}=221 (b) \alpha_{k}=174 , \beta_{k}=1.98 Figure 3 : k=1 (a) N_{d_{k}}=346 , N_{v_{k}}=238 (b) \alpha_{k}=146 , \beta_{k}=2.26 Figure 4 : k=2 (a) N_{d_{k}}=348 , N_{v_{k}}=241 (b) \alpha_{k}=180 , \beta_{k}=1.8 Figure 5 : k=3 (a) N_{d_{k}}=370 , N_{v_{k}}=239 (b) \alpha_{k}=145 , \beta_{k}=2.32 Figure 6 : k=4 Each figure represents the results of an iteration k . The left sub-figure represents the Lyapunov function V_{k} solution of the optimisation problem. The right sub-figure represents the following: • in a dashed line the borders of \mathcal{X}_{k} ; • in a blue line the patchy region of attraction (delimited by the border of the level set \mathbf{L}^{V_{k}}_{\alpha_{k}} ); • in a faded blue line the border of the previous level set \mathbf{L}^{V_{k-1}}_{\alpha_{k-1}} ; • in red, the area \mathcal{C}_{k} that still needs to be certified; • in green the previous uncertified area \mathcal{C}_{k-1} ; • in orange the set \mathcal{A}_{k} ; • and in transparent yellow the set \mathcal{A}=\mathcal{A}_{0} . One can notice that the new level set \mathbf{L}^{V_{k}}_{\alpha_{k}} inside \mathcal{X}_{k} in each iteration k includes the region \mathcal{C}_{k-1} not certified by the Lyapunov candidate in the previous step, which is in line with the first condition of Theorem 1 : \mathcal{C}_{k-1}\subset\mathbf{L}^{V_{k}}_{\alpha_{k}}\subset\mathcal{X}_{k}\subset\mathbf{L}^{V_{k-1}}_{\alpha_{k-1}} . One can also see that \mathcal{C}_{k} covers less area than \mathcal{C}_{k-1} , hinting at algorithm convergence. \mathcal{C}_{4} in particular is small enough to validate the stopping criterion, which is the inclusion in \mathcal{A} , in line with the validation of the second condition of Theorem 1 : \mathcal{C}_{K}\subset\mathcal{A}=\mathcal{A}_{0} . The validation of the two conditions implies that the level set \mathbf{L}^{V_{0}}_{\alpha_{0}} is a region of attraction. Figure 7 shows the progression of the level sets from figures 2 to 6 over the iterations (from green to blue). All trajectories starting in an invariant set converge to the subset inside it. As for the last invariant set, the trajectories converge to \mathcal{A} and then to the equilibrium point. In grey dotted lines, we can see the level sets obtained from a completely data-driven simulation. It converged to \mathcal{A} successfully, albeit in one more iteration compared to the informed simulation above. This proves that it is possible to certify the attraction of the equilibrium point in the region without relying on the model, and that the choice of tessellation strongly influences the speed of convergence. Figure 7 : Graphical description of the relationship between the level sets’ boundaries obtained iteratively. The progression in terms of set inclusions illustrates the convergence of the proposed algorithm. 5 Conclusion The paper concentrates on the data-driven stability certification. It employs an optimisation-based technique to build a PWA Lyapunov function and, as a contribution, proves that iterative treatment of the regions to be analysed can provide an increased complexity of the tessellations in the areas where the data are informative on the dynamical evolution. Practically, the resulting certificates of convergence rely on patchy Lyapunov functions and the construction of regions of attraction is ordered in the sense of inclusion. Several directions remain open for future research. Considering data’s influence on the results, it would be interesting to consider some system trajectories as input instead of just independent data points. An essential next step is considering discrete and controlled systems to broaden the approach’s applicability.