28
Learning Lagrangian Dynamics Clancy Rowley Joint work with Mohamadreza Ahmadi and Ufuk Topcu (UT Austin)

Learning Lagrangian dynamics

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Learning Lagrangian dynamics

Learning Lagrangian Dynamics

Clancy Rowley

Joint work withMohamadreza Ahmadi and Ufuk Topcu (UT Austin)

Page 2: Learning Lagrangian dynamics

Overview

I Many mechanical systems are described by Lagrangiandynamics

I Properties of the Lagrangian (e.g., symmetries) lead tophysical properties of the system (e.g., conservation laws)

IdeaI Instead of learning the dynamics directly, learn the LagrangianI Known symmetries (a type of side information) can be

incorporated, and the models obtained will therefore respectconservation laws (e.g., energy, momentum, angularmomentum)

2 / 16

Page 3: Learning Lagrangian dynamics

Overview

I Many mechanical systems are described by Lagrangiandynamics

I Properties of the Lagrangian (e.g., symmetries) lead tophysical properties of the system (e.g., conservation laws)

IdeaI Instead of learning the dynamics directly, learn the LagrangianI Known symmetries (a type of side information) can be

incorporated, and the models obtained will therefore respectconservation laws (e.g., energy, momentum, angularmomentum)

2 / 16

Page 4: Learning Lagrangian dynamics

Lagrangian dynamicsI Consider a 2n dimensional state space with variables

q = (q1, . . . , qn) (“positions”) and q = (q1, . . . , qn)(“velocities”).

I Define a real-valued function L(q, q).I The corresponding dynamics are given by the Euler-Lagrange

equations:d

dt

(∂L

∂qi

)− ∂L

∂qi= 0, i = 1, . . . , n.

I For mechanical systems, the Lagrangian is kinetic energyminus potential energy:

L(q, q) =12qTMq − V (q)

I The corresponding equations are equivalent to Newton’sequations:

d

dtMq = −∇V (q),

where the force is −∇V .

3 / 16

Page 5: Learning Lagrangian dynamics

Lagrangian dynamicsI Consider a 2n dimensional state space with variables

q = (q1, . . . , qn) (“positions”) and q = (q1, . . . , qn)(“velocities”).

I Define a real-valued function L(q, q).I The corresponding dynamics are given by the Euler-Lagrange

equations:d

dt

(∂L

∂qi

)− ∂L

∂qi= 0, i = 1, . . . , n.

I For mechanical systems, the Lagrangian is kinetic energyminus potential energy:

L(q, q) =12qTMq − V (q)

I The corresponding equations are equivalent to Newton’sequations:

d

dtMq = −∇V (q),

where the force is −∇V .

3 / 16

Page 6: Learning Lagrangian dynamics

Lagrangian dynamicsI Consider a 2n dimensional state space with variables

q = (q1, . . . , qn) (“positions”) and q = (q1, . . . , qn)(“velocities”).

I Define a real-valued function L(q, q).I The corresponding dynamics are given by the Euler-Lagrange

equations:d

dt

(∂L

∂qi

)− ∂L

∂qi= 0, i = 1, . . . , n.

I For mechanical systems, the Lagrangian is kinetic energyminus potential energy:

L(q, q) =12qTMq − V (q)

I The corresponding equations are equivalent to Newton’sequations:

d

dtMq = −∇V (q),

where the force is −∇V .3 / 16

Page 7: Learning Lagrangian dynamics

Learning Lagrangians versus learning dynamics

Suppose the dynamics of a system are given by

x = f (x),

where x = (q, q) is the state.

I One approach to learning is to use data (e.g., samples ofx(ti )) to try to find the function f : R2n → R2n.

I If the dynamics come from a Lagrangian L(q, q), then adifferent approach is to use data to try to find the LagrangianL : R2n → R.

I Here we take the latter approach.

4 / 16

Page 8: Learning Lagrangian dynamics

Learning Lagrangians versus learning dynamics

Suppose the dynamics of a system are given by

x = f (x),

where x = (q, q) is the state.

I One approach to learning is to use data (e.g., samples ofx(ti )) to try to find the function f : R2n → R2n.

I If the dynamics come from a Lagrangian L(q, q), then adifferent approach is to use data to try to find the LagrangianL : R2n → R.

I Here we take the latter approach.

4 / 16

Page 9: Learning Lagrangian dynamics

Learning Lagrangians versus learning dynamics

Suppose the dynamics of a system are given by

x = f (x),

where x = (q, q) is the state.

I One approach to learning is to use data (e.g., samples ofx(ti )) to try to find the function f : R2n → R2n.

I If the dynamics come from a Lagrangian L(q, q), then adifferent approach is to use data to try to find the LagrangianL : R2n → R.

I Here we take the latter approach.

4 / 16

Page 10: Learning Lagrangian dynamics

Why?

Why would we want to do this?

5 / 16

Page 11: Learning Lagrangian dynamics

SymmetriesI Symmetries are a type of side information. For instance, the

Lagrangian may be independent of a particular variable qj , orinvariant to the action of some group (e.g., rotations).

I For instance, suppose L(q, q) is independent of position qj (forsome j).

I Then the Euler-Lagrange equation for that variable isd

dt

∂L

∂qj= 0,

so the “generalized momentum” ∂L/∂qj is conserved.

I Emmy Noether showed that a similar result holds forsymmetries described by arbitrary Lie groups.

IdeaI If there are known symmetries, incorporate these as “side

information”.I The resulting models will then automatically satisfy the

corresponding conservation laws.

6 / 16

Page 12: Learning Lagrangian dynamics

SymmetriesI Symmetries are a type of side information. For instance, the

Lagrangian may be independent of a particular variable qj , orinvariant to the action of some group (e.g., rotations).

I For instance, suppose L(q, q) is independent of position qj (forsome j).

I Then the Euler-Lagrange equation for that variable isd

dt

∂L

∂qj= 0,

so the “generalized momentum” ∂L/∂qj is conserved.I Emmy Noether showed that a similar result holds for

symmetries described by arbitrary Lie groups.

IdeaI If there are known symmetries, incorporate these as “side

information”.I The resulting models will then automatically satisfy the

corresponding conservation laws.

6 / 16

Page 13: Learning Lagrangian dynamics

SymmetriesI Symmetries are a type of side information. For instance, the

Lagrangian may be independent of a particular variable qj , orinvariant to the action of some group (e.g., rotations).

I For instance, suppose L(q, q) is independent of position qj (forsome j).

I Then the Euler-Lagrange equation for that variable isd

dt

∂L

∂qj= 0,

so the “generalized momentum” ∂L/∂qj is conserved.I Emmy Noether showed that a similar result holds for

symmetries described by arbitrary Lie groups.

IdeaI If there are known symmetries, incorporate these as “side

information”.I The resulting models will then automatically satisfy the

corresponding conservation laws.6 / 16

Page 14: Learning Lagrangian dynamics

Problem setup for learning Lagrangians

We will assume the dynamics satisfy Euler-Lagrange equations ofthe form

d

dt

(∂L

∂q

)− ∂L

∂q= B(q)u.

I u(t) is a control input, which we get to chooseI B(q) is knownI The function L(q, q) is unknown, and we will try to determine

it from data.

7 / 16

Page 15: Learning Lagrangian dynamics

Learning Lagrangians from data

t

q(t), q(t)

q(0)

q(0)

q(tN )

q(tN )

I The goal is to learn L(q, q) given data{ti , u(ti ), q(ti ), q(ti ), q(ti )}Ni=1.

I Parameterize the Lagrangian:

L(q, q) =d∑

i=1

αiϕi (q, q),

for given basis functions ϕi (e.g., monomials)I Find constants αi that best fit the data.I One can then predict the future evolution from E-L equations.

8 / 16

Page 16: Learning Lagrangian dynamics

Learning Lagrangians from data

t

q(t), q(t)

q(0)

q(0)

q(tN )

q(tN )

I The goal is to learn L(q, q) given data{ti , u(ti ), q(ti ), q(ti ), q(ti )}Ni=1.

I Parameterize the Lagrangian:

L(q, q) =d∑

i=1

αiϕi (q, q),

for given basis functions ϕi (e.g., monomials)

I Find constants αi that best fit the data.I One can then predict the future evolution from E-L equations.

8 / 16

Page 17: Learning Lagrangian dynamics

Learning Lagrangians from data

t

q(t), q(t)

q(0)

q(0)

q(tN )

q(tN )

I The goal is to learn L(q, q) given data{ti , u(ti ), q(ti ), q(ti ), q(ti )}Ni=1.

I Parameterize the Lagrangian:

L(q, q) =d∑

i=1

αiϕi (q, q),

for given basis functions ϕi (e.g., monomials)I Find constants αi that best fit the data.I One can then predict the future evolution from E-L equations. 8 / 16

Page 18: Learning Lagrangian dynamics

Two warnings

1. Different Lagrangians can lead to the same dynamics2. If L(q, q) = 0, the Euler-Lagrange equations are trivially

satisfied for any data.

We take steps to find a particular (non-trivial) Lagrangian whosecorresponding dynamics agree with the data.For details, see paper (M. Ahmadi, U. Topcu, C. Rowley, ACC2018).

9 / 16

Page 19: Learning Lagrangian dynamics

Two warnings

1. Different Lagrangians can lead to the same dynamics2. If L(q, q) = 0, the Euler-Lagrange equations are trivially

satisfied for any data.

We take steps to find a particular (non-trivial) Lagrangian whosecorresponding dynamics agree with the data.For details, see paper (M. Ahmadi, U. Topcu, C. Rowley, ACC2018).

9 / 16

Page 20: Learning Lagrangian dynamics

Example: forced Duffing equation

q

A cos(ωt)

N/SN/S

beam

magnet magnet

rigid frame

10 / 16

Page 21: Learning Lagrangian dynamics

Results: forced Duffing equation

q

A cos(ωt)

N/SN/S

beam

magnet magnet

rigid frame

0 5 10 15 20 25 30Time (s)

-10

-5

0

5

10

11 / 16

Page 22: Learning Lagrangian dynamics

Example: Acrobot

m1, I1

m2, I2

q1

q2

l1

l2

u

x

y

12 / 16

Page 23: Learning Lagrangian dynamics

Results: Acrobot

m1, I1

m2, I2

q1

q2

l1

l2

u

x

y

13 / 16

Page 24: Learning Lagrangian dynamics

Results: Acrobot

m1, I1

m2, I2

q1

q2

l1

l2

u

x

y

6 8 10 12 14 16

Time (s)

-8

-6

-4

-2

0

2

4

6

8

q1

q1

q1

ˆq1

14 / 16

Page 25: Learning Lagrangian dynamics

Results: Acrobot

m1, I1

m2, I2

q1

q2

l1

l2

u

x

y

15 / 16

Page 26: Learning Lagrangian dynamics

Summary and future work

I Instead of learning dynamics directly (x = f (x)), we learn aLagrangian L(q, q).

I This provides a way to incorporate physics into learning.I For instance, known symmetries (a type of side information)

lead to conservation laws.I The method works for some simple examples of mechanical

systems, for which it is known how the control input enters.

I Ufuk and his team have a way of quantifying uncertainty, andusing barrier certificates for safety verification and safecontroller synthesis thanks to sum-of-squares programming.

I In the future, we want to try these methods on more complexexamples, with known symmetries, for which it is not knownhow the control enters.

16 / 16

Page 27: Learning Lagrangian dynamics

Summary and future work

I Instead of learning dynamics directly (x = f (x)), we learn aLagrangian L(q, q).

I This provides a way to incorporate physics into learning.I For instance, known symmetries (a type of side information)

lead to conservation laws.I The method works for some simple examples of mechanical

systems, for which it is known how the control input enters.

I Ufuk and his team have a way of quantifying uncertainty, andusing barrier certificates for safety verification and safecontroller synthesis thanks to sum-of-squares programming.

I In the future, we want to try these methods on more complexexamples, with known symmetries, for which it is not knownhow the control enters.

16 / 16

Page 28: Learning Lagrangian dynamics

Summary and future work

I Instead of learning dynamics directly (x = f (x)), we learn aLagrangian L(q, q).

I This provides a way to incorporate physics into learning.I For instance, known symmetries (a type of side information)

lead to conservation laws.I The method works for some simple examples of mechanical

systems, for which it is known how the control input enters.

I Ufuk and his team have a way of quantifying uncertainty, andusing barrier certificates for safety verification and safecontroller synthesis thanks to sum-of-squares programming.

I In the future, we want to try these methods on more complexexamples, with known symmetries, for which it is not knownhow the control enters.

16 / 16