Upcoming SlideShare
×

# Review for final exam

3,117 views

Published on

Published in: Technology
1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
3,117
On SlideShare
0
From Embeds
0
Number of Embeds
46
Actions
Shares
0
145
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Review for final exam

1. 1. Review for Final Exam Math 20 January 15, 2008 Announcements Final Friday, January 18, 9:15am ML Oﬃce Hours Wednesday (tomorrow) 10–11 and 2–3 (SC 323) Old exams (and solutions) on website
2. 2. Outline Strictly Determined Games Linear Programming Two-by-two The Corner Principle non-strictly-determined Duality games The Simplex Method Larger, non-strictly The Assignment Problem determined games Zero-sum Game Theory Review of older material
3. 3. The Corner Principle Learning Objectives Formulate a linear programming problem Use the corner principle to solve an LP problem
4. 4. Linear Programming The Corner Principle Deﬁnition A linear programming problem is a constrained optimization problem where the objective function is linear and the constraints are all linear inequalities. Theorem (The Corner Principle) In any linear programming problem, the extreme values of the objective function, if achieved, will be achieved on a corner of the feasibility set.
5. 5. Example A farmer who has a 120-acre farm plants corn and wheat. The expenses are \$12 for each acre of corn planted and \$24 for each acre of wheat planted. Each acre of corn requires 32 bushels of storage and yields a proﬁt of \$40; each acre of wheat requires 8 bushels of storage and yields a proﬁt of \$50. If the total amount of storage available is 160 bushels and the farmer has \$1200 in capital, how many acres of corn and how many acres of wheat should be planted to maximize proﬁt?
6. 6. Formulating the Problem Let x be the number of acres of corn planted and y the number of acres of wheat planted. Then we want to maximize z = 40x + 50y (proﬁt) subject to constraints x+ y ≤ 120 (land) 32x+ 8y ≤ 160 (storage) 12x+24y ≤1200 (capital) as well as x, y > 0.
7. 7. Drawing the feasible set 120 x + y ≤ 12 0 50 12x +2 32x + 4y ≤1 20 200 8y ≤ 160 5 100 120
8. 8. Checking the corners x y z = 40x + 50y 0 0 0 5 0 200 0 20 1000
9. 9. Checking the corners x y z = 40x + 50y 0 0 0 5 0 200 0 20 1000 We should plant 20 acres of wheat and no corn.
10. 10. Duality Learning Objectives Given an LP problem, formulate its dual problem Interpret the solutions to the dual problem in terms of the primal problem
11. 11. Duality Deﬁnition An LP problem is in standard form if it is expressed as max z = c1 x1 + c2 x2 + · · · + cn xn subject to the constraints a11 x1 + a12 x2 + · · · + a1n xn ≤ b1 a21 x1 + a22 x2 + · · · + a2n xn ≤ b2 ··· ··· am1 x1 + am2 x2 + · · · + amn xn ≤ bm x1 , x2 , . . . , xn ≥ 0 In vector notation, an LP problem is in standard form it it reads max z = c x subject to constraints Ax ≤ b, x ≥ 0
12. 12. Deﬁnition Given a linear programming problem in standard form, the dual linear programming problem is min w = b1 y1 + · · · + bm ym subject to constraints a11 y1 + a21 y2 + · · · + am1 ym ≥ p1 a12 y1 + a22 y2 + · · · + am2 ym ≥ p2 ··· ··· a1n y1 + a2n y2 + · · · + amn ym ≥ pn y1 , . . . , ym ≥ 0 or in vector notation, min w = b y subject to constraints A y ≥ c, y ≥ 0.
13. 13. Example In a product-mix problem, the dual problem is to buy out the producer’s materials while minimizing total payout In a diet problem, the dual problem is to sell the nutrients (kind of weird) In any LP problem, the dual variables represent the marginal objective of each variable In some cases the primal problem is easier to solve.
14. 14. Example In a product-mix problem, the dual problem is to buy out the producer’s materials while minimizing total payout In a diet problem, the dual problem is to sell the nutrients (kind of weird) In any LP problem, the dual variables represent the marginal objective of each variable In some cases the primal problem is easier to solve. Look at Lesson 30 for a good, worked out example.
15. 15. The Simplex Method Learning Objectives Form tableaux and how to move between them Given an LP problem in standard form, solve it using the simplex method Interpret the solutions to the dual problem in terms of the simplex method solution for the primal problem
16. 16. The Simplex Method 1. Set up the initial tableau. 2. Apply the optimality test. If the objective row has no negative entries in the columns labeled with variables, then the indicated solution is optimal; we can stop. 3. Choose a pivotal column by determining the column with the most negative entry in the objective row. If there are several candidates for a pivotal column, choose any one. 4. Choose a pivotal row. Form the ratios of the entries above the objective row in the rightmost column by the corresponding entries of the pivotal column for those entries in the pivotal column which are positive. The pivotal row is the row for which the smallest of these ratios occurs. If there is a tie, choose any one of the qualifying rows. If none of the entries in the pivotal column above the objective row is positive, the problem has no ﬁnite optimum. We stop. 5. Perform pivotal elimination to construct a new tableau and return to Step 2.
17. 17. Example We are going to solve the linear programming problem of maximizing z = 2x1 − 4x2 + 5x3 subject to constraints 3x1 + 2x2 + x3 ≤ 6 3x1 − 6x2 + 7x3 ≤ 9 and x1 , x2 , x3 ≥ 0.
18. 18. Tableau x1 x2 x3 u1 u2 z value u1 3 2 1 1 0 0 6 u2 3 −6 7 0 1 0 9 z −2 4 −5 0 0 1 0
19. 19. Tableau x1 x2 x3 u1 u2 z value u1 3 2 1 1 0 0 6 u2 3 −6 7 0 1 0 9 z −2 4 −5 0 0 1 0 largest negative coeﬃcient in ob- jective row
20. 20. Tableau entering variable x1 x2 x3 u1 u2 z value u1 3 2 1 1 0 0 6 u2 3 −6 7 0 1 0 9 z −2 4 −5 0 0 1 0 largest negative coeﬃcient in ob- jective row
21. 21. Tableau entering variable x1 x2 x3 u1 u2 z value θ u1 3 2 1 1 0 0 6 6 u2 3 −6 7 0 1 0 9 9/7 z −2 4 −5 0 0 1 0 largest negative coeﬃcient in ob- jective row
22. 22. Tableau smallest positive entering variable θ-ratio x1 x2 x3 u1 u2 z value θ u1 3 2 1 1 0 0 6 6 u2 3 −6 7 0 1 0 9 9/7 z −2 4 −5 0 0 1 0 largest negative coeﬃcient in ob- jective row
23. 23. Tableau departing variable smallest positive entering variable θ-ratio x1 x2 x3 u1 u2 z value θ u1 3 2 1 1 0 0 6 6 u2 3 −6 7 0 1 0 9 9/7 z −2 4 −5 0 0 1 0 largest negative coeﬃcient in ob- jective row
24. 24. Tableau departing variable smallest positive entering variable θ-ratio x1 x2 x3 u1 u2 z value θ u1 3 2 1 1 0 0 6 6 u2 3 −6 7 0 1 0 9 9/7 z −2 4 −5 0 0 1 0 make this entry 1 and the rest of its largest negative column 0 coeﬃcient in ob- jective row
25. 25. Tableau x1 x2 x3 u1 u2 z value u1 3 2 1 1 0 0 6 u2 3 −6 7 0 1 0 9 ×1/7 z −2 4 −5 0 0 1 0 make this entry 1 and the rest of its column 0
26. 26. Tableau x1 x2 x3 u1 u2 z value u1 3 2 1 1 0 0 6 x3 3/7 −6/7 1 0 1/7 0 9/7 z −2 4 −5 0 0 1 0 make this entry 1 and the rest of its column 0
27. 27. Tableau x1 x2 x3 u1 u2 z value u1 3 2 1 1 0 0 6 −1 x3 3/7 −6/7 1 0 1/7 0 9/7 z −2 4 −5 0 0 1 0 5 make this entry 1 and the rest of its column 0
28. 28. Tableau x1 x2 x3 u1 u2 z value u1 18/7 20/7 0 1 −1/7 0 33/7 x3 3/7 −6/7 1 0 1/7 0 9/7 z −2 4 −5 0 0 1 0 make this entry 1 and the rest of its column 0
29. 29. Tableau x1 x2 x3 u1 u2 z value u1 18/7 20/7 0 1 −1/7 0 33/7 x3 3/7 −6/7 1 0 1/7 0 9/7 z 1/7 −2/7 0 0 5/7 1 45/7 make this entry 1 and the rest of its column 0
30. 30. Tableau x1 x2 x3 u1 u2 z value u1 18/7 20/7 0 1 −1/7 0 33/7 x3 3/7 −6/7 1 0 1/7 0 9/7 z 1/7 −2/7 0 0 5/7 1 45/7 largest negative coeﬃcient in ob- jective row
31. 31. Tableau entering variable x1 x2 x3 u1 u2 z value u1 18/7 20/7 0 1 −1/7 0 33/7 x3 3/7 −6/7 1 0 1/7 0 9/7 z 1/7 −2/7 0 0 5/7 1 45/7 largest negative coeﬃcient in ob- jective row
32. 32. Tableau entering variable x1 x2 x3 u1 u2 z value θ u1 18/7 20/7 0 1 −1/7 0 33/7 33/20 x3 3/7 −6/7 1 0 1/7 0 9/7 −3/2 z 1/7 −2/7 0 0 5/7 1 45/7 largest negative coeﬃcient in ob- jective row
33. 33. Tableau smallest positive θ-ratio entering variable x1 x2 x3 u1 u2 z value θ u1 18/7 20/7 0 1 −1/7 0 33/7 33/20 x3 3/7 −6/7 1 0 1/7 0 9/7 −3/2 z 1/7 −2/7 0 0 5/7 1 45/7 largest negative coeﬃcient in ob- jective row
34. 34. Tableau smallest positive departing variable θ-ratio entering variable x1 x2 x3 u1 u2 z value θ u1 18/7 20/7 0 1 −1/7 0 33/7 33/20 x3 3/7 −6/7 1 0 1/7 0 9/7 −3/2 z 1/7 −2/7 0 0 5/7 1 45/7 largest negative coeﬃcient in ob- jective row
35. 35. Tableau smallest positive departing variable θ-ratio entering variable x1 x2 x3 u1 u2 z value θ u1 18/7 20/7 0 1 −1/7 0 33/7 33/20 x3 3/7 −6/7 1 0 1/7 0 9/7 −3/2 z 1/7 −2/7 0 0 5/7 1 45/7 make this entry 1 largest negative and the rest of its coeﬃcient in ob- column 0 jective row
36. 36. Tableau x1 x2 x3 u1 u2 z value u1 18/7 20/7 0 1 −1/7 0 33/7 ×7/20 x3 3/7 −6/7 1 0 1/7 0 9/7 z 1/7 −2/7 0 0 5/7 1 45/7 make this entry 1 and the rest of its column 0
37. 37. Tableau x1 x2 x3 u1 u2 z value x2 9/10 1 0 7/20 −1/20 0 33/20 x3 3/7 −6/7 1 0 1/7 0 9/7 z 1/7 −2/7 0 0 5/7 1 45/7 make this entry 1 and the rest of its column 0
38. 38. Tableau x1 x2 x3 u1 u2 z value x2 9/10 1 0 7/20 −1/20 0 33/20 6/7 x3 3/7 −6/7 1 0 1/7 0 9/7 2/7 z 1/7 −2/7 0 0 5/7 1 45/7 make this entry 1 and the rest of its column 0
39. 39. Tableau x1 x2 x3 u1 u2 z value x2 9/10 1 0 7/20 −1/20 0 33/20 x3 6/5 0 1 3/10 1/10 0 27/10 z 1/7 −2/7 0 0 5/7 1 45/7 make this entry 1 and the rest of its column 0
40. 40. Tableau x1 x2 x3 u1 u2 z value x2 9/10 1 0 7/20 −1/20 0 33/20 x3 6/5 0 1 3/10 1/10 0 27/10 z 2/5 0 0 1/10 7/10 1 69/10
41. 41. Tableau x1 x2 x3 u1 u2 z value x2 9/10 1 0 7/20 −1/20 0 33/20 x3 6/5 0 1 3/10 1/10 0 27/10 z 2/5 0 0 1/10 7/10 1 69/10 No more negative coeﬃcients. We are done!
42. 42. Tableau x1 x2 x3 u1 u2 z value x2 9/10 1 0 7/20 −1/20 0 33/20 x3 6/5 0 1 3/10 1/10 0 27/10 z 2/5 0 0 1/10 7/10 1 69/10 No more negative coeﬃcients. We are done!
43. 43. Simplex Method and Duality Once the problem is solved, the entries in the objective row below the slack variables are the solutions to the dual problem! This means we can solve some LP problems by ﬁnding their duals and solving them instead.
44. 44. Outline Strictly Determined Games Linear Programming Two-by-two The Corner Principle non-strictly-determined Duality games The Simplex Method Larger, non-strictly The Assignment Problem determined games Zero-sum Game Theory Review of older material
45. 45. The Assignment Problem Learning Objectives Formulate a (linear) assignment problem Solve linear assignment problems using the Hungarian algorithm
46. 46. The Assignment Problem Given: A set of “jobs” to assign to “people” (start with the same of each, can solve the general problem later) A cost of assigning each job to each person Find the assignment that minimizes total cost.
47. 47. Mathematical Formulation Let C = (cij ) be the costs of assigning job j to person i Let X = (xij ) be 1 if person i does job j, 0 otherwise. The problem is to minimize n cij xij i,j=1 subject to constraint that there is exactly one 1 in each row and column, and the rest of the entries in each row and column are zero. The goal is to replace C with an “ideal cost matrix” with the properties that All entries are nonnegative There is a “sudoku pattern” of zeroes Then the minimal assignment(s) are clear.
48. 48. The Hungarian Algorithm Work with C: 1. Find the minimum entry in each row and subtract it from each row 2. Find the minimum entry in each column and subtract it from each column. The resulting matrix is nonnegative 3. Using lines that go all the way across or all the way up-and-down, cross out all zeros in the new cost matrix 4. If you can only do this with n lines, an assignment of zeroes is possible. 5. Otherwise, determine the smallest entry not covered by any line. Subtract this entry from all uncovered entries Add it to all double-covered entries Return to Step 3
49. 49. Example A coin dealer is to sell four coins through a mail auction. Bids are received for each of the four coins from ﬁve bidders with instructions that at most one of his bids is to be honored. The bids are: Bids Coin 1 Coin 2 Coin 3 Coin 4 Bidder 1 \$150 \$65 \$210 \$135 Bidder 2 175 75 230 155 Bidder 3 135 85 200 140 Bidder 4 140 70 190 130 Bidder 5 170 50 200 160 How should the dealer assign the four coins in order to maximize the sum of the resulting bids?
50. 50. Solution We create a dummy coin for which each bidder bids nothing. The maximum bid is \$230, we replace all the entries with \$230 minus them. This changes our maximization problem into a minimization problem. For the entries now represent not the amount bid but the amount expected back from a \$230 payment, and clearly the dealer wants to minimize the amount given back.
51. 51. Non-negativizing the cost matrix So we have −30 −115 −40 −190     80 165 20 95 230 −20 60 145 0 75 210 55 155 0 75 230 55 155 0 75 230         95 145 30 90 230−30 65 115 0 60 200     90 160 40 100 230−40 50 120 0 60 190     60 180 30 70 230 −30 30 150 0 40 200   30 30 0 35 20 25 40 0 35 40   35 0 0 20 10   20 5 0 20 0  0 35 0 0 10
52. 52. Crossing out     30 30 0 35 20 10 10 0 15 0 25 40 0 35 40 5 20 0 15 20         35 0 0 20 10 35 0 20 20 10         20 5 0 20 0 20 5 20 20 0       0 35 0 0 10 0 35 20 0 10   5 10 0 10 0   0 20 0 10 20     3 0 20 15 10    15 5 20 15 0  0 40 25 0 15
53. 53. The answer Since we have the assignment of zeroes, we can read oﬀ the solution: Bidder 1 gets Coin 3 Bidder 2 gets Coin 1 Bidder 3 gets Coin 2 Bidder 4 gets the dummy coin (nothing) Bidder 5 gets Coin 4
54. 54. Outline Strictly Determined Games Linear Programming Two-by-two The Corner Principle non-strictly-determined Duality games The Simplex Method Larger, non-strictly The Assignment Problem determined games Zero-sum Game Theory Review of older material
55. 55. Zero-sum Game Theory Learning Objectives Formulate a game theory problem, ﬁnding strategies and payoﬀs Find the optimal strategies for games strictly determined games 2 × 2 non-strictly-determined games using the simplex method
56. 56. Deﬁnitions A game theory problem is a contest between two players who “move” simultaneously The row player chooses among m strategies and the column player chooses among n strategies. The payoﬀ aij is the amount paid to the row player if R chooses i and C chooses j (could be negative). A strategy vector is a probability vector representing the percentage of the time each strategy should be chosen: row player’s strategy is a row vector p column players strategy is a column vector q The expected value of these strategies is the sum n E (p, q) = pi aij qj = pAq i,j=1
57. 57. Theorem (Fundamental Theorem of Zero-Sum Games) There exist optimal strategies p∗ for R and q∗ for C such that for all strategies p and q: E (p∗ , q) ≥ E (p∗ , q∗ ) ≥ E (p, q∗ )
58. 58. Theorem (Fundamental Theorem of Zero-Sum Games) There exist optimal strategies p∗ for R and q∗ for C such that for all strategies p and q: E (p∗ , q) ≥ E (p∗ , q∗ ) ≥ E (p, q∗ ) E (p∗ , q∗ ) is called the value v of the game.
59. 59. Theorem (Fundamental Theorem of Zero-Sum Games) There exist optimal strategies p∗ for R and q∗ for C such that for all strategies p and q: E (p∗ , q) ≥ E (p∗ , q∗ ) ≥ E (p, q∗ ) E (p∗ , q∗ ) is called the value v of the game. So the problem is to ﬁnd p∗ and q∗ .
60. 60. Strictly Determined Games Deﬁnition Let A be a payoﬀ matrix. A saddle point is an entry ars which is the minimum entry in its row and the maximum entry in its column. A game whose payoﬀ matrix has a saddle point is called strictly determined Payoﬀ matrices can have multiple saddle points
61. 61. Strictly Determined Games Deﬁnition Let A be a payoﬀ matrix. A saddle point is an entry ars which is the minimum entry in its row and the maximum entry in its column. A game whose payoﬀ matrix has a saddle point is called strictly determined Payoﬀ matrices can have multiple saddle points Theorem Let A be a payoﬀ matrix. If ars is a saddle point, then er (choose r all the time) is an optimal strategy for R es (choose s all the time) is an optimal strategy for C
62. 62. Finding equilibria by gravity If C chose strategy 2, and R knew it, R would   deﬁnitely choose 2  1 3    This would make C     choose strategy 1     but (2, 1) is an   2 4 equilibrium, a saddle point.
63. 63. Finding equilibria by gravity   Here (1, 1) is an equilibrium  2 3  position; starting from there     neither player would want to     deviate from this.     1 4
64. 64. Finding equilibria by gravity    2 3    What about this one?           4 1
65. 65. Zero-sum Game Theory Two-by-two non-strictly-determined games In this case we can compute E (p, q) by hand in terms of p1 and q1 (see Lesson 34 for the details) a22 − a21 a22 − a12 p1 = q1 = a11 + a22 − a21 − a22 a11 + a22 − a21 − a12 p2 = 1 − p1 q2 = 1 − q1 These are in between 0 and 1 if there are no saddle points in the matrix. a11 a22 − a12 a21 v= a11 + a22 − a21 − a12 To remember this, remember that q is the strategy for the column player. So to get q1 we take the diﬀerence between the two entries in the second column.
66. 66. Examples 1 3 If A = , then p1 = 2 ? Doesn’t work because A has a 0 2 4 saddle point. 2 3 If A = , p1 = 3 ? Again, doesn’t work. 2 1 4 2 3 If A = , p1 = −3 = 3 , while q1 = −4 = 2 . So R −4 4 −2 1 4 1 should pick 1 half the time and 2 the other half, while C should pick 1 3/4 of the time and 2 the rest.
67. 67. Larger, non-strictly determined games Theorem Consider a game with payoﬀ matrix A, where each entry of A is positive. 1 The column player’s optimal strategy q is z x, where x ≥ 0 satisﬁes the LP problem of maximizing z = x1 + · · · + xn subject to the constraints Ax ≤ 1. 1 The row player’s optimal strategy p is is w y, where y ≥ 0 satisﬁes the LP problem of minimizing w = y1 + · · · + yn subject to the constraint that A y ≥ 1. The two problems are dual to each other, so the optimal values of the objective are the same. The value of the game is 1 1 v = z = w.
68. 68. Method By adding a constant to every entry in the payoﬀ matrix A, make sure every entry is positive Solve the LP problem of maximizing z = x1 + · · · + xn subject to the constraints Ax ≤ 1. 1 Then v = z and the entries of q are the entries of x divided by z The values of the slack variables, again divided by z, are the entries of p. The value of the game is v , minus the quantity added at the beginning See Lesson 35 and the Game Theory problem set solutions for details.