Math Models of OR: The Revised Simplex Method: An...

22
Math Models of OR: The Revised Simplex Method: An Example John E. Mitchell Department of Mathematical Sciences RPI, Troy, NY 12180 USA September 2018 Mitchell The Revised Simplex Method: An Example 1 / 22

Transcript of Math Models of OR: The Revised Simplex Method: An...

Page 1: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Math Models of OR:The Revised Simplex Method: An Example

John E. Mitchell

Department of Mathematical SciencesRPI, Troy, NY 12180 USA

September 2018

Mitchell The Revised Simplex Method: An Example 1 / 22

Page 2: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Our example

Consider the following example with initial simplex tableau:

M0 =

#ratio x1 x2 x3 x4 x5 x6 x7

�4 0 1 �3 2 �5 1 02 2 1 �1 1� 1 2 �1 0� 1 0 4 �2 1 1 3 1

basic sequence S = (1, 7).

Mitchell The Revised Simplex Method: An Example 2 / 22

updated basic sequence : (3,7).

Page 3: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

First iteration

Outline

1 First iteration

2 Second iteration

3 Third iteration

4 Checking the solution

Mitchell The Revised Simplex Method: An Example 3 / 22

Page 4: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

First iteration

First iteration

In the first iteration, x3 replaces x1 in the basis.

M0 =

#ratio x1 x2 x3 x4 x5 x6 x7

�4 0 1 �3 2 �5 1 02 2 1 �1 1� 1 2 �1 0� 1 0 4 �2 1 1 3 1

S = (1, 7).

The initial pivot matrix is Q1, found by “doing unto the identity as youwould do unto M0”:

2

41 0 00 1 00 0 1

3

5 R0 + 3R1, R2 + 2R1�! Q1 =

2

41 3 00 1 00 2 1

3

5

Mitchell The Revised Simplex Method: An Example 4 / 22

Page 5: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

First iteration

Find reduced costs

The updated tableau is M1 = Q1M0. We first calculate the reducedcosts:

Q1M0 =

2

41 3 00 1 00 2 1

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=2 3 �2 0 5 1 �2 0⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤

=: M2 S = (3, 7).

Mitchell The Revised Simplex Method: An Example 5 / 22

Page 6: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

First iteration

Find the pivot column

We will choose x2 as the next pivot column in the second iteration.

In order to finish the first iteration, we need to calculate the x2 columnof the tableau:

Q1M0 =

2

41 3 00 1 00 2 1

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=

#2 3 �2 0 5 1 �2 0⇤ ⇤ �1 ⇤ ⇤ ⇤ ⇤ ⇤⇤ ⇤ 2 ⇤ ⇤ ⇤ ⇤ ⇤

=: M2 S = (3, 7).

Mitchell The Revised Simplex Method: An Example 6 / 22

0

Page 7: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

First iteration

Find b

To perform the minimum ratio test in the second iteration, we will needto know the entries in b corresponding to the positive entries in thepivot column:

Q1M0 =

2

41 3 00 1 00 2 1

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=

ratio #2 3 �2 0 5 1 �2 0

� ⇤ ⇤ �1 ⇤ ⇤ ⇤ ⇤ ⇤52 5 ⇤ 2� ⇤ ⇤ ⇤ ⇤ ⇤

=: M2 S = (3, 7).

Mitchell The Revised Simplex Method: An Example 7 / 22

Page 8: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Second iteration

Outline

1 First iteration

2 Second iteration

3 Third iteration

4 Checking the solution

Mitchell The Revised Simplex Method: An Example 8 / 22

Page 9: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Second iteration

Second iteration

In the second iteration, x2 replaces x7 in the basis.

M2 =

ratio #2 3 �2 0 5 1 �2 0

� ⇤ ⇤ �1 ⇤ ⇤ ⇤ ⇤ ⇤52 5 ⇤ 2� ⇤ ⇤ ⇤ ⇤ ⇤

S = (3, 7).

We can now calculate the new pivot matrix Q2, by “doing unto theidentity as you would do unto M1”:2

41 0 00 1 00 0 1

3

512R2 then R0 + 2R2, R1 + R2

�! Q2 =

2

41 0 10 1 1

20 0 1

2

3

5

Mitchell The Revised Simplex Method: An Example 9 / 22

Page 10: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Second iteration

Use products of pivot matrices

The updated tableau is M2 = Q2M1.

However, we don’t know M1 explicitly, so we need to exploit the factthat M1 = Q1M0, so M2 = (Q2Q1)M0, by the associativity property ofmatrix multiplication.

We first calculate the matrix product P2 = Q2Q1:

P2 = Q2Q1 =

2

41 0 10 1 1

20 0 1

2

3

5

2

41 3 00 1 00 2 1

3

5 =

2

41 5 10 2 1

20 1 1

2

3

5

Mitchell The Revised Simplex Method: An Example 10 / 22

M r sQin, = Qe(Q,Mu)= (QQ,) Mo

M - = R Mo

Page 11: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Second iteration

Find the reduced costs

We can now calculate the reduced costs:

Q2M1 = P2M0 =

2

41 5 10 2 1

20 1 1

2

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=7 5 0 0 8 6 �1 1⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤

=: M2

S = (3, 2).

Mitchell The Revised Simplex Method: An Example 11 / 22

O

X , replace, o n e of these.

Page 12: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Second iteration

Calculate the pivot column

We choose x6 as the pivot column in the third iteration, so we need tocalculate the x6 column of the tableau as part of the second iteration:

P2M0 =

2

41 3 00 1 00 2 1

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=

#7 5 0 0 8 6 �1 1⇤ ⇤ ⇤ ⇤ ⇤ ⇤ �1

2 ⇤⇤ ⇤ ⇤ ⇤ ⇤ ⇤ 1

2� ⇤

=: M2

S = (3, 2).

Mitchell The Revised Simplex Method: An Example 12 / 22

K Oshould be P ,

New basic sequence wi l l be (3,6)

Page 13: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Second iteration

Calculate b

To perform the minimum ratio test in the third iteration, we will need toknow the entries in b corresponding to the positive entries in the pivotcolumn:

P2M0 =

2

41 3 00 1 00 2 1

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=

ratio #7 5 0 0 8 6 �1 1

� ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ �12 ⇤

5 52 ⇤ ⇤ ⇤ ⇤ ⇤ 1

2� ⇤

=: M2

S = (3, 2).

Mitchell The Revised Simplex Method: An Example 13 / 22

Page 14: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Third iteration

Outline

1 First iteration

2 Second iteration

3 Third iteration

4 Checking the solution

Mitchell The Revised Simplex Method: An Example 14 / 22

Page 15: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Third iteration

Third iteration

In the third iteration, x6 replaces x2 in the basis.

ratio #7 5 0 0 8 6 �1 1

� ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ �12 ⇤

5 52 ⇤ ⇤ ⇤ ⇤ ⇤ 1

2� ⇤

=: M2 S = (3, 2).

We can now calculate the new pivot matrix Q3, by “doing unto theidentity as you would do unto M2”:2

41 0 00 1 00 0 1

3

5 2R2 then R0 + R2, R1 +12R2

�! Q3 =

2

41 0 20 1 10 0 2

3

5

Mitchell The Revised Simplex Method: An Example 15 / 22

Page 16: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Third iteration

Calculate product of pivot matrices

The updated tableau is M3 = Q3M2.

However, we don’t know M2 explicitly, so we need to exploit the factthat M2 = Q2Q1M0 = P2M0, so M3 = (Q3P2)M0, by the associativityproperty of matrix multiplication.

We first calculate the matrix product P3 = Q3P2:

P3 = Q3P2 =

2

41 0 20 1 10 0 2

3

5

2

41 5 10 2 1

20 1 1

2

3

5 =

2

41 7 20 3 10 2 1

3

5

Mitchell The Revised Simplex Method: An Example 16 / 22

= Qs(P,Mu)=@R)Mo

Page 17: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Third iteration

Calculate reduced costs

We can now calculate the reduced costs:

Q3M2 = P3M0 =

2

41 7 20 3 10 2 1

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=12 7 2 0 11 11 0 2⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤

=: M3

S = (3, 6).

Mitchell The Revised Simplex Method: An Example 17 / 22

0I 'o9×3=7,

x , = 5

Page 18: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Third iteration

Get optimal solutionThis tableau is in optimal form, so we have an optimal solution withbasic variables x3 and x6. We need to calculate the values of the basicvariables:

P3M0 =

2

41 3 00 1 00 2 1

3

5�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 �1 01 0 4 �2 1 1 3 1

=12 7 2 0 11 11 0 2

7 ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤5 ⇤ ⇤ ⇤ ⇤ ⇤ ⇤ ⇤

=: M3

S = (3, 6).

Thus, the optimal solution is x3 = 7, x6 = 5, with nonbasicsx1 = x2 = x4 = x5 = x7 = 0 and value �12.

Mitchell The Revised Simplex Method: An Example 18 / 22

Page 19: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Checking the solution

Outline

1 First iteration

2 Second iteration

3 Third iteration

4 Checking the solution

Mitchell The Revised Simplex Method: An Example 19 / 22

Page 20: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Checking the solution

Check the optimal solution

The initial tableau is

M0 =

x1 x2 x3 x4 x5 x6 x7�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 -1� 01 0 4 -2� 1 1 3 1

S = (1, 7).

We found an optimal solution with basic variables x3 = 7 and x6 = 5.

We can first check that x3 = 7, x6 = 5 does indeed satisfy theconstraints, with value �12. X

Mitchell The Revised Simplex Method: An Example 20 / 22

Page 21: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Checking the solution

Pivoting to create canonical form

By pivoting on the two indicated entries, we can construct a tableauwhere x3 and x6 are the basic variables.

Provided our answer above was correct, the resulting tableau shouldhave b � 0 and c � 0. Pivot first on entry a16:

M0 =

x1 x2 x3 x4 x5 x6 x7�4 0 1 �3 2 �5 1 0

2 1 �1 1 1 2 -1� 01 0 4 -2� 1 1 3 1

S = (1, 7).

�R1 then R0 � R1, R2 � 3R1�!

x1 x2 x3 x4 x5 x6 x7�2 1 0 �2 3 �3 0 0�2 �1 1 �1 �1 �2 1� 0

7 3 1 1� 4 7 0 1

basic sequence S = (6, 7).

Mitchell The Revised Simplex Method: An Example 21 / 22

Page 22: Math Models of OR: The Revised Simplex Method: An Exampleeaton.math.rpi.edu/faculty/Mitchell/courses/matp4700/notesMATP47… · 3 Third iteration 4 Checking the solution Mitchell

Checking the solution

The second pivot to create canonical form

Now pivot on entry a23:

x1 x2 x3 x4 x5 x6 x7�2 1 0 �2 3 �3 0 0�2 �1 1 �1 �1 �2 1� 0

7 3 1 1� 4 7 0 1

basic sequence S = (6, 7).

R0 + 2R2, R1 + R2�!

x1 x2 x3 x4 x5 x6 x712 7 2 0 11 11 0 25 2 2 0 3 5 1� 17 3 1 1� 4 7 0 1

S = (6, 3).

Thus, we do indeed get a tableau in optimal form. X

Mitchell The Revised Simplex Method: An Example 22 / 22