380 likes | 507 Views
FORS 8450 • Advanced Forest Planning Lecture 3 Linear Programming - The Simplex Method (Appendix B of Bettinger, Boston, Siry, and Grebner). Dave Powell, USDA Forest Service, www.forestryimages.org Image number 1210054. Create DCM. Linear programming Simplex method. Calc. opportunity
E N D
FORS 8450 • Advanced Forest Planning Lecture 3 Linear Programming - The Simplex Method (Appendix B of Bettinger, Boston, Siry, and Grebner) Dave Powell, USDA Forest Service, www.forestryimages.org Image number 1210054
Create DCM Linear programming Simplex method Calc. opportunity costs Optimal ? Yes Stop No ID Pivot Column Calc. maximum contributions ID Pivot Row ID Pivot Number Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Linear programming Simplex method - Example Maximize 2.5 X + 8 Y Subject to: 15 X + 20 Y 60 X + 5 Y 10 Y X + 5 Y 10 X 15 X + 20 Y 60
Linear programming Simplex method - Example X Y S1 S2 Q Objective function 2.5 8 2.5 X + 8 Y Constraint 1 15 20 1 60 15 X + 20 Y + S1 = 60 Constraint 2 1 5 1 10 X + 5 Y + S2 = 10 Initially, Q = RHS values
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop No X Y S1 S2 Q ID Pivot Column 2.5 8 15 20 1 60 Calc. maximum contributions 1 5 1 10 ID Pivot Row ID Pivot Number Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Linear programming Simplex method - Example Maximize 2.5 X + 8 Y Subject to: 15 X + 20 Y 60 X + 5 Y 10 Where are we? Y X + 5 Y 10 X 15 X + 20 Y 60
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row Variables currently in the solution have an opportunity cost of 0 or less. "Their value" is their value in the objective function. ID Pivot Number Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row OCx = (Objective function value of variable X) - ((Columnx1 value) ("their value1")) - ((Columnx2 value) ("their value2")) ID Pivot Number Calc. "Ratio" OCx = (2.5) - ((15) (0)) - ((1) (0)) = 2.5 OCy = (8) - ((20) (0)) - ((5) (0)) = 8.0 Transform Pivot Row OCS1 = (0) - ((1) (0)) - ((0) (0)) = 0 Transform Non-Pivot Row(s) OCS2 = (0) - ((0) (0)) - ((1) (0)) = 0
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row 2.5 8.0 0 0 Opportunity costs ID Pivot Number Not the optimal solution, since some opportunity costs are > 0. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row 2.5 8.0 0 0 Opportunity costs ID Pivot Number Pivot Column is the column with the highest opportunity cost Whichever variable that column refers to is "coming into the solution." Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row ID Pivot Number Maximum contributions are the most that the variable represented by the Pivot Column can bring into the solution. Max contribution = (Q row / Pivot Column value row ) Calc. "Ratio" Transform Pivot Row MC constraint #1 = (60 / 20) = 3 MC constraint #2 = (10 / 5) = 2 Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row ID Pivot Number The most of Y that we can bring into the solution is 2 units (related to constraint row #2). Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row ID Pivot Number The Pivot Row is the row related to the maximum contribution of variable Y Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row ID Pivot Number The Pivot Number is the value of the cell at the intersection of the Pivot Row and the Pivot Column. Here, the Pivot Number = 5 Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 1 5 1 10 S2 0 ID Pivot Row ID Pivot Number The "Ratio" for this simple 2-constraint problem is the value in the cell of the non-Pivot Row / Pivot Column (20) divided by the Pivot Number. Here, the "ratio" = (20 / 5) = 4 Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 0.2 1 0.2 2 S2 0 ID Pivot Row ID Pivot Number Transform the Pivot Row by dividing all values in that row by the Pivot Number. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number This indicates that we are bringing the Y variable into the solution. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number Transform the Non-Pivot Row (the other constraint row). New cell value = (old cell value) - (old Pivot Row value for the new cell's column x "ratio") Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 15 20 1 60 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number Example: X variable column, 1st constraint row: Old cell value = 15 Old Pivot Row value for the new cell's column = 1 "ratio" = 4 New cell value = 15 - (1 x 4) = 11 Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Linear programming Simplex method - Example Maximize 2.5 X + 8 Y Subject to: 15 X + 20 Y 60 X + 5 Y 10 Where are we? Y X + 5 Y 10 X 15 X + 20 Y 60
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row OCx = (Objective function value of variable X) - ((Columnx1 value) ("their value1")) - ((Columnx2 value) ("their value2")) ID Pivot Number Calc. "Ratio" OCx = (2.5) - ((11) (0)) - ((0.2) (8)) = 0.9 OCy = (8) - ((0) (0)) - ((1) (8)) = 0 Transform Pivot Row OCS1 = (0) - ((1) (0)) - ((0) (8)) = 0 Transform Non-Pivot Row(s) OCS2 = (0) - ((-4) (0)) - ((0.2) (8)) = -1.6
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row 0.9 0 0 -1.6 Opportunity costs ID Pivot Number Not the optimal solution, since some opportunity costs are > 0. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row 0.9 0 0 -1.6 Opportunity costs ID Pivot Number Pivot Column is the column with the highest opportunity cost Whichever variable that column refers to is "coming into the solution." Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number Maximum contributions are the most that the variable represented by the Pivot Column can bring into the solution. Max contribution = (Q row / Pivot Column value row ) Calc. "Ratio" Transform Pivot Row MC constraint #1 = (20 / 11) = 1.8182 MC constraint #2 = (2 / 0.2) = 10 Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number The most of X that we can bring into the solution is 1.8182 units (related to constraint row #1). Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number The Pivot Row is the row related to the maximum contribution of variable X Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number The Pivot Number is the value of the cell at the intersection of the Pivot Row and the Pivot Column. Here, the Pivot Number = 11 Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 11 0 1 -4 20 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number The "Ratio" for this simple 2-constraint problem is the value in the cell of the non-Pivot Row / Pivot Column (0.2) divided by the Pivot Number. Here, the "ratio" = (0.2 / 11) = 0.018182 Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 S1 0 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number Transform the Pivot Row by dividing all values in that row by the Pivot Number. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 X 2.5 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number This indicates that we are bringing the X variable into the solution. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 X 2.5 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number Transform the Non-Pivot Row (the other constraint row). New cell value = (old cell value) - (old Pivot Row value for the new cell's column x "ratio") Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 X 2.5 Calc. maximum contributions 0.2 1 0.2 2 Y 8 ID Pivot Row ID Pivot Number Example: X variable column, 2nd constraint row: Old cell value = 0.2 Old Pivot Row value for the new cell's column = 11 "ratio" = 0.018182 New cell value = 0.2 - (11 x 0.018182) = 0 Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 X 2.5 Calc. maximum contributions 0 1 -0.018 0.273 1.636 Y 8 ID Pivot Row ID Pivot Number This indicates that we are bringing the X variable into the solution. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 X 2.5 Calc. maximum contributions 0 1 -0.018 0.273 1.636 Y 8 ID Pivot Row OCx = (Objective function value of variable X) - ((Columnx1 value) ("their value1")) - ((Columnx2 value) ("their value2")) ID Pivot Number Calc. "Ratio" OCx = (2.5) - ((1) (2.5)) - ((0) (8)) = 0 OCy = (8) - ((0) (2.5)) - ((1) (8)) = 0 Transform Pivot Row OCS1 = (0) - ((0.09) (2.5)) - ((-.018) (8)) = -0.081 Transform Non-Pivot Row(s) OCS2 = (0) - ((-0.364) (2.5)) - ((0.273) (8)) = -1.27
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 X 2.5 Calc. maximum contributions 0 1 -0.018 0.273 1.636 Y 8 ID Pivot Row 0 0 -0.081 -1.27 Opportunity costs ID Pivot Number The optimal solution, since no opportunity costs are > 0. Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Create DCM Linear programming Simplex method - Example Calc. opportunity costs Optimal ? Yes Stop Variables in the solution No X Y S1 S2 Q Their value ID Pivot Column 2.5 8 1 0 0.09 -0.364 1.818 X 2.5 Calc. maximum contributions 0 1 -0.018 0.273 1.636 Y 8 ID Pivot Row Optimal solution: X = 1.818 Y = 1.636 Solution value = 1.818 (2.5) + 1.636 (8) = 17.633 ID Pivot Number Calc. "Ratio" Transform Pivot Row Transform Non-Pivot Row(s)
Linear programming Simplex method - Example Maximize 2.5 X + 8 Y Subject to: 15 X + 20 Y 60 X + 5 Y 10 Where are we? Y X + 5 Y 10 X 15 X + 20 Y 60