Download presentation
Presentation is loading. Please wait.
1
1 Generality of Languages Maximum Cardinality Matching Max (s,t)-Flow Min Cost Flow Hopcroft-Karp Linear Programs Reduction Edmonds-Karp Klein’s algorithm Simplex Algorithm, Interior Point Algorithms Algorithm Increasing generality Decreasing efficiency Algorithm
2
2 Min Cost Flow Problem Given flow network with costs G =(V,E,c,b,k), find flow f minimizing cost(f).
3
3 Min Cost Flow Problem Given G=(V,E,c,b,k), find f: V £ V ! R minimizing (u,v) 2 V £ V k(u,v) f(u,v) so that 8 (u,v): f(u,v) · c(u,v). 8 (u,v): f(u,v) = – f(v,u). 8 u 2 V: v 2 V f(u,v) = b(u)
4
4 Min Cost Flow Problem Find (x 1, x 2,…, x 64 ) 2 R 64 minimizing k 1 x 1 + k 2 x 2 + + k 64 x 64 so that x 1 · 3, x 2 · -1, ….. x 1 = - x 19, x 2 = - x 27, …. x 9 + x 17 + x 34 = 17, x 12 + x 11 + x 19 = 0, ….
5
5 Linear Programs Find x 2 R n minimizing or maximizing a linear form h x,c i = i c i x i (the objective function) so that a given set of linear equations and inequalities are satisfied. A feasible solution to the program is a point x satisfying the equations and inequalities.
6
6 Linear Programs Linear Programs generalize the min cost flow problem. Linear Programs generalize systems of linear equations. To solve general linear programs we seem to need a common generalization of Klein’s algorithm and Gaussian elimination!
7
7 Diet Problem Serving Size Energy (kcal) Protein (g) Calcium (mg) Price per serving (cents) Oatmeal28 g110423 Chicken100 g205321224 Eggs2 large160135413 Whole Milk237 cc16082859 Cherry Pie170 g42042220 Pork with Beans260 g260148019 Necessary daily intake: Energy 2000 kcal, Protein 55 g, Calcium 800 mg Compose a diet minimizing price and fulfilling necessary daily intake.
8
8 Diet Problem Serving Size Energy (kcal) Protein (g) Calcium (mg) Price per serving (cents) Oatmeal x 1 28 g110423 Chicken x 2 100 g205321224 Eggs x 3 2 large160135413 Whole Milk x 4 237 cc16082859 Cherry Pie x 5 170 g42042220 Pork with Beans x 6 260 g260148019 Necessary daily intake: Energy 2000 kcal, Protein 55 g, Calcium 800 mg Compose a diet minimizing price and fulfilling necessary daily intake.
9
9 Linear Program for Diet Problem Find (x 1, x 2, x 3, x 4, x 5, x 6 ) 2 (R + ) n minimizing 3x 1 + 24x 2 + 13x 3 + 9x 4 + 20x 5 + 19x 6 so that 110x 1 + 205x 2 + 160 x 3 + 160 x 4 + 420 x 5 + 260 x 6 ¸ 2000 4 x 1 + 32 x 2 + 13 x 3 + 8 x 4 + 4 x 5 + 14 x 6 ¸ 55 2 x 1 + 12 x 2 + 54 x 3 + 285 x 4 + 22 x 5 + 80 x 6 ¸ 800
10
10 Linear Programs, Geometric View x – y = 0
11
11 x – y ¸ 0
12
12 x – y = 0 x + 3y = -1 x + 2y = 1 2x – y = 3 x + 2y · 1 Æ x + 3 y ¸ -1 Æ x – y ¸ 0 Æ 2 x - y · 3
13
13 x + 2y · 1 Æ x + 3 y ¸ -1 Æ x – y ¸ 0 Æ 2 x - y · 3
14
14 The set of feasible solutions F is a convex Polyhedron. F
15
15 F Minimize x-2y over F x-2y = 1 x-2y = 0
16
16 F Minimize x-2y over F x-2y = -2/3
17
17 Linear Programs, Geometric view The set of feasible solutions of a linear program is a polyhedron in R n. The minimal (maximal) value of the linear objective function is attained in a corner of the polyhedron. Simplex algorithm: Do a local search, walking from corner to corner of the polyhedron improving the objective function until no improvement is possible. Exceptions: The set of feasible solutions may be unbounded or empty (the linear program is then said to be infeasible).
18
18
19
19 Linear Programs in Standard Form The objective must be to maximize a linear function. All variables are restricted to non- negative values. All constraints have the form d 1 x 1 + d 2 x 2 + + d n x n · e
20
20 Linear Programs in Standard Form Find (x 1, x 2, x 3, …, x n ) 2 (R + ) n maximizing c 1 x 1 + c 2 x 2 + + c n x n so that a 11 x 1 + a 12 x 2 + + a 1n x n · b 1 a 21 x 1 + a 22 x 2 + + a 2n x n · b 2 … a m1 x 1 + a m2 x 2 + + a mn x n · b m Exceptions: If no fesible solution exist, report “Infeasible”. If arbitrarily good feasible solutions exist, report “Unbounded”.
21
21 Linear Program in Standard Form Matrix Notation Given A 2 R m £ n, b 2 R m, c 2 R n, find x 2 (R + ) n maximizing h c,x i so that Ax · b.
22
22 Reduction from LP in general form to LP in standard form Suppose we want to minimize (not maximize) c 1 x 1 + c 2 x 2 + c n x n Maximize - c 1 x 1 - c 2 x 2 - - c n x n
23
23 Reduction from LP in general form to LP in standard form Suppose we have a constraint d 1 x 1 + d 2 x 2 + + d n x n ¸ e Replace with - d 1 x 1 - d 2 x 2 - - d n x n · - e
24
24 Reduction from LP in general form to LP in standard form Suppose we have a constraint d 1 x 1 + d 2 x 2 + + d n x n = e Replace with d 1 x 1 + d 2 x 2 + + d n x n · e - d 1 x 1 - d 2 x 2 - - d n x n · - e
25
25 Reduction from LP in general form to LP in standard form Suppose y is a variable for which we do not want the constraint y ¸ 0. Suppose we do want a constraint such as y ¸ -17 Introduce new variable y’ = y+17 and replace y with y’-17 everywhere in the program.
26
26 Reduction from LP in general form to LP in standard form Suppose y is a variable for which we do not want the constraint y ¸ 0 and no other constraint y ¸ –c. Introduce two new variables y +, y - with constraints y + ¸ 0, y - ¸ 0. Replace y with y + - y - everywhere in the program. Do this for every unconstrained variable in the program.
27
27 Reduction from LP in general form to LP in standard form The old program P and the new program P’ are related as follows: A feasible solution to P can be converted to a feasible solution to P’ with same value by setting y + = max(y,0), y - = – min(y,0). A feasible solution to P’ can be converted to a feasible solution to P with same value by setting y = y + - y -.
28
28 Reduction from LP in general form to LP in standard form Conclusion: Linear Programs in general form can be converted to linear programs in standard form by doubling the number of constraints and doubling number of variables. From a practical point of view, the factor 2 £ 2= 4 blowup in size is undesirable. Exercise: One extra constraint and one extra variable suffices.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.