Control Synthesis by Sum of Squares Optimization

56
Control Synthesis by Sum of Squares Optimization An Introduction Behzad Samadi [email protected] Concordia University Montreal, Canada

description

 

Transcript of Control Synthesis by Sum of Squares Optimization

Page 1: Control Synthesis by Sum of Squares Optimization

Control Synthesis by Sum ofSquares Optimization

An Introduction

Behzad Samadi

[email protected]

Concordia University

Montreal, Canada

Page 2: Control Synthesis by Sum of Squares Optimization

Outline

◮ Convex Optimization

▽Control Synthesis by Sum of Squares Optimization – p.1/30

Page 3: Control Synthesis by Sum of Squares Optimization

Outline

◮ Convex Optimization

◮ Sum of Squares

▽Control Synthesis by Sum of Squares Optimization – p.1/30

Page 4: Control Synthesis by Sum of Squares Optimization

Outline

◮ Convex Optimization

◮ Sum of Squares

◮ Control Applications

▽Control Synthesis by Sum of Squares Optimization – p.1/30

Page 5: Control Synthesis by Sum of Squares Optimization

Outline

◮ Convex Optimization

◮ Sum of Squares

◮ Control Applications

◮ Conclusion

Control Synthesis by Sum of Squares Optimization – p.1/30

Page 6: Control Synthesis by Sum of Squares Optimization

Convex set

C ⊆ Rn is convex if

x, y ∈ C, θ ∈ [0, 1] =⇒ θx + (1 − θ)y ∈ C

"Convex Optimization with Engineering Applications", Professor Stephan Boyd, Stanford University

Control Synthesis by Sum of Squares Optimization – p.2/30

Page 7: Control Synthesis by Sum of Squares Optimization

Convex function

f : Rn −→ R is convex if

x, y ∈ Rn, θ ∈ [0, 1]

⇓f(θx + (1 − θ)y) ≤ θf(x) + (1 − θ)f(y)

"Convex Optimization with Engineering Applications", Professor Stephan Boyd, Stanford University

Control Synthesis by Sum of Squares Optimization – p.3/30

Page 8: Control Synthesis by Sum of Squares Optimization

Convex optimization problem

minimize f(x)

subject to x ∈ C

f convex, C convex

"Convex Optimization with Engineering Applications", Professor Stephan Boyd, Stanford University

▽Control Synthesis by Sum of Squares Optimization – p.4/30

Page 9: Control Synthesis by Sum of Squares Optimization

Convex optimization problem

minimize f(x)

subject to x ∈ C

f convex, C convex

Convex optimization problems

◮ can be solved numerically with great efficiency

◮ have extensive useful theory

◮ occur often in engineering problems

◮ often go unrecognized

"Convex Optimization with Engineering Applications", Professor Stephan Boyd, Stanford University

Control Synthesis by Sum of Squares Optimization – p.4/30

Page 10: Control Synthesis by Sum of Squares Optimization

Linear programming

minimize aT0 x

subject to aTi x ≤ bi, i = 1, . . . ,m.

"Convex Optimization with Engineering Applications", Professor Stephan Boyd, Stanford University

Control Synthesis by Sum of Squares Optimization – p.5/30

Page 11: Control Synthesis by Sum of Squares Optimization

Semidefinite programming

minimize cT x

subject to x1F1 + · · · + xnFn + G ≤ 0

Ax = b,

"Convex Optimization with Engineering Applications", Professor Stephan Boyd, Stanford University

Control Synthesis by Sum of Squares Optimization – p.6/30

Page 12: Control Synthesis by Sum of Squares Optimization

In fact the great watershed inoptimization isn’t betweenlinearity and nonlinearity ,

butconvexityand nonconvexity.

Rockafellar 1993

Control Synthesis by Sum of Squares Optimization – p.7/30

Page 13: Control Synthesis by Sum of Squares Optimization

Nonnegativity of polynomialsPolynomials of degree d in n variables:

p(x) , p(x1, x2, . . . , xn) =∑

k1+k2+···+kn≤d

ak1k2...knxk1

1xk2

2· · ·xkn

n

▽Control Synthesis by Sum of Squares Optimization – p.8/30

Page 14: Control Synthesis by Sum of Squares Optimization

Nonnegativity of polynomialsPolynomials of degree d in n variables:

p(x) , p(x1, x2, . . . , xn) =∑

k1+k2+···+kn≤d

ak1k2...knxk1

1xk2

2· · ·xkn

n

How to check if a given p(x) (of even order) is globallynonnegative?

p(x) ≥ 0,∀x ∈ Rn

▽Control Synthesis by Sum of Squares Optimization – p.8/30

Page 15: Control Synthesis by Sum of Squares Optimization

Nonnegativity of polynomialsPolynomials of degree d in n variables:

p(x) , p(x1, x2, . . . , xn) =∑

k1+k2+···+kn≤d

ak1k2...knxk1

1xk2

2· · ·xkn

n

How to check if a given p(x) (of even order) is globallynonnegative?

p(x) ≥ 0,∀x ∈ Rn

◮ For d = 2, easy (check eigenvalues). What happensin generel?

◮ Decidable, but NP-hard when d ≥ 4.

◮ "Low complexity" is desired at the cost of possiblybeing conservative.

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.8/30

Page 16: Control Synthesis by Sum of Squares Optimization

A sufficient conditionA "simple" sufficient condition: a sum of squares (SOS)decomposition:

p(x) =m

i=1

f2i (x)

If p(x) can be written as above, for some polynomials fi,then p(x) ≥ 0.

▽Control Synthesis by Sum of Squares Optimization – p.9/30

Page 17: Control Synthesis by Sum of Squares Optimization

A sufficient conditionA "simple" sufficient condition: a sum of squares (SOS)decomposition:

p(x) =m

i=1

f2i (x)

If p(x) can be written as above, for some polynomials fi,then p(x) ≥ 0.

◮ p(x) is an SOS if and only if a positive semidefinitematrix Q exists such that

p(x) = ZT (x)QZ(x)

where Z(x) is the vector of monomials of degree lessthan or equal to deg(p)/2

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.9/30

Page 18: Control Synthesis by Sum of Squares Optimization

Examplep(x, y) = 2x4 + 5y4 − x2y2 + 2x3y

=

x2

y2

xy

T

q11 q12 q13

q21 q22 q23

q13 q23 q33

x2

y2

xy

= q11x4 + q22y

4 + (q33 + 2q12)x2y2 + 2q13x

3y + 2q23xy3

An SDP with equality constraints.

▽Control Synthesis by Sum of Squares Optimization – p.10/30

Page 19: Control Synthesis by Sum of Squares Optimization

Examplep(x, y) = 2x4 + 5y4 − x2y2 + 2x3y

=

x2

y2

xy

T

q11 q12 q13

q21 q22 q23

q13 q23 q33

x2

y2

xy

= q11x4 + q22y

4 + (q33 + 2q12)x2y2 + 2q13x

3y + 2q23xy3

An SDP with equality constraints. Solving, we obtain:

Q =

2 −3 1

−3 5 0

1 0 5

= LT L, L =

1√2

[

2 −3 1

0 1 3

]

And therefore p(x, y) = 1

2(2x2 − 3y2 + xy)2 + 1

2(y2 + 3xy)2.

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.10/30

Page 20: Control Synthesis by Sum of Squares Optimization

Sum of squares programming

A sum of squares program is a convex optimizationprogram of the following form:

MinimizeJ

j=1

wjαj

subject to fi,0 +J

j=1

αjfi,j(x) is SOS, for i = 1, . . . , I

where the αj ’s are the scalar real decision variables, thewj ’s are some given real numbers, and the fi,j are somegiven multivariate polynomials.

"Nonlinear control synthesis by sum of squares optimization: a Lyapunov-based approach", Stephen Prajna et al, ASCC 2004

Control Synthesis by Sum of Squares Optimization – p.11/30

Page 21: Control Synthesis by Sum of Squares Optimization

SOSTOOLS: Sum of squares toolbox

◮ SOSTOOLS handles the general SOS programming.

◮ MATLAB toolbox, freely available.

◮ Requires SeDuMi (a freely available SDP solver).

◮ Natural syntax, efficient implementation

◮ Developed by S. Prajna, A. Papachristodoulou and P.Parrilio

◮ Includes customized functions for several problems

Get it from:http://www.aut.ee.ethz.ch/~parrilo/sostoolshttp://www.cds.caltech.edu/sostools

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.12/30

Page 22: Control Synthesis by Sum of Squares Optimization

Global optimizationConsider for example:

minx,y

F (x, y)

with F (x, y) = 4x2 − 21

10x4 + 1

3x6 + xy − 4y2 + 4y4

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.13/30

Page 23: Control Synthesis by Sum of Squares Optimization

Global optimization

◮ Not convex, many local minima. NP-Hard in general.

▽Control Synthesis by Sum of Squares Optimization – p.14/30

Page 24: Control Synthesis by Sum of Squares Optimization

Global optimization

◮ Not convex, many local minima. NP-Hard in general.

◮ Find the largest γ s.t.

F (x, y) − γ is SOS.

▽Control Synthesis by Sum of Squares Optimization – p.14/30

Page 25: Control Synthesis by Sum of Squares Optimization

Global optimization

◮ Not convex, many local minima. NP-Hard in general.

◮ Find the largest γ s.t.

F (x, y) − γ is SOS.

◮ A semidefinite program (convex!).

▽Control Synthesis by Sum of Squares Optimization – p.14/30

Page 26: Control Synthesis by Sum of Squares Optimization

Global optimization

◮ Not convex, many local minima. NP-Hard in general.

◮ Find the largest γ s.t.

F (x, y) − γ is SOS.

◮ A semidefinite program (convex!).

◮ If exact, can recover optimal solution.

▽Control Synthesis by Sum of Squares Optimization – p.14/30

Page 27: Control Synthesis by Sum of Squares Optimization

Global optimization

◮ Not convex, many local minima. NP-Hard in general.

◮ Find the largest γ s.t.

F (x, y) − γ is SOS.

◮ A semidefinite program (convex!).

◮ If exact, can recover optimal solution.

◮ Surprisingly effective.

▽Control Synthesis by Sum of Squares Optimization – p.14/30

Page 28: Control Synthesis by Sum of Squares Optimization

Global optimization

◮ Not convex, many local minima. NP-Hard in general.

◮ Find the largest γ s.t.

F (x, y) − γ is SOS.

◮ A semidefinite program (convex!).

◮ If exact, can recover optimal solution.

◮ Surprisingly effective.

Solving, the maximum value is −1.0316. Exact value.Many more details in Parrilio & Strumfels, 2001

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.14/30

Page 29: Control Synthesis by Sum of Squares Optimization

Lyapunov stability analysis◮ To prove asymptotic stability of x = f(x),

V (x) > 0, x 6= 0, V (x) =

(

∂V

∂x

)T

f(x) < 0, x 6= 0

▽Control Synthesis by Sum of Squares Optimization – p.15/30

Page 30: Control Synthesis by Sum of Squares Optimization

Lyapunov stability analysis◮ To prove asymptotic stability of x = f(x),

V (x) > 0, x 6= 0, V (x) =

(

∂V

∂x

)T

f(x) < 0, x 6= 0

◮ For linear systems x = Ax, quadratic Lyapunovfunctions V (x) = xT Px

P > 0, AT P + PA < 0

▽Control Synthesis by Sum of Squares Optimization – p.15/30

Page 31: Control Synthesis by Sum of Squares Optimization

Lyapunov stability analysis◮ To prove asymptotic stability of x = f(x),

V (x) > 0, x 6= 0, V (x) =

(

∂V

∂x

)T

f(x) < 0, x 6= 0

◮ For linear systems x = Ax, quadratic Lyapunovfunctions V (x) = xT Px

P > 0, AT P + PA < 0

◮ With an affine family of candidate Lyapunov functionsV , V is also affine.

▽Control Synthesis by Sum of Squares Optimization – p.15/30

Page 32: Control Synthesis by Sum of Squares Optimization

Lyapunov stability analysis◮ To prove asymptotic stability of x = f(x),

V (x) > 0, x 6= 0, V (x) =

(

∂V

∂x

)T

f(x) < 0, x 6= 0

◮ For linear systems x = Ax, quadratic Lyapunovfunctions V (x) = xT Px

P > 0, AT P + PA < 0

◮ With an affine family of candidate Lyapunov functionsV , V is also affine.

◮ Instead of checking nonnegativity, use an SOScondition

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.15/30

Page 33: Control Synthesis by Sum of Squares Optimization

Lyapunov stability - Example

A jet engine model (derived from Moore-Greitzer), withcontroller:

x = −y +3

2x2 − 1

2x3

y = 3x − y

Try a generic 4th order polynomial Lyapunov function.

▽Control Synthesis by Sum of Squares Optimization – p.16/30

Page 34: Control Synthesis by Sum of Squares Optimization

Lyapunov stability - Example

A jet engine model (derived from Moore-Greitzer), withcontroller:

x = −y +3

2x2 − 1

2x3

y = 3x − y

Try a generic 4th order polynomial Lyapunov function.Find a V (x, y) that satisfies the conditions:

◮ V (x, y) is SOS.

◮ −V (x, y) is SOS

Can easily do this using SOS/SDP techniques...

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.16/30

Page 35: Control Synthesis by Sum of Squares Optimization

Lyapunov stability - Example

After solving the SDPs, we obtain a Lyapunov function.

"Certificates, convex Optimization, and their applications", Pablo A. Parrilo, Swiss Federal Institute of Technology Zurich

Control Synthesis by Sum of Squares Optimization – p.17/30

Page 36: Control Synthesis by Sum of Squares Optimization

Lyapunov stability - Example◮ Consider the nonlinear system

x1 = −x31 − x1x

23

x2 = −x2 − x21x2

x3 = −x3 −3x3

x23+ 1

+ 3x21x3

▽Control Synthesis by Sum of Squares Optimization – p.18/30

Page 37: Control Synthesis by Sum of Squares Optimization

Lyapunov stability - Example◮ Consider the nonlinear system

x1 = −x31 − x1x

23

x2 = −x2 − x21x2

x3 = −x3 −3x3

x23+ 1

+ 3x21x3

◮ Looking for a quadratic Lyapunov function s.t.

V − (x21 + x2

2 + x23) is SOS,

(x23 + 1)(− ∂V

∂x1x1 − ∂V

∂x2x2 − ∂V

∂x3x3) is SOS,

we have V (x) = 5.5489x21 + 4.1068x2

2 + 1.7945x23.

"SOSTOOLS: control applications and new developments", Stephen Prajna et al, CACSD 2004

Control Synthesis by Sum of Squares Optimization – p.18/30

Page 38: Control Synthesis by Sum of Squares Optimization

Parametric robustness analysis - Example◮ Consider the following linear system

d

dt

x1

x2

x3

=

−p1 1 −1

2 − p2 2 −1

3 1 −p1p2

x1

x2

x3

where p1 ∈ [p1, p1] and p2 ∈ [p2, p2] are parameters.

▽Control Synthesis by Sum of Squares Optimization – p.19/30

Page 39: Control Synthesis by Sum of Squares Optimization

Parametric robustness analysis - Example◮ Consider the following linear system

d

dt

x1

x2

x3

=

−p1 1 −1

2 − p2 2 −1

3 1 −p1p2

x1

x2

x3

where p1 ∈ [p1, p1] and p2 ∈ [p2, p2] are parameters.

◮ Parameter set can be captured by

a1(p) , (p1 − p1)(p1 − p1) ≤ 0

a2(p) , (p2 − p2)(p2 − p2) ≤ 0

"SOSTOOLS: control applications and new developments", Stephen Prajna et al, CACSD 2004

Control Synthesis by Sum of Squares Optimization – p.19/30

Page 40: Control Synthesis by Sum of Squares Optimization

Parametric robustness analysis - Example

Find V (x; p) and qi,j(x; p), such that

◮ V (x; p) − ‖x‖2 +∑2

j=1q1,j(x; p)ai(p) is SOS,

◮ −V (x; p) − ‖x‖2 +∑2

j=1q2,j(x; p)ai(p) is SOS,

qi,j(x; p) is SOS, for i, j = 1, 2.

"SOSTOOLS: control applications and new developments", Stephen Prajna et al, CACSD 2004

Control Synthesis by Sum of Squares Optimization – p.20/30

Page 41: Control Synthesis by Sum of Squares Optimization

Safety verification - Example

◮ Consider the following system

x1 = x2

x2 = −x1 +1

3x3

1 − x2

◮ Initial set

X0 = {x : g0(x) = (x1 − 1.5)2 + x22 − 0.25 ≤ 0}

◮ Unsafe set

Xu = {x : gu(x) = (x1 + 1)2 + (x2 + 1)2 − 0.16 ≤ 0}

"SOSTOOLS: control applications and new developments", Stephen Prajna et al, CACSD 2004

Control Synthesis by Sum of Squares Optimization – p.21/30

Page 42: Control Synthesis by Sum of Squares Optimization

Safety verification - ExampleBarrier certificate B(x)

◮ B(x) < 0,∀x ∈ X0

◮ B(x) > 0,∀x ∈ Xu

◮ ∂B∂x1

x1 + ∂B∂x2

x2 ≤ 0

▽Control Synthesis by Sum of Squares Optimization – p.22/30

Page 43: Control Synthesis by Sum of Squares Optimization

Safety verification - ExampleBarrier certificate B(x)

◮ B(x) < 0,∀x ∈ X0

◮ B(x) > 0,∀x ∈ Xu

◮ ∂B∂x1

x1 + ∂B∂x2

x2 ≤ 0

SOS program: Find B(x) and σi(x)

◮ −B(x) − 0.1 + σ1(x)g0(x) is SOS,

◮ B(x) − 0.1 + σ2(x)gu(x) is SOS,

◮ − ∂B∂x1

x1 − ∂B∂x2

x2 is SOS

◮ σ1(x) and σ2(x) are SOS

"SOSTOOLS: control applications and new developments", Stephen Prajna et al, CACSD 2004

Control Synthesis by Sum of Squares Optimization – p.22/30

Page 44: Control Synthesis by Sum of Squares Optimization

Safety verification - Example

"SOSTOOLS: control applications and new developments", Stephen Prajna et al, CACSD 2004

Control Synthesis by Sum of Squares Optimization – p.23/30

Page 45: Control Synthesis by Sum of Squares Optimization

Nonlinear control synthesis◮ Consider the system

x = f(x) + g(x)u

▽Control Synthesis by Sum of Squares Optimization – p.24/30

Page 46: Control Synthesis by Sum of Squares Optimization

Nonlinear control synthesis◮ Consider the system

x = f(x) + g(x)u

◮ State dependent linear-like representation

x = A(x)Z(x) + B(x)u

where Z(x) = 0 ⇔ x = 0

▽Control Synthesis by Sum of Squares Optimization – p.24/30

Page 47: Control Synthesis by Sum of Squares Optimization

Nonlinear control synthesis◮ Consider the system

x = f(x) + g(x)u

◮ State dependent linear-like representation

x = A(x)Z(x) + B(x)u

where Z(x) = 0 ⇔ x = 0

◮ Consider the following Lyapunov function and controlinput

V (x) = ZT (x)P−1Z(x)

u(x) = K(x)P−1Z(x)

"Nonlinear control synthesis by sum of squares optimization: a Lyapunov-based approach", Stephen Prajna et al, ASCC 2004

Control Synthesis by Sum of Squares Optimization – p.24/30

Page 48: Control Synthesis by Sum of Squares Optimization

Nonlinear control synthesisFor the system x = A(x)Z(x) + B(x)u, suppose thereexist a constant matrix P , a polynomial matrix K(x), aconstant ǫ1 and a sum of squares ǫ2(x), such that

◮ vT (P − ǫ1I)v is SOS,

◮ −vT (PAT (x)MT (x) + M(x)A(x)P +

KT (x)BT (x)MT (x) + M(x)B(x)K(x) + ǫ2(x)I) is SOS,

where v ∈ RN and Mij(x) = ∂Zi

∂xj(x). Then a controller that

stabilizes the system is given by:

u(x) = K(x)P−1Z(x)

Furthermore, if ǫ2(x) > 0 for x 6= 0, then the zeroequilibrium is globally asymptotically stable.

"Nonlinear control synthesis by sum of squares optimization: a Lyapunov-based approach", Stephen Prajna et al, ASCC 2004

Control Synthesis by Sum of Squares Optimization – p.25/30

Page 49: Control Synthesis by Sum of Squares Optimization

Nonlinear control synthesis - Example

Consider a tunnel diode circuit:

x1 = 0.5(−h(x1) + x2)

x2 = 0.2(−x1 − 1.5x2 + u)

where the diode characteristic:

h(x1) = 17.76x1 − 103.79x21 + 229.62x3

1 − 226.31x41 + 83.72x5

1

"Nonlinear control synthesis by sum of squares optimization: a Lyapunov-based approach", Stephen Prajna et al, ASCC 2004

Control Synthesis by Sum of Squares Optimization – p.26/30

Page 50: Control Synthesis by Sum of Squares Optimization

Nonlinear control synthesis - Example

"Nonlinear control synthesis by sum of squares optimization: a Lyapunov-based approach", Stephen Prajna et al, ASCC 2004

Control Synthesis by Sum of Squares Optimization – p.27/30

Page 51: Control Synthesis by Sum of Squares Optimization

How conservative is SOS?

◮ It is proven by Hilbert that "nonnegativity" and "sumof squares" are equivalent in the following cases.⊲ Univariate polynomials, any (even) degree⊲ Quadratic polynomials, in any number of variables⊲ Quartic polynomials in two variables

▽Control Synthesis by Sum of Squares Optimization – p.28/30

Page 52: Control Synthesis by Sum of Squares Optimization

How conservative is SOS?

◮ It is proven by Hilbert that "nonnegativity" and "sumof squares" are equivalent in the following cases.⊲ Univariate polynomials, any (even) degree⊲ Quadratic polynomials, in any number of variables⊲ Quartic polynomials in two variables

◮ When the degree is larger than two it follows that⊲ There are signitcantly more nonnegative

polynomials than sums of squares.⊲ There are signitcantly more sums of squares than

sums of even powers of linear forms.[G. Blekherman, University of Michigan, submitted forpublication]

Control Synthesis by Sum of Squares Optimization – p.28/30

Page 53: Control Synthesis by Sum of Squares Optimization

Conclusion

◮ Sum of squares, conservative but much moretractable than nonnegativity

▽Control Synthesis by Sum of Squares Optimization – p.29/30

Page 54: Control Synthesis by Sum of Squares Optimization

Conclusion

◮ Sum of squares, conservative but much moretractable than nonnegativity

◮ Many applications in control theory

▽Control Synthesis by Sum of Squares Optimization – p.29/30

Page 55: Control Synthesis by Sum of Squares Optimization

Conclusion

◮ Sum of squares, conservative but much moretractable than nonnegativity

◮ Many applications in control theory

◮ Try your problem!

Control Synthesis by Sum of Squares Optimization – p.29/30

Page 56: Control Synthesis by Sum of Squares Optimization

References

◮ Convex optimmization by Stephen Boyd and LievenVandenberghe, available onlinehttp://www.stanford.edu/~boyd/cvxbook

◮ SOSTOOLS, MATLAB toolbox, freely availablehttp://www.cds.caltech.edu/sostools

Control Synthesis by Sum of Squares Optimization – p.30/30