Upload
dorcas-casey
View
214
Download
1
Embed Size (px)
Citation preview
This presentation shows how the tableau method is used to solve a simple linear programming problem in two variables:
Maximising subject to two constraints.
Setting up problem
• Constraint equations
• 2x + y < 10
• 6x + 24y < 72
• The objective function (maximise)
• P = 4x + 6y
6x + 24y < 72
2x + y < 10 x = 0 y = 10y = 0 x = 5
x = 0 y = 3y = 0 x = 12
Note Maximum x value in shaded area is x = 5
Maximum y value in shaded area is y = 3
At intersection x = 4 and y = 2
Profit = 4x + 6y = 18Profit = 4x + 6y = 20Profit = 4x + 6y = 28
-1
1
2
3
4
5
2 4 6 8 10 12 14 16 180X->
|̂Y
To find the maximum profit we need to consider each vertex in the shaded area.
What the simplex method does is an algebraic method of considering each vertex in turn that can be applied to any number of variables.
2 variables can be represented graphically easily
3 variables can be represented graphically by intersecting planes – but 4 or more variables is impossible to represent graphically
Applying the Simplex AlgorithmIn the Simplex algorithm slack variables are used to convert inequalities into equations
which can then be solved using a tableau
e.g. 2x + y < 10
6x + 24y < 72
x > 0 y > 0.
Maximise the profit P = 4x + 6y.
Let 2x + y + s = 10 6x + 24y + t = 72 where s and t are slack variables s > 0 t > 0.
The slack variables represent the difference between the amount used and the max amount allowable.
In equation (1) 23 + 2 = 8 so the slack s is 2 as the maximum allowed is 10.
In equation (2) 63 + 242 = 66 so the slack t is 6 as the maximum allowed is 72.
Ex If x = 3 and y = 2
Maximisation problemsThe objective function P = 4x + 6y is rewritten as
P - 4x - 6y = 0
Objective equation must equal zero.
Setting up problem
• Constraint equation 1
• 2x + y < 10
• becomes
• 2x + y + s = 10
• s is a slack variable which represents the difference between the amount used and the max amount allowable.
Setting up problem
• Constraint equation 2
• 6x + 24y < 72
• becomes
• 6x +24y + t = 72t is a slack variable which represents the difference between the amount used and the max amount allowable.
Setting up problem
The objective function (maximise)
• P = 4x + 6y
• becomes
• P – 4x – 6y = 0
Setting up problem
• P – 4x – 6y = 0
• 2x + y + s = 10
• 6x +24y + t = 72
• These equations are all put into a table and the objective is to make all the coefficients in the objective function positive.
LINEAR PROGRAMMING
Example 1
Maximise P – 4x – 6y = 0Subject to 2x + y + s = 10
6x +24y + t = 72
Initial solution:
P = 0
at (0, 0)
-1
1
2
3
4
5
2 4 6 8 10 12 14 16 180X->
|̂Y
6x + 24y < 72
LINEAR PROGRAMMING
Example 1
Maximise P – 4x – 6y = 0Subject to 2x + y + s = 10
6x +24y + t = 72
Maximise Pwhere P - 4x - 6y = 0subject to 2x + y + s = 10
6x + 24y + t = 72
The table
P x y s t l Equation
1 -4 -6 0 0 0 (1)
0 2 1 1 0 10 (2)
1P – 4x – 6y = 06x +24y + t = 722x + y + s = 10
0 6 24 0 1 72 (3)
P x y s t RHS
1 -4 -6 0 0 0
0 2 1 1 0 10
0 6 24 0 1 72
SIMPLEX TABLEAU
P = 0, x = 0, y = 0, s = 10, t = 72
Initial solution
P x y s t RHS
1 -4 -6 0 0 0
0 2 1 1 0 10
0 6 24 0 1 72
PIVOT 1
Choosing the pivot column
Choose negative number in objective row
P x y s t RHS
1 -4 -6 0 0 0
0 2 1 1 0 10 10/2=5
0 6 24 0 1 72 72/6=12
PIVOT 1
Choosing the pivot element
Ratio test: Min. of 2 ratios gives 2 as pivot element
P x y s t RHS
1 -4 -6 0 0 0
0 1 0 5
0 6 24 0 1 72
PIVOT 1
Making the pivot
Divide through the pivot row by the pivot element
P x y s t RHS
1 0 -6 0 0 0
0 1 0 5
0 6 24 0 1 72
PIVOT 1
Making the pivot
Objective row + 4×pivot row
P x y s t RHS
1 0 -4 0 0 0
0 1 0 5
0 6 24 0 1 72
PIVOT 1
Making the pivot
Objective row + 4×pivot row
P x y s t RHS
1 0 -4 2 0 0
0 1 0 5
0 6 24 0 1 72
PIVOT 1
Making the pivot
Objective row + 4×pivot row
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 6 24 0 1 72
PIVOT 1
Making the pivot
Objective row + 4×pivot row
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 24 0 1 72
PIVOT 1
Making the pivot
2nd constraint row - 6×pivot row
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 21 0 1 72
PIVOT 1
Making the pivot
2nd constraint row - 6×pivot row
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 21 -3 1 72
PIVOT 1
Making the pivot
2nd constraint row - 6×pivot row
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 21 -3 1 72
PIVOT 1
Making the pivot
2nd constraint row - 6×pivot row
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 21 -3 1 42
PIVOT 1
Making the pivot
2nd constraint row - 6×pivot row
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 21 -3 1 42
PIVOT 1
New solution
P = 20, x = 5, y = 0, r = 0, s = 0
The processP x y s t l Equation
1 -4 -6 0 0 0 (1)
0 2 1 1 0 10 (2)
0 6 24 0 1 72 (3)10 ÷ 2 = 572 ÷ 6 = 12
Smallest value
(4) = 4 x (5) + (1) making x = 0(5) = (2) ÷ 2 to obtain a 1, pivot row
(6) = (3) - 6 x (5) –making x = 0
0
0
1 42
20
5
1
0
0
0
1
0
-4
½
21
2
½
-3
Choose a column with a negative objective function for x or y
-4102726
This means we have found the smallest x intercept i.e. x = 5
Interpreting IterationsP x y s t l
1 -4 -6 0 0 0
0 2 1 1 0 10
0 6 24 0 1 72
1 0 -4 2 0 20
0 1 ½ ½ 0 5
0 0 21 -3 1 42If y and s = 0 then x = 5This means we are at the point x = 5 and y = 0 which was the smallest x intercept on the 2D graph drawn earlier
If y and s = 0 then P = 20
-1
1
2
3
4
5
2 4 6 8 10 12 14 16 180X->
|̂Y
6x + 24y < 72
2x + y < 10
Profit = 4x + 6y = £20x = 5 and y = 0
Understanding why it is not a maximum
–42–13–2100
501/21/210
2002–401
ltsyxP
If y is increased then the profit would increase. So we have not yet reached a maximum profit.
P – 4y + 2s = 20
P = 20 + 4y – 2s
s and t are slack variables which represent the difference between the amount used and the max amount allowable.
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 21 -3 1 42
PIVOT 2
Choose negative number in objective row
Choosing the pivot column
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5 5/ =10
0 0 21 -3 1 42 42/21=2
PIVOT 2
Choosing the pivot element
Ratio test: Min. of 3 ratios gives 21 as pivot element
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
Divide the pivot row by the pivot element
P x y s t RHS
1 0 -4 2 0 20
0 1 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
Objective row + 4 x pivot row
P x y s t RHS
1 0 0 2 0 20
0 1 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
Objective row + 4 x pivot row
P x y s t RHS
1 0 0 30/21 0 20
0 1 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
Objective row + 4 x pivot row
P x y s t RHS
1 0 0 30/214/21 20
0 1 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
Objective row + 4 x pivot row
P x y s t RHS
1 0 0 30/214/21 28
0 1 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
Objective row + 4 x pivot row
P x y s t RHS
1 0 0 30/214/21 28
0 1 0 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
1st constraint row - x pivot row
P x y s t RHS
1 0 0 30/214/21 28
0 1 0 24/42 0 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
1st constraint row - x pivot row
P x y s t RHS
1 0 0 30/214/21 28
0 1 0 24/42-1/42 5
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
1st constraint row - x pivot row
P x y s t RHS
1 0 0 30/214/21 28
0 1 0 24/42-1/42 4
0 0 1 -3/211/21 2
PIVOT 2
Making the pivot
1st constraint row - x pivot row
The processP x y s t l Equation
1 -4 -6 0 0 0
0 2 1 1 0 10
0 6 24 0 1 72
(4)
(6) 42 ÷ 21 = 2
0
0
1 42
205
1
0
0
0
1
0
-4½21
2
½
-3
Choose a column with a negative objective function for x or y
1 0 0 (7) = (4) + 4 x (9) making y =030/214/21
24/42-1/42
-3/211/21
0
0
0
0
1
28
4
1 2
(8) = (5) - x(9) making y = 0
(9) = (6) ÷ 21 to obtain 1, pivot row
-4(5) 5 ÷ ½ = 10
Smallest value5½ 4221
Interpreting Iterations
If s and t = 0 then P = 28
If s and t equal 0 then x = 4
If s and t equal 0 then y = 2
This means we are at the point x = 4 and y = 2 which was the interception of the 2 lines on the 2D graph drawn earlier.P = 4x + 6y = £28
P x y s t l
1 -4 -6 0 0 0
0 2 1 1 0 10
0 6 24 0 1 72
1 0 -4 2 0 20
0 1 ½ ½ 0 5
0 0 -21 3 -1 -42
1 0 0 30/214/21 28
0 1 0 24/42-1/42 4
0 0 1 -3/211/21 2
-1
1
2
3
4
5
2 4 6 8 10 12 14 16 180X->
|̂Y
6x + 24y < 72
2x + y < 10
Profit = 4x + 6y = £28x = 4 and y = 2
21/21-3/21100
4-1/4224/42010
284/2130/21001
ltsyxP
Understanding why it is a maximum
If either s or t are increased then the profit would decrease. So the maximum profit occurs when s and t = 0
P + 30/21s + 4/21t = 28
P = 28 – 30/21s – 4/21t
s and t are slack variables which represent the difference between the amount used and the max amount allowable.
Understanding why it is a maximum
21/21-3/21100
4-1/4224/42010
284/2130/21001
ltsyxP
So obtaining a profit line with positive coefficients will give a maximum.
Spreadsheet
50
There are 9 steps in the Simplex algorithm
1. Rewrite objective formula so it is equal to zero
2. Add slack variables to remove inequalities
3. Place in a tableau
4. Look at the most negative values to determine pivot column
5. Divide end column by the corresponding pivot value in that column
6. The least value is the pivot row
7. Divide pivotal row by pivot value – so pivot becomes 1
8. Add/subtract multiples of pivot row to other rows to zero
9. When top element are ≥ 0 then optimised solution
Summary questions
Link to notes