78
Linear Programming Eric Price UT Austin CS 331, Spring 2020 Coronavirus Edition Eric Price (UT Austin) Linear Programming CS 331, Sprin / 17

Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear Programming

Eric Price

UT Austin

CS 331, Spring 2020 Coronavirus Edition

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 1

/ 17

Page 2: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Logistics

Office hours by appointment this week.

Problem 2(b), on set selection, is now extra credit (= 1/8 of a HW)

This week: linear programming

Next week: complexity

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 2

/ 17

Page 3: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Logistics

Office hours by appointment this week.

Problem 2(b), on set selection, is now extra credit (= 1/8 of a HW)

This week: linear programming

Next week: complexity

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 2

/ 17

Page 4: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Logistics

Office hours by appointment this week.

Problem 2(b), on set selection, is now extra credit (= 1/8 of a HW)

This week: linear programming

Next week: complexity

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 2

/ 17

Page 5: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Logistics

Office hours by appointment this week.

Problem 2(b), on set selection, is now extra credit (= 1/8 of a HW)

This week: linear programming

Next week: complexity

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 2

/ 17

Page 6: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Class Outline

1 Introduction to Linear Programming

2 How to Solve a Linear Program

3 Reducing Problems to Linear Programs

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 3

/ 17

Page 7: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 8: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid Kantorovich

Think central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 9: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 10: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucks

I Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 11: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton wood

I Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 12: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons wood

I Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 13: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.

I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 14: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.

I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 15: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 16: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Linear ProgrammingGeneral way of writing problems: maximize linear function subject tolinear constraints.

Developed 1939 by Leonid KantorovichThink central planning of factories:

I Can produce cars or trucksI Cars take 2 tons metal, 1 ton woodI Trucks take 3 tons metal, 5 tons woodI Trucks carry twice as much as cars.I You are supplied 12 tons metal, 15 tons wood / day.I Q: how many cars vs trucks to produce to maximize total capacity?

Mathematically:

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 4

/ 17

Page 17: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Solving small cases by hand

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Algebraically:

I Find all vertices, and for each:I Check if feasible (satisfy the constraints)I Pick the feasible vertex maximizing the objective.

Geometrically:

I Draw the picture of all feasible pointsI Slide in the direction of the objective until you get stuck.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 5

/ 17

Page 18: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Solving small cases by hand

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Algebraically:I Find all vertices, and for each:I Check if feasible (satisfy the constraints)I Pick the feasible vertex maximizing the objective.

Geometrically:

I Draw the picture of all feasible pointsI Slide in the direction of the objective until you get stuck.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 5

/ 17

Page 19: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Solving small cases by hand

maximize: C + 2T

subject to: 2C + 3T ≤ 12

C + 5T ≤ 15

C ,T ≥ 0

Algebraically:I Find all vertices, and for each:I Check if feasible (satisfy the constraints)I Pick the feasible vertex maximizing the objective.

Geometrically:I Draw the picture of all feasible pointsI Slide in the direction of the objective until you get stuck.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 5

/ 17

Page 20: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

General Linear Programming (LP)

Linear Programming

Optimize (maximize or minimize) a linear objective in many variables,subject to linear constraints on them (=,≤,≥).

maximize: x1 + 3x2 − 345x3 + x4

subject to: x1 − 17x2 ≤ x4 + 12

x4 − x3 ≥ x2

67x2 − 3x1 = 83

x3 ≤ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 6

/ 17

Page 21: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

General Linear Programming (LP)

Linear Programming

Optimize (maximize or minimize) a linear objective in many variables,subject to linear constraints on them (=,≤,≥).

maximize: x1 + 3x2 − 345x3 + x4

subject to: x1 − 17x2 ≤ x4 + 12

x4 − x3 ≥ x2

67x2 − 3x1 = 83

x3 ≤ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 6

/ 17

Page 22: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Formulations of LP

Standard form (or “symmetric”)

For m constraints on n variables, given A ∈ Rm×n, b ∈ Rm, c ∈ Rn:

maximize: c · xsubject to: Ax ≤ b

x ≥ 0

Common alternative forms

“Alternative form” “Slack form”

maximize: c · x maximize: c · xsubject to: Ax ≤ b or subject to: Ax = b

x ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 7

/ 17

Page 23: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Formulations of LP

Standard form (or “symmetric”)

For m constraints on n variables, given A ∈ Rm×n, b ∈ Rm, c ∈ Rn:

maximize: c · xsubject to: Ax ≤ b

x ≥ 0

Common alternative forms

“Alternative form” “Slack form”

maximize: c · x maximize: c · xsubject to: Ax ≤ b or subject to: Ax = b

x ≥ 0

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 7

/ 17

Page 24: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative:

solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 25: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative:

solve alternative with A′ =

[A−In

], b′ =

[b0

]

Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 26: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]

Alternative → standard:

new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 27: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard:

new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 28: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard:

solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 29: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard:

solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 30: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack:

m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 31: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack:

m new “slack” variables z , solve slack withA′ =

[A Im

]

Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 32: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]

Minimization problems?

c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 33: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems?

c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 34: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

The forms are reducible to each other

Standard Alternative Slackmax c · x max c · x max c · xAx ≤ b Ax ≤ b Ax = bx ≥ 0 x ≥ 0

Standard → alternative: solve alternative with A′ =

[A−In

], b′ =

[b0

]Alternative → standard: new nonnegative variables y and z , sox = y − z . Solve standard with A′ =

[A −A

].

Slack → standard: solve standard with A′ =

[A−A

], b′ =

[b−b

].

Standard → slack: m new “slack” variables z , solve slack withA′ =

[A Im

]Minimization problems? c ′ = −c .

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 8

/ 17

Page 35: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Class Outline

1 Introduction to Linear Programming

2 How to Solve a Linear Program

3 Reducing Problems to Linear Programs

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 9

/ 17

Page 36: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

Simplex

I Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

Ellipsoid

I Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 37: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

Simplex

I Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

Ellipsoid

I Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 38: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

Simplex

I Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

Ellipsoid

I Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 39: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.

I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

Ellipsoid

I Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 40: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)

I Worst-case inputs can take exponential time, but fast on most inputs.

Ellipsoid

I Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 41: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

Ellipsoid

I Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 42: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

EllipsoidI Iteratively shrink an ellipsoid around the solution.

I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits ofprecision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 43: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

EllipsoidI Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior point

I Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 44: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

EllipsoidI Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior pointI Iteratively move through the center of the region.

I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 45: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

EllipsoidI Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior pointI Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).

I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 46: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

EllipsoidI Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior pointI Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.

I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 47: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Overview of solution methods

SimplexI Start at a vertex, and walk from vertex to vertex, increasing objective.I First algorithm (Dantzig ’47)I Worst-case inputs can take exponential time, but fast on most inputs.

EllipsoidI Iteratively shrink an ellipsoid around the solution.I First polynomial time algorithm (Khachiyan ’79); O(n6L) for L bits of

precision.

Interior pointI Iteratively move through the center of the region.I Introduced by Karmarkar in ’84, O(n3.5).I More practical than ellipsoid, even better than simplex sometimes.I Best theoretical result: O(n2.38L) time (Cohen, Lee, Song ’19).

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 10

/ 17

Page 48: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:

I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 49: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:

I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 50: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:

I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 51: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:

I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 52: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:

I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 53: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:

I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 54: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:

I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 55: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:I If we get to the true solution, the algorithm will stop.

I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 56: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 57: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:

I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 58: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:I Polynomial time per iteration.

I Number of iterations depends on problem instance & rule for choosingnext vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 59: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Simplex Algorithm

Linear program with n variables and m constraints (including xi ≥ 0).

Vertex of feasible set is where some n constraints are tight.

n adjacent vertices: drop one constraint, move along line untilanother constraint becomes tight.

Simplex algorithm

1 Find an initial vertex (we’ll see how later)

2 Repeatedly move to adjacent vertex of larger objective.

Correctness:I If we get to the true solution, the algorithm will stop.I By convexity: if not at the true solution, can move and make progress.

Running time:I Polynomial time per iteration.I Number of iterations depends on problem instance & rule for choosing

next vertex, but could be exponential.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 11

/ 17

Page 60: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

Doesn’t seem so useful:

Problem

If you can solve “does this polytope have any feasible point” you can alsosolve linear programming (= optimize over polytopes).

Proof.

We want to determine OPT = max c · x s.t. Ax ≤ b. Then OPT ≥ τ ifand only if the polytope

Ax ≤ b

c · x ≥ τ

has any solution. So if we can solve this, we binary search on τ to solveLP.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 12

/ 17

Page 61: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

Doesn’t seem so useful:

Problem

If you can solve “does this polytope have any feasible point” you can alsosolve linear programming (= optimize over polytopes).

Proof.

We want to determine OPT = max c · x s.t. Ax ≤ b. Then OPT ≥ τ ifand only if the polytope

Ax ≤ b

c · x ≥ τ

has any solution. So if we can solve this, we binary search on τ to solveLP.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 12

/ 17

Page 62: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

In general, finding a feasible vertex is as hard as LP.

We create a new LP, where finding a feasible vertex is easy, and theoptimal solution identifies a feasible point of the initial LP.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

z = 0 possible if and only if Ax ≤ b, x ≥ 0 is feasible.

x = 0, z = max(0, b1, . . . , bm) is a feasible vertex.

So simplex can get started on NEW and solve it.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 13

/ 17

Page 63: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

In general, finding a feasible vertex is as hard as LP.

We create a new LP, where finding a feasible vertex is easy, and theoptimal solution identifies a feasible point of the initial LP.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

z = 0 possible if and only if Ax ≤ b, x ≥ 0 is feasible.

x = 0, z = max(0, b1, . . . , bm) is a feasible vertex.

So simplex can get started on NEW and solve it.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 13

/ 17

Page 64: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

In general, finding a feasible vertex is as hard as LP.

We create a new LP, where finding a feasible vertex is easy, and theoptimal solution identifies a feasible point of the initial LP.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

z = 0 possible if and only if Ax ≤ b, x ≥ 0 is feasible.

x = 0, z = max(0, b1, . . . , bm) is a feasible vertex.

So simplex can get started on NEW and solve it.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 13

/ 17

Page 65: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

In general, finding a feasible vertex is as hard as LP.

We create a new LP, where finding a feasible vertex is easy, and theoptimal solution identifies a feasible point of the initial LP.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

z = 0 possible if and only if Ax ≤ b, x ≥ 0 is feasible.

x = 0, z = max(0, b1, . . . , bm) is a feasible vertex.

So simplex can get started on NEW and solve it.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 13

/ 17

Page 66: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

In general, finding a feasible vertex is as hard as LP.

We create a new LP, where finding a feasible vertex is easy, and theoptimal solution identifies a feasible point of the initial LP.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

z = 0 possible if and only if Ax ≤ b, x ≥ 0 is feasible.

x = 0, z = max(0, b1, . . . , bm) is a feasible vertex.

So simplex can get started on NEW and solve it.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 13

/ 17

Page 67: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

In general, finding a feasible vertex is as hard as LP.

We create a new LP, where finding a feasible vertex is easy, and theoptimal solution identifies a feasible point of the initial LP.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

z = 0 possible if and only if Ax ≤ b, x ≥ 0 is feasible.

x = 0, z = max(0, b1, . . . , bm) is a feasible vertex.

So simplex can get started on NEW and solve it.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 13

/ 17

Page 68: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

In general, finding a feasible vertex is as hard as LP.

We create a new LP, where finding a feasible vertex is easy, and theoptimal solution identifies a feasible point of the initial LP.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

z = 0 possible if and only if Ax ≤ b, x ≥ 0 is feasible.

x = 0, z = max(0, b1, . . . , bm) is a feasible vertex.

So simplex can get started on NEW and solve it.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 13

/ 17

Page 69: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

Simplex can get started on NEW and solve it.

The solution to NEW returned by simplex is a vertex (x , z) of NEW.

NEW has n + 1 variables, one tight constraint of the optimum isz ≥ 0, and the other n are among Ax ≤ b, x ≥ 0.

Hence the solution x is a vertex of the original LP.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 14

/ 17

Page 70: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

Simplex can get started on NEW and solve it.

The solution to NEW returned by simplex is a vertex (x , z) of NEW.

NEW has n + 1 variables, one tight constraint of the optimum isz ≥ 0, and the other n are among Ax ≤ b, x ≥ 0.

Hence the solution x is a vertex of the original LP.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 14

/ 17

Page 71: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

Simplex can get started on NEW and solve it.

The solution to NEW returned by simplex is a vertex (x , z) of NEW.

NEW has n + 1 variables, one tight constraint of the optimum isz ≥ 0, and the other n are among Ax ≤ b, x ≥ 0.

Hence the solution x is a vertex of the original LP.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 14

/ 17

Page 72: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Finding an initial feasible vertex

Simplex works, eventually, once you have a feasible vertex.

Finding a feasible point

We want to find a point x such that Ax ≤ b, x ≥ 0. Introduce a newvariable z ∈ R, and solve:

minimize: z

subject to: Ax − z ≤ b (NEW)

x , z ≥ 0

Simplex can get started on NEW and solve it.

The solution to NEW returned by simplex is a vertex (x , z) of NEW.

NEW has n + 1 variables, one tight constraint of the optimum isz ≥ 0, and the other n are among Ax ≤ b, x ≥ 0.

Hence the solution x is a vertex of the original LP.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 14

/ 17

Page 73: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Class Outline

1 Introduction to Linear Programming

2 How to Solve a Linear Program

3 Reducing Problems to Linear Programs

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 15

/ 17

Page 74: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

L1 linear regression

x

y

Given n points on plane: (x1, y1), . . . , (xn, yn). Find the line mx + bminimizing the average error:

Err =1

n

n∑i=1

|yi − (mxi + b)|

Part (2): Now, minimize the maximum error.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 16

/ 17

Page 75: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

L1 linear regression

x

y

Given n points on plane: (x1, y1), . . . , (xn, yn). Find the line mx + bminimizing the average error:

Err =1

n

n∑i=1

|yi − (mxi + b)|

Part (2): Now, minimize the maximum error.

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 16

/ 17

Page 76: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Writing old problems as linear programs

Write network flow as a linear program

Write shortest paths as a linear program

Write minimum cut as a linear program

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 17

/ 17

Page 77: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 18

/ 17

Page 78: Linear Programmingecprice/courses/331/slides/04...Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid

Eric Price (UT Austin) Linear ProgrammingCS 331, Spring 2020 Coronavirus Edition 19

/ 17