Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

LP Duality

Teuku Naraski Zahari, S.T., M.T.


The Dual of a Normal LP (1/3)
• Associated with any LP is another LP, called the dual. The “original” or
given LP is referred as the primal.
• The relation between an LP and its dual important because it gives us
interesting economic insights.
• Knowledge of duality will also provide additional insights into sensitivity
analysis.
• The objective and the constraints of the dual is always the opposite of
its primal.
o If the primal is a maximization problem, then its dual is a minimization problem
o If the constraint(s) of the primal is a ≤, then its dual will have ≥ constraint(s).
• A minimization dual problem that has all ≥ constraints and all variables
nonnegative is called a normal minimization problem.
The Dual of a Normal LP (2/3)
For a primal LP… There is a dual LP
max 𝑧 = 𝑐1 𝑥1 + 𝑐2 𝑥2 + ⋯ + 𝑐𝑛 𝑥𝑛 min 𝑤 = 𝑏1 𝑦1 + 𝑏2 𝑦2 + ⋯ + 𝑏𝑚 𝑦𝑚
s.t. s.t.
𝑎11 𝑥1 + 𝑎12 𝑥2 + ⋯ + 𝑎1𝑛 𝑥𝑛 ≤ 𝑏1 𝑎11 𝑦1 + 𝑎21 𝑦2 + ⋯ + 𝑎𝑚1𝑦𝑚 ≥ 𝑐1
𝑎21 𝑥1 + 𝑎22 𝑥2 + ⋯ + 𝑎2𝑛 𝑥𝑛 ≤ 𝑏1 𝑎12 𝑦1 + 𝑎22𝑦2 + ⋯ + 𝑎𝑚2 𝑦𝑚 ≥ 𝑐2
. .
. .
𝑎𝑚1 𝑥1 + 𝑎𝑚2 𝑥2 + ⋯ + 𝑎𝑚𝑛 𝑥𝑛 ≤ 𝑏𝑚 𝑎1𝑛 𝑦1 + 𝑎2𝑛 𝑦2 + ⋯ + 𝑎𝑚𝑛 𝑦𝑚 ≥ 𝑐𝑚

𝑥𝑗 ≥ 0 (𝑗 = 1,2, … , 𝑛) 𝑦𝑖 ≥ 0 (𝑗 = 1,2, … , 𝑛)
The Dual of a Normal LP (3/3)
Example 1
From the previous Dakota problem
(omitting the 4th constraint), Its dual is
max 𝑧 = 60𝑥1 + 30𝑥2 + 20𝑥3 min 𝑤 = 48𝑦1 + 20𝑦2 + 8𝑦3
s.t. s.t.
8𝑥1 + 6𝑥2 + 𝑥3 ≤ 48 (lumber) 8𝑦1 + 4𝑦2 + 2𝑦3 ≥ 60 (desk)
4𝑥1 + 2𝑥2 + 1.5𝑥3 ≤ 20 (finishing) 6𝑦1 + 2𝑦2 + 1.5𝑦3 ≥ 30 (tables)
2𝑥1 + 1.5𝑥2 + 0.5𝑥3 ≤ 8 (carpentry) 𝑦1 + 1.5𝑥2 + 0.5𝑥3 ≥ 20 (chairs)

𝑥1, 𝑥2, 𝑥3 ≥ 0
𝑦1, 𝑦2, 𝑦3 ≥ 0
Normalizing a Non-Normal LP (1/3)
• Unfortunately, many LPs are not normal maximization or minimization
problems. For these cases, we need to “convert” them into a normal LP.
• For a maximization primal problem:
o Step 1: Multiply each ≥ constraint by multiplying −1, converting it into a ≤
constraint
o Step 2: Replace each equality constraint by two inequality constraints
o Step 3: Replace each urs variable 𝑥𝑖 by 𝑥𝑖 = 𝑥𝑖′ − 𝑥𝑖′′ , where 𝑥𝑖′ , 𝑥𝑖′′ ≥ 0.
• For a minimization primal problem:
o Step 1: Multiply each ≤ constraint by multiplying −1, converting it into a ≥
constraint
o Step 2: Replace each equality constraint by two inequality constraints
o Step 3: Replace each urs variable 𝑥𝑖 by 𝑥𝑖 = 𝑥𝑖′ − 𝑥𝑖′′ , where 𝑥𝑖′ , 𝑥𝑖′′ ≥ 0.
Normalizing a Non-Normal LP (2/3)
Example 2
Suppose for a non-normal max LP The normal max LP is
max 𝑧 = 2𝑥1 + 𝑥2 max 𝑧 = 2𝑥1 + 𝑥2′ − 𝑥2′′
s.t. s.t.
𝑥1 + 𝑥2 = 2 𝑥1 + 𝑥2′ − 𝑥2′′ ≤ 2
2𝑥1 − 𝑥2 ≥ 3 −𝑥1 − 𝑥2′ + 𝑥2′′ ≤ −2
𝑥1 − 𝑥2 ≤ 1 −2𝑥1 + 𝑥2′ − 𝑥2′′ ≤ −3
𝑥1 − 𝑥2′ + 𝑥2′′ ≤ 1

𝑥1 ≥ 0, 𝑥2 urs 𝑥1 , 𝑥2′ , 𝑥2′′ ≥ 0


Normalizing a Non-Normal LP (3/3)
Example 3
Suppose for a non-normal min LP The normal min LP is
min 𝑧 = 2𝑥1 + 4𝑥2 + 6𝑥3 max 𝑧 = 2𝑥1′ − 2𝑥1′′ + 4𝑥2 + 6𝑥3
s.t. s.t.
𝑥1 + 2𝑥2 + 𝑥3 ≥ 2 𝑥1′ − 𝑥1′′ + 2𝑥2 + 𝑥3 ≥ 2
𝑥1 − 𝑥3 ≥ 1 𝑥1′ − 𝑥1′′ − 𝑥3 ≥ 1
𝑥2 + 𝑥3 = 1 𝑥2 + 𝑥3 ≥ 1
2𝑥1 + 𝑥2 ≤ 3 −𝑥2 − 𝑥3 ≥ −1
−2𝑥1′ + 2𝑥1′′ − 𝑥2 ≥ −3

𝑥1 urs; 𝑥2 , 𝑥3 ≥ 0 𝑥1′ , 𝑥1′′ , 𝑥2 , 𝑥3 ≥ 0


Finding Dual of a Non-Normal LP (1/4)
To find the dual of a non-normal maximization problem, we need to:
• For all ith ≥ primal constraint, the corresponding dual variable 𝑦𝑖 must
be nonpositive, or 𝑦𝑖 ≤ 0.
• For all ith = primal constraint, the corresponding dual variable 𝑦𝑖 must
be unrestricted to sign (urs).
• For all ith urs primal variable, the corresponding ith dual constraint must
be an equality constraint.
Finding Dual of a Non-Normal LP (2/4)
Example 4
Suppose for a non-normal max LP The dual is
max 𝑧 = 2𝑥1 + 𝑥2 min 𝑤 = 2𝑦1 + 3𝑦2 + 𝑦3
s.t. s.t.
𝑥1 + 𝑥2 = 2 𝑦1 + 2𝑦2 + 𝑦3 ≥ 2
2𝑥1 − 𝑥2 ≥ 3 𝑦1 − 𝑦2 − 𝑦3 = 1
𝑥1 − 𝑥2 ≤ 1

𝑥1 ≥ 0, 𝑥2 urs 𝑦1 urs, 𝑦2 ≤ 0, 𝑦3 ≥ 0
Finding Dual of a Non-Normal LP (3/4)
To find the dual of a non-normal minimization problem, we need to:
• For all ith ≤ primal constraint, the corresponding dual variable 𝑦𝑖 must
be nonpositive, or 𝑦𝑖 ≤ 0.
• For all ith = primal constraint, the corresponding dual variable 𝑦𝑖 must
be unrestricted to sign (urs).
• For all ith urs primal variable, the corresponding ith dual constraint must
be an equality constraint.
Finding Dual of a Non-Normal LP (4/4)
Example 5
Suppose for a non-normal min LP The dual is
min 𝑧 = 2𝑥1 + 4𝑥2 + 6𝑥3 max 𝑤 = 2𝑦1 + 𝑦2 + 𝑦3 + 3𝑦4
s.t. s.t.
𝑥1 + 2𝑥2 + 𝑥3 ≥ 2 𝑦1 + 𝑦2 + 2𝑦4 = 2
𝑥1 − 𝑥3 ≥ 1 2𝑦1 + 𝑦3 + 𝑦4 ≤ 4
𝑥2 + 𝑥3 = 1 𝑦1 − 𝑦2 + 𝑦3 ≤ 6
2𝑥1 + 𝑥2 ≤ 3

𝑥1 urs; 𝑥2 , 𝑥3 ≥ 0 𝑦1 , 𝑦2 ≥ 0, 𝑦3 urs, 𝑦4 ≤ 0
The Dual Theorem (1/5)
• The dual problem acts as a boundary for the value of its primal and there are
two kinds of duality: weak and strong duality.
• Let
𝑥1
𝑥2
𝐱= ⋮
𝑥𝑛
be a feasible solution to the primal and 𝐲 = 𝑦1 𝑦2 ⋯ 𝑦𝑚 be any feasible
solution to the dual and 𝑧 = 𝐜𝐱 and 𝑤 = 𝐲𝐛
• A weak duality is when the gap between 𝑧 and 𝑤 is greater than 0. For a
maximization problem, 𝑧 ≤ 𝑤 and for a minimization problem 𝑧 ≥ 𝑤
• However if, 𝒛 = 𝒘 then the duality is called strong duality.
• If a primal problem has an unbounded solution, then the dual will be
infeasible.
The Dual Theorem (2/5)
Primal and dual optimality must also follow the following. Let
𝑥1
𝑥2
𝐱= ⋮
𝑥𝑛
be a feasible solution to the primal and 𝐲 = 𝑦1 𝑦2 ⋯ 𝑦𝑚 be any
feasible solution to the dual. Then 𝐱 is primal optimal and 𝐲 is dual
optimal if and only if
𝑠𝑖 𝑦𝑖 = 0, (𝑖 = 1,2, … , 𝑚)
𝑒𝑗 𝑥𝑗 = 0, (𝑗 = 1,2, … , 𝑛)
This is called the complementary slackness theorem.
The Dual Theorem (3/5)
Suppose BV is an optimal basis for the primal. Then 𝑐𝐵𝑉 𝐵 −1 is an optimal
solution to the dual. Also, 𝑧ҧ = 𝑤.

When we find the optimal solution to the primal by using the simplex
algorithm, we have also found the optimal solution to the dual.
• If the ith primal constraint is a ≤ constraint,
𝑦𝑖 = the coefficient of 𝑠𝑖 in primal optimal row 0
• If the ith primal constraint is a ≥ constraint,
𝑦𝑖 = − the coefficient of 𝑒𝑖 in primal optimal row 0
• If the ith primal constraint is a = constraint is equal to
𝑦𝑖 = (coefficient of 𝑎𝑖 in optimal row 0) − 𝑀 (if primal is max problem)
𝑦𝑖 = (coefficient of 𝑎𝑖 in optimal row 0) + 𝑀 (if primal is min problem)
The Dual Theorem (4/5)
Example 6
Consider the following primal LP max 𝑧 = 3𝑥1 + 2𝑥2 + 5𝑥3 , s.t. 𝑥1 + 3𝑥2 + 2𝑥3 ≤ 15;
2𝑥2 − 𝑥3 ≥ 5; 2𝑥1 + 𝑥2 − 5𝑥3 = 10; and 𝑥1 , 𝑥2 , 𝑥3 ≥ 0.
565 15 65 120
The optimal solution is 𝑧 = 23
, 𝑥3 = ,𝑥
23 2
= ,𝑥
23 1
= 23
, 𝑠1 = 𝑒2 = 𝑎2 = 𝑎3 = 0. And
the optimal tableau is

51 58 9 565
Its dual optimal solution is 𝑦1 = ,𝑦 =− ,𝑦 = ,𝑤 =
23 2 23 3 23 23
The Dual Theorem (5/5)
Example 7
Consider the following primal LP min 𝑧 = 3𝑥1 + 2𝑥2 + 𝑥3 , s.t. 𝑥1 + 𝑥2 + 𝑥3 ≥ 4;
𝑥2 − 𝑥3 ≤ 2; 𝑥1 + 𝑥2 + 2𝑥3 = 6; and 𝑥1 , 𝑥2 , 𝑥3 ≥ 0.
The optimal solution is 𝑧 = 6, 𝑥2 = 2, 𝑥3 = 2, 𝑥1 = 𝑒1 = 𝑠2 = 𝑎1 = 𝑎3 = 0. And the
optimal tableau is

Its dual optimal solution is 𝑦1 = 3, 𝑦2 = 0, 𝑦3 = −1, 𝑤 = 6


Dual Simplex Method (1/7)
• The Dual simplex method enables us to solve a non-normal LP without
writing its dual problem.
• An LP must meet two conditions for The Dual Simplex method can be
used:
o The objective function must satisfy the optimality condition.
• For a maximization problem, all coefficients in the objective function
must be negative.
• For a minimization, all coefficients must be positive.
o At least one constraint does not meet the feasibility condition i.e. it
has a negative right-hand side
Dual Simplex Method (2/7)
The Dual Simplex Method has five steps:
Step 1 Check whether at least one constraint has a negative right-hand side. If
there are then, go to step 2. If not, an optimal solution is found.
Step 2 Choose the most negative basic variable as the variable to leave the
basis. The row in which the variable is basic will be the pivot row.
Step 3 Select entering variable by dividing the non-zero coefficient of each
variable 𝑥𝑗 in row 0 with the coefficient of each variable 𝑥𝑗 that has a
negative coefficient in the pivot row. Select the variable with the
smallest ratio.
Step 4 Perform ERO as in the simplex method.
Step 5 If there is any constraint in which the right-hand side is negative and
optimality condition is satisfied, return to step 1. If not, optimal solution
has been found.
Dual Simplex Method (3/7)
Three uses of the dual simplex method:
1. Finding the new optimal solution after a constraint is added to an LP
2. Finding the new optimal solution after changing a right-hand side of
an LP
3. Solving a normal minimization problem
Dual Simplex Method (4/7)
Find optimal solution after adding constraint
Consider the Dakota problem again. The optimal tableau of the Dakota
problem was
B.V 𝒛 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝐬𝟏 𝐬𝟐 𝐬𝟑 RHS
𝑧 1 0 5 0 0 10 10 280
𝑠1 0 0 −2 0 1 2 −8 24
𝑥3 0 0 −2 1 0 2 −4 8
𝑥1 0 1 5/4 0 0 −1/2 3/2 2

Suppose now Dakota is required to make tables, 𝑥2 ≥ 1. Because the


current optimal solution has 𝑥2 = 0, it is no longer feasible and cannot be
optimal.
Dual Simplex Method (5/7)
Find optimal solution after adding constraint
• Suppose now Dakota is required to make tables, 𝑥2 ≥ 1. Because the
current optimal solution has 𝑥2 = 0, it is no longer feasible and cannot
be optimal.
• The fourth constraint can be converted to an ≤ constraint by
multiplying it with −1 which yields −𝑥2 ≤ −1.
• Adding slack variable, the fourth constraint is be standardized −𝑥2 +
𝑠4 = −1
Dual Simplex Method (6/7)
Find optimal solution after adding constraint
• The new tableau of the Dakota problem is now
B.V 𝒛 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝐬𝟏 𝐬𝟐 𝐬𝟑 𝐬𝟒 RHS
𝑧 1 0 5 0 0 10 10 0 280
𝑠1 0 0 −2 0 1 2 −8 0 24
𝑥3 0 0 −2 1 0 2 −4 0 8
𝑥1 0 1 5/4 0 0 −1/2 3/2 0 2
𝑠4 0 0 −1 0 0 0 0 1 −1

• We can now apply the dual simplex method to this new problem.
• Row 4 will be the pivot row since it has the most negative RHS and 𝑥2
will be the entering variable.
Dual Simplex Method (7/7)
Find optimal solution after adding constraint
• After performing ERO, the new tableau will become
B.V 𝒛 𝒙𝟏 𝒙𝟐 𝒙𝟑 𝐬𝟏 𝐬𝟐 𝐬𝟑 𝐬𝟒 RHS
𝑧 1 0 0 0 0 10 10 5 275
𝑠1 0 0 0 0 1 2 −8 −2 26
𝑥3 0 0 0 1 0 2 −4 −2 10
𝑥1 0 1 0 0 0 −1/2 3/4 5/4 3/4
𝑥2 0 0 1 0 0 0 0 −1 1

• Since there are no negative RHS and the optimality condition is met,
then we have reached the new optimal solution.
Economic Interpretation of the Dual
Problem
• From the Dakota dual problem, suppose we want to purchase all their
resources (lumber, finishing hour, and carpentry hour).
• When we purchase, we always want to minimize the cost. Hence the
objective function of the dual is a minimization problem.
• However, to induce Dakota to sell their resource, we must convince them
that selling their resource is more profitable than producing their products.
For example, the price for 8 board feet of lumber, 4 finishing hours, and 2
carpentry hours must be higher than the price of a desk which is sold at 60$
each. This is expressed in the first constraint of the dual
8𝑦1 + 4𝑦2 + 2𝑦3 ≥ 60
• In summary, when the primal is a normal max problem, the dual variables are
related to the value of the resources available to the decision maker. For this
reason, the dual variables are often referred to as resource shadow prices.
Shadow Prices
• The shadow price of the ith constraint is the amount by which the
optimal z-value is improved if we increase 𝑏𝑖 by 1 (from 𝑏𝑖 to 𝑏𝑖 + 1),
assuming the current basis remains optimal.
• By using the Dual Theorem, we can easily determine the shadow price
of the ith constraint. To illustrate, we use the Dakota problem again.
• Let 𝑐𝐵𝑉 𝐵 −1 = 0 10 10 , or 𝑦1 = 0, 𝑦2 = 10, 𝑦3 = 10. From its dual
problem we know that the resources cost is given by 48𝑦1 + 20𝑦2 + 8𝑦3.
• What happens when 𝑏2 is increased by 1 unit i.e. 𝑏2=21? Then the dual
objective function will be 48𝑦1 + 21𝑦2 + 8𝑦3 and
48𝑦1 + 21𝑦2 + 8𝑦3 − 48𝑦1 + 20𝑦2 + 8𝑦3 = 𝑦2
• Since 𝑦2 = 10, this means changing one unit of 𝑏2 will improve 10 unit of
the objective function.
Duality and Sensitivity Analysis (1/4)
• Duality can be used as an alternative way for the following types of
sensitivity analysis:
o Changing the objective function coefficient of a nonbasic variable
o Changing the column of a nonbasic variable
o Adding a new activity
• Primal optimality and dual feasibility are equivalent, so we see that the
above changes will leave the current basis optimal if and only if the
current dual solution 𝑐𝐵𝑉 𝐵−1 remains dual feasible.
Duality and Sensitivity Analysis (2/4)
Changing the objective function coefficient of NBV
Consider to Dakota problem again. The optimal solution was 𝑧 = 280, 𝑠1 =
24, 𝑥3 = 8, 𝑥1 = 2, 𝑥2 = 𝑠2 = 𝑠3 = 0 and the optimal dual solution was 𝑦1 = 0, 𝑦2 =
10, 𝑦3 = 10.
Let 𝑐2 be the coefficient of 𝑥2 in the objective function. For what values of 𝑐2 will
the current basis remain optimal? Note that if 𝑥2 is changed then the second
dual constraint will also change while the other remains unchanged. The
second dual constraint is
6𝑦1 + 2𝑦2 + 1.5𝑦3 ≥ 𝑐2
If 𝑦1 = 0, 𝑦2 = 10, 𝑦3 = 10 satisfies the inequality then the dual feasibility (and
primal optimality) is maintained.
6(0) + 2(10) + 1.5(10) ≥ 𝑐2 or 𝑐2 ≤ 35
This shows that for 𝑐2 ≤ 35, the current basis remains optimal. Conversely, if 𝑐2 >
35, the current basis is no longer optimal.
Duality and Sensitivity Analysis (3/4)
Changing a Non-Basic Variable
Suppose we now 𝑐2 = 43, and each 𝑥2 (tables) requires 5 board feet of
lumber, 2 finishing hours, and 2 carpentry hours. The second dual
constraint is now
5𝑦1 + 2𝑦2 + 2𝑦3 ≥ 43

For 𝑦1 = 0, 𝑦2 = 10, 𝑦3 = 10 this dual constraint is not satisfied and the dual
feasibility (and primal optimality) is not maintained.
In terms of shadow price, will cost $40 but can be sold at $43. Dakota
can now increase their revenue by selling tables.
Thus, the current basis is no longer optimal, and 𝑥2 (tables) will be basic in
the new optimal solution.
Duality and Sensitivity Analysis (4/4)
Adding New Activity
Suppose Dakota is considering manufacturing footstools (𝑥4 ). A footstool
sells for $15 and uses 1 board foot of lumber, 1 finishing hour, and 1
carpentry hour. Does the current basis remain optimal?
The new dual constraint will be
𝑦1 + 𝑦2 + 𝑦3 ≥ 15

For 𝑦1 = 0, 𝑦2 = 10, 𝑦3 = 10 this dual constraint is satisfied and the dual


feasibility (and primal optimality) is maintained. From shadow price
perspective, footstool will cost 0 + 10 + 10 = $20 but will only sell at $15.
Thus, Dakota should not make footstools, and the current basis remains
optimal.

You might also like