• Keine Ergebnisse gefunden

Computation of approximate Koopman Operator

Im Dokument 1.1.1 LPV Model Predictive Control (Seite 118-121)

π‘₯> 𝑒> πœ“π‘›+π‘š+

1

π‘₯ 𝑒

... πœ“π‘›

πœ“

π‘₯ 𝑒

>

(6.7) an approximation of the model (6.4) is given by

π‘₯π‘˜+

1β‰ˆ 𝐾ˆΨ π‘₯π‘˜

π‘’π‘˜ (6.8)

where ˆ𝐾 = 𝐼𝑛 0

𝐾.

Note that, as expected, the system dynamics are linear in a lifted space spanned by the observ-ables, which are now treated as basis functions. In this way, nonlinearities can be captured by an appropriate choice ofΨ(·). This means that these functions play a crucial role in the accuracy of the approximated model, so their choice must be done with care. An often used choice applies to systems for which the structure of the dynamic equations is partially known, so that basis functions can be selected by picking some or all of the nonlinear functions of the underlying dynamical model, i.e. the R.H.S of (6.4). Alternatively, polynomial, Fourier, radial or any other standard basis functions can be used instead.

6.2 Computation of approximate Koopman Operator

There is only a limited number of applications for which an analytic Koopman operator can be computed. However, where the interest in Koopman operator theory lies, is in its capa-bility to discover nonlinear system dynamics using data-driven techniques. In this sense, the Koopman operator extends the Dynamic Mode Decomposition ([104]) approach to nonlinear systems. In this section, an algorithm to compute the Koopman operator is presented which is tailored for online-based learning, as opposed to system identification-like algorithms in which computational load is not critical.

Assume that a data-set Z = {𝑧𝑖, 𝑧+

𝑖}𝑖=0,1,···𝑃 is collected, where 𝑧𝑖 and𝑧+

𝑖 are consecutive data points. It is not necessary (indeed not even desired) for the data collected inZto correspond to a single trajectory, i.e. any two data pairs{{𝑧𝑖, 𝑧+

𝑖},{𝑧𝑖+

1, 𝑧+

𝑖+1}}need not be consecutive. In order to find the Koopman operator which better approximates (6.3) given a set of basis functions, an optimization problem is solved. The cost function can be chosen in several ways, in the present context a quadratic function of the approximation residual is used, i.e.

𝐽 = 1 2

π‘ƒβˆ’1

Γ•

𝑖=0

||Ξ¨(𝑧+

𝑖) βˆ’πΎΞ¨(𝑧𝑖) ||2.

Depending on the application, other choices might be more meaningful, for instance adding a sparsity-promoting 𝐿

1-regularization term [22] can be used in cases in which there is no prior knowledge about the system and a large number of basis functions are attempted in order to prioritize the most important ones. On the other hand, choosing a more complex cost function precludes to some extent an online-adaptive implementation and is, for this reason, not pursued in this thesis. A quadratic cost function is an attractive choice as it enables a closed-form solution and can therefore be efficiently implemented. In light of this, an analytic solution to the optimization problem can be obtained as follows: define the data matricesD,D+ ∈Rπ‘›πœ“Γ—π‘ƒ as

D = [Ξ¨(𝑧

0) Ξ¨(𝑧

1) Β· Β· Β·Ξ¨(𝑧𝑃)], D+ =[Ξ¨(𝑧+

0) Ξ¨(𝑧+

1) Β· Β· Β·Ξ¨(𝑧+

𝑃)]

obtained by stacking the basis functions corresponding to the collected data column-wise. Note that, according to the definition of𝑧and𝑧+,D+is just the time-shifted version ofD.

It can be shown that the cost function previously defined is equivalent to 𝐽 = 1

2

||D+βˆ’πΎD ||𝐹2 where||𝑋||𝐹 =p

Trace(𝑋𝑇𝑋)is the Frobenius norm. The optimization problem is therefore min

𝐾

1 2

||D+βˆ’πΎD ||2𝐹

which is unconstrained and has a differentiable cost function, therefore an analytic solution can be found by solving

πœ• 𝐽

πœ• 𝐾

=𝐾DD𝑇 βˆ’ D+D𝑇 =! 0π‘›πœ“Γ—π‘›πœ“ (6.9) for the minimizing𝐾, thus given by

𝐾DD𝑇 =D+D𝑇 𝐾 = 𝐴𝐺†

where the following matrices have been defined for convenience [124]1

𝐺 = 1 𝑃

DD𝑇 = 1 𝑃

𝑃

Γ•

𝑝=0

Ξ¨(𝑧𝑝)Ξ¨(𝑧𝑝)𝑇

𝐴= 1 𝑃

D+D𝑇 = 1 𝑃

𝑃

Γ•

𝑝=0

Ξ¨(𝑧+

𝑝)Ξ¨(𝑧𝑝)𝑇.

(6.10)

1The𝐺and𝐴matrices are normalized by the total number of collected data points𝑃. This is done to avoid large entries on the matrices which could result in numerical problems at implementation time.

6.2.1 Recursive Computation

An online solution of (6.9) using the definitions (6.10) would require the storage and update of the data vectorsD+,D. Whereas this is often done in many data-driven techniques, particularly those based on kernel methods [125], it has the clear disadvantage that memory allocation and limitation could represent a problem. Moreover, the computation would become increasingly demanding with the number of stored data points 𝑃. Alternatively, (6.10) could be expressed in a such way that incoming data is added to the model, without the need to explicitly recompute the previous outer products; this can be done by storing𝐺 , 𝐴∈Rπ‘›πœ“Γ—π‘›πœ“ andπ‘ƒβˆˆZβ‰₯0and at time stepπ‘˜ computing

𝑃+ =𝑃+1 𝐺+ = 1

𝑃+

(𝑃+βˆ’1)𝐺+Ξ¨(π‘§π‘˜βˆ’

1)Ξ¨(π‘§π‘˜βˆ’

1)>

𝐴+ = 1 𝑃+

(𝑃+βˆ’1)𝐴+Ξ¨(π‘§π‘˜)Ξ¨(π‘§π‘˜βˆ’

1)>

(6.11)

where+ is used to denote the updated variables. Using these definitions, the Koopman operator can be updated online with consistent and relatively low computational complexity, regardless of the number of data points that have been added to the, now fictitious, data setZ. Furthermore, memory allocation poses no limitation as the size of the matrices being stored (𝐺 , 𝐴, 𝑃) is constant.

Koopman Operator Update

Although as discussed above, adding new information to the model (in the form of data pairs {π‘§π‘˜βˆ’

1, π‘§π‘˜}) does not result in considerable computational burden, doing so at every time step is not advisable, as adding e.g. steady-state data-points which do not contribute to enrich the model, would indeed result in actual new information having diminished influence on updating the model (the weight 1/𝑃 of any new data point would make the effect negligible for large values of𝑃). For this reason, incoming state and input data need to be analyzed in some way to determine if they representnewinformation to enrich the model. There are several ways to do this, the one presented here is intuitive and easy to implement. The principle at the core is to

"learn" only if the current model disagrees (more than a certain threshold) with the observation.

To this end, assume the state and input at the previous β„Ž+1 time instants is stored in a vector πœ™=

π‘₯>

π‘˜βˆ’1 𝑒>

π‘˜βˆ’1 ... π‘₯>

π‘˜βˆ’β„Žβˆ’2 𝑒>

π‘˜βˆ’β„Žβˆ’2

>

, a decision whether to add the data pair {π‘§π‘˜βˆ’

1, π‘§π‘˜} to the model is made by comparing the maximum prediction error of the approximated system (6.8) within this time window. If this error is greater than a given threshold, the data point is added, i.e. add data point if

wherek Β· k∞is the vector infinity norm2. Note that any other norm may be used instead, however this choice offers the advantage that it is independent of the window length β„Žand it enables the use of physical insight to determine a suitable 𝜈 (i.e. an admissible error tolerance in physical units). Note that in equation (6.12), the state is computed recursively rather than by the linearity-exploiting formπ‘₯π‘˜ =[𝐼𝑛 0]πΎβ„ŽΞ¨(π‘§π‘˜βˆ’β„Žβˆ’

1), the reason for this is that the dynamic behavior of the input is not being discovered by the Koopman operator, so that the input trajectory is virtually exogenous.

Im Dokument 1.1.1 LPV Model Predictive Control (Seite 118-121)