linear programming applications - webhomeaspremon/pdf/ensae/linearprogramapps.pdf · linear...

40
Convex Optimization Linear Programming Applications ENSAE: Optimisation 1/40

Upload: tranquynh

Post on 02-Sep-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Convex Optimization

Linear Programming Applications

ENSAE: Optimisation 1/40

Page 2: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Today

� This is the “What’s the point?” lecture. . .

� What can be solved using linear programs?

Just an introduction. . .

ENSAE: Optimisation 2/40

Page 3: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Linear Programs

A linear program is written

minimize cTxsubject to Ax = b

x ≥ 0,

in the variable x ∈ Rn. Or in inequality form

minimize cTxsubject to Ax ≤ b.

ENSAE: Optimisation 3/40

Page 4: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Linear Program Applications

ENSAE: Optimisation 4/40

Page 5: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Linear Programming: applications

� Originally, linear programs considered “toy problems”

� Algorithm came first

� LPs could be solved efficiently, some applications were found

� Successful applications meant publicity

� Tons of applications subsequently discovered. . .

� Among the most commonly used optimization results today

ENSAE: Optimisation 5/40

Page 6: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Linear Programming: applications

Today, a quick look at applications of linear programming:

� Finance

� Statistics

� Networks

� Game theory

� Structural design

� Scheduling

� Signal processing, etc

ENSAE: Optimisation 6/40

Page 7: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

The diet problem:

� Resource allocation problem

� Could replace, calories & nutrients by parts in a factory, etc

� Classic first example in linear programming classes

� Follow a 50 years old tradition. . .

ENSAE: Optimisation 7/40

Page 8: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

The diet problem

Eating fast food optimally, using linear programming. . .

ENSAE: Optimisation 8/40

Page 9: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

The diet problem:

� We’re given the nutrition facts on burgers, fries, etc

� We need to design our meal so that the quantity of nutrients falls betweencertain values

� Objective: minimize costs

� Another possibility: minimize calories (optimally healthy fast-food meal)

Easy: this is a linear program. . .

ENSAE: Optimisation 9/40

Page 10: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

Data (fictitious). On prices:

Quarter Pounder w/ Cheese: 1.84McLean Deluxe w/ Cheese: 2.19Big Mac: 1.84Filet-O-Fish: 1.44McGrilled Chicken: 2.29Fries, small: 0.77Sausage McMuffin: 1.291% Lowfat Milk: 0.60Orange Juice: 0.72

ENSAE: Optimisation 10/40

Page 11: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

Minimum and maximum values for some type of nutrients:

Min. Max.Calories 2000Carbs 350 375Protein 55VitA 100VitC 100Calc 100Iron 100

ENSAE: Optimisation 11/40

Page 12: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

Nutrition facts:

Cal Carbs Protein VitA VitC Calc IronQuarter Pounder 510 34 28 15 6 30 20McLean Deluxe 370 35 24 15 10 20 20Big Mac 500 42 25 6 2 25 20Filet-O-Fish 370 38 14 2 0 15 10McGrilled Chicken 400 42 31 8 15 15 8Fries, small 220 26 3 0 15 0 2Sausage McMuffin 345 27 15 4 0 20 151% Lowfat Milk 110 12 9 10 4 30 0Orange Juice 80 20 1 2 120 2 2

ENSAE: Optimisation 12/40

Page 13: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

We can write this as a linear program:

� The variables are xi, the quantity of item in the menu we purchase

� We let ci be the cost of each item, the total cost of the meal is:

9∑i=1

cixi

� Let Aij be the nutrition value for nutrient i in item j, the nutrition constraintsare:

mini ≤9∑j=1

Aijxj ≤ maxi for each nutrient i

� And of course: all the quantities xi have to be positive: xi ≥ 0

ENSAE: Optimisation 13/40

Page 14: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

Minimum cost meal meeting minimum requirements

minimize∑9i=1 cixi

subject to mini ≤∑9j=1Aijxj ≤ maxi for each nutrient i

xi ≥ 0,

Solution:

Quarter Pounder w/ Cheese 4.38525Fries, small 6.147541% Lowfat Milk 3.42213

Price: 14.85, but 4000 calories. . .

ENSAE: Optimisation 14/40

Page 15: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

2500 calories meal meeting minimum requirements

minimize∑9i=1 cixi

subject to∑9j=1A1jxj = 2500

mini ≤∑9j=1Aijxj ≤ maxi for each nutrient i = 2, . . . , 7

xi ≥ 0,

Solution:

Quarter Pounder w/ Cheese 0.231942McLean Deluxe w/ Cheese 3.854651% Lowfat Milk 2.0433Orange Juice 9.13408

Price goes up: $16.67. . .

ENSAE: Optimisation 15/40

Page 16: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

Can we make a 2000 calories meal meeting minimum requirements?

minimize∑9i=1 cixi

subject to∑9j=1A1jxj = 2000

mini ≤∑9j=1Aijxj ≤ maxi for each nutrient i = 2, . . . , 7

xi ≥ 0,

� No solution!

� What’s the best we can do?

ENSAE: Optimisation 16/40

Page 17: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

Minimum calories meal meeting minimum requirements

minimize∑9j=1A1jxj

subject to mini ≤∑9j=1Aijxj ≤ maxi for each nutrient i = 2, . . . , 7

xi ≥ 0,

Solution:

McLean Deluxe w/ Cheese 4.088051% Lowfat Milk 2.04403Orange Juice 9.1195

Price is $16.75, minimum calories: 2467

ENSAE: Optimisation 17/40

Page 18: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

A bit of history: the diet problem

A few interesting results from this experiment:

� Some problems are infeasible, how do we detect that?

� We can’t ask for integer results

� Solution: rounding

� But we can’t be certain to get the optimal integer solution. . .(more on this later)

ENSAE: Optimisation 18/40

Page 19: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Finance

Portfolio theory.

� Classic view: mean-variance tradeoff

� Portfolio management: a quadratic program (later)

� Variance is (by far) not the only measure of risk

� Other possibility: mean absolute deviation:

risk =1

T

T∑t=1

|rt − r̄|

where rt = St − St−1 is the return at time t and r̄ the mean return.

ENSAE: Optimisation 19/40

Page 20: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

Historical (relative) returns St/St−1 on a few investments. . .(EAFE: Europe, Australia, and Far East).

ENSAE: Optimisation 20/40

Page 21: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

Markovitz type model:

� We look for a portfolio of N assets with coefficients xi

� We have an initial budget of $1

� For a given level of risk, we seek to maximize return

� When the level of risk (µ) varies, the maximum return defines a set of optimalrisk/return tradeoffs: the efficient frontier

� We consider aboslute returns rt = St − St−1.

ENSAE: Optimisation 21/40

Page 22: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

The program to be solved can be written:

maximize1

T

N∑i=1

T∑t=1

xiri,t (portfolio return)

subject to1

T

T∑t=1

∣∣∣∣∣N∑i=1

xiri,t −N∑i=1

xir̄i

∣∣∣∣∣ ≤ µ (portfolio risk bounded)

N∑i=1

xiPi = 1 (initial budget)

xi ≥ 0 (no short sale)

Is this a linear program?

ENSAE: Optimisation 22/40

Page 23: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

� The following constraint on the absolute value:

|x| ≤ y

is equivalent to:−y ≤ x ≤ y

� This means that we can replace each inequality on an absolute value by toinequalities

� We have to introduce additional variables in the original program. . .

ENSAE: Optimisation 23/40

Page 24: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

The new program is written:

maximize1

T

N∑i=1

T∑t=1

xiri,t (portfolio return)

subject to1

T

T∑t=1

yt ≤ µ (portfolio risk bounded)

−yt ≤(∑N

i=1 xiri,t −∑Ni=1 xir̄i

)≤ yt

N∑i=1

xiPi = 1 (initial budget)

xi ≥ 0 (no short sale)

This is now a linear program!

ENSAE: Optimisation 24/40

Page 25: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

Efficient frontier for a few reference assets (N = 8).

ENSAE: Optimisation 25/40

Page 26: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

Composition, risk and return of optimal portfolios for various values of µ.

ENSAE: Optimisation 26/40

Page 27: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

Efficient frontier for 719 stocks.

ENSAE: Optimisation 27/40

Page 28: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Statistics: Regression

How far is this from the standard mean variance analysis?

� We replace the variance by the deviation

� How do these two measures of “error” compare?

Let’s pick an example from statistics:

� Regress a set of data points on a few variables

� Compare least squares regression with least absolute deviation regression

ENSAE: Optimisation 28/40

Page 29: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Statistics: Regression

Given N data points yi and xi, we look for parameters a and b and compute the“best” linear model y = ax+ b

� The usual least squares regression is written:

minimizeN∑i=1

‖yi − axi − b‖2

� The least absolute deviation regression is here:

minimizeN∑i=1

|yi − axi − b|

ENSAE: Optimisation 29/40

Page 30: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Portfolio Optimization

Not that different here. . .

ENSAE: Optimisation 30/40

Page 31: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Game Theory

Two person game.

� Count to three and declare:

Paper Scissors Rock

� Winner selected according to:

Rock beats ScissorsPaper beats Rock

Scissors beats Paper

� We can arrange this in a payoff matrix:

P S RPSR

0 1 −1−1 0 1

1 −1 0

ENSAE: Optimisation 31/40

Page 32: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Game Theory

� Playing a fixed (deterministic, pure) strategy is bad: “always stone” is alwaysbeaten by paper. . .

� We know from game theory that there is always a Nash equilibrium involvingrandom (mixed) strategies.

� How do we find these?

� A random strategy is simply a probability vector:

3∑i=1

xi = 1 and xi ≥ 0

� Solving for the equilibrium strategy for both players is a linear program (moredetails later).

ENSAE: Optimisation 32/40

Page 33: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Signal Processing

FIR filter design.

� Finite Impulse Response filter:

yt =

n−1∑τ=0

hτut−τ

where ut is the input signal and hi are the filter coefficients

� The magnitude of the frequency response of the filter can be written:

|H̃(ω)| = 2h0 cos(Nω) + 2h1 cos((N − 1)ω) + . . .+ hN

� For each particular frequency ω, this a linear function of the filter coefficients h

Designing a custom filter is just a linear program . . .

ENSAE: Optimisation 33/40

Page 34: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Signal Processing

0 0.5 1 1.5 2 2.5 3 3.5−0.2

0

0.2

0.4

0.6

0.8

1

1.2

Frequency

Response

This filter lets bass go through and filters out higher frequencies (low-pass)

ENSAE: Optimisation 34/40

Page 35: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Wifi

� Wifi (802.11) is another example. . .

� Maximum allowed radiated power (EIRP) is 100mW

� Why? So you don’t fry your friend next door, also avoids interferences. . .

� This power is dissipated in all directions. . .

� Increase the range: focus most of this power in one direction

ENSAE: Optimisation 35/40

Page 36: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Wifi

ENSAE: Optimisation 36/40

Page 37: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Wifi

Professional solution.

� Use multiple antennas

� Use interference patterns to focus most of the power in a particular direction

� Problem is similar to filter design: linear program

!

ENSAE: Optimisation 37/40

Page 38: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Wifi

0.2

0.4

0.6

0.8

1

30

210

60

240

90

270

120

300

150

330

180 0

103110

0.23215

0.4643

0.69644

0.92859

1.1607

30

210

60

240

90

270

120

300

150

330

180 0

103110

0.2

0.4

0.6

0.8

1

30

210

60

240

90

270

120

300

150

330

180 0

103110

Dreamno errors

‖D∗ − D‖2 = 0.014

Reality0.1% errors

‖D∗ − D‖2 ∈ [0.17, 0.89]

Reality2% errors

‖D∗ − D‖2 ∈ [2.9, 19.6]Nominal Least Squares design: dream and reality

Data over a 100-diagram sample

{

}

Implementation is tricky. . .

ENSAE: Optimisation 38/40

Page 39: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Wifi

{

}

0.20689

0.41378

0.62066

0.82755

1.0344

30

210

60

240

90

270

120

300

150

330

180 0

103110

0.20695

0.4139

0.62086

0.82781

1.0348

30

210

60

240

90

270

120

300

150

330

180 0

103110

0.2084

0.41681

0.62521

0.83362

1.042

30

210

60

240

90

270

120

300

150

330

180 0

103110

Dream

no errors

‖D∗ − D‖2 = 0.025

Reality

0.1% errors

‖D∗ − D‖2 ≈ 0.025

Reality

2% errors

‖D∗ − D‖2 ≈ 0.025

Robust Least Squares design: dream and realityData over a 100-diagram sample

ENSAE: Optimisation 39/40

Page 40: Linear Programming Applications - WebHomeaspremon/PDF/ENSAE/LinearProgramApps.pdf · Linear Programming: applications Originally, linear programs considered \toy problems" Algorithm

Convex interpolation

What’s next? We will study convex problems.

� Much more general class of problems

� Complexity similar to linear programming

� Similar solvers

� Very very very long list of applications in statistics, engineering, finance, etc.

ENSAE: Optimisation 40/40