Linear Programming Eric Price UT Austin CS 331, Spring 2020 Coronavirus Edition CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Logistics Office hours by appointment this week. CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Logistics Office hours by appointment this week. Problem 2(b), on set selection, is now extra credit (= 1/8 of a HW) CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
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 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
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 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Class Outline Introduction to Linear Programming 1 How to Solve a Linear Program 2 Reducing Problems to Linear Programs 3 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: ◮ Can produce cars or trucks CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: ◮ Can produce cars or trucks ◮ Cars take 2 tons metal, 1 ton wood CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: ◮ Can produce cars or trucks ◮ Cars take 2 tons metal, 1 ton wood ◮ Trucks take 3 tons metal, 5 tons wood CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: ◮ Can produce cars or trucks ◮ Cars take 2 tons metal, 1 ton wood ◮ Trucks take 3 tons metal, 5 tons wood ◮ Trucks carry twice as much as cars. CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: ◮ Can produce cars or trucks ◮ Cars take 2 tons metal, 1 ton wood ◮ Trucks take 3 tons metal, 5 tons wood ◮ Trucks carry twice as much as cars. ◮ You are supplied 12 tons metal, 15 tons wood / day. CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: ◮ Can produce cars or trucks ◮ Cars take 2 tons metal, 1 ton wood ◮ Trucks take 3 tons metal, 5 tons wood ◮ Trucks carry twice as much as cars. ◮ You are supplied 12 tons metal, 15 tons wood / day. ◮ Q: how many cars vs trucks to produce to maximize total capacity? CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Linear Programming General way of writing problems: maximize linear function subject to linear constraints. Developed 1939 by Leonid Kantorovich Think central planning of factories: ◮ Can produce cars or trucks ◮ Cars take 2 tons metal, 1 ton wood ◮ Trucks take 3 tons metal, 5 tons wood ◮ Trucks carry twice as much as cars. ◮ You are supplied 12 tons metal, 15 tons wood / day. ◮ Q: how many cars vs trucks to produce to maximize total capacity? Mathematically: maximize: C + 2 T subject to: 2 C + 3 T ≤ 12 C + 5 T ≤ 15 C , T ≥ 0 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Solving small cases by hand maximize: C + 2 T subject to: 2 C + 3 T ≤ 12 C + 5 T ≤ 15 C , T ≥ 0 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Solving small cases by hand maximize: C + 2 T subject to: 2 C + 3 T ≤ 12 C + 5 T ≤ 15 C , T ≥ 0 Algebraically: ◮ Find all vertices, and for each: ◮ Check if feasible (satisfy the constraints) ◮ Pick the feasible vertex maximizing the objective. CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Solving small cases by hand maximize: C + 2 T subject to: 2 C + 3 T ≤ 12 C + 5 T ≤ 15 C , T ≥ 0 Algebraically: ◮ Find all vertices, and for each: ◮ Check if feasible (satisfy the constraints) ◮ Pick the feasible vertex maximizing the objective. Geometrically: ◮ Draw the picture of all feasible points ◮ Slide in the direction of the objective until you get stuck. CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
General Linear Programming (LP) Linear Programming Optimize (maximize or minimize) a linear objective in many variables, subject to linear constraints on them (= , ≤ , ≥ ). CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
General Linear Programming (LP) Linear Programming Optimize (maximize or minimize) a linear objective in many variables, subject to linear constraints on them (= , ≤ , ≥ ). maximize: x 1 + 3 x 2 − 345 x 3 + x 4 subject to: x 1 − 17 x 2 ≤ x 4 + 12 x 4 − x 3 ≥ x 2 67 x 2 − 3 x 1 = 83 x 3 ≤ 0 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Formulations of LP Standard form (or “symmetric”) For m constraints on n variables, given A ∈ R m × n , b ∈ R m , c ∈ R n : maximize: c · x subject to: Ax ≤ b x ≥ 0 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Formulations of LP Standard form (or “symmetric”) For m constraints on n variables, given A ∈ R m × n , b ∈ R m , c ∈ R n : maximize: c · x subject to: Ax ≤ b x ≥ 0 Common alternative forms “Alternative form” “Slack form” maximize: c · x maximize: c · x subject to: Ax ≤ b or subject to: Ax = b x ≥ 0 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
The forms are reducible to each other Standard Alternative Slack max c · x max c · x max c · x Ax ≤ b Ax ≤ b Ax = b x ≥ 0 x ≥ 0 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
The forms are reducible to each other Standard Alternative Slack max c · x max c · x max c · x Ax ≤ b Ax ≤ b Ax = b x ≥ 0 x ≥ 0 Standard → alternative: CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
The forms are reducible to each other Standard Alternative Slack max c · x max c · x max c · x Ax ≤ b Ax ≤ b Ax = b x ≥ 0 x ≥ 0 � A � � b � Standard → alternative: solve alternative with A ′ = , b ′ = − I n 0 CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
The forms are reducible to each other Standard Alternative Slack max c · x max c · x max c · x Ax ≤ b Ax ≤ b Ax = b x ≥ 0 x ≥ 0 � A � � b � Standard → alternative: solve alternative with A ′ = , b ′ = − I n 0 Alternative → standard: CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
The forms are reducible to each other Standard Alternative Slack max c · x max c · x max c · x Ax ≤ b Ax ≤ b Ax = b x ≥ 0 x ≥ 0 � A � � b � Standard → alternative: solve alternative with A ′ = , b ′ = − I n 0 Alternative → standard: new nonnegative variables y and z , so � � x = y − z . Solve standard with A ′ = A − A . CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
The forms are reducible to each other Standard Alternative Slack max c · x max c · x max c · x Ax ≤ b Ax ≤ b Ax = b x ≥ 0 x ≥ 0 � A � � b � Standard → alternative: solve alternative with A ′ = , b ′ = − I n 0 Alternative → standard: new nonnegative variables y and z , so � � x = y − z . Solve standard with A ′ = A − A . Slack → standard: CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
The forms are reducible to each other Standard Alternative Slack max c · x max c · x max c · x Ax ≤ b Ax ≤ b Ax = b x ≥ 0 x ≥ 0 � A � � b � Standard → alternative: solve alternative with A ′ = , b ′ = − I n 0 Alternative → standard: new nonnegative variables y and z , so � � x = y − z . Solve standard with A ′ = A − A . � A � � b � Slack → standard: solve standard with A ′ = , b ′ = . − A − b CS 331, Spring Eric Price (UT Austin) Linear Programming / 17
Recommend
More recommend