This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Computationally Efficient Data-Driven Discovery and Linear Representation of Nonlinear Systems For Control

Madhur Tiwari,1 George Nehma1 and Bethany Lusch2 This research was funded in part by and used resources of the Argonne Leadership Computing Facility, which is a DOE Office of Science User Facility supported under Contract DE-AC02-06CH11357.1Madhur Tiwari and George Nehma are with the Department of Aerospace, Physics and Space Sciences, Florida Institute of Technology, 150 W University Blvd, Melbourne, FL, 32901 USA ([email protected], [email protected])2 Bethany Lusch is a computer scientist with Argonne Leadership Computing Facility, Argonne National Laboratory, 9700 S Cass Ave, Lemont, IL 60439 USA ([email protected])
Abstract

This work focuses on developing a data-driven framework using Koopman operator theory for system identification and linearization of nonlinear systems for control. Our proposed method presents a deep learning framework with recursive learning. The resulting linear system is controlled using a linear quadratic control. An illustrative example using a pendulum system is presented with simulations on noisy data. We show that our proposed method is trained more efficiently and is more accurate than an autoencoder baseline.

I Introduction

Linear dynamics are desirable for control due to the applicability of a rigorous control system toolkit to guarantee controllability, observability, and stability for dynamical systems. However, nearly all dynamical systems are inherently nonlinear and thus require linearization techniques or complex nonlinear state estimation and control. Traditional linearization techniques linearize around an operating point, only approximate for small time horizons, and require real-time or recursive techniques, which increase the computational burden and unpredictability of the system. Additionally, nonlinear state estimation and control techniques often cannot guarantee stability without making several assumptions.

Koopman theory, first proposed in 1931 [1], has gained traction over the last few years as a solution for linearizing nonlinear systems. In a nutshell, the theory states that the dynamics of a system can be described linearly by an infinite-dimensional Koopman operator; due to its infinite dimensions, for practical use, it is typically approximated using data-driven methods such as Extended Dynamic Mode Decomposition (EDMD) [2, 3, 4]. Constructing a feed-forward neural network (NN) with the EDMD makes it possible to find an approximate general Koopman operator linearization applicable to a region of state space. Another advantage of using a data-driven method is that it does not require system knowledge, and the nonlinear system can be completely unknown.

Recently, several works have focused on developing data-driven frameworks for linearization and system identification of nonlinear systems. Notably, Lusch et al. [4] presented a data-driven method for discovering Koopman eigenfunctions. A modified autoencoder was implemented for identifying nonlinear coordinates on which the dynamics are globally linear. However, the framework handles the continuous spectra with a generalization of Koopman representations, which makes the application of linear control non-trivial. Additionally, even though the models can accurately predict longer intervals than traditional linearization schemes, error propagation still compounds. Junker et al. [5] implemented the prediction step from [2] that reduced the propagation of the error by reevaluating the observable function at every time step through the extraction of the state vector. The authors applied their implementation to a simplified golf robot and produced highly accurate representations that strongly align with the nonlinear dynamics of the robot. They showed that the technique could correctly represent system properties such as stability, controllability, and observability.

In training any neural network, the amount of data that can be generated or gathered is an important factor in how successful the network will be in its prediction. [6] utilizes a deep neural network (DNN) to implement a real-time, online MPC in robotic simulations. Although proving successful in implementation, some shortcomings for some simulations were large training data requirements and the handling of non-Lipschitz terms. Gathering these large amounts of data, especially in real-world scenarios, could be lengthy and difficult, as seen in [7, 8, 9].

In [10], Xiao et al. investigated using a deep learning-based EDMD approach to constructing a set of observables able to linearize vehicle dynamics for an autonomous control approach. Compared to other neural network approaches, which often lack interpretability, this method proved to be significantly better at long-term prediction due to its novel, multi-step prediction loss function, similar to the loss function we implemented in this work. A similar example to the problem presented in this paper is the inverted pendulum case. In [11], the authors looked at inverting the pendulum on a cart and then comparing a traditional linearized model to that of a 4×44\times 4 and 16×1616\times 16-sized Koopman operator. Finding little improvement in the approximation with the larger, higher-dimensional operator was an interesting finding. The operators presented in [11] performed better than traditional linearization techniques for large-angle initial conditions for the pendulum. Zinage et al. [12] developed a learning-based controller using Lyapunov theory. The framework ensures stability. However, system knowledge is required for physics-inspired learning, and the autoencoder needs a large amount of training data.

To this end, the contributions we propose are three-fold: (1) an implementation of a feed-forward NN model for recursive learning of deep-Koopman (RLDK) that removes the necessity for a decoder, therefore improving computation speed, reducing complexity in the model and enhancing the efficiency for real-world use, (2) an implementation of a linear quadratic regulator (LQR) controller for the system to demonstrate the ability of the learned system to be controlled effectively, and (3) a demonstration that the RLDK learning framework is inherently robust to noisy training data as shown in later sections.

Section II provides background information regarding the Koopman operator and its derivation, EDMD and how it is used in the formulation of the Koopman operator, and finally, the neural network architecture used in our work. The pendulum problem used to verify this method is presented in Section III, followed by results and discussions. Section IV concludes this paper.

II Background and Theory

II-A Koopman Operator Theory

Koopman operator theory defines a way to transform any nonlinear dynamical system into an infinite-dimensional linear system [1]. Suppose we have an uncontrolled discrete-time nonlinear dynamical system defined as

xk+1=𝒇(xk),x_{k+1}=\boldsymbol{f}(x_{k}), (1)

where xknx_{k}\in\mathcal{M}\subset\mathbb{R}^{n} is the system state, kk is the time index, and 𝒇\boldsymbol{f} is the function that evolves the states through state space. We then define observables (unrelated to observability from control theory), which here are real-valued functions of the system state: g:ng:\mathbb{R}^{n}\rightarrow\mathbb{R}. The Koopman operator, 𝒦\mathcal{K}, is defined such that, for any observable function gg,

𝒦g=g𝒇,\mathcal{K}g=g\circ\boldsymbol{f}, (2)

where \circ is the composition operator. We can now apply this operator to the discrete-time system defined previously to arrive at:

𝒦g(xk)=g(𝒇(xk))=g(xk+1).\mathcal{K}g(x_{k})=g(\boldsymbol{f}(x_{k}))=g(x_{k+1}). (3)

Equation (3) shows that the Koopman operator propagates an observable function of any state, g(xk)g(x_{k}), to the next time step.

It is not practical to apply the infinite-dimensional operator, so several methods have been developed to select a useful finite-dimensional Koopman observable space [13, 3, 4, 10]. Since it is non-trivial to select a set of observable functions that span a Koopman invariant subspace, we use EDMD [14] to find finite-dimensional approximations of the Koopman operator. EDMD involves lifting time-series data x1,,xMx_{1},\dots,x_{M} into higher-dimensional space by selecting a set of observable functions and applying them to each xkx_{k}. Then, a linear matrix is fit to the higher-dimensional system. It is common to consider observable functions such as higher-order polynomials, radial basis functions, trigonometric functions, etc. [13, 15]. Note: in this work, we include the identity function g(x)=xg(x)=x as an observable function (see section II C). We refer readers to Brunton et al. [16] for an in-depth study of Koopman operator theory.

II-B Koopman with Control

In this work, deep neural networks (DNNs) are employed in conjunction with EDMD to approximate the Koopman operator in finite dimensions. First, rather than hand-selecting a set of observable functions, the DNN defines a set of observable functions. Then, the finite-dimensional approximation to the Koopman operator is calculated using least-squares regression (see Algorithm 1).

For a controlled system, the nonlinear dynamics are propagated with the following mathematical expression:

xk+1=𝒇(xk,uk),x_{k+1}=\boldsymbol{f}(x_{k},u_{k}), (4)

where xknx_{k}\in\mathbb{R}^{n} and ukpu_{k}\in\mathbb{R}^{p}. After lifting the states to higher dimensions with 𝚽\boldsymbol{\Phi}, we wish to find a linear input-output system representation

𝚽(xk+1)𝐊𝚽(xk)+𝐁𝐮k,\mathbf{\Phi}(x_{k+1})\approx\mathbf{K}\boldsymbol{\Phi}(x_{k})+\mathbf{B}\mathbf{u}_{k}, (5)

where the matrix 𝐊\mathbf{K} approximates the Koopman operator. This is analogous to 𝐀\mathbf{A} and 𝐁\mathbf{B}, the state transition and input matrices, respectively, in linear control systems. The goal of the deep learning framework (Fig. 1) is to learn NN observables/lifting functions and calculate the 𝐊\mathbf{K} and 𝐁\mathbf{B} matrices. We choose NN such that N>>nN>>n and define

𝚽(xk):=[xkϕ1(xk)ϕ2(xk)ϕN(xk)],\mathbf{\Phi}(\textbf{x}_{k}):=\begin{bmatrix}\textbf{x}_{k}\\ \phi_{1}(\textbf{x}_{k})\\ \phi_{2}(\textbf{x}_{k})\\ \vdots\\ \phi_{N}(\textbf{x}_{k})\end{bmatrix}, (6)

where ϕi:n,i=1,,N\mathbf{\phi}_{i}:\mathbb{R}^{n}\rightarrow\mathbb{R},i=1,...,N are the observable functions, which are defined by the DNN. Note that we concatenate the original states 𝐱k\mathbf{x}_{k} with the observables from the DNN. This helps in two ways: (1) the original states can be easily extracted from the observables for control (see below), and (2) there is no need for a decoder to extract the original, thus saving valuable computational resources. Currently, there is no method to dictate the size of NN that would guarantee the best balance between simplicity and accurate approximation of the system; therefore, in most cases, NN is chosen empirically through trial and error. Some work has been done to study the size NN to find controllable systems [12, 4]. In this work, DNNs are applied with EDMD to find the Koopman operator.

Refer to caption
Figure 1: Complete schematic of dynamic propagation of the states, including the control input. Note that a decoder is not needed.

To calculate the approximate Koopman operator 𝐊\mathbf{K} and the input matrix 𝐁\mathbf{B}, the time history of measurement data for MM steps is arranged into snapshot matrices. The first matrix, XX, is the state history from time k=1k=1 to k=M1k=M-1, whilst the second matrix, XX^{\prime} is the same state history, right shifted by one-time step:

X=[x1,x2,x3,,xM1]X=\begin{bmatrix}x_{1},x_{2},x_{3},\dots,x_{M-1}\end{bmatrix} (7)
X=[x2,x3,x4,,xM]X^{\prime}=\begin{bmatrix}x_{2},x_{3},x_{4},\dots,x_{M}\end{bmatrix} (8)

Mapping the measured states with observable functions leads to

𝚽(X)=[𝚽(x1),𝚽(x2),,𝚽(xM1)]\boldsymbol{\Phi}(X)=\begin{bmatrix}\boldsymbol{\Phi}(x_{1}),\boldsymbol{\Phi}(x_{2}),\dots,\boldsymbol{\Phi}(x_{M-1})\end{bmatrix} (9)
𝚽(X)=[𝚽(x2),𝚽(x3),,𝚽(xM)]\boldsymbol{\Phi}(X^{\prime})=\begin{bmatrix}\boldsymbol{\Phi}(x_{2}),\boldsymbol{\Phi}(x_{3}),\dots,\boldsymbol{\Phi}(x_{M})\end{bmatrix} (10)

Given the dataset, the matrices 𝐊\mathbf{K} and 𝐁\mathbf{B} can be found using least-sqaures

min𝚽(xk+1)(𝐊𝚽(xk)+𝐁uk)2.\min\sum\left\|\boldsymbol{\Phi}(x_{k+1})-\left(\mathbf{K}\mathbf{\Phi}\left(x_{k}\right)+\mathbf{B}u_{k}\right)\right\|^{2}. (11)

Applying the snapshot matrices of real data yields

𝚽(𝐗)𝐊𝚽(𝐗)+𝐁𝐔=[𝐊𝐁][𝚽(𝐗)𝐔];\mathbf{\Phi(X^{\prime})}\approx\mathbf{K}\mathbf{\Phi(X)}+\mathbf{B}\mathbf{U}=\begin{bmatrix}\mathbf{K}&\mathbf{B}\end{bmatrix}\begin{bmatrix}\mathbf{\Phi(X)}\\ \mathbf{U}\end{bmatrix}; (12)

therefore,

[𝐊𝐁]=𝚽(𝑿)[𝚽(𝐗)𝐔],\begin{bmatrix}\mathbf{K}&\mathbf{B}\end{bmatrix}=\boldsymbol{\Phi(X^{\prime})}\begin{bmatrix}\mathbf{\Phi(X)}\\ \mathbf{U}\end{bmatrix}^{\dagger}, (13)

where \dagger denotes the Moore-Penrose inverse of the matrix [17].

Because the Koopman operator calculated with least-squares is an approximation, as the observable functions do not span a Koopman invariant subspace, the predicted state is an approximation, which we denote with the ^\hat{} symbol:

𝚽^(xk+1)=𝐊𝚽^(xk)+𝐁𝐮k.\hat{\mathbf{\Phi}}(x_{k+1})=\mathbf{K}\hat{\mathbf{\Phi}}(x_{k})+\mathbf{B}\mathbf{u}_{k}. (14)

Now, we can extract the original states from the observables using a projection matrix 𝐏\mathbf{P} [5] yielding

xk+1=𝐏𝚽^(xk+1)with𝐏=[𝐈n,𝟎nxN],x_{k+1}=\mathbf{P}\hat{\mathbf{\Phi}}(x_{k+1})\;\text{with}\;\mathbf{P}=\begin{bmatrix}\mathbf{I}_{n},\mathbf{0}_{n\text{x}N}\end{bmatrix}, (15)

where 𝐈n\mathbf{I}_{n} is the nn x nn identity matrix and 𝟎nxN\mathbf{0}_{n\text{x}N} is the nxNn\;\text{x}\;N zero matrix. As shown in [5] and [2], the observable functions not spanning a Koopman invariant subspace leads to error accumulation over time, which can lead to misleading predictions. However, if the prediction is corrected at each time step, then this error can be mitigated. This correction is applied by extracting the estimated state variable x^k+1\hat{x}_{k+1} at each time step with Equation 15 and then reapplying the observables to the extracted state variable with Equation 6.

II-C Neural Network Architecture

One of the key improvements introduced in this paper is the use of a neural network with a recursive learning framework for learning the Koopman matrix to improve the training speed and reduce the time to predict the next step. Ultimately, more complex dynamical systems would inherently require more complex, larger Koopman operators in a higher dimensional lifted space, and the proposed architecture could facilitate that case.

As a baseline, we compare to an autoencoder, which is a type of NN architecture in which the output is the same as the input with an intermediate state in the middle that is “encoded.” Some of the most common uses of an autoencoder are in image compression, anomaly detection, and data denoising [18], where the encoder transforms the original data into the (generally compressed) encoded space, and the decoder reconstructs the original data from that encoded space. To use the autoencoder architecture with the Koopman operator, we encode the states into a higher dimensional lifted space with the encoder. One purpose of an autoencoder for Koopman operator theory is to recover the original states for control uses, which, in our case, is bypassed by concatenating the original states, as shown earlier.

Figure 1 shows the proposed architecture for the trained network with prediction and control in continuous time. Here, the given initial states pass through the DNN block to form the lifted states. The lifted states are then concatenated with original states 𝐱k\mathbf{x}_{k} to form the new set of observables 𝚽\mathbf{\Phi}. The states are propagated through the control block where 𝐀\mathbf{A} and 𝐁con\mathbf{B}_{con} are the continuous form of Koopman matrix 𝐊\mathbf{K} and 𝐁\mathbf{B} (see section III B). The predicted states then pass through the correction block, resulting in the original states’ extraction. The entire loop runs until the states are regulated.

The complete algorithm can be seen in Algorithm 1, and the full PyTorch code is on Github111https://github.com/tiwari-research-group/Koopman-Control-No-Decoder.

The NN is trained using traditional batch training with a custom loss function. The loss is calculated recursively by applying the mean squared error (MSE) and EDMD. The prediction loss function is given as

pred=1Ndk=1Nd𝚽^(xk+1)𝚽(xk+1)22.\mathcal{L}_{\text{pred}}=\frac{1}{N_{d}}\sum_{k=1}^{N_{d}}\left\|\hat{\boldsymbol{\Phi}}({x_{k+1}})-\mathbf{\Phi}({x_{k+1}})\right\|_{2}^{2}. (16)

Here 𝚽^(xk+1)\hat{\boldsymbol{\Phi}}({x_{k+1}}) is the predicted observable defined in Equation 14, where 𝐊\mathbf{K} and 𝐁\mathbf{B} are calculated recursively using the least-squares method as in Equation 13, and 𝚽(xk+1)\mathbf{\Phi}({x_{k+1}}) are the observables calculated using the true data.

The data generation pipeline for the batch training can be seen in Algorithm 2. It can be noted that to collect data, the system is excited using random control input (+1 or -1). Also, random Gaussian noise is added to the training data to test the effectiveness of the proposed framework.

Algorithm 1 Learning Koopman and Input Matrix
1:Input: X,Y,u training data, batch size bs,b_{s}, Epochmax
2:Method
3:for epoch in range(Epochmax) do
4:     for batch in range(number of batches) do
5:         Sample bsb_{s} from training, control and label data
6:            X={X0:k1i}i=1bs,Y={Y1:ki}i=1bsX=\{X^{i}_{0:k-1}\}^{b_{s}}_{i=1},Y=\{Y^{i}_{1:k}\}^{b_{s}}_{i=1}
7:            u={u0:k1i}i=1bsu=\{u^{i}_{0:k-1}\}^{b_{s}}_{i=1}
8:         Encode the training and label data and stack the
9:            original states onto the encoded states.
10:            Φx=[X;Φ(X)]T,Φy=[Y;Φ(Y)]T\Phi_{x}=[X;\Phi(X)]^{T},\Phi_{y}=[Y;\Phi(Y)]^{T}
11:         Compute the W,V matrices and their transposes.
12:            W=[Φx;u],V=ΦyW=[\Phi_{x};u],V=\Phi_{y}
13:         Use Least Squares to find the KB matrix and
14:            extract K and B from KB matrix.
15:            KB=VWT(WWT)KB=VW^{T}\cdot(WW^{T})^{\dagger}
16:         Compute the next state with the linear equation.
17:            Φ^x+1=KΦx+Bu\hat{\Phi}_{x+1}=K\Phi_{x}+Bu
18:         Apply the loss function \mathcal{L} using MSE
19:         Update the model weights and parameters with
20:            the Adam optimizer.
21:     end for
22:end for
23:Output: K and B matrices, trained DNN

II-D LQR Controller

An LQR controller is employed with the learned dynamics. The objective of the LQR controller is to regulate the states of a system through the use of a quadratic loss function. The loss function 𝒥\mathcal{J} is given by

𝒥=012[𝚽(x)T𝐐𝚽(x)+𝐮T𝐑𝐮]𝑑t,\mathcal{J}=\int_{0}^{\infty}\frac{1}{2}[\mathbf{\Phi}(x)^{T}\mathbf{Q\Phi}(x)+\mathbf{u}^{T}\mathbf{Ru}]dt, (17)

where 𝐐=[In×n..0...0...00000]RN×N\mathbf{Q}=\begin{bmatrix}I_{n\times n}&.&.&0\\ .&.&.&0\\ .&.&.&0\\ 0&0&0&0\end{bmatrix}\in R^{N\times N} and 𝐑=1\mathbf{R}=1 are the tuning matrices for states and control respectively. It can be noted that since the first nn rows of the observable 𝚽(x)\mathbf{\Phi}(x) are the states themselves, it is straightforward to weight the controllable states. The LQR control effort is given as

u(t)=KLQR𝚽(x).u(t)=-K_{LQR}\mathbf{\Phi}(x). (18)

This constant gain is found in MATLAB by calling the LQR function with the appropriate input variables. The trajectory of the LTI system can then easily be found by integrating it with the RK4 function. For purposes of control, we converted the Koopman matrix 𝐊\mathbf{K} and input matrix 𝐁\mathbf{B} in continuous form such that

𝐀=𝐊𝐈Δtand𝐁𝐜𝐨𝐧=𝐁Δt,\mathbf{A}=\frac{\mathbf{K-I}}{\Delta t}\ \ \text{and}\ \ \mathbf{B_{con}}=\frac{\mathbf{B}}{\Delta t}, (19)

where Δt\Delta t is the RK4 time step of 0.010.01 seconds.

III Simulation and Results

In this section, we present the simulation, results, and discussion of the proposed method. A comparison of the proposed methodology against a traditional architecture with an autoencoder-based framework is also presented.

III-A Simulation Setup

To demonstrate the applicability of our model, we have chosen to use the pendulum problem. It is a common example that is widely used due to its relatively simple yet nonlinear dynamics. The nonlinear state dynamics are given as follows:

[x1x2]=[θθ˙]\begin{bmatrix}x_{1}\\ x_{2}\end{bmatrix}=\begin{bmatrix}\theta\\ \dot{\theta}\end{bmatrix} (20)
x˙=[x1˙x2˙]=[x2glsin(x1)]\dot{x}=\begin{bmatrix}\dot{x_{1}}\\ \dot{x_{2}}\end{bmatrix}=\begin{bmatrix}x_{2}\\ -\frac{g}{l}sin(x_{1})\end{bmatrix} (21)

To generate training data, the pendulum dynamics were integrated for 2 seconds using a Runge-Kutta integrator, using random initial conditions within 2θ02-2\leq\theta_{0}\leq 2. For each initial condition, two data sets were created to provide the inputs and labels for the custom loss function. The first set, XX was the state history from time k=0k=0 to k=M1k=M-1, whilst the second set, XX^{\prime}, was the same state history, right shifted by one time step:

X=[x0,x1,x2,,xM1]\displaystyle X=\begin{bmatrix}x_{0},x_{1},x_{2},\dots,x_{M-1}\end{bmatrix}
X=[x1,x2,x3,,xM].\displaystyle X^{\prime}=\begin{bmatrix}x_{1},x_{2},x_{3},\dots,x_{M}\end{bmatrix}.

The training data is comprised of 8000 different random initial conditions. From this, 80% of the data is used in the training set, whilst 10% is used for the validation set and 10% is used as the test set. The duration for each initial condition is 2 seconds with a Δt=0.01\Delta t=0.01.

Algorithm 2 Data Generation for Noisy Data w/ Control
1:Input: Number of Initial Conditions, time step dtdt,
2:final time tft_{f}, data points dpdp, state length nxn_{x},
3:control input length mm.
4:Method
5:for num in range(number of Initial Conditions) do
6:     Generate random I.C with noise
7:      xinit=2torch.Tensor(2).uniform_(1,1)+x_{init}=2*torch.Tensor(2).uniform\_(-1,1)+
8:      (0.00010.5)np.random.normal(0,1,2)(0.0001**0.5)*np.random.normal(0,1,2)
9:     Declare the time vector for each I.C
10:      time=torch.linspace(0,tf,dp)time=torch.linspace(0,t_{f},dp)
11:     for t in time do
12:         Generate random control input
13:            uk=torch.Tensor(1).uniform_(1,1)u_{k}=torch.Tensor(1).uniform\_(-1,1)
14:         Save the current state in the X data array
15:         Integrate the current state using the dynamics
16:           and RK4 functions. Add noise to new state
17:            xk+1=rk4(pendfunc,t,xk,uk,dt)+x_{k+1}=rk4(pendfunc,t,x_{k},u_{k},dt)+
18:            (0.00010.5)np.random.normal(0,1,2)(0.0001**0.5)*np.random.normal(0,1,2)
19:         Save the new state in the Y data array.
20:     end for
21:     Stack the solutions, X,Y,u from the I.C. into 3D
22:      array that holds every trajectory for each I.C.
23:      datai=torch.vstack([datai,newi[None,:]])data_{i}=torch.vstack([data_{i},new_{i}[None,:]])
24:end for
25:Output: Data matrices, dataxdata_{x}, dataydata_{y}, dataudata_{u},
26:            input parameters.

The training data includes a random control effort of -1 or 1 to simulate the control effort that would be normally applied when deployed. This randomly excites the system and enables the extraction of the control input matrix 𝐁\mathbf{B}. Additionally, to check the robustness of the model, random Gaussian noise is added to each state to simulate sensor measurement noise. This is achieved by adding noise with the same standard deviation to each state at every integration time step with μ=0.0158\mu=0.0158 and σ=0.00913\sigma=0.00913. See Algorithm 2.

III-B Results and Discussions

In this subsection, we discuss the results of the proposed architecture. We also compare the performance of the proposed architecture with a traditional learning framework with an autoencoder. Figure 2 shows the prediction for only one step compared to the true dynamics. Figure 3 shows the prediction for 10 seconds, given only the initial states. It can be seen that learned dynamics closely follow true nonlinear dynamics. However, beyond 10 seconds, there is a significant divergence from the true dynamics, highlighting the limitations of the finite representation of the Koopman operator. The system response when subjected to LQR control is shown in Figure 4. It can be noted that other controllers such as a model predictive control can be employed in this case. Evident in Figure 5, the data that is used for the training of the DNN includes noise to mimic the inputs from a real-world sensor. As shown in the full prediction in Figure 3, the DNN learns to predict smoother dynamics than the noisy training data, shown in Figure 5. It can be seen in Figure 6 that the loss of both models observes the anticipated downward trend.

Refer to caption
Figure 2: Learned Koopman Operator dynamics prediction for only one time step in the future with comparison to the ground truth nonlinear dynamics.
Refer to caption
Figure 3: Learned, self-propagating dynamics prediction given only the same initial condition as the ground truth nonlinear dynamics
Refer to caption
Figure 4: System response to LQR Controller developed using the linear system created with the learned Koopman operator.
Refer to caption
Figure 5: Five random trajectories from the training set, highlighting the noise in the data.
Refer to caption
Figure 6: Training loss comparison between the autoencoder model and our proposed model. Our model immediately begins with a lower loss due to weight initialisation.

Figure 7 shows the 10 second comparison between the true dynamics, the proposed method, and the traditional autoencoder. It can be seen that the proposed model more closely follows the true dynamics. Figure 8 shows the absolute error between the true dynamics, the proposed method, and the traditional autoencoder solution. It can be noted that the proposed method is more accurate than the autoencoder framework. Additionally, the training time of our method was 30 seconds, and autoencoder training took 54 seconds. Therefore, the proposed method trains more efficiently than the traditional framework.

Refer to caption
Figure 7: Comparison of the learned dynamics between the model with autoencoder and the new model.
Refer to caption
Figure 8: Absolute Error (difference between prediction and truth) for our proposed solution and the autoencoder.

IV Conclusions

In this work, an updated framework for learning the Koopman operator with control is proposed. It was found that the proposed method is more computationally efficient and accurate than the baseline Koopman learning architecture with an autoencoder. The proposed method is tested in simulation on a pendulum problem with LQR control, and it was seen that the method is able to closely follow the true nonlinear dynamics for at least 10 seconds. Future work involves testing and verifying the framework for complex systems with experimental data. Furthermore, ensuring the stability of the learning and control with further testing against noisy and impartial data is another topic of future study.

References

  • [1] B. O. Koopman, “Hamiltonian systems and transformation in hilbert space,” Proceedings of the National Academy of Sciences, vol. 17, no. 5, pp. 315–318, 1931.
  • [2] M. Korda and I. Mezić, “Linear predictors for nonlinear dynamical systems: Koopman operator meets model predictive control,” Automatica, vol. 93, pp. 149–160, jul 2018.
  • [3] S. L. Brunton, B. W. Brunton, J. L. Proctor, and J. N. Kutz, “Koopman invariant subspaces and finite linear representations of nonlinear dynamical systems for control,” PLoS One, vol. 11, p. e0150171, Feb. 2016.
  • [4] B. Lusch, J. N. Kutz, and S. L. Brunton, “Deep learning for universal linear embeddings of nonlinear dynamics,” Nature Communications, vol. 9, Nov 2018.
  • [5] A. Junker, J. Timmermann, and A. Trachtler, “Data-driven models for control engineering applications using the koopman operator,” in 2022 3rd International Conference on Artificial Intelligence, Robotics and Control (AIRC), IEEE, may 2022.
  • [6] J. Zhang and H. Wang, “Online model predictive control of robot manipulator with structured deep koopman model,” IEEE Robotics and Automation Letters, vol. 8, no. 5, pp. 3102–3109, 2023.
  • [7] J. Zhan, Z. Ma, and L. Zhang, “Data-driven modeling and distributed predictive control of mixed vehicle platoons,” IEEE Transactions on Intelligent Vehicles, vol. 8, no. 1, pp. 572–582, 2023.
  • [8] W. A. Manzoor, S. Rawashdeh, and A. Mohammadi, “Vehicular applications of koopman operator theory—a survey,” IEEE Access, vol. 11, pp. 25917–25931, 2023.
  • [9] J. S. Kim, Y. S. Quan, and C. C. Chung, “Data-driven modeling and control for lane keeping system of automated driving vehicles: Koopman operator approach,” in 2022 22nd International Conference on Control, Automation and Systems (ICCAS), pp. 1049–1055, 2022.
  • [10] Y. Xiao, X. Zhang, X. Xu, X. Liu, and J. Liu, “Deep neural networks with koopman operators for modeling and control of autonomous vehicles,” IEEE Transactions on Intelligent Vehicles, vol. 8, no. 1, pp. 135–146, 2023.
  • [11] J. Leventides, E. Melas, and C. Poulios, “Koopman operators and extended dynamic mode decomposition for the inverted pendulum,” in 2022 4th International Conference on Industrial Artificial Intelligence (IAI), pp. 1–6, 2022.
  • [12] V. Zinage and E. Bakolas, “Neural koopman lyapunov control,” Neurocomputing, vol. 527, pp. 174–183, Mar. 2023.
  • [13] I. Mezić, “Spectral properties of dynamical systems, model reduction and decompositions,” Nonlinear Dyn., vol. 41, pp. 309–325, Aug. 2005.
  • [14] M. O. Williams, I. G. Kevrekidis, and C. W. Rowley, “A Data–Driven approximation of the koopman operator: Extending dynamic mode decomposition,” J. Nonlinear Sci., vol. 25, pp. 1307–1346, Dec. 2015.
  • [15] C. Folkestad, D. Pastor, I. Mezic, R. Mohr, M. Fonoberova, and J. Burdick, “Extended dynamic mode decomposition with learned koopman eigenfunctions for prediction and control,”
  • [16] S. L. Brunton, M. Budišić, E. Kaiser, and J. N. Kutz, “Modern koopman theory for dynamical systems,” 2021.
  • [17] R. Penrose, “A generalized inverse for matrices,” Mathematical Proceedings of the Cambridge Philosophical Society, vol. 51, no. 3, p. 406–413, 1955.
  • [18] P. Li, Y. Pei, and J. Li, “A comprehensive survey on design and application of autoencoder in deep learning,” Applied Soft Computing, vol. 138, p. 110176, 2023.