Duality
Duality
P&S Chapter 3
Last Revised – Nov 1, 2004
1
In this section we lean about duality, which is another
way to approach linear programming. In particular, we
will see:
• Complementary Slackness:
A combinatorial statement of the relationship be-
tween the primal and the dual
2
min c′x
Convert an LP in general
form such as one on the a′ix = bi i ∈ M
right into a LP in stan- a′ix ≥ bi i ∈ M̄
dard form using method xj ≥ 0 j ∈ N
seen earlier. That is xj ≷ 0 j ∈ N̄
min ĉ′x̂
Âx̂ = b
x̂ ≥ 0
where
" #
0, i ∈ M
 = Aj , j ∈ N (Aj , −Aj ), j ∈ N̄
−I, i ∈ M̄
x̂ = col(xj , j ∈ N |(x+
j , x − s
j ), j ∈ N̄ |xi , i ∈ M̄ )
3
0, i ∈ M
min ĉ′x̂ Â = Aj , j ∈ N (Aj , −Aj ), j ∈ N̄
−I, i ∈ M̄
Âx̂ = b x̂ = col(xj , j ∈ N |(x+ − s
j , xj ), j ∈ N̄ |xi , i ∈ M̄ )
x̂ ≥ 0
ĉ = col(cj , j ∈ N |(cj , −cj ), j ∈ N̄ |0)
π ′Â ≤ ĉ′
where π ∈ Rm and m = |M | + |M̄ | is # of rows in
original LP.
4
0, i ∈ M
min ĉ′x̂ Â = Aj , j ∈ N (Aj , −Aj ), j ∈ N̄
−I, i ∈ M̄
Âx̂ = b x̂ = col(xj , j ∈ N |(x+ − s
j , xj ), j ∈ N̄ |xi , i ∈ M̄ )
x̂ ≥ 0
ĉ = col(cj , j ∈ N |(cj , −cj ), j ∈ N̄ |0)
1. If j ∈ N then π ′Aj ≤ cj
3. If i ∈ M̄ then −π ′ ≤ 0 so π ′ ≥ 0.
Primal Dual
min c′x max π ′b
a′ix = bi i∈M πi ≷ 0
a′ix ≥ bi i ∈ M̄ πi ≥ 0
xj ≥ 0 j∈N π ′Aj ≤ cj
xj ≷ 0 j ∈ N̄ π ′Aj = cj
5
Primal Dual
min c′x max π ′b
a′ix = bi i∈M πi ≷ 0
a′ix ≥ bi i ∈ M̄ πi ≥ 0
xj ≥ 0 j∈N π ′Aj ≤ cj
xj ≷ 0 j ∈ N̄ π ′Aj = cj
min π ′(−b)
(−A′j )π ≥ −cj j∈N
(−Aj )π = −cj j ∈ N̄
πi ≥ 0 i ∈ M̄
πi ≷ 0 i∈M
and consider it as primal. Then
max x′(−c)
xj ≥ 0 j∈N
xj ≷ 0 j ∈ N̄
−a′ix ≤ −b i ∈ M̄
−a′ix = −b i∈M
7
Theorem: Given a primal-dual pair, exactly one of the
three situations occurring below occurs. The X’s de-
note situations which can not occur.
Finite 1 X X
optimum
Unbounded X X 3
Infeasible X 3 2
Note that both the Primal and Dual are infeasible, giv-
ing case 2. Now modify the primal so that x1, x2 ≥ 0.
Then
PRIMAL DUAL
min x1 max π1 + π2
x1 + x2 ≥ 1 π1 − π2 ≤ 1
−x1 − x2 ≥ 1 π1 − π2 ≤ 0
x1 ≥ 0 π1 ≥ 0
x2 ≥ 0 π2 ≥ 0
The Dual is
max π ′r
π ′A ≤ c′
π′ ≥ 0
This can be interpreted as saying that a pill-manufacturer
wants to sell m nutrients; pill i containing one unit of
nutrient i at price πi. Manufacturer wants to maximize
revenue. Constraint is that, for each food j, it must
be cheaper for customer to satisfy nutritional require-
ments via pills rather than eating food.
10
Complementary Slackness Conditions
u + v = c′x − π ′b.
So, (2) and (3) are true iff c′x = π ′b which is true iff
both x and π are optimal.
11
Example
min x1 + x2 + x3 + x4 + x5
3x1 + 2x2 + x3 = 1
Primal 5x1 + x2 + x3 + x4 = 3
2x1 + 5x2 + x3 + x5 = 4
xi ≥ 0
12
min x1 + x2 + x3 + x4 + x5
3x1 + 2x2 + x3 = 1
Primal 5x1 + x2 + x3 + x4 = 3
2x1 + 5x2 + x3 + x5 = 4
xi ≥ 0
14
+1 if arc ej leaves node i
!
i = 1, . . . , |V | and
aij = −1 if arc ej enters node i
0
j = 1, . . . , |E|
otherwise
a
e1 3
e4
1
2
s e3 t
2 e5
e2 1
b
e1 e2 e3 e4 e5
+1 +1
s 0 0 0
A= t
0 0 0 −1 −1
a
−1 0 +1 +1 0
b 0 −1 −1 0 +1
15
To create a LP introduce fj to denote flow through arc
ej . The intuition is that we would like to send one unit
of flow from s to t. The cost of one unit of flow through
ej will be cj so a shortest s − t path “should” be one
that minimizes cost.
min c′f
+1
−1
where the +1 corre-
0
Af =
sponds to row s and the
0
..
−1 corresponds to row t.
0
f ≥0
17
Example
a
e1 3
e4
1
2
s e3 t
2 e5
e2 1
b
f1 f2 f3 f4 f5
−z= 0 1 2 2 3 1
1 1 1 0 0 0
0 −1 0 1 1 0
0 0 −1 −1 0 1
Now create a basis with {f1, f4, f5}.
f1 f2 f3 f4 f5
−z= −4 0 −1 0 0 0
f1 = 1 1 1 0 0 0
f4 = 1 0 1 1 1 0
f5 = 0 0 −1 −1 0 1
1111111111 111111111
0000000000 000000000
Leaving arc
0000000000 111111111
1111111111 000000000
e1
e4
0000000000 111111111
1111111111 000000000
0000000000
1111111111
0000000000
1111111111 000000000
111111111
000000000
111111111
0000000000
1111111111
s e3 t
0000000000
1111111111
0000000000
1111111111 000000000
111111111
0000000000
1111111111 000000000
111111111
e5
0000000000
1111111111
e2
0000000000
1111111111
0000000000 111111111
1111111111 000000000
Entering
arc b
f1 f2 f3 f4 f5
−z= −4 0 −1 0 0 0
f1 = 1 1 1 0 0 0
f4 = 1 0 1 1 1 0
f5 = 0 0 −1 −1 0 1
f1 f2 f3 f4 f5
−z= −3 0 0 1 1 0
f1 = 0 1 0 −1 −1 0
f2 = 1 0 1 1 1 0
f5 = 1 0 0 0 1 1
19
Primal
min c′f
Dual
+1
−1 max πs − πt
0
π ′A ≤ c′
Af =
0
.. π≷0
0
f ≥0
ek ek−1, . . . , e1,
where ei = ui, vi, uk = s, v1 = t and vi = ui−1.
21
3
a
3
1
2
s t
3 0
2
1
b 1
πt = πb − cb,t = 1 − 1 = 0
22
Initial Tableau Final Tableau
cj cj πj
I B −1
π = (−5/2, 1, 1)
which is exactly what we derived on page 13.
24