You are on page 1of 16

# MthSc 440/H440/640: Linear Programming Lecture 20

Pietro Belotti
Dept. of Mathematical Sciences Clemson University

November 4, 2010 Reading for today: pages 148-166. No class on Tuesday, November 9.

Dual feasibility
Consider a primal LP (in standard form) and its dual: max c x s.t. Ax b x 0 min b u s.t. A u c u 0

Add slack variables to the primal, surplus1 variables to the dual. max c x s.t. Ax + Ix = b x, x 0 min b u s.t. A u Iu = c u, u 0

## Called surplus because we subtract from the left-hand side.

Example
max s.t. 3x1 x1 2x1 x1 , +2x2 +x2 +x2 x2 , +x3 +x3 +3x3 x3 min s.t. 4u1 u1 u1 u1 u1 , +6u2 +2u2 +u2 +3u2 u2

4 6 0

3 2 1 0

become max s.t. 3x1 x1 2x1 x1 , 4u1 u1 u1 u1 u1 , +2x2 +x2 +x2 x2 , +6u2 +2u2 +u2 +3u2 u2 , +x3 +x3 +3x3 x3 , +x4 x4 , +x5 x5 = 4 = 6 0

min s.t.

u3 u4 u3 , u4 , u5 u5

= = =

3 2 1 0

## Primal and dual dictionaries

In the primal, consider the basis (x4 , x5 ) and the dictionary x4 = 4 x1 x2 x3 x5 = 6 2x1 x2 3x3 z= 3x1 +2x2 +x3 . Feasible2 solution (4 0, 6 0) but not optimal (3, 2, 1 > 0). In the dual, consider the basis (u3 , u4 , u5 ) and the dictionary u3 = 3 +u1 +2u2 +u2 u4 = 2 +u1 u5 = 1 +u1 +3u2 w = 4u1 6u2 . Infeasible solution (3, 2, 1 < 0). If it wasnt, it would be optimal (as 4, 6 0).
2

## Primal and dual dictionaries

Change indices of the dual variables so that dual surplus variables have indices 1, 2 . . . , n, same as primal original variables: min 4u4 +6u5 ( max 4u4 6u5 ) s.t. u4 +2u5 u1 u4 +u5 u2 u4 +3u5 u3 u4 , u5 , u1 , u2 , u3

= = =

3 2 1 0

. . . and clear up the link between primal and dual dictionaries: x4 = 4 x1 x2 x3 x5 = 6 2x1 x2 3x3 z= 3x1 +2x2 +x3 ; u1 = 3 +u4 +2u5 u2 = 2 +u4 +u5 u3 = 1 +u4 +3u5 w = 4u4 6u5 .

## Basic duals, nonbasic primals (and viceversa)

primal xi basic xi nonbasic dual ui nonbasic ui basic

The dual (with surplus variables included) can be written as min b u s.t. Au = c u0 and A has

## one row for primal variable m + n columns:

one for each original dual variable (there are m) and one for each surplus variable (there are n)

Dual dictionaries
Now partition again A (not the same A as in the primal: why?) as (B|N), and rewrite the dual as min b uB + b uN N B s.t. BuB + NuN = c uB , uN 0 Having a dej vu here? Dual dictionary: a uB = z Remember:

B1 c B1 NuN

= b B1 c + (b b B1 N)uN B N B

## Primal and dual dictionaries

A := B1 N, b := B1 b, Dene := c c B1 N, B N c d := c B1 b. B Its easy to prove (but we wont) that for a primal dictionary xB = AxN b z = + xN d c the corresponding dual dictionary is uB = w + A uN c = uN d b

## Primal and dual dictionaries

So far, we have always looked at (and played with) primal dictionaries. Lets look at dual dictionaries.

Primal dictionary: B = {4, 5}; N = {1, 2, 3}; Dual dictionary: B = {1, 2, 3}; N = {4, 5}.

x4 = 4 x1 x2 x3 x5 = 6 2x1 x2 3x3 is a primal feasible z= 3x1 +2x2 +x3 dictionary. It is also dual infeasible: its dual dictionary u1 = 3 +u4 +2u5 u2 = 2 +u4 +u5 u3 = 1 +u4 +3u5 w = 4u4 6u5 is infeasible. Dual infeasibility = cN cB B1 N 0. The c 3 c c column 2 = , so 0 not optimal. 1

## Primal and dual dictionaries

Pivot: x2 enters x4 leaves.

Primal dictionary: B = {2, 5}; N = {1, 3, 4}; x2 = 4 x1 x3 x4 x5 = 2 x1 2x3 +x4 z = 6 +x1 x3 2x4

()

Dual dictionary: B = {1, 3, 4}; N = {2, 5}. u1 = u3 = u4 = w = 1 +u2 +u5 +1 +u2 +2u5 +2 +u2 u5 6 2u2 4u5

()

Dictionary () is primal feasible, dual infeasible. Dictionary () is primal infeasible, dual feasible

## Optimal solutions and dual feasibility

Pivot: x1 enters x5 leaves.

Primal dictionary: B = {1, 2}; N = {3, 4, 5}; () x1 = 2 2x3 +x4 x5 x2 = 2 +x3 x4 +x5 z = 8 3x3 x4 x5

Dual dictionary: B = {3, 4, 5}; N = {1, 2}. u3 = u4 = u5 = w = +3 +2u1 u2 +1 u1 +u2 +1 +u1 u2 8 2u1 2u2

()

It is optimal.

## Optimal solutions and dual feasibility

The simplex method visited three dictionaries the rst two were only feasible Or, better, primal feasible and dual infeasible The last one was optimal,

i.e. Both primal feasible and dual feasible. An alternative to the (primal) simplex method is:

Start from a primal infeasible (but dual feasible) dictionary; Do pivots aimed at

## Terminate on dictionary both primal and dual feasible.

We dont even need to write the dual dictionary explicitly: the primal dictionary will do just ne.

## The dual simplex method

Start from a dual feasible, primal infeasible dictionary: x1 = 4 +3x2 11x4 +x5 x3 = 3 x2 +3x4 2x5 z = 12 4x2 x4 x5

Select a leaving variable among {x1 , x3 }. x3 = 3 0, so we can only select x1 as the leaving variable. Choose the entering one so that dual feasibility is retained. The rows of the dual dictionary are: u2 = 4 3u1 u4 = 1 + 11u1 u5 = 1 u1

Which, among {u2 , u4 , u5 }, decreases to zero rst? u5 (would be the leaving variable in the dual dictionary) x5 is the entering variable.

To recap

xB = z

B1 b

B1 NxN

= c B1 b + (c c B1 N)xN B N B

## If = c c B1 N 0, it is dual feasible (i.e., optimal) c N B Primal simplex keeps primal feasibility ( 0) b

i.e. it stops when dual feasibility is reached Dual simplex keeps dual feasibility ( 0) c i.e. it stops when primal feasibility is reached

## The dual simplex method (cont.)

What steps were performed two slides ago?

Find leaving variable (look at 1 < 0, so x1 leaves b): b The x1 -row of B1 N is3 3 11 1 = (3, 11, 1) e B1 N = (1, 0) 1 1 3 2 Find the entering variable (that drives x1 from 4 to zero) Keep dual feasibility! must stay 0 c
j c ij a

## The x5 -th column of N: a =

0 1

; so d = B1 a =

Set t so that xB td has a zero at x1 : 4 t(1) = 0 t = 4 (Psst! What if, instead, if was (3, 11, 1)?)

## The revised dual simplex method

R EVISED S IMPLEX(n, m, A, b, c) 1 Consider a basis B 2 while true 3 do 4 If xB 0, STOP : primal feasibility optimum 5 Select i B : xi < 0 (leaving variable) B1 N : solve v B = e ; compute w := v N 6 Compute ei i 7 If w 0, STOP : problem infeasible c (entering variable) 8 Find j N that minimizes wjj 9 Let a be the xj column of N 10 Compute B1 a : solve Bd = a 11 12 13 14 15 Set entering variable: xB = j
xB i wj

Set remaining basic variables: xB xB td c Set leaving variables : i = wij c c Set remaining nonbasic variables : k k + i wk c c c c B B \ {j} {i}