1 / 28

Generality of Languages

Generality of Languages. Linear Programs. Algorithm. Simplex Algorithm , Interior Point Algorithms. Reduction. Klein’s algorithm. Min Cost Flow. Algorithm. Reduction. Decreasing efficiency. Algorithm. Max (s,t)-Flow. Edmonds-Karp. Increasing generality. Reduction. Maximum

erich-bond
Download Presentation

Generality of Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Generality of Languages Linear Programs Algorithm Simplex Algorithm, Interior Point Algorithms Reduction Klein’s algorithm Min Cost Flow Algorithm Reduction Decreasing efficiency Algorithm Max (s,t)-Flow Edmonds-Karp Increasing generality Reduction Maximum Cardinality Matching Algorithm Hopcroft-Karp

  2. Min Cost Flow Problem • Given flow network with costs G =(V,E,c,b,k), find flow f minimizing cost(f).

  3. Min Cost Flow Problem • Given G=(V,E,c,b,k), find f: V£V!R minimizing (u,v) 2V£Vk(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). 8u2V: v2Vf(u,v) = b(u)

  4. Min Cost Flow Problem Find (x1, x2,…, x64) 2R64 minimizing k1x1 + k2x2 +  + k64x64 so that x1· 3, x2· -1, ….. x1 = - x19, x2 = - x27, …. x9 + x17 + x34 = 17, x12 + x11 + x19 = 0, ….

  5. Linear Programs Find x2Rn minimizing or maximizing a linear formhx,ci = i ci xi (the objective function) so that a given set of linear equations and inequalitiesare satisfied. A feasible solution to the program is a point xsatisfying the equations and inequalities.

  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. Diet Problem Necessary daily intake: Energy 2000 kcal, Protein 55 g, Calcium 800 mg Compose a diet minimizing price and fulfilling necessary daily intake.

  8. Diet Problem Necessary daily intake: Energy 2000 kcal, Protein 55 g, Calcium 800 mg Compose a diet minimizing price and fulfilling necessary daily intake.

  9. Linear Program for Diet Problem Find (x1, x2, x3, x4, x5, x6) 2 (R+)n minimizing 3x1 + 24x2 + 13x3 + 9x4 + 20x5 + 19x6 so that 110x1 + 205x2 + 160 x3 + 160 x4 + 420 x5 + 260 x6¸ 2000 4 x1 + 32 x2 + 13 x3 + 8 x4 + 4 x5 + 14 x6¸ 55 2 x1 + 12 x2 + 54 x3 + 285 x4 + 22 x5 + 80 x6¸ 800

  10. Linear Programs, Geometric View x – y = 0

  11. x – y ¸ 0

  12. x + 2y · 1 Æ x + 3 y ¸ -1 Æ x – y ¸ 0 Æ 2 x - y · 3 x + 2y = 1 x + 3y = -1 x – y = 0 2x – y = 3

  13. x + 2y · 1 Æ x + 3 y ¸ -1 Æ x – y ¸ 0 Æ 2 x - y · 3

  14. The set of feasible solutions F is a convex Polyhedron. F

  15. Minimize x-2y over F x-2y = 0 F x-2y = 1

  16. Minimize x-2y over F x-2y = -2/3 F

  17. Linear Programs, Geometric view • The set of feasible solutions of a linear program is a polyhedronin Rn. • 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 unboundedor empty (the linear program is then said to be infeasible).

  18. 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 d1x1 + d2x2 +  + dn xn·e

  19. Linear Programs in Standard Form Find (x1, x2, x3, …, xn) 2 (R+)n maximizing c1 x1+ c2 x2 +  + cn xn so that a11x1 + a12x2 +  + a1nxn·b1 a21x1 + a22x2 +  + a2nxn· b2 … am1 x1 + am2x2 +  + amnxn·bm Exceptions: If no fesible solution exist, report “Infeasible”. If arbitrarily good feasible solutions exist, report “Unbounded”.

  20. Linear Program in Standard FormMatrix Notation Given A 2Rm£n, b2Rm, c2Rn, find x2 (R+)n maximizing hc,xi so that Ax·b.

  21. Reduction from LP in general form to LP in standard form Suppose we want to minimize (not maximize) c1x1 + c2x2 + cn xn Maximize - c1x1 - c2x2 -  - cn xn

  22. Reduction from LP in general form to LP in standard form Suppose we have a constraint d1x1 + d2x2 +  + dnxn¸e Replace with - d1x1 - d2x2 -  - dn xn· - e

  23. Reduction from LP in general form to LP in standard form Suppose we have a constraint d1x1 + d2x2 +  + dn xn = e Replace with d1x1 + d2x2 +  + dn xn·e - d1x1 - d2x2 -  - dn xn· - e

  24. Reduction from LP in general form to LP in standard form • Suppose yis 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.

  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 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.

  26. 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-.

  27. 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.

More Related