Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems...

32
Applications of the Linear Complementarity Problem Yoni Nazarathy, May 2017. 1

Transcript of Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems...

Page 1: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Applications of the Linear Complementarity ProblemYoni Nazarathy, May 2017.

1

Page 2: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

The Linear Complementarity Problem (LCP)

Data: q ∈ Rn, M ∈ Rn×n.

Find w , z ∈ Rn such that:

1 w −Mz = q

2 w , z ≥ 0

3 w ′z = 0

2

Page 3: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

It is all about choosing a subset

w −Mz = q

Set α ⊂ {1, . . . , n} and denote B(α) as matrix with collumns αtaken from I and collumns α taken from −M.

Seek α:B(α)x = q.

3

Page 4: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

It is all about choosing a subset

4

Page 5: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Outline

1 Linear Programming (LP)

2 Quadratic Programming (QP)

3 Bimatrix Games

4 Min-linear equations in queueing networks

5 Some facts about LCP

5

Page 6: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

LP

6

Page 7: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Linear Programming

Primal-LP Dual-LP

min c ′x

s.t. Ax ≥ b

x ≥ 0

max b′y

s.t. A′y ≤ c

y ≥ 0

min c ′x

s.t. Ax − b = v

x , v ≥ 0

max b′y

s.t. u = c − A′y

y , u ≥ 0

Theorem ( complementary slackness)

Assume x , v , y , u are feasible for primal and dual:

xiui = 0, yivi = 0 ⇐⇒ x and y are optimal

7

Page 8: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

LP as LCP

Set w =

[u

v

], z =

[x

y

].

Want to find non-negative, w , v such that Ax − b = v ,u = c − A′y and w ′v = 0.

[u

v

]−

[0 −A′

A 0

][x

y

]=

[c

−b

]

8

Page 9: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

LP facts (audience to fill in 8,9,10,. . . )

1 Weak duality: dual∗ = y ′b ≤ y ′Ax = x ′A′y ≤ x ′c = primal∗

2 Strong duality

3 Simplex Algorithm works well on “most” cases

4 Simplex may have exponential inputs

5 Problem has polynomial time algorithm

6 Applications...

7 History...

8 ...

9 ...

10 ...

11 ...

12 ...

13 ...

9

Page 10: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

QP

10

Page 11: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Quadratic Programming

min x ′Dx + c ′x

s.t. Ax ≥ b

x ≥ 0

11

Page 12: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Example: Linear Quadratic MPC

Model:x(k + 1) = Ax(k) + Bu(k).

Cost:

J(u) =N−1∑k=0

x(k)′Q x(k) + u′(k)R u(k) + x ′(N)Qf x(N).

Constraints:

F

[x(k)

u(k)

]≤ b.

12

Page 13: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Formulation as a Quadratic Program (QP)

At time k (taken to be 0 for simplicity), given a measured (orestimated) state x(k) we need to solve,

minu(0),u(1),...,u(N−1)

N−1∑k=0

x(k)′Q x(k)+u′(k)R u(k)+x ′(N)Qf x(N)

s.t. x(k + 1) = Ax(k) + Bu(k) and,

F

[x(k)

u(k)

]≤ b.

13

Page 14: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Formulation as a Quadratic Program (QP)

x(1)

x(2)...

x(N)

=

A

A2

...

AN

x(0)+

B 0 · · · 0

AB B...

.... . .

AN−1B · · · B

u(0)

u(1)...

u(N − 1)

This converts the optimization problem of the MPC controller toone that simply depends on the mN dimensional vectoru(0), . . . , u(N − 1).

The general form of a quadratic program (QP) is:

minzz′Qz + Pz ,

s.t. F z ≤ b.

With a bit of (tedious rearranging) the MPC controller can then bepresented as a convex QP in mN decision variables. QPs whereQ > 0 have a unique solution and are quite efficiently solvable!!!

14

Page 15: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

The Closed Loop System is Non-Linear

MPC generates a “feedback” control law u(k) = g(x(k)

), where

the function g(·) is implicitly defined by the unique solution of theQP. The resulting controlled system,

x(k + 1) = Ax(k) + Bg(x(k)

),

is in general non-linear (it is linear if there are no-constraintsbecause then the problem is simply LQR).

The resulting system is piece-wise linear, (Bemporad, Morari, Duaand Pistikopoulus, 2002, “The explicit linear quadratic regulatorfor constrained systems”).

15

Page 16: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Discrete Queueing Network MPC

16

Page 17: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Towards QP as LCP

QP:

min Q(x) = x ′Dx + c ′x

s.t. Ax ≥ b

x ≥ 0

Claim: An optimiser x of the QP also optimises the LP:

min (c + Dx)′x

s.t. Ax ≥ b

x ≥ 0Proof:Let x be feasible (of QP and LP) and η ∈ (0, 1). Set xη = x + η(x − x). Byconvexity it is also feasible.

Q(xη)− Q(x) ≥ 0

η(c ′ + x ′D)(x − x) + η2(x − x)′D(x − x) ≥ 0

(c ′ + x ′D)(x − x) ≥ −η(x − x)′D(x − x) for all η ∈ (0, 1)

(c ′ + x ′D)(x − x) ≥ 0

(c ′ + x ′D)x ≥ (c ′ + x ′D)x

Now since x is arbitrary, x must optimise LP. �

17

Page 18: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

QP as LCP

We use the LP of the QP:

min (c + Dx)′x

s.t. Ax ≥ b

x ≥ 0

As with LCP of LP:[u

v

]−

[0 −A′

A 0

][x

y

]=

[c + Dx

−b

]

That is, setup and LCP with,

M =

[D −A′

A 0

], q =

[c

−b

].

18

Page 19: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

QP facts

1 An example of convex-programming.

2 If D is Positive Semi Definite (PSD), that is Q(·) convex andsolved efficiently.

3 If D is not PSD the problem is NP-hard.

4 Applications: . . .

5 Algorithms: . . .

6 ...

7 ...

8 ...

19

Page 20: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Another Encounter with QPs

20

Page 21: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Bimatrix Games

21

Page 22: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Bimatrix Game

Player I Player II

Choice: i j

Loses: Aij ≥ 0 Bij ≥ 0

Strategy (distribution): x y

Expected losses: x ′Ay x ′B y

The strategy pair, (x , y) is an equilibrium pair if no playerbenefits by changing her own strategy while the other player keepsher strategy fixed:

x ′Ay ≤ x ′Ay , ∀xx ′By ≤ x ′By , ∀y

or

x ′Ay 1m1 ≤ Ay

x ′By 1m2 ≤ x ′B22

Page 23: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Bimatrix Game (cont.)

x ′Ay 1m1 ≤ Ay

x ′By 1m2 ≤ x ′B

Set,

ξ =x

x ′By, η =

y

x ′Ay

Hence,

1m1 ≤ Aη

1′m2≤ ξ′B

And with slack variables, u, v ≥ 0 we get:

0 = Aη − 1m1 − u

0 = ξ′B − 1′m2− v ′

Noting that, u′ξ = 0 and v ′η = 0, we get the LCP:[u

v

]−

[0 A

B ′ 0

][ξ

η

]=

[−1m1

−1m2

]23

Page 24: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Bimatrix Game Facts

1 Basic example: “The Prisoners’ Dilemma”.

2 If A + B = 0, it is a zero-sum game.

3 ...

4 ...

5 ...

6 ...

7 ...

8 ...

9 ...

10 ...

24

Page 25: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Min-Linear Equations

25

Page 26: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Example: Queueing Networks

µ1

µ2

µ3

α1

α2

α3

An illustration of an overflow fluid network with nodes i = 1, 2, 3: Fluid arrives

exogenously at rates αi and served at rates µi . Nodes 1 and 2 have finite buffer

capacity, while node 3 has unbounded buffer capacity. Fluid drained out of node i is

routed to node j with proportion pi,j . Fluid reaching a node with a full buffer i

overflows onto other nodes with proportion qi,j . The remaining proportions of routing

(p) or overflow (q) leave the system.26

Page 27: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Example: Queueing Networks (cont.)

λ = α + λP, (1)

λ = α + min(λ, µ)P, (2)

λ = α + min(λ, µ)P + max(λ− µ, 0)Q. (3)

λi = αi+n∑

j=1

min(λj , µj)pj ,i+n∑

j=1

max(λj−µj , 0)qj ,i , i = 1, . . . , n.

27

Page 28: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Min Linear Equations

Data: A, b, c with non-negative elements.

Solve:x = A(x ∧ b) + c , x ≥ 0.

Or in scalar form, for i = 1, . . . , n:

xi = ci +n∑

j=1

Aij min(xi , bi ), xi ≥ 0.

Let’s make it an LCP.

28

Page 29: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

Min Linear Equations (cont.)

x = A(x ∧ b) + c , x ≥ 0.

Set δ = x ∧ b. So δ ∈ [0, x ] and δ ∈ [0, b]. Hence,

(x − δ)′(b − δ) = 0.

Set w = x − δ and z = b − δ. Note that w , z ≥ 0 and w ′z = 0.

Now use x = Aδ + c , to get,

w + δ = Aδ + c

w + (I − A)δ = c

w + (I − A)(b − z) = c

w − (I − A)z = c − (I − A)b

This is an LCP with M = I − A and q = c − (I − A)b.

29

Page 30: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

So what do we know about LCP?

30

Page 31: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

LCP facts

1 (At least) two books dedicated to LCP:The Linear Complementarity Problem, Second Edition, RichardW. Cottle, Jong-Shi Pang, Richard E. Stone. 1991, 2009.Linear Complementarity, Linear and Nonlinear Programming,Katta G. Murty, 1988. Internet edition.

2 Appears in dynamic problems with boundaries - See lastweek’s SMOR talk by David Stewart.

3 Stochastic Networks had contribution to dynamic problems:Unpublished paper ( 1989), Avi Mandelbaum, , The DynamicComplementarity Problem

4 NP-Complete with general M matrix.5 Has unique solution for every q if the M matrix is a

“P-Matrix”. If symmetric this means it is PSD.6 ...7 ...8 ...9 ...

10 ...31

Page 32: Applications of the Linear Complementarity Problem · 2017-09-26 · 2 Appears in dynamic problems with boundaries - See last week’s SMOR talk by David Stewart. 3 Stochastic Networks

The End

32