CSC 445/545 Notes 3.3: Complementary Slackness

We proved earlier that for any primal feasible solution X, and any dual feasible solution Y:

C1*X1  + C2*X2 + .... + Cn*Xn   <=  S =

(A11* Y1 + A21*Y2 + ... + Am1*Ym)*X1 +  [Eq. A]
(A12* Y1 + A22*Y2 + ... + Am2*Ym)*X2 +

(A1n* Y1 + A2n*Y2 + ... + Amn*Ym)*Xn

=
(A11* X1 + A12*X2 + ... + A1n*Xn)*Y1 + [Eq. B] (A21* X1 + A22*X2 + ... + A2n*Xn)*Y2 + (Am1* X1 + Am2*X2 + ... + Amn*Xn)*Ym <= B1*Y1 + B2*Y2 + .... + Bm*Ym

But by the Duality Theorem, If X' is an optimal solution to the primal and Y' is an optimal solution to the dual, then

C1*X1' + C2*X2' + .... + Cn*Xn'
= S  =
B1*Y1'  + B2*Y2' + .... + Bm*Ym' 

How can equality occur?

Consider the equation (taken from Eq. A):
(A1j* Y1 + A2j*Y2 + ... + Amj*Ym)*Xj = Cj*Xj.

If for all j=1, 2, ..., n, either

  1. (A1j* Y1 + A2j*Y2 + ... + Amj*Ym) = Cj
    [which is the same as saying that the jth dual equation is tight, or equivalently, its slack variable Ym+j=0], or
  2. (b) Xj = 0
then there is equality.


Consider the equation (taken from Eq. B):
(Ai1* X1 + Ai2*X2 + ... + Ain*Xn)*Yi = Bi*Yi

If for all i=1, 2, ..., m, either

  1. (Ai1* X1 + Ai2*X2 + ... + Ain*Xn)= Bi
    [which is the same as saying that the ith primal equation is tight, or equivalently, its slack variable Xn+i=0], or
  2. Yi = 0

then there is equality.

Not only are these conditions sufficient for optimality but they are also necessary:


Complementary Slackness Theorem (Thm 5.2 in text)

Let X' be a feasible solution of the primal and Y' be a feasible solution of the dual. Necessary and sufficicent conditions for simultaneous optimality of X' and Y' are

for all j=1, 2, ..., n, either

  1. (A1j* Y1' + A2j*Y2' + ... + Amj*Ym') = Cj or
  2. Xj' = 0 (or both).
and

    for all i=1, 2, ..., m, either
  1. (Ai1* X1' + Ai2*X2' + ... + Ain*Xn')= Bi or
  2. Yi' = 0 (or both).

Recipe for Using this Theorem

Given: X' Question: Is X' an optimal solution? Procedure:

  1. First consider each Xj' (j=1, 2, ..., n) such that Xj' is NOT 0. Write down the equation of the dual that corresponds to the coefficients of Xj in the primal:
    (A1j* Y1 + A2j*Y2 + ... + Amj*Ym) = Cj
  2. Next consider each equation i of the primal problem (i=1, 2, 3, ... , m). If the ith equation is NOT tight (there is some slack), write down Yi= 0.
  3. Solve these equations that you get for Y. If there is a unique solution continue. If not, abort.
  4. Test Y to see if it is dual feasible. Yes- X' is optimal. No- X' is not optimal.

When does the system of equations have a unique solution?

Theorem 5.4 in text: when X' is a nondegenerate basic feasible solution.

Nondegenerate: no basis variables have value 0.


The problem:

Maximize 5 X1 + 4 X2 + 3 X3 

subject to

  2 X1 + 3 X2 + 1 X3  <=  5 
  4 X1 + 1 X2 + 2 X3  <= 11 
  3 X1 + 4 X2 + 2 X3  <=  8 

X1, X2, X3 >= 0


The second last dictionary: u= (2.5, 0, 0)
 
X1 =   2.50 - 1.50 X2 - 0.50 X3 - 0.50 X4 
X5 =   1    + 5    X2 + 0    X3 + 2    X4 
X6 =   0.50 + 0.50 X2 - 0.50 X3 + 1.50 X4 
-------------------------------------------------
z  =  12.50 - 3.50 X2 + 0.50 X3 - 2.50 X4 


The last dictionary: v= (2, 0, 1)

X1 =   2 - 2 X2 - 2 X4 + 1 X6 
X5 =   1 + 5 X2 + 2 X4 + 0 X6 
X3 =   1 + 1 X2 + 3 X4 - 2 X6 
-------------------------------------------------
z  =  13 - 3 X2 - 1 X4 - 1 X6 


First test if u=(2.5, 0, 0) is optimal.

Maximize 5 X1 + 4 X2 + 3 X3 

subject to

  2 X1 + 3 X2 + 1 X3  <=  5 
  4 X1 + 1 X2 + 2 X3  <= 11 
  3 X1 + 4 X2 + 2 X3  <=  8 

X1, X2, X3 >= 0

1. First consider each Xj' such that Xj' is NOT 0. Write down the equation of the dual that corresponds to the coefficients of Xj in the primal:

X1 is not 0:  2 Y1 + 4 Y2 + 3 Y3 = 5

2. Next consider each equation i of the primal problem If the ith equation is NOT tight (there is some slack), write down Yi= 0.

2(2.5) + 3(0) + 1(0)  = 5   <=  5   TIGHT
4(2.5) + 1(0) + 2(0)  = 10  <= 11   Y2=0
3(2.5) + 4(0) + 2(0)  = 7.5 <=  8   Y3=0

3. Solve these equations that you get for Y.


2 Y1 + 4 Y2 + 3 Y3  = 5
         Y2         = 0
                Y3  = 0

Solution: (2.5, 0, 0)

4. Check for dual feasibility.

Minimize 5 Y1  + 11 Y2  + 8 Y3

subject to

2 Y1 + 4 Y2 + 3 Y3 >=  5
3 Y1 + 1 Y2 + 4 Y3 >=  4
1 Y1 + 2 Y2 + 2 Y3 >=  3

Y1, Y2, Y3 >= 0
    
Plugging (2.5, 0, 0) into the dual:

2 (2.5) + 4 (0) + 3 (0) = 5    >=  5 OK
3 (2.5) + 1 (0) + 4 (0) = 7.5  >=  4 OK
1 (2.5) + 2 (0) + 2 (0) = 2.5  >=  3 VIOLATION

So x= (2.5, 0, 0) is NOT optimal.

Now test if v=(2, 0, 1) is optimal.

1. First consider each Xj' (j=1, 2, ..., n) such that Xj' is NOT 0. Write down the equation of the dual that corresponds to the coefficients of Xj in the primal:

X1 is not 0:  2 Y1 + 4 Y2 + 3 Y3 = 5
X3 is not 0:  1 Y1 + 2 Y2 + 2 Y3 =  3

2. Next consider each equation i of the primal problem If the ith equation is NOT tight (there is some slack), write down Yi= 0.

2(2) + 3(0) + 1(1)  =  5  <=  5   TIGHT
4(2) + 1(0) + 2(1)  = 10  <= 11   Y2=0
3(2) + 4(0) + 2(1)  =  8  <=  8   TIGHT

3. Solve these equations that you get for Y.

2 Y1 + 4 Y2 + 3 Y3 = 5
         Y2        = 0
1 Y1 + 2 Y2 + 2 Y3 =  3

Solution: (1, 0, 1)

4. Check for dual feasibility.

Minimize 5 Y1  + 11 Y2  + 8 Y3

subject to

2 Y1 + 4 Y2 + 3 Y3 >=  5
3 Y1 + 1 Y2 + 4 Y3 >=  4
1 Y1 + 2 Y2 + 2 Y3 >=  3

Y1, Y2, Y3 >= 0
    
Plugging (1, 0, 1) into the dual:

2 (1) + 4 (0) + 3 (1) = 5  >=  5 OK
3 (1) + 1 (0) + 4 (1) = 7  >=  4 OK
1 (1) + 2 (0) + 2 (1) = 3  >=  3 OK

So x= (2, 0, 1) is optimal.