Presentation is loading. Please wait.

Presentation is loading. Please wait.

D1 Discrete Mathematics

Similar presentations


Presentation on theme: "D1 Discrete Mathematics"— Presentation transcript:

1 D1 Discrete Mathematics
Maximisation problems The Simplex Algorithm

2 The basic idea in maximisation problems we are trying to maximise some function (P, say – the objective function) of two or more variables, x and y but there will be some constraints such as x + y ≤ 7 now, if x + y ≤ 7 then: x + y + ‘something’ = 7 the ‘something’ (or slack variable) must be zero or greater so, in the simplex algorithm, we change the inequalities to equations then we use simultaneous equation techniques to get: an equation which involves P, the slack variables and, at most, one of x or y equations involving only one of x or y plus the slack variables our solution can then be found ideally the maximum value of P will occur when the slack variables are zero the simplex algorithm is a way of achieving this, that can easily be programmed into a computer let’s see how it works:

3 The simplex algorithm formulate the maximising problem as a tableau using slack variables as necessary ensure that all elements in the last column (except possibly the top one) are non-negative select any column (except the last one) whose top element is negative (it may help to choose the lowest negative number e.g. -7 instead of -4; this may get the top row all non-negative more quickly) for each row, divide the number in the last column by the number in the chosen column in the selected column choose the positive number which gave you the smallest result; this is called the pivot divide the pivot row by the pivot to give a new row combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column if all the top elements (except possibly the last one) are non-negative then the maximum has been reached; otherwise return to step 3 the last column contains the values of the objective function and the non-zero variables note: this is essentially the method of elimination as applied to simultaneous equations

4 Example: Maximise 7x + 11y subject to 2x + 4y ≤ 60, 3x + 3y ≤ 60 and x, y ≥ 0
P = 7x + 11y 2x + 4y ≤ 60 3x + 3y ≤ 60 formulate the maximising problem (using slack variables as necessary) P - 7x - 11y = 0 2x + 4y + s = 60 3x + 3y + t = 60 P x y s t l ensure that all elements in the last column (except possibly the top one) are non-negative

5 Example: Maximise 7x + 11y subject to 2x + 4y ≤ 60, 3x + 3y ≤ 60 and x, y ≥ 0
P = 7x + 11y 2x + 4y ≤ 60 3x + 3y ≤ 60 formulate the maximising problem (using slack variables as necessary) ensure that all elements in the last column (except possibly the top one) are non-negative P - 7x - 11y = 0 2x + 4y + s = 60 3x + 3y + t = 60 P x y s t l 1 -7 -11

6 Example: Maximise 7x + 11y subject to 2x+4y ≤ 60, 3x + 3y ≤ 60 and x, y ≥ 0
formulate the maximising problem (using slack variables as necessary) ensure that all elements in the last column (except possibly the top one) are non-negative P = 7x + 11y 2x + 4y ≤ 60 3x + 3y ≤ 60 P - 7x - 11y = 0 2x + 4y + s = 60 3x + 3y + t = 60 P x y s t l 1 -7 -11 2 4 60

7 Example: Maximise 7x + 11y subject to 2x+4y ≤ 60, 3x + 3y ≤ 60 and x, y ≥ 0
formulate the maximising problem (using slack variables as necessary) ensure that all elements in the last column (except possibly the top one) are non-negative P = 7x + 11y 2x + 4y ≤ 60 3x + 3y ≤ 60 P - 7x - 11y = 0 2x + 4y + s = 60 3x + 3y + t = 60 P x y s t l 1 -7 -11 2 4 60 3

8 select any column (except the last one) whose top element is negative
for each row, divide the number in the last column by the number in the chosen column in the selected, column choose the positive number which gave you the smallest result; this is called the pivot P x y s t l 1 -7 -11 2 4 60 3 0 ÷ -7 = 0 60 ÷ 2 = 30 60 ÷ 3 = 20

9 divide the pivot row by the pivot
x y s t l 1 -7 -11 2 4 60 3

10 divide the pivot row by the pivot
x y s t l 1 -7 -11 2 4 60 3  =  ÷ 3

11 divide the pivot row by the pivot
x y s t l 1 -7 -11 2 4 60 3 1/3 20  =  ÷ 3

12 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 1/3 20  =  ÷ 3

13 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3  =  + 7 x  1/3 20  =  ÷ 3

14 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  1/3 20  =  ÷ 3

15 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x   =  – 2 x  1/3 20  =  ÷ 3

16 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3

17 if all the top elements (except possibly the last one) are non-negative then the maximum has been reached; otherwise return to step 3 P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3

18 select any column (except the last one) whose top element is negative
for each row, divide the number in the last column by the number in the chosen column in the selected, column choose the number which gave you the smallest result; this is called the pivot P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3

19 divide the pivot row by the pivot
x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3

20 divide the pivot row by the pivot
x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3  =  ÷ 2

21 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3 -1/3 10  =  ÷ 2

22 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3 -1/3 10  =  ÷ 2

23     =  + 7 x   =  – 2 x   =  ÷ 3  =  + 4 x  ½  =  ÷ 2
combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3  =  + 4 x  -1/3 10  =  ÷ 2

24 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3 180  =  + 4 x  -1/3 10  =  ÷ 2

25 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3 180  =  + 4 x  -1/3 10  =  ÷ 2  =  - 

26 combine appropriate multiples of the new row with all the other rows in order to reduce to zero all other elements in the pivot column P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3 180  =  + 4 x  -1/3 10  =  ÷ 2 2/3  =  - 

27 if all the top elements (except possibly the last one) are non-negative then the maximum has been reached; otherwise return to step 3 the last column contains the values of the objective function and the non-zero variables P x y s t l 1 -7 -11 2 4 60 3 -4 7/3 140  =  + 7 x  - 2/3 20  =  – 2 x  1/3  =  ÷ 3 180  =  + 4 x  -1/3 10  =  ÷ 2 2/3  =  - 

28 the last column contains the values of the objective function and the non-zero variables
now: convert the tableau back to equation form P x y s t l 1 2 180 -1/3 10 2/3

29 the last column contains the values of the objective function and the non-zero variables
now: convert the tableau back to equation form P x y s t l 1 2 180 P + 2s + t = 180 -1/3 10 2/3

30 the last column contains the values of the objective function and the non-zero variables
now: convert the tableau back to equation form P x y s t l 1 2 180 P + 2s + t = 180 -1/3 10 y + ½s - 1/3t = 10 2/3

31 the last column contains the values of the objective function and the non-zero variables
now: convert the tableau back to equation form P x y s t l 1 2 180 P + 2s + t = 180 -1/3 10 y + ½s - 1/3t = 10 2/3 x - ½s + 2/3t = 10

32 The last column contains the values of the objective function and the non-zero variables
The maximum will be reached when the slack variables are zero since P = 180 – 2s – t Which is why we needed those elements on the top row to be non-negative P x y s t l 1 2 180 P + 2s + t = 180 -1/3 10 y + ½s - 1/3t = 10 2/3 x - ½s + 2/3t = 10

33 ½ y + ½s - 1/3t = 10 -½ x - ½s + 2/3t = 10 P x y s t l 1 2 180
the last column contains the values of the objective function and the non-zero variables P x y s t l 1 2 180 P + 2s + t = 180 P = 180 -1/3 10 y + ½s - 1/3t = 10 2/3 x - ½s + 2/3t = 10

34 the last column contains the values of the objective function and the non-zero variables
P x y s t l 1 2 180 P + 2s + t = 180 P = 180 -1/3 10 y + ½s - 1/3t = 10 y = 10 2/3 x - ½s + 2/3t = 10

35 the last column contains the values of the objective function and the non-zero variables
P x y s t l 1 2 180 P + 2s + t = 180 P = 180 -1/3 10 y + ½s - 1/3t = 10 y = 10 2/3 x - ½s + 2/3t = 10 x = 10

36 There's a lot to do to apply the simplex algorithm, but
keep your head, use the fraction button on your calculator, take your time and you should be ok!

37 That’s all folks!


Download ppt "D1 Discrete Mathematics"

Similar presentations


Ads by Google