the simplex algorithm: technicalities1 · the simplex algorithm: technicalities1 adrian vetta 1this...

45
The Simplex Algorithm: Technicalities 1 Adrian Vetta 1 This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45

Upload: lamtruc

Post on 01-Jul-2018

222 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

The Simplex Algorithm: Technicalities1

Adrian Vetta

1This presentation is based upon the book Linear Programming by Vasek Chvatal1/45

Page 2: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Two Issues

Here we discuss two potential problems with the simplexmethod and how to avoid them.

Termination.

How can we ensure that the algorithm terminates?

Initialialisation.

How can we ensure that the algorithm starts?

2/45

Page 3: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Part I

Termination: Cycling

3/45

Page 4: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Choosing Pivots

Entering Variable.

We may chose any non-basic variable with a positive coefficient in the toprow of the dictionary to enter the basis.

If there is more than one choice to enter, which do we pick?

Leaving Variable.

We may chose any basic variable whose non-negativity imposes the moststringent constraint on the entering variable to leave the basis.

If there is more than one choice to leave, which do we pick?

4/45

Page 5: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Degeneracy

Leaving Variable.

We may chose any basic variable whose non-negativity imposes the moststringent constraint on the entering variable to leave the basis.

If two basic variables xi , xj can be selected to leave the basis thentheir values are both forced to zero by the entering variable.

Since one of them, say xi , must stay in the basis, we now have a basicvariable whose value is zero. [Its constant term in the dictionary is 0.]

Basic solutions with some basic variables of value zero are calleddegenerate.

For a pivot at a degenerate solution, the objective value will notincrease, nor will any of the variable values change.

5/45

Page 6: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Cycling

So pivots at degenerate solutions do not lead to better solutions.

Is it possible that the algorithm can get stuck (before it finds anoptimal solution) in a sequence of degenerate solutions?

YES. - If we are not careful in how we choose our pivots.

6/45

Page 7: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

An Example of Cycling

Assume we use the following rules for selecting pivots:

Entering Variable.

Add the non-basic variable with the highest positive coefficient.

Leaving Variable.

In case of a tie, remove the basic variable with the smallest subscript.

Apply these rules to the following example.

maximise 10x1 − 57x2 − 9x3 − 24x4

subject to 12x1 − 11

2 x2 − 52x3 + 9x4 ≤ 0

12x1 − 3

2x2 − 12x3 + x4 ≤ 0

x1 ≤ 1x1, x2, x3, x4 ≥ 0

7/45

Page 8: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Dictionary Form

maximise 10x1 − 57x2 − 9x3 − 24x4

subject to 12x1 − 11

2x2 − 5

2x3 + 9x4 ≤ 0

12x1 − 3

2x2 − 1

2x3 + x4 ≤ 0

x1 ≤ 1x1, x2, x3, x4 ≥ 0

Write in dictionary form.

z = 10x1 − 57x2 − 9x3 − 24x4

x5 = − 12x1 + 11

2 x2 + 52x3 − 9x4

x6 = − 12x1 + 3

2x2 + 12x3 − x4

x7 = 1 − x1

8/45

Page 9: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Pivot 1

z = 10x1 − 57x2 − 9x3 − 24x4

x5 = − 12x1 + 11

2 x2 + 52x3 − 9x4

x6 = − 12x1 + 3

2x2 + 12x3 − x4

x7 = 1 − x1

Pivot: Add x1 to basis. (We had no choice.)

Remove x5 from basis. (We had the choice of x5 or x6).

z = 10(11x2 + 5x3 − 18x4 − 2x5) − 57x2 − 9x3 − 24x4

x1 = 11x2 + 5x3 − 18x4 − 2x5

x6 = − 12(11x2 + 5x3 − 18x4 − 2x5) + 3

2x2 + 1

2x3 − x4

x7 = 1 − (11x2 + 5x3 − 18x4 − 2x5)

z = 53x2 + 41x3 − 204x3 − 20x5

x1 = 11x2 + 5x3 − 18x4 − 2x5

x6 = − 4x2 − 2x3 + 8x4 + x5

x7 = 1 − 11x2 − 5x3 + 18x4 + 2x5

9/45

Page 10: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Pivot 2

z = 53x2 + 41x3 − 204x3 − 20x5

x1 = 11x2 + 5x3 − 18x4 − 2x5

x6 = − 4x2 − 2x3 + 8x4 + x5

x7 = 1 − 11x2 − 5x3 + 18x4 + 2x5

Pivot: Add x2 to basis. (It has a higher coefficient than x3.)

Remove x6 from basis. (We had no choice; x1 is unconstrained by x2).

z = 53(− 12x3 + 2x4 + 1

4x5 − 1

4x6) + 41x3 − 204x3 − 20x5

x2 = − 12x3 + 2x4 + 1

4x5 − 1

4x6

x1 = 11(− 12x3 + 2x4 + 1

4x5 − 1

4x6) + 5x3 − 18x4 − 2x5

x7 = 1 − 11(− 12x3 + 2x4 + 1

4x5 − 1

4x6) − 5x3 + 18x4 + 2x5

z = 292 x3 − 98x4 − 27

4 x5 − 534 x6

x2 = − 12x3 + 2x4 + 1

4x5 − 14x6

x1 = − 12x3 + 4x4 + 3

4x5 − 114 x6

x7 = 1 + 12x3 − 4x4 − 3

4x5 + 114 x6

10/45

Page 11: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Pivot 3

z = 292x3 − 98x4 − 27

4x5 − 53

4x6

x2 = − 12x3 + 2x4 + 1

4x5 − 1

4x6

x1 = − 12x3 + 4x4 + 3

4x5 − 11

4x6

x7 = 1 + 12x3 − 4x4 − 3

4x5 + 11

4x6

Pivot: Add x3 to basis. (No choice.)

Remove x1 from basis. (We had the choice of choice of x1 or x2.)

z = 292(8x4 + 3

2x5 − 11

2x6 − 2x1) − 98x4 − 27

4x5 − 53

4x6

x3 = 8x4 + 32x5 − 11

2x6 − 2x1

x2 = − 12(8x4 + 3

2x5 − 11

2x6 − 2x1) + 2x4 + 1

4x5 − 1

4x6

x7 = 1 + 12(8x4 + 3

2x5 − 11

2x6 − 2x1) − 4x4 − 3

4x5 + 11

4x6

z = 18x4 + 15x5 − 93x6 − 29x1

x3 = 8x4 + 32x5 − 11

2 x6 − 2x1

x2 = − 2x4 − 12x5 + 5

2x6 + x1

x7 = 1 − x1

11/45

Page 12: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Pivot 4

z = 18x4 + 15x5 − 93x6 − 29x1

x3 = 8x4 + 32x5 − 11

2x6 − 2x1

x2 = − 2x4 − 12x5 + 5

2x6 + x1

x7 = 1 − x1

Pivot: Add x4 to basis. (It has a higher coefficient than x5.)

Remove x2 from basis. (No choice as x3 unconstrained by x4.)

z = 18(− 14x5 + 5

4x6 + 1

2x1 − 1

2x2) + 15x5 − 93x6 − 29x1

x4 = − 14x5 + 5

4x6 + 1

2x1 − 1

2x2

x3 = 8(− 14x5 + 5

4x6 + 1

2x1 − 1

2x2) + 3

2x5 − 11

2x6 − 2x1

x7 = 1 − x1

z = 212 x5 − 141

2 x6 − 20x1 − 9x2

x4 = − 14x5 + 5

4x6 + 12x1 − 1

2x2

x3 = − 12x5 + 9

2x6 + 2x1 − 4x2

x7 = 1 − x1

12/45

Page 13: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Pivot 5

z = 212x5 − 141

2x6 − 20x1 − 9x2

x4 = − 14x5 + 5

4x6 + 1

2x1 − 1

2x2

x3 = − 12x5 + 9

2x6 + 2x1 − 4x2

x7 = 1 − x1

Pivot: Add x5 to basis. (No choice.)

Remove x3 from basis. (We had the choice of x3 or x4.)

z = 212(9x6 + 4x1 − 8x2 − 2x3) − 141

2x6 − 20x1 − 9x2

x5 = 9x6 + 4x1 − 8x2 − 2x3

x4 = − 14(9x6 + 4x1 − 8x2 − 2x3) + 5

4x6 + 1

2x1 − 1

2x2

x7 = 1 − x1

z = 24x6 + 22x1 − 93x2 − 21x3

x5 = 9x6 + 4x1 − 8x2 − 2x3

x4 = − x6 − 12x1 + 3

2x2 + 12x3

x7 = 1 − x1

13/45

Page 14: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Pivot 6

z = 24x6 + 22x1 − 93x2 − 21x3

x5 = 9x6 + 4x1 − 8x2 − 2x3

x4 = − x6 − 12x1 + 3

2x2 + 1

2x3

x7 = 1 − x1

Pivot: Add x6 to basis. (It has a higher coefficient than x1.)

Remove x4 from basis. (No choice as x5 unconstrained by x6.)

z = 24(− 12x1 + 3

2x2 + 1

2x3 − x4) + 22x1 − 93x2 − 21x3

x6 = − 12x1 + 3

2x2 + 1

2x3 − x4

x5 = 9(− 12x1 + 3

2x2 + 1

2x3 − x4) + 4x1 − 8x2 − 2x3

x7 = 1 − x1

z = 10x1 − 57x2 − 9x3 − 24x4

x6 = − 12x1 + 3

2x2 + 12x3 − x4

x5 = − 12x1 + 11

2 x2 + 52x3 − 9x4

x7 = 1 − x1

14/45

Page 15: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

A Cycle is Obtained

z = 10x1 − 57x2 − 9x3 − 24x4

x6 = − 12x1 + 3

2x2 + 1

2x3 − x4

x5 = − 12x1 + 11

2x2 + 5

2x3 − 9x4

x7 = 1 − x1

But this is exactly the same as the original dictionary!

z = 10x1 − 57x2 − 9x3 − 24x4

x5 = − 12x1 + 11

2 x2 + 52x3 − 9x4

x6 = − 12x1 + 3

2x2 + 12x3 − x4

x7 = 1 − x1

We are stuck in a cycle (with top row coefficients not all negative).

So the simplex algorithm did not terminate!

15/45

Page 16: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Part II

Bland’s Rule

16/45

Page 17: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule

Can we stop the algorithm from cycling?

YES. - If we are more careful in how we choose the entering andleaving variables.

Bland’s Rule.

Given a choice, always choose the variable with the smallest subscript(for both entering and leaving variables).

17/45

Page 18: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Pivot 1

Let’s see how this works with the previous example.

z = 10x1 − 57x2 − 9x3 − 24x4

x5 = − 12x1 + 11

2 x2 + 52x3 − 9x4

x6 = − 12x1 + 3

2x2 + 12x3 − x4

x7 = 1 − x1

Pivot: Add x1 to basis. (We had no choice.)

Remove x5 from basis. (It has a lower subscript than x6.)

z = 53x2 + 41x3 − 204x3 − 20x5

x1 = 11x2 + 5x3 − 18x4 − 2x5

x6 = − 4x2 − 2x3 + 8x4 + x5

x7 = 1 − 11x2 − 5x3 + 18x4 + 2x5

18/45

Page 19: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Pivot 2

z = 53x2 + 41x3 − 204x3 − 20x5

x1 = 11x2 + 5x3 − 18x4 − 2x5

x6 = − 4x2 − 2x3 + 8x4 + x5

x7 = 1 − 11x2 − 5x3 + 18x4 + 2x5

Pivot: Add x2 to basis. (It has a lower subscript than x3.)

Remove x6 from basis. (We had no choice; x1 is unconstrained by x2.)

z = 292 x3 − 98x4 − 27

4 x5 − 534 x6

x2 = − 12x3 + 2x4 + 1

4x5 − 14x6

x1 = − 12x3 + 4x4 + 3

4x5 − 114 x6

x7 = 1 + 12x3 − 4x4 − 3

4x5 + 114 x6

19/45

Page 20: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Pivot 3

z = 292x3 − 98x4 − 27

4x5 − 53

4x6

x2 = − 12x3 + 2x4 + 1

4x5 − 1

4x6

x1 = − 12x3 + 2x4 + 3

4x5 − 11

4x6

x7 = 1 + 12x3 − 4x4 − 3

4x5 − 53

4x6

Pivot: Add x3 to basis. (No choice.)

Remove x1 from basis. (It has a lower subscript x2.)

z = 18x4 + 15x5 − 93x6 − 29x1

x3 = 8x4 + 32x5 − 11

2 x6 − 2x1

x2 = − 2x4 − 12x5 + 5

2x6 + x1

x7 = 1 − x1

20/45

Page 21: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Pivot 4

z = 18x4 + 15x5 − 93x6 − 29x1

x3 = 8x4 + 32x5 + 11

2x6 − 9x1

x2 = − 2x4 − 92x5 + 5

2x6 + x1

x7 = 1 − x1

Pivot: Add x4 to basis. (It has a lower subscript than x5.)

Remove x2 from basis. (No choice as x3 unconstrained by x4.)

z = 212 x5 − 141

2 x6 − 20x1 − 9x2

x4 = − 14x5 + 5

4x6 + 12x1 − 1

2x2

x3 = − 12x5 + 9

2x6 + 2x1 − 4x2

x7 = 1 − x1

21/45

Page 22: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Pivot 5

z = 212x5 − 141

2x6 − 20x1 − 9x2

x4 = − 14x5 + 5

4x6 + 1

2x1 − 1

2x2

x3 = − 12x5 + 9

2x6 + 2x1 − 4x2

x7 = 1 − x1

Pivot: Add x5 to basis. (No choice.)

Remove x3 from basis. (It has a lower subscript than x4.)

z = 24x6 + 22x1 − 93x2 − 21x3

x5 = 9x6 + 4x1 − 8x2 − 2x3

x4 = − x6 − 12x1 + 3

2x2 + 12x3

x7 = 1 − x1

22/45

Page 23: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Pivot 6

z = 24x6 + 22x1 − 93x2 − 21x3

x5 = 9x6 + 4x1 − 8x2 − 2x3

x4 = − x6 − 12x1 + 3

2x2 + 1

2x3

x7 = 1 − x1

So far all our pivots has been the same as before, but now....

Pivot: Add x1 to basis. (It has a lower subscript than x6.)

Remove x4 from basis. (No choice as x5 unconstrained by x6.)

z = 24x6 + 22(−2x6 + 3x2 + x3 − 2x4) − 93x2 − 21x3

x1 = − 2x6 + 3x2 + x3 − 2x4

x5 = 9x6 + 4(−2x6 + 3x2 + x3 − 2x4) − 8x2 − 2x3

x7 = 1 − (−2x6 + 3x2 + x3 − 2x4)

z = −20x6 − 27x2 + x3 − 44x4

x1 = − 2x6 + 3x2 + x3 − 2x4

x5 = − x6 + 4x2 + 2x3 − 8x4

x7 = 1 + 2x6 − 3x2 − x3 − 2x4

23/45

Page 24: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Pivot 7

z = −20x6 − 27x2 + x3 − 44x4

x1 = − 2x6 + 3x2 + x3 − 2x4

x5 = − x6 + 4x2 + 2x3 − 8x4

x7 = 1 + 2x6 − 3x2 − x3 − 2x4

Pivot: Add x3 to basis. (No choice.)

Remove x7 from basis. (No choice as x1, x5 unconstrained by x3.)

z = −20x6 − 27x2 + (1 + 2x6 − 3x2 − 2x4 − x7) − 44x4

x3 = 1 + 2x6 − 3x2 − 2x4 − x7

x1 = − 2x6 + 3x2 + (1 + 2x6 − 3x2 − 2x4 − x7) − 2x4

x5 = − x6 + 4x2 + 2(1 + 2x6 − 3x2 − 2x4 − x7) − 8x4

z = 1 − 18x6 − 30x2 − 46x4 − x7

x3 = 1 + 2x6 − 3x2 − 2x4 − x7

x1 = 1 − 4x4 − x7

x5 = 2 + 3x6 − 2x2 − 12x4 − 2x7

24/45

Page 25: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Bland’s Rule: Breaking the Cycle

z = 1 − 18x6 − 30x2 − 46x4 − x7

x3 = 1 + 2x6 − 3x2 − 2x4 − x7

x1 = 1 − 4x4 − x7

x5 = 2 + 3x6 − 2x2 − 12x4 − 2x7

All the coefficients in the top row are now negative.

Thus, we break out of the degeneracy and obtain an optimal solution(x1, x2, x3, x4) = (1, 0, 1, 0) and z = 1.

25/45

Page 26: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Remarks

Bland’s Rule always works: use it and you obtain an optimal solution.

There are other methods, e.g. Perturbation Methods, that also work.

For proofs and discussions on these issues see Chvatal’s book.

26/45

Page 27: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Part III

The Starting Point?

27/45

Page 28: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Is the All-Zero Solution Feasible?Suppose we want to solve the linear program

maximise∑n

j=1 cjxj

subject to∑n

j=1 aijxj ≤ bj ∀i ∈ [m]

xj ≥ 0 ∀j ∈ [n]

To run the simplex algorithm we need to start with a feasible solution.

So far we have used the all-zero solution.

But if some bj are negative then the all-zero solution is not feasible!E.g.

maximise x1 − x2 + x3

subject to 2x1 − x2 + 2x3 ≤ 42x1 − 3x2 + x3 ≤ −5−x1 + x2 − 2x3 ≤ −1

x1, x2, x3 ≥ 0

28/45

Page 29: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

An Auxiliary Problem

maximise∑n

j=1 cjxj

subject to∑n

j=1 aijxj ≤ bj ∀i ∈ [m]

xj ≥ 0 ∀j ∈ [n]

But our LP has a feasible solution if and only if the following auxiliarylinear program has an optimal solution of value zero.

minimise x0

subject to∑n

j=1 aijxj − x0 ≤ bj ∀i ∈ [m]

xj ≥ 0 ∀j ∈ {0, 1, . . . , n}

So can we use an optimal solution to this auxiliary problem to find afeasible solution (and starting dictionary) for our LP?

YES.

29/45

Page 30: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Finding a Starting Feasible Solution

Let’s see how this works on the problem

maximise z = x1 − x2 + x3

subject to 2x1 − x2 + 2x3 ≤ 42x1 − 3x2 + x3 ≤ −5−x1 + x2 − 2x3 ≤ −1

x1, x2, x3 ≥ 0

The auxiliary problem is then

maximise w = −x0

subject to 2x1 − x2 + 2x3 − x0 ≤ 42x1 − 3x2 + x3 − x0 ≤ −5−x1 + x2 − 2x3 − x0 ≤ −1

x0, x1, x2, x3 ≥ 0

30/45

Page 31: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Solving the Auxiliary Problem: a Dictionary

maximise w = −x0

subject to 2x1 − x2 + 2x3 − x0 ≤ 42x1 − 3x2 + x3 − x0 ≤ −5−x1 + x2 − 2x3 − x0 ≤ −1

x0, x1, x2, x3 ≥ 0

Let’s apply the simplex method to this auxiliary problem.

First put it in dictionary form.

w = −x0

x4 = 4 − 2x1 + x2 − 2x3 + x0

x5 = −5 − 2x1 + 3x2 − x3 + x0

x6 = −1 + x1 − x2 + 2x3 + x0

31/45

Page 32: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Solving the Auxiliary Problem: an Infeasible Solution

w = −x0

x4 = 4 − 2x1 + x2 − 2x3 + x0

x5 = −5 − 2x1 + 3x2 − x3 + x0

x6 = −1 + x1 − x2 + 2x3 + x0

The only term, i.e. x0, in the top row has a negative coefficient.

But this solution is not feasible for the auxiliary problem.

To see this observe that x5, x6 < 0.

But if we increase x0 these variables will become non-negative (at theexpense of decreasing the objective value).

Let’s make this pivot and see what happens...

32/45

Page 33: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

A Strange Pivot: Pivot 0

w = −x0

x4 = 4 − 2x1 + x2 − 2x3 + x0

x5 = −5 − 2x1 + 3x2 − x3 + x0

x6 = −1 + x1 − x2 + 2x3 + x0

Pivot: Add x0 to basis.

Remove x5 from basis. (As x5 was the most negative basic variable.)

w = −(5 + 2x1 − 3x2 + x3 + x5)

x0 = 5 + 2x1 − 3x2 + x3 + x5

x4 = 4 − 2x1 + x2 − 2x3 + (5 + 2x1 − 3x2 + x3 + x5)x6 = −1 + x1 − x2 + 2x3 + (5 + 2x1 − 3x2 + x3 + x5)

w = −5 − 2x1 + 3x2 − x3 − x5

x0 = 5 + 2x1 − 3x2 + x3 + x5

x4 = 9 − 2x2 − x3 + x5

x6 = 4 + 3x1 − 4x2 + 3x3 + x5

33/45

Page 34: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Solving the Auxiliary Problem: Pivot 1

w = −5 − 2x1 + 3x2 − x3 − x5

x0 = 5 + 2x1 − 3x2 + x3 + x5

x4 = 9 − 2x2 − x3 + x5

x6 = 4 + 3x1 − 4x2 + 3x3 + x5

Hooray: this is feasible for the auxiliary problem!

Pivot: Add x2 to basis.

Remove x6 from basis.

w = −5 − 2x1 + 3(1 + 34x1 + 3

4x3 + 1

4x5 − 1

4x6) − x3 − x5

x2 = 1 + 34x1 + 3

4x3 + 1

4x5 − 1

4x6

x0 = 5 + 2x1 − 3(1 + 34x1 + 3

4x3 + 1

4x5 − 1

4x6) + x3 + x5

x4 = 9 − 2(1 + 34x1 + 3

4x3 + 1

4x5 − 1

4x6) − x3 + x5

w = −2 + 14x1 + 5

4x3 − 14x5 − 3

4x6

x2 = 1 + 34x1 + 3

4x3 + 14x5 − 1

4x6

x0 = 2 − 14x1 − 5

4x3 + 14x5 + 3

4x6

x4 = 7 − 32x1 − 5

2x3 + 12x5 + 1

2x6

34/45

Page 35: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Solving the Auxiliary Problem: Pivot 2

w = −2 + 14x1 + 5

4x3 − 1

4x5 − 3

4x6

x2 = 1 + 34x1 + 3

4x3 + 1

4x5 − 1

4x6

x0 = 2 − 14x1 − 5

4x3 + 1

4x5 + 3

4x6

x4 = 7 − 32x1 − 5

2x3 + 1

2x5 + 1

2x6

Pivot: Add x3 to basis. [Note: here it is quicker not to use Bland’s rule.]

Remove x0 from basis.

w = −2 + 14x1 + 5

4( 8

5− 1

5x1 − 1

5x5 + 3

5x6 − 4

5x0) − 1

4x5 − 3

4x6

x2 = 1 + 34x1 + 3

4( 8

5− 1

5x1 − 1

5x5 + 3

5x6 − 4

5x0) + 1

4x5 − 1

4x6

x3 = 85

− 15x1 − 1

5x5 + 3

5x6 − 4

5x0

x4 = 7 − 32x1 − 5

2( 8

5− 1

5x1 − 1

5x5 + 3

5x6 − 4

5x0) + 1

2x5 + 1

2x6

w = − x0

x3 = 85 − 1

5x1 − 15x5 + 3

5x6 − 45x0

x2 = 115 + 3

5x1 + 25x5 + 1

5x6 − 35x0

x4 = 3 − x1 − x6 + 2x0

35/45

Page 36: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

The Auxiliary Problem: an Optimal Solution

w = − x0

x3 = 85

− 15x1 − 1

5x5 + 3

5x6 − 4

5x0

x2 = 115

+ 35x1 + 2

5x5 + 1

5x6 − 3

5x0

x4 = 3 − x1 − x6 + 2x0

All coefficients in the top row are now negative.

So we have an optimal solution for the auxiliary problem.(x0, x1, x2, x3, x4, x5, x6) = (0, 0, 11

5 , 85 , 3, 0, 0).

The objective value is w = −x0 = 0.

So this corresponds to a feasible solution to the original problem.

36/45

Page 37: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

A Feasible Solution to the Original Problem

maximise x1 − x2 + x3

subject to 2x1 − x2 + 2x3 ≤ 42x1 − 3x2 + x3 ≤ −5−x1 + x2 − 2x3 ≤ −1

x1, x2, x3 ≥ 0

So we have an optimal solution for the auxiliary problem.(x0, x1, x2, x3, x4, x5, x6) = (0, 0, 11

5 , 85 , 3, 0, 0).

This gives the solution (x1, x2, x3) = (0, 115 , 8

5) to the original problem.

This is feasible. [Check it!]

37/45

Page 38: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

A Feasible Dictionary for the Original Problem

maximise x1 − x2 + x3

subject to 2x1 − x2 + 2x3 ≤ 42x1 − 3x2 + x3 ≤ −5−x1 + x2 − 2x3 ≤ −1

x1, x2, x3 ≥ 0

So we have a feasible solution for the original LP.

How do we find a feasible starting dictionary?

Consider the final dictionary for the auxiliary LP.

w = − x0

x2 = 115 + 3

5x1 + 25x5 + 1

5x6 − 35x0

x3 = 85 − 1

5x1 − 15x5 + 3

5x6 − 45x0

x4 = 3 − x1 − x6 + 2x0

Remove the column for x0 and add back the original objective...

38/45

Page 39: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

A Feasible Dictionary for the Original Problem (cont.)

maximise x1 − x2 + x3

subject to 2x1 − x2 + 2x3 ≤ 42x1 − 3x2 + x3 ≤ −5−x1 + x2 − 2x3 ≤ −1

x1, x2, x3 ≥ 0

Remove the column for x0 and add back the original objective.

z = x1 − x2 + x3

x2 = 115

+ 35x1 + 2

5x5 + 1

5x6

x3 = 85

− 15x1 − 1

5x5 + 3

5x6

x4 = 3 − x1 − x6

z = x1 − ( 115

+ 35x1 + 2

5x5 + 1

5x6) + ( 8

5− 1

5x1 − 1

5x5 + 3

5x6)

x2 = 115

+ 35x1 + 2

5x5 + 1

5x6

x3 = 85

− 15x1 − 1

5x5 + 3

5x6

x4 = 3 − x1 − x6

This gives a feasible dictionary for the original LP.

z = − 35

+ 15x1 − 3

5x5 + 2

5x6

x2 = 115

+ 35x1 + 2

5x5 + 1

5x6

x3 = 85

− 15x1 − 1

5x5 + 3

5x6

x4 = 3 − x1 − x6

39/45

Page 40: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

The Two Phase Simplex Method

So we use a two phase approach to solve the linear program.

First we solve the auxiliary problem:

Case I.

If the optimal value is zero we have a feasible solution for the original.We then run the simplex algorithm for the second time.

Case II.

If the optimal value is less than zero the original problem is infeasible.

40/45

Page 41: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Part IV

Efficiency

41/45

Page 42: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Termination

With Bland’s Rule the algorithm will terminate.

To see this, observe that there are(m+n

m

)bases.

The dictionary corresponding to each basis can appear only once.

So there are at most(m+n

m

)iterations.

But(m+n

m

)>> 2m+n.

Does the algorithm always make an exponential # pivots?

42/45

Page 43: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Typical Running Times

The simplex method typically makes O(m) pivots, where m is thenumber of constraints.

Each pivot takes time O(mn) with the dictionary method.[But there are actually faster ways to implement pivots.]

So typically the algorithm is fast.

On the other hand...

43/45

Page 44: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Exponential Running Times

....all known pivot rules have pathological examples on which theymake an exponential number of pivots.

So the simple algorithm is a fast practical algorithm but hasexponential worst case running time.

In some sense the simplex algorithm is the exception that proves therule: “Polynomial algorithms good; exponential algorithms bad”.

In fact, recent theoretical results show the simplex algorithm isn’treally an exception to this rule after all.[But that research is beyond the scope of this course...]

44/45

Page 45: The Simplex Algorithm: Technicalities1 · The Simplex Algorithm: Technicalities1 Adrian Vetta 1This presentation is based upon the book Linear Programming by Vasek Chvatal 1/45Authors:

Polynomial Time Algorithms

There are polynomial time algorithms for solving linear programs.

The ellipsoid method and the interior point method are polytimealgorithms.

Conjecture.

The simplex algorithm is polynomial time if, given a choice,it chooses the pivot variables at random.

45/45