Dual

Duality
𝑛
Maximize
Primal:
Subject to
𝑗=1
𝑐𝑗 π‘₯𝑗
𝑛
𝑗=1
π‘Žπ‘–π‘— π‘₯𝑗 ≀ 𝑏𝑖
𝑖 = 1,2, … , π‘š.
π‘₯𝑗 β‰₯ 0
𝑗 = 1,2, … , 𝑛.
π‘š
Minimize
Dual:
Subject to
𝑖=1
𝑏𝑖 𝑦𝑖
π‘š
𝑖=1
π‘Žπ‘–π‘— 𝑦𝑗 β‰₯ 𝑐𝑗
𝑗 = 1,2, … , 𝑛.
𝑦𝑖 β‰₯ 0
𝑖 = 1,2, … , π‘š.
Duality
Primal:
Dual:
Maximize
π‘βŠΊπ‘₯
Subject to
𝐴π‘₯ ≀ 𝑏
π‘₯β‰₯0
Minimize
π‘βŠΊπ‘¦
Subject to
𝐴⊺ 𝑦 β‰₯ 𝑐
𝑦β‰₯0
The Duality Theorem
Primal P:
Dual D:
Maximize 𝑐 ⊺ π‘₯ subject to 𝐴π‘₯ ≀ 𝑏, π‘₯ β‰₯ 0.
Minimize 𝑏 ⊺ 𝑦 subject to 𝐴⊺ 𝑦 β‰₯ 𝑐, 𝑦 β‰₯ 0.
Weak Duality Theorem:
If π‘₯ is feasible for P and 𝑦 is feasible for D, then:
𝑐 ⊺ π‘₯ ≀ π‘βŠΊ 𝑦
(Strong) Dualiy Theorem:
If π‘₯ βˆ— is optimal for P and 𝑦 βˆ— is optimal for D, then:
𝑐 ⊺π‘₯ βˆ— = π‘βŠΊ π‘¦βˆ—
Finding Optimal Dual Solution from
Otimal Primal Dictionary
Primal P:
Maximize 𝑐 ⊺ π‘₯ subject to 𝐴π‘₯ ≀ 𝑏, π‘₯ β‰₯ 0.
Solve P using the two phase Simplex method, obtaining
optimal solution π‘₯ βˆ— . First row of final dictionary:
𝑧 = π‘§βˆ— +
𝑛
𝑗=1
π‘π‘—βˆ— π‘₯𝑗 +
π‘š
𝑖=1
Let π‘¦π‘–βˆ— = βˆ’π‘‘π‘–βˆ— , for 𝑖 = 1,2, … , π‘š.
Then:
1. 𝑦 βˆ— is a feasible solution to dual D.
2. π‘βŠΊ 𝑦 βˆ— = 𝑧 βˆ—
π‘‘π‘–βˆ— π‘₯𝑛+𝑖
Explaining the magic
Primal
Dual
Maximize
5π‘₯1 + 4π‘₯2 + 3π‘₯3
Subject to
2π‘₯1 + 3π‘₯2 + π‘₯3
4π‘₯1 + π‘₯2 + 2π‘₯3
3π‘₯1 + 4π‘₯2 + 2π‘₯3
π‘₯1 , π‘₯2 , π‘₯3
Minimize
5𝑦1 + 11𝑦2 + 8𝑦3
Subject to
2𝑦1 + 4𝑦2 + 3𝑦3
3𝑦1 + 𝑦2 + 4π‘₯3
𝑦1 + 2𝑦2 + 2𝑦3
π‘₯1 , π‘₯2 , π‘₯3
≀ 5
≀ 11
≀8
β‰₯0
β‰₯ 5
β‰₯4
β‰₯3
β‰₯0
Pivoting primal and dual dictionary
Primal:
4π‘₯2
3π‘₯2
π‘₯2
4π‘₯2
+
βˆ’
βˆ’
βˆ’
3π‘₯3
π‘₯3
2π‘₯3
2π‘₯3
𝑀 =
βˆ’ 5𝑦1 βˆ’ 11𝑦2
(not feasible!)
𝑦4 = βˆ’5 + 2𝑦1 + 4𝑦2
𝑦5 = βˆ’4 + 3𝑦1 +
𝑦2
𝑦6 = βˆ’3 + 𝑦1 + 2𝑦2
βˆ’
+
+
+
8𝑦3
3𝑦3
4𝑦3
2𝑦3
Dual:
𝑧 =
π‘₯4 = 5 βˆ’
π‘₯5 = 11 βˆ’
π‘₯6 = 8 βˆ’
5π‘₯1
2π‘₯1
4π‘₯1
3π‘₯1
+
βˆ’
βˆ’
βˆ’
Pivoting π‘₯1 and π‘₯4 (and 𝑦4 and 𝑦1 )
Primal:
𝑧 =
π‘₯1 =
π‘₯5 =
π‘₯6 =
25
2
5
2
1
1
2
25
2
7
2
1
βˆ’
2
5
2
βˆ’
βˆ’
+
+
Dual:
𝑀 = βˆ’
βˆ’
(still not
feasible!)
𝑦5 =
+
π‘₯6 =
𝑦1 =
+
+
7
π‘₯2 +
2
3
π‘₯ βˆ’
2 2
5π‘₯2
1
π‘₯2 βˆ’
2
5
𝑦4 βˆ’
2
3
𝑦4 βˆ’
2
1
𝑦
2 4
1
𝑦4 βˆ’
2
1
π‘₯
2 3
1
π‘₯
2 3
βˆ’
βˆ’
+
1
π‘₯
2 3
+
𝑦2
βˆ’
5𝑦2
βˆ’
+
2𝑦2
βˆ’
5
π‘₯
2 4
1
π‘₯
2 4
2π‘₯4
3
π‘₯
2 4
1
𝑦
2 3
1
𝑦
2 3
1
𝑦
2 3
3
𝑦
2 3
Pivoting π‘₯3 and π‘₯6 (and 𝑦6 and 𝑦3 )
Primal:
optimal!
Dual:
Feasible!
(and optimal)
𝑧 = 13 βˆ’ 3π‘₯2
π‘₯1 = 2 βˆ’ 2π‘₯2
π‘₯5 = 1 + 5π‘₯2
π‘₯3 = 1 + π‘₯2
𝑀 = βˆ’13 βˆ’
𝑦5 =
3 +
𝑦1 =
1 +
𝑦3 =
1 βˆ’
βˆ’
βˆ’
+
+
π‘₯4 βˆ’
2π‘₯4 +
2π‘₯4
3π‘₯4 βˆ’
2𝑦4 βˆ’ 𝑦2
2𝑦4 βˆ’ 5𝑦2
2𝑦4 βˆ’ 2𝑦2
𝑦4
π‘₯6
π‘₯6
2π‘₯6
βˆ’ 𝑦6
βˆ’ 𝑦6
βˆ’ 3𝑦6
+ 2𝑦6
Consequence of Strong duality
β€’ Software solving LP programs to optimality
can easily be checked.
β€’ Give the software the primal program as well
as the dual program. The solution to the dual
problem is a certificate that the solution to
the primal program is optimal.
Linear Inequalities Problem
Input:
𝐴 ∈ π‘…π‘š×𝑛 , 𝑏 ∈ π‘…π‘š
Output:
If π‘₯ ∈ 𝑅𝑛 ∣ 𝐴π‘₯ ≀ 𝑏 is empty, report Infeasible,
otherwise output π‘₯ such that 𝐴π‘₯ ≀ b .
Linear Programming
Input:
𝐴 ∈ π‘…π‘š×𝑛 , 𝑏 ∈ π‘…π‘š , 𝑐 ∈ 𝑅𝑛
Output:
π‘₯ ∈ 𝐹 maximizing 𝑐 ⊺ π‘₯, where 𝐹 = π‘₯ ∈ 𝑅𝑛 ∣ 𝐴π‘₯ ≀
Consequence of Strong duality
β€’ Solving linear programs to optimality is as
easy as solving a system of linear inequalities:
1. Given LP P, check if P is feasible using LI
algorithm. Otherwise report Infeasible.
2. Construct dual D of P. Use LI algorithm to find
(π‘₯, 𝑦) so that 𝐴π‘₯ ≀ 𝑏, π‘₯ β‰₯ 0,
𝐴⊺ 𝑦 β‰₯ 𝑐, 𝑦 β‰₯ 0, and 𝑐 ⊺ π‘₯ = 𝑏 ⊺ 𝑦. If no such
(π‘₯, 𝑦) exist, report Unbounded. Otherwise
return π‘₯.
Complementary Slackness
Primal P:
Dual D:
Maximize 𝑐 ⊺ π‘₯ subject to 𝐴π‘₯ ≀ 𝑏, π‘₯ β‰₯ 0.
Minimize 𝑏 ⊺ 𝑦 subject to 𝐴⊺ 𝑦 β‰₯ 𝑐, 𝑦 β‰₯ 0.
Suppose π‘₯ βˆ— and 𝑦 βˆ— are a pair of optimal solutions to P and
D. By strong duality:
𝑐 ⊺ π‘₯ βˆ— = π‘βŠΊ yβˆ—
Consider the proof of weak duality:
𝑐 ⊺ π‘₯ ≀ 𝑦 ⊺ 𝐴 π‘₯ = 𝑦 ⊺ 𝐴π‘₯ ≀ 𝑦 ⊺ 𝑏
For π‘₯ βˆ— and 𝑦 βˆ— the inequalities must be equalities.
𝑛
𝑛
π‘š
π‘š
𝑐𝑗 π‘₯𝑗 =
𝑗=1
𝑛
π‘š
π‘Žπ‘–π‘— 𝑦𝑖 π‘₯𝑗 =
𝑗=1
𝑖=1
π‘Žπ‘–π‘— π‘₯𝑗 𝑦𝑖 =
𝑖=1
𝑗=1
𝑏𝑖 𝑦𝑖
𝑖=1
Consider last part:
π‘š
𝑛
π‘š
π‘Žπ‘–π‘— π‘₯𝑗 𝑦𝑖 =
𝑖=1
𝑗=1
𝑏𝑖 𝑦𝑖
𝑖=1
Rewrite as:
π‘š
𝑛
𝑏𝑖 βˆ’
𝑖=1
π‘Žπ‘–π‘— π‘₯𝑗 𝑦𝑖 = 0
𝑗=1
This is a sum of non-negative numbers (Why?)
summing to 0.
π‘š
𝑛
𝑏𝑖 βˆ’
𝑖=1
π‘Žπ‘–π‘— π‘₯𝑗 𝑦𝑖 = 0
𝑗=1
β€’ All terms must be 0.
β€’ Hence, for all 𝑖 = 1,2, … , π‘š (at least) one of
the following must hold:
a) 𝑏𝑖 βˆ’
b)
𝑦𝑖 = 0
𝑛
𝑗=1 π‘Žπ‘–π‘— π‘₯𝑗
= 0 (i.e. slack π‘₯𝑛+𝑖 = 0).
The Complementary Slackness Property
Primal P:
Dual D:
Maximize 𝑐 ⊺ π‘₯ subject to 𝐴π‘₯ ≀ 𝑏, π‘₯ β‰₯ 0.
Minimize 𝑏 ⊺ 𝑦 subject to 𝐴⊺ 𝑦 β‰₯ 𝑐, 𝑦 β‰₯ 0.
Solutions π‘₯ and 𝑦 are said to satisfy Complementary Slackness if
and only if:
β€’ for all 𝑖 = 1,2, … , π‘š (at least) one of the following holds:
𝑛
a)
𝑗=1 π‘Žπ‘–π‘— π‘₯𝑗 = 𝑏𝑖 (𝑖th primal constraint has slack 0)
b) 𝑦𝑖 = 0
(𝑖th dual variable is 0)
β€’ for all j= 1,2, … , 𝑛 (at least) one of the following holds:
π‘š
a)
𝑖=1 π‘Žπ‘–π‘— 𝑦𝑖 = 𝑐𝑗 (𝑗th dual constraint has slack 0)
b) π‘₯𝑗 = 0
(𝑗th primal variable is 0)
Complementary Slackness Theorem
Primal P:
Dual D:
Maximize 𝑐 ⊺ π‘₯ subject to 𝐴π‘₯ ≀ 𝑏, π‘₯ β‰₯ 0.
Minimize 𝑏 ⊺ 𝑦 subject to 𝐴⊺ 𝑦 β‰₯ 𝑐, 𝑦 β‰₯ 0.
Theorem
Let π‘₯ and 𝑦 be feasible solutions to P and D. Then:
π‘₯ and 𝑦 are both optimal
if and only if
π‘₯ and 𝑦 satisfy complementary slackness.
The Dual Simplex Method
β€’ Simple idea: Instead of running the Simplex
Algorithm on the primal problem, run it on the
dual problem.
β€’ Can be usuful as β€œempiric” number of pivoting
steps of the Simplex Algorithm is roughly ∼
π‘š log 2 𝑛.
β€’ We can even run the Dual Simplex algorithm on
the primal dictionary.
Dual-Based Phase I Algorithm
β€’ If we change the objective function to
max 0
the dual program is origo feasible!
β€’ The optimal dual solution is feasible in the
primal – this may serve as a replacement for
Phase I.
β€’ We may now proceed as usual in the twophase Simplex algorithm.
We often have feasible origo in dual
program in practice
In many situations the linear program we
formulate is about minimizing cost,
𝑛
min
𝑐𝑗 π‘₯𝑗
𝑗=1
which turns into the objective function,
𝑛
max
βˆ’π‘π‘— π‘₯𝑗
𝑗=1
If 𝑐𝑗 β‰₯ 0 for all 𝑗, then the dual is origo feasible!
Generalized Duality
Primal:
Maximize 𝑐1 π‘₯1 + 𝑐2 π‘₯2 + 𝑐3 π‘₯3
Subject to 𝑦1 : π‘Ž11 π‘₯1 + π‘Ž12 π‘₯2 + π‘Ž13 π‘₯3 ≀ 𝑏1
Dual:
Manimize 𝑏1 𝑦1 + 𝑏2 𝑦2 + 𝑏3 𝑦3
Subject to π‘₯1 : π‘Ž11 𝑦1 + π‘Ž21 𝑦2 + π‘Ž31 𝑦3 β‰₯ 𝑐1
𝑦2 : π‘Ž21 π‘₯1 + π‘Ž22 π‘₯2 + π‘Ž23 π‘₯3 β‰₯ 𝑏2
𝑦3 : π‘Ž31 π‘₯1 + π‘Ž32 π‘₯2 + π‘Ž33 π‘₯3 = 𝑏3
π‘₯1 β‰₯ 0, π‘₯2 ≀ 0, π‘₯3 free
π‘₯2 : π‘Ž12 𝑦1 + π‘Ž22 𝑦2 + π‘Ž32 𝑦3 ≀ 𝑐2
π‘₯3 : π‘Ž13 𝑦1 + π‘Ž23 𝑦2 + π‘Ž33 𝑦3 = 𝑐3
𝑦1 β‰₯ 0, 𝑦2 ≀ 0, 𝑦3 free
Rules for Taking the Dual
β€’ Constraints in primal corresponds to variables in
dual (and vice versa).
β€’ Coefficients of objective function in primal
corresponds to constants in dual (and vice versa).
Primal (Maximization)
Dual (Minimization)
≀ for constraint
β‰₯0 for variable
β‰₯ for constraint
≀0 for variable
= for constraint
free for variable
β‰₯0 for variable
β‰₯ for constraint
≀0 for variable
≀ for constraint
free for variable
= for constraint