Duality and Complementary Slackness
Theorem
U Dinesh Kumar
This session…
Relationship between Primal and Dual Linear
Programming.
Complementary Slackness Theorem.
Linear
Programming
Allocation of Valuation of
limited resource Resource
Primal Problem Dual Problem
Primal and Dual Linear Programming
Associated with any LP is another LP called Dual.
The formulation that solves resource allocation
problem is called the Primal (primal linear
programming).
The problem that finds the marginal value of the
limited resource is called dual (dual linear
programming)
Applications of Dual LP
In some cases it is easy to solve dual than primal.
Provides better insight to the original LPP.
Converting Primal to Dual
If primal is a maximization problem, the dual will be a
minimization problem, and vice versa.
Before finding the dual of a LP, we convert the original
problem in its standard form.
Standard Form of LP (Maximization)
Standard Maximization Problem (n variables and m
constraints)
M aximize Z C1 x1 C2 x2 ... Cn xn
Subject
a11x1 a12 x2 ... a1n xn b1
a 21x1 a22 x2 ... a2 n xn b2
...........................................
a m1 x1 am 2 x2 ... amn xn bm
x1 , x2 ,..., xn 0
Standard Form of LP (Minimization)
Standard Minimization Problem
M inimize Z C1 x1 C2 x2 ... Cn xn
Subject
a11x1 a12 x2 ... a1n xn b1
a 21x1 a22 x2 ... a2 n xn b2
...........................................
a m1 x1 am 2 x2 ... amn xn bm
x1 , x2 ,..., xn 0
Primal and Dual
Primal Problem Dual Problem
M ax Z CX M in W Yb
Subject to : Subject to :
AX b yA c
and and
X0 y0
Manvi Motors (Primal and Dual)
Primal Dual
M ax 3500 C 5000 T M in 12000 y1 10000 y2
S.t. S.t.
20 C 40 T 12000 20 y1 25 y2 3500
25 C 10 T 10000 40 y1 10 y2 5000
C, T 0 y1, y2 0
Primal-Dual relationship
If the primal has n variables and m resource constraints (standard
form), the dual will have m variables and n constraints.
There is one-to-one correspondence between the primal
constraints and dual variables. For every primal constraint there is
a dual variable. For every primal variable, there is a dual
constraint.
The value of dual variables are shadow prices and indicate
marginal value of each resource.
Weak Duality Property
If x is a feasible solution for the primal and y
is a feasible solution for the dual problem,
then:
cx yb
That is, the value of dual objective function is
always greater than or equal to the primal
objective function value for any pair of feasible
solutions.
Applications of weak duality
The value of primal objective cx is a lower bound to the
value of dual optimal value y*b.
The value of dual objective yb is upper bound to any
primal objective cx*.
20C + 40T 12000
Manvi Motors – Primal Problem
D
C
Cars
E
45C + 50T 14000 25C + 10T 10000
A
O
Isoprofit line
Trucks
40Y1 + 10Y2 5000
Manvi Motors – Dual Problem
C
Y2
B
A 20Y1 + 25Y2 3500
O
Y1
Strong Duality Property
If x* is an optimal solution for the primal and y* is an
optimal solution for the dual problem, then:
cx* = y*b
Applications of strong duality
If X* and Y* are feasible solutions of primal and dual and if their
corresponding objective functions are equal, then X* and Y* are
optimal solutions.
If X* is an optimal solution to primal, then a finite optimal
solution exists for dual (vice versa).
Symmetry Property
1. If one problem has a feasible solutions and bounded
objective function (and so an optimal solution), then so
does the other problem.
2. If one problem has a feasible and an unbounded objective
function (and so no optimal solution), then the other
problem has no feasible solutions.
3. If one problem has no feasible solution, then the other
problem has either no feasible solutions or an unbounded
objective function.
Finding Dual of Non-standard LP (Max Problem)
Step 1: Multiply each constraint by – 1. Then convert
into constraint.
Step 2: Replace each equality constraint by two
inequality constraint.
Replace unrestricted variables with two non-negative
variables.
Example 1
Primal
Max Z 2X1 X2 M ax Z 2x1 X3 X4
Subject to : S.t.
X1 X3 X4 2
X1 X2 2
- X1 - X3 X4 -2
2X1 - X2 3 - 2X1 X3 X4 - 3
X1 - X2 1 X1 - X3 X4 1
Where
X1 0, X2 is urs X2 X3 - X4
Example 1
Primal Dual
M ax Z 2x1 X3 X4
S.t. M in 2y1- 2y2- 3y3 y4
X1 X3 X4 2
- X1 - X3 X4 -2 y1- y2- 2y3 y4 2
- 2X1 X3 X4 - 3
X1 - X3 X4 1 y1- y2 y3- y4 1
Where
X2 X3 - X4
- y1 y2- y3 y4 -1
Y1 – y2 + y3 – y4 = 1
Primal – Dual Relationship
If the primal variable is unrestricted then the
corresponding dual constraint will be an equality
constraint.
If the primal constraint is an equality constraint then the
corresponding dual variable will be unrestricted.
Dual of non-standard Min problem
Step 1: Change each constraint to a constraint by
multiplying each by -1.
Step 2: Replace each equality constraint by a and
constraint. Then transform into a constraint.
Replace any unrestricted variables using two non-
negative variables.
Example 2
Primal Dual
Min w = 2Y1 + 3Y2 + Y3 M ax Z 2X1 X2
Subject to:
S.t.
Y1 + 2Y2 + Y3 2
Y1 – Y2 – Y3 = 1 X1 X2 2
Y1 is urs, Y2 and Y3 0 2X1 X2 3
X1 X2 1
X2 is urs, X1 0
Complementary Slackness Theorem
Complementary Slackness Theorem
Let x = (x1, x2, . . ., xn) is primal feasible and that y = (y1, y2,
. . . , ym) is dual feasible.
Let (w1, w2, . . ., wm) denote the corresponding primal
slack variables, and let (z1, z2, . . . , zn) denote the
corresponding dual slack variables.
Then x and y are optimal for their respective problems if
and only if xjzj = 0, for j = 1, 2, . . . , n, wiyi = 0, for i = 1, 2, . .
. , m.
Complementary Slackness
If a constraint in either the primal (or dual problem) is
non-binding then the corresponding variable in the
other (complementary problem) must equal to zero.
If a constraint in a primal problem is non-binding
then the corresponding variable in dual will be
zero.
If a variable in the optimal solution is non-zero
then the corresponding dual constraint is binding.
Complementary Slackness
A pair of feasible solutions (x* and y*) for the primal and dual,
respectively, to be optimal for the primal and dual a necessary and
sufficient conditions is:
1. yk* = 0 whenever kth constraint is slack at x*.
2. xk* = 0 whenever kth constraint is slack at y*.
Complementary Slackness
If x* and y* are feasible and satisfy the complementary
slackness conditions, then they are optimal.
Application of Duality Theorem and
Complementary Slackness Theorem
M anvi M otors Primal M anvi M otors Dual
M ax 3500C 5000T M in 12000y1 10000y2- 14000y3
20C 40T 12000 500y4 200y5
25C 10T 10000 20y1 25y2- 45y3 y4 3500
45C 50T 14000 40y1 10y2 - 50y3 y5 5000
C 500 y1, y2 0
T 250
C, T 0
Example 1: Strong Duality Example
If C = 350 and T = 125 is the optimal solution, then find
the shadow price.
C = 350 and T = 125 means, constraints 1 and 2 in the
primal problems are binding and the remaining
constraints are non-binding. That is, y3 = y4 = y5 = 0
Using complementary slackness theorem, 20y1 + 25 y2 =
3500 and 40y1 + 10y2 = 5000. That is, y1 = 112.5 and y2
= 50.
Example 2: Complementary slackness
Theorem and weak duality
M ax 30x1 6x 2 5x 3 18x 4
S.t.
x1 2x 3 x 4 20
2x1 x 2 x 4 15
6x1 2x 2 3x 3 54
x i 0, i 1,2,3,4
Check whether (0, 25, 5, 10) is an optimal solution for the above problem
Dual problem
M in w 20y1 15y 2 54y 3
s.t.
Using CST,
y1 2y 2 6y 3 30 y 2 2 y3 6
y 2 2y 3 6 2 y1 3 y3 5
2y1 3y 3 5
y1 y2 18
y1 y 2 18
y i 0, i 1,2,3,4 (4,14,1) which is not feasibe
so (0,25,5,10) is not optimal
Primal Dual Relationship
Primal Solution Item Dual Solution Item
Objective: Maximization Objective: Minimization
Shadow Prices Variable Values
Slacks Reduced Cost
Variable Values Shadow Prices
Reduced costs Slacks
Recommended Reading
Wayne L Winston, “Operations Research: Applications and
Algorithms”, Cengage Learning, 2009.
Hillier and Hillier, “Introduction to Management Science”,
2009.