Contents 1. the Simplex Method 1 1.1. Lecture 1: Introduction
Total Page:16
File Type:pdf, Size:1020Kb
Contents 1. The Simplex Method 1 1.1. Lecture 1: Introduction. 1 1.2. Lecture 2: Notation, Background, History. 3 1.3. Lecture 3: The simplex method 7 1.4. Lecture 4: An example. 10 1.5. Lecture 5: Complications 13 1.6. Lecture 6: 2-phase method and Big-M 15 1.7. Lecture 7: Dealing with a general LP 18 1.8. Lecture 8: Duality 22 1.9. Lecture 9: more duality 24 1.10. Lecture 10: Assorted facts on duality 26 1.11. Lecture 11: A problem for duality 29 1.12. Lecture 12: Post-optimal considerations and general Duality 31 1.13. Lecture 13: The Revised Simplex 34 1.14. Lecture 14: Filling the knapsack 38 1.15. Lecture 15: Knapsack, day 2 40 1.16. Lecture 16: Knapsack, day 3 43 1.17. Lecture 17: A branch and bound example in class 50 1.18. Lecture 18: Matrix games 51 1.19. Lecture 19: Mixed strategies 53 1.20. Lecture 20, 21: a game example 59 1.21. Lecture 22: Review for the test 62 1.22. Lecture 23: Midterm 64 1.23. Lecture 24, 25: Network Simplex, Transshipment (Chapter 19) 65 1.24. Lecture 26: Network Simplex, Transshipment: initial trees 69 1.25. Lecture 27: an example on network simplex 73 1.26. Lecture 28: Upper bounded Transshipment problems 75 1.27. Lecture 29: Upper bounded network II 76 1.28. Lecture 30: Network flows 78 1.29. Network simplex on maximum flows problems 78 1.30. Lecture 31: Network flows, part 2 80 1.31. Lecture 32: An example on maximum flows 82 1.32. Lecture 33: Applications of network simplex 83 1.33. Lecture 34: More applications of the network simplex 87 1.34. Lecture 35: Transportation problems 89 1.35. Lecture 36: An transport problem 94 1.36. Lecture 37: Transport example, second day 95 1.37. Lecture 38: Integer Programming 96 1.38. Lectures 39, 40: Gr¨obnerbases and Buchberger algorithm 98 1.39. Lecture 41: Gr¨obnerbases with Maple 100 1 2 1.40. Lectures 42, 43, 44: Review of final material, questions 104 421 COURSE NOTES ULI WALTHER Abstract. Textbook: V. Chvatal, \Linear Programming". grade: 30% midterm, 30% homework, 40% final. homework collected each Thursday in class or in my office by 3pm. 1. The Simplex Method What is linear programming? 1.1. Lecture 1: Introduction. 1.1.1. Some examples: Example 1.1 (Knapsack problem). Looking for x1; : : : ; xn such that x1c1 + ::: + xncn ! max x1a1 + ::: + xnan ≤ A (the knapsack) xi = 0; 18i Example 1.2 (Transportation problem). Looking for x1;1; : : : ; xm;n such that m n X X ci;jxi;j ! min (fuel from i to j) i=1 j=1 n X xi;j = ri8i (producers) j=1 m X xi;j = si8j (consumers) i=1 xi;j ≥ 08i; j Example 1.3 (matrix games). 2 players play against each other a version of stone-paper-scissors. The outcome is decided by how they choose their strategies, no random components. The question is how to choose the strat- egy. Minimize losses in worst case scenario? Maximize wins in best case? Maximize wins in worst case? Minimize losses in best case? When is a game fair? For example, 1 2 ULI WALTHER a b c d A 0 2 -3 0 B -2 0 0 3 C 3 0 0 -4 D 0 -3 4 0 A,. ,d are the possible choices the players Bob and Alice have. Tabulated are the winnings of Alice. How should they play? Example 1.4 (Isoperimetric problem). Amongst all closed curves in the plane with circumference 1 meter, which curve encloses the largest area? (This we will not answer!) Example 1.5 (Garbage removal). Given a weighted graph, find a cheapest (closed?) path that travels along all edges. We may talk about that. 1.1.2. Some geometric remarks. Let us solve 2x + 3y ! max x + 3y ≤ 6 x ≤ 12 x − y ≤ 1 3x + 2y ≤ 6 x; y ≥ 0: (2,3) is the direction in which we maximize. The lines give a finite region with straight lines and corners as boundary. The max will be taken in a corner (unless the maximizing direction is perpendicular to a boundary ! degeneracy). 421 COURSE NOTES 3 1.2. Lecture 2: Notation, Background, History. Definition 1.6. A convex set C is a set for which all line segments between points of C are completely in C as well. Show some examples of convex sets. n n Definition 1.7. A point in R n C (the complement of C in R ) belongs to n the boundary of C ⊆ R if one can get arbitrarily close to P while staying n in C.A closed set C ⊆ R is a set that contains its boundary. n A half space of R is the collection of points satisfying a single linear inequality. A polyhedron or polytope is the intersection of a finite number of half spaces. Polyhedra are convex, and closed. Theorem 1.8. Let C be closed. A linear function f on C takes its maximum and minimum at a point on the boundary, or at infinity. For polyhedra, maxima occur in corners or at infinity. Proof. If f is constant there is nothing to prove. n Let L be a line in R that goes through P 2 C and pick it in such a way that f grows. Then either, we get at some point to the end of C. Then the maximum point on L is part of the boundary of C, which as C is closed is part of C. Or, we never get to the end of C, in which case f is unbounded on C. Hence, no matter what P is, there is always a better point than P on the boundary. (Or f is unbounded.) So the max is on the boundary, and we know that is part of C. 2 In principle: given any number (say m) of conditions (the inequalities) in (say) n < m variables, • choose n conditions, • read them as equalities, • solve for the xi, • check if the other inequalities are OK (admissible solution) • and if so, calculate the objective function. Once this has been done, compare all results and pick the best. In theory linear optimization (with linear constraints) is trivial. Problem: in praxis, one often has hundreds of variables to thousands of 2000 constraints. Let's say n = 500, m = 2000. Then there are 500 = at least 10100 corners. If we could do 1010 per second (that is about 1,000,000 of what can be done) it would take so much time (1082 years) that a snail could go 1054 times from one end of the universe to the other. Thus, one needs a clever way of checking. Strategy: start in some corner, and move to a better one. This can in the 2000/500 example usually be done in a couple of hundreds of steps. 4 ULI WALTHER Example 1.9 (A diet problem:). 3x1 + 24x2 + 13x3 + 9x4 + 20x5 + 19x6 ! min price x1 ≤ 4 (oatmeal) x2 ≤ 3 (chicken) x3 ≤ 2 (eggs) x4 ≤ 8 (mil)k x5 ≤ 2 (cherry pie) x6 ≤ 2 (pork+beans) 110x1 + 205x2 + 160x3 + 160x4 + 420x5 + 260xx ≥ 2000 (calories) 4x1 + 32x2 + 13x3 + 8x4 + 4x5 + 14x6 ≥ 55 (protein, g) 2x1 + 12x2 + 54x3 + 285x4 + 22x5 + 80x6 ≥ 800 (calcium, mg) xi ≥ 08i The first six are dictated by taste, the other 3 by nutritionists. Without the taste constraints, one could have x6 = 10, all others zero (gives 1.90$). With them, 8 = x4; 2 = x5 works(gives 1.12$). But is it the cheapest? Explain: objective (or cost) function, linear equation (constraint), non- negativity constraints, optimal solution, optimal value, feasible/infeasible solution/problem, unbounded problem, decision variables. Explain how unbounded and degenerate problems and infeasible ones come about. Remark 1.10. George Dantzig (1947) made linear programming a science. Before, various people thought about it and recognized the importance (Fourier), but could not make it efficient. Kantorovich (1939) had good ideas like Dantzig, but they were not published. 1975, 2 mathematicians became Nobel prize winners in economics. one a student of Dantzig. The simplex algorithm (next) works most of the time really well, but sometimes is awful. The probability of an awful case is zero. There does exist an algorithm (Khachian,1979) that is never awful, but it is almost always beat by the simplex algorithm. Means: with probability zero simplex loses. 421 COURSE NOTES 5 Homework 1 (for week 2). 2 (1) Find an example of an optimization problem on a region in R with a linear objective function f that is bounded on C but where there is no max in C. (This will by our theorem require a non-closed C). Prove that there is no max on C. (2) Find an example of an optimization problem with a closed C where the max of f is not on the boundary and not at infinity. (By the theorem, this will require a non-linear f.) Prove that the max is where you claim it to be. (3) Solve the following linear program graphically and explain why the max is taken where you claim it is. x1 ≤ 4 2x2 ≤ 12 3x1 + 2x2 ≤ 18 x1; x2 ≥ 0 3x1 + 5x2 ! max (4) Solve the following linear program graphically and explain why the max is taken where you claim it is. x2 ≤ 10 x1 + 2x2 ≤ 15 x1 + x2 ≤ 12 5x1 + 3x2 ≤ 45 x1; x2 ≥ 0 10x1 + 20x2 ! max (5) The Southern Confederation of Kibbutzim (SCK) is a group of three kibbutzim (communal farming communities) in Israel.