Beruflich Dokumente
Kultur Dokumente
Understanding Duality
Even though the emphasis of this book is to solve LP problems and understand to interpret
the solutions, we deviate from the main focus of applications to understand duality. We will
however retain the methodology of solving LPs to understand the concepts and applications.
We explain duality using an example.
In Illustration 1.1, we formulated and solved the LP problem to maximize the revenue for the
bakery. The problem is to
Illustration 1.18
We solve this LP using the solver. The final output is given in Table 1.16
374
32 >= 32
25 >= 25
4 >= 0
3 >= 0
Now considering the maximization problem (called P1) and the minimization problem (called
P2) we make the following observations:
1. P1 and P2 had the same value of the objective function at the optimum
2. The objective function coefficient coefficients of P1 are the RHS values of P2 and
vice versa.
3. The number of variables in P1 and the number of constraints in P2 are equal and vice
versa.
The obvious question is Is there a relationship between P1 and P2? The relationship is
established using the discussion that follows:
Therefore problem P2 is born out of P1. The problem P2 is called the dual of the given
problem P1 (called the primal).
1. Do the primal and dual have the same value of the objective function at the optimum?
Yes. If both have optimum solutions their objective function value is the same. This result is
called the main duality theorem. If the primal and dual have optimal solutions, the objective
function value at the optimum for both is the same.
2. Can we read the solution of the dual from the solution of the primal?
Yes. When the LP is written into the solver, we click options and click linear model and non
negative.
After we solve the LP, the solver dialogue box shows option for three reports. We can click
on them and press OK. The reports are available as active sheets. If we go to the sensitivity
report, we see a table under constraints. This part is shown in Table 1.17
The shadow prices against the two constraints are 4 and 3 respectively. These are the values
of Y1 and Y2 at the optimum. (We will see the relationship between the shadow prices and the
dual solution later).
4. Since the primal and dual have the same value of the objective function, how do we
define the dual variables?
The optimum solution to the dual is Y1 = 4 and Y2 =3 with W = 59 x 4 + 46 x 3 = 374. The
values Y1 = 4 and Y2 =3 represent the worth of the 59 units of the first resource and 46 units
of the second resource at the optimum. The dual solution represents the worth of the
resources at the optimum.
5. What is shadow price and why is it related to the resources (primal constraints)?
We have already seen that the dual solution represents the worth of one unit of each resource
at the optimum. Let us explain it further using an example. Here we increase the first resource
of the primal by 1 to 60.
Illustration 1.19
The optimum solution to the primal (using solver) is given in Table 1.18
obj fn 378
60 <= 60
46 <= 46
4 >= 0
10 >= 0
We continue to produce both the items but with different quantities. The objective function
value has increased by 4 to 378. This shows that if we can increase the RHS of the first
resource by 1, the profit increases by 4 (as long as we continue to produce the same products
as before). The worth of the additional resource at the optimum is the extent to which the
revenue goes up on increase of the resource. This is called the shadow price of the resource
at the optimum or the worth of an additional amount of the resource at the optimum or the
marginal value of the resource at the optimum. This is represented by the optimum solution
of the dual.
We restore the RHS of the first constraint to 59 and decrease the second resource by 1 to 45.
Illustration 1.20
Solve the LP - Maximize 32X1 + 25X2
Subject to
5 X1 4 X 2 59
4 X1 3 X 2 45
X1 , X 2 0 .
The optimum solution to the primal (using solver) is given in Table 1.19
obj fn 371
59 <= 59
45 <= 45
3 >= 0
11 >= 0
We continue to produce both the items but with different quantities. The objective function
value has decreased by 3 to 371. This shows that if we decrease the RHS of the first resource
by 1, the profit decreases by 3 (as long as we continue to produce the same products as
before). The worth of the additional resource at the optimum is the extent to which the
revenue decreases on decrease of the resource. This is called the shadow price of the
resource at the optimum. This is represented by the optimum solution of the dual.
Illustration 1.21
Consider the LP
Minimize 59Y1 + 46Y2 + 37Y3
Subject to
5Y1 4Y2 3Y3 32
4Y1 3Y2 8Y3 26
2Y1 5Y2 9Y3 60
3Y1 2Y2 3Y3 15
Y1 0, Y2unrestricted , Y3 0 .
Write the dual to this LP and solve the dual?
Using the information in Table 1.20 (treating the minimization problem as primal) we get the
dual as
obj 380
32 = 32
26 >= 26
6 <= 60
20 >= 15
8 >= 0
0 <= 0
We now solve the dual. The solution to the dual is given in Table 1.22
obj fn 380
59 <= 59
46 = 46
69 >= 37
6 >= 0
0 <= 0
0 >= 0
7. It was mentioned that the dual value for a resource is the increase in profit for unit
increase in the resource. If we increase the resource by a large value will the objective
function value increase at the rate of the dual?
Illustration 1.22
We know that the dual solution is Y1 =4, Y2 = 3. We have already seen that if the RHS of the
first constraint becomes 60, the solution to the primal is X1 =4, X2 = 10 with Z = 378.
When RHS = 62, the solution is X1 = 0, X2 = 15.333 with Z = 383.33. We observe that the
objective function has not increased by 12 when the RHS of the first constraint is increased
by 3.
When RHS = 61.3, the solution is X1 = 0.1, X2 = 15.2with Z = 383.2 We observe that the
objective function has increased by 9.2 when the RHS of the first constraint is increased by
3.2. The linear increase continues because we continue to produce X1 and X2.
As we keep increasing (decreasing) the value of the RHS (resource) the combination of
products made changes. At that point, the shadow price changes and the proportional increase
(decrease) in the objective function also changes.
8. Is the first dual variable related to the first constraint or the primal (resource)?
Yes. We have as many dual variables as the number of constraints in the primal. For every
primal constraint there is a dual variable. The dual variable represents the value of the
corresponsing resource at the optimum.
369.5
59 <= 59
44.5 <= 46
30 <= 30
The solution is given by X1 = 1, X2 = 13.5 and Z = 369.5. We store the sensitivity result for
this solution. Table 1.24 shows the sensitivity results.
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$B$2 X1 1 0 32 5.5 0.75
$C$2 X2 13.5 0 25 0.6 3.666666667
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$B$6 X1 59 5.5 59 3 1E+30
$B$7 X1 44.5 0 46 1E+30 1.5
$B$8 X1 30 1.499999999 30 3 1E+30
From the shadow prices, we find that the dual solution is Y1 = 5.5, Y2 = 0 and Y3 = 1.5 with
W = 59 x 5.5 + 30 x 1.5 = 369.5. We observe that the objective function value of the primal
and dual at the optimum is 369.5.
Here we observe that Y2 = 0 indicating that the value of the second dual variable is zero.
From Table 6.8 we observe that the primal optimal solution X1 = 1, X2 = 13.5 completely
utilizes resource 1 and 3 (in the primal) but uses only 44.5 out of the available 46 units of the
second resource. We also observe that Y2 (the dual variable corresponding to this resource) is
zero.
At the optimum, when the primal resource is utilized fully, the dual variable has a positive
value. When a resource is not utilized fully the corresponding dual variable is zero.
The dual variable is the marginal value of the resource at the optimum. It also represents the
price at which an additional resource can be bought at the optimum. It is obvious that when a
resource is not utilized fully, increasing it will not increase the revenue. Therefore the shadow
price or marginal value of such a resource is zero.
Illustration 1.24
Consider a small factory that makes two types of furniture tables and chairs. They use two
resources wood and steel. The amount of steel used per unit is 4 kg and 5 kg for a table and a
chair. The amount of wood required per table and chair is 6 and 5 kg. We have 60 kg of steel
and 80 kg of wood. The selling price of table and chair is Rs 80 and 70 respectively. Find the
number of tables and chairs to be made to maximize revenues.
Let X1 and X2 be the number of tables and chairs produced. The corresponding LP problem is
to Maximize 80X1 + 70X2
Subject to
4X1 + 5X2 60
6X1 + 5X2 80
X1, X2 0
Let Y1 and Y2 be the worth of 1 kg of steel and wood at the optimum. The worth of a table is
4Y1 + 6Y2 and the worth of a chair is 5Y1 + 5Y2. Now 4Y1 + 6Y2 should be 80 and 5Y1 +
5Y2 70 (The worth of a table should not be less than the selling price of 80; otherwise we
would not convert the raw material into products and sell them). If the value of the unit
resource represents the cost price of the resource (at the optimum), we would minimize the
cost price which is to minimize 60Y1 + 80Y2. The corresponding LP that determines the
value of the resources at the optimum is to
It is to be noted that expectedly, the total revenue is equal to the total worth of the resource at
the optimum.
In our example, we were able to convert 60 kg of steel and 80 kg of wood to 10 tables and 4
chairs having total revenue (worth) of Rs 1080. Let us solve the problem assuming that we
have 61 kg of steel and 80 kg of wood.
Illustration 1.26
Solve the problem in Illustration 1.24 considering 61 kg of steel and interpret the solution?
What happens if we wish to have 70 kg and 90 kg of steel?
The optimum solution is given by X1 = 9.5, X2 = 4.6 with revenue = 1082. We observe that a
unit increase of steel results in an increase of revenue of Rs 2. If we were to buy the extra
resource (at the optimum) from the market, its worth is Rs 2 because it can fetch us additional
revenue of Rs 2. This is the same as Y1 = 2 in example 2.
The value of Y1 is called the marginal value of resource 1 at the optimum which is the
additional worth of a unit of the resource.
The reader would observe that the optimum solution now has X1 = 9.5 and X2 = 4.6. The
reader can ask a question as to whether we can make and sell a fractional number of tables
and chairs. The answer is that we are solving LP problem that allows fractional values for the
variables. In fact the proportionality assumption makes us believe that 0.5 tables is worth Rs
40 just as half a kg of the first resource is worth Re 1 at the optimum!
Illustration 1.27
Consider the data in Illustration 1.24. In addition it is observed that it takes 8 hours to make a
table and 5 hours to make a chair. The company works 5 days a week and 16 hours a day.
Assume that the products have to be made in a week.
We have a third constraint which relates the time required to the time available. The problem
is to
The sensitivity report from the excel solver shows that the shadow prices are 8, 0 and 6 for
the three resources. The worth of the resources are 60 x 8 + 80 x 0 + 80 X 6 = 960 which is
equal to the revenue.
It is observed that the shadow price of resource 2 is zero. This is because this resource is not
fully consumed. Obviously the marginal value (cost) of this resource is zero because we need
not pay extra to buy a unit of this resource since it is available with us.
Shadow prices are positive for resources that are scarce (fully consumed). Shadow price is
zero when a resource is not fully consumed.
Does it mean that the wood used has no value? The answer is No. It is acceptable to say that
the marginal value (or the implied cost of procuring an extra kg) is zero since the resource is
available with us. When the shadow price is zero we should not assume that the worth is zero.
The 70 kg of wood consumed has a value which is not visible at the optimum. Only the
marginal value at the optimum has to be interpreted as zero. The total revenue of 960 is
distributed between the value of the other two resources at the optimum
Sensitivity Analysis
Sensitivity analysis deals with the sensitivity of the solution to an LP to changes in problem
parameters. The parameters that can change are:
In addition two more aspects are included in sensitivity analysis. These are
In the days when LPs were solved by hand or when solvers were not available freely, it was
necessary to compute the effect of the above changes from the optimal solution. Sensitivity
analysis methods essentially did that and obtained the optimum solution after the changes
from the given optimum. So long as the changes were not on the coefficients of the
constraints corresponding to the decision variables in the optimum solution, it is possible to
carry out sensitivity analysis from the present optimum solution.
Since we are using the excel solver, we do not emphasize much on sensitivity analysis
because it is possible to solve the problem from the beginning using the solver for every
change made. We need to make changes in the template and modify the constraints or the
objective in the solver.
Illustration 1.28
The observations in Table 1.25 are based on solving the LP problem at least ten times using
the solver. It is not a difficult task but one of the reports that can be obtained from the
solution to the original problem (sensitivity analysis report) gives all the above information.
After we solve the problem, we get a message keep solver solution and we can retain the
solver solution. On the right hand side we have the following three options:
1. Answer
2. Sensitivity
3. Limits
We can click on the Sensitivity and the solver creates a sheet called Sensitivity report 1.
The sheet looks as shown in Table 1.26
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$B$6 x1 59 4.000000003 59 2.333333332 1.5
$B$7 x1 46 2.999999996 46 1.2 1.749999999
The allowable increase and decrease for the coefficients in the objective function and for the
constraints can be read from Table 1.26. The shadow prices indicate the optimum solution to
the dual.
Thus the sensitivity analysis report provides certain basic information about the solution to
the dual. It also tells us the extent to which the solution is sensitive to changes in coefficients
in the objective function and to RHS values. The limiting values where there is a change in
the products made is known when the original problem is solved.
Illustration 1.29
Consider the data given in Illustration 1.24. The sensitivity analysis report given when the
problem is solved using Excel solver is reproduced in Table 1.27 Interpret the solver report to
explain the sensitivity of the LP parameters.
The table shows that the optimum solution to the given problem is X1 = 10, X2 = 4. The
shadow prices for the two resources are 2 and 12 respectively.
When the objective function coefficient for X1 can be increased to 84 and decreased to 56, we
will continue to produce both items. When this value goes out of this range, we will not
produce tables. Similarly when the revenue from chair is within 100 and 66.666, we will
produce chairs. When the revenue goes beyond these values, we will produce a different
combination of items.
When the availability of resource 1 is between 80 and 53.333, the revenue increase (or
decrease) will be at the rate of Rs 2 per kg. Similarly, till the availability of the second
resource is between 90 and 60, the increase or decrease in revenue will be Rs 12 for unit
increase or decrease of the resource.
What happens when the objective function coefficients are 50 and 50 and the availability of
resources is 60 and 50? The optimum solution to the LP is X2 = 10 and revenue = 500. The
problem becomes a new LP which is quite unrelated to the old LP that we are solving. It only
shows that some linear relationships among the variables are not valid at the new values.