Duality and Sensitivity Analysis
Duality and Sensitivity Analysis
• Let us multiply the first constraint by 6 to get 6X1 + 6X2 30. The optimum solution has to be feasible
(X1, X2 0) and therefore should satisfy 6X1 + 6X2 30.
• Since 6X1 + 5X2 6X1 + 6X2 30 for X1, X2 0, the upper estimate of Z* is 30.
• Let us multiply the first constraint by 1 and second constraint by 2 and add them to get 7X1 + 5X2 29.
• The optimum solution has to be feasible (X1, X2 0) and therefore should satisfy 7X1 + 5X2 29.
• Since 6X1 + 5X2 7X1 + 5X2 29 for X1, X2 0, the upper estimate of Z* is 29.
• From the above arguments we understand that if we multiply the
• first constraint by a non negative quantity a and
• the second constraint by a non negative quantity b and
• add them such that the resultant constraint has all coefficients more than that in
the objective function, then the right hand side value is an upper bound to Z*.
• This is under the assumption that the constraints are of the type.
• The lowest value that can be achieved will have a certain value of a and b, if
such a value exists. Let such values of a and b be Y1 and Y2.
• For every Y1 and 3Y2 satisfying (3.3) to (3.5) W = 5Y1 + 12Y2 is an upper
estimate of Z*.
• The lowest value W can take is given by the Linear Programming problem
(P2)
Minimize W = 5Y1 + 12Y2
Subject to
Y1 + 3Y2 6 (3.3)
Y1 + 2Y2 5 (3.4)
Y1, Y2 0 (3.5)
• Problem P2 is called the dual of the given problem P1. The given problem is
called the Primal.
All the constraints are written as constraints by multiplying them with –1.
Making theses changes we get
Maximize - 8X1 - 5X4+ 5X5 + 4X6
Subject to
4X1 + 2X4 – 2X5 - 8X6 12
- 4X1 - 2X4 + 2X5 + 8X6 -12
- 7X1 - 5X4 + 5X5 + 6X6 -9
8X1 + 5X4 – 5X5 - 4X6 10
- 3X1 - 7X4 + 7X5 + 9X6 -7
X1, X4, X5, X6 0
• Now the primal is converted to the standard form for which we
can write the dual. Introducing variables Y1 to Y5 for each of the
constraints we write the dual as:
Y6 unrestricted in sign.
Result 3.1
In any LPP, the dual of the dual is the Primal itself
We also observe the following based on our
examples
Primal Dual
1. Maximization Minimization
2. Minimization Maximization
3. Number of variables (n) Number of constraints (n)
4. Number of constraints (m) Number of variables (m)
5. RHS (b) Objective function coefficients (cj)
6. Objection function coefficients(cj) RHS (b)
7. Constraint coefficients (A) Constraint coefficients (AT)
If the primal is a maximization problem, the dual is a minimization problem and vice
versa.
We have as many variables in the dual as the number of constraints in the primal
and vice versa.
The RHS of the primal become the objective function coefficients of the dual and
vice versa.
There is also a relationship between the types of variables (of the primal) and
the type of constraint (of the dual) and vice versa.
If the primal is a minimization problem as has third constraint as type (say), then
the third variable of the dual is of the type.
Primal- Dual Relationships
The dual is
Minimize W = 5Y1 + 12Y2
Subject to
Y1 + 3Y2 – v1 = 6
Y1 + 2Y2 – v2 = 5
Y1, Y2, v1, v2 0
• Similarly since Y1 and Y2 are basic variables of the dual at the optimum, we
verify that u1 and u2 are non basic with value zero.
• In fact, we can evaluate the optimum solution to the dual if the optimum
solution to the primal is known and vice versa.
• From the optimum solution X1* = 6, X2* = 6, u3* = 6 Z* = 42, we observe that
variables Y1 and Y2 are basic at the optimum to the dual (because slack variables
u1 and u2 are non basic at the optimum to the primal).
• Also variable Y3 is non basic at the optimum to the dual because u3 is basic to the
primal at the optimum.
• It is enough now to solve for Y1 + 2Y2 = 3 and Y1 + 3Y2 = 4. This gives us Y1* =
1, Y2* = 1 W* = 42.
The value of the dual variable at the optimum is the rate of change of objective function for a
small change in the value of the resource.
It can be viewed as the change in the objective function for a unit change of the resource at
the optimum (assuming that the change is not significant enough to change the set of basic
variable themselves).
Economic Interpretation of the dual
• From the previous discussion we know that the objective function increases by 3 for
a unit increase in the first resource.
• If we have to buy the resource we will be willing to pay a maximum of Rs 3 for the
unit increase.
• Otherwise we will end up making a loss and it will not be profitable considering the
purchase of the extra resource
• The value of the dual variable is the marginal value of the corresponding resource
at the optimum
• We have defined the primal earlier as the problem of the carpenter who makes
tables and chairs.
• Now the dual is the problem faced by the person who is assumed to be selling the
resources to the carpenter.
• If the person sells the extra resource for a price less than Rs 3, the carpenter will buy
and make more profit than what the problem allows him to make (which the seller
would not want)
• On the other hand if the seller charges more than Rs 3, the carpenter will not buy
the resource and the seller cannot make money and profit.
• So both the carpenter and the seller will agree for Rs 3 (in a competitive
environment) and each will make their money and the associated profit.
Let us consider problem P4
Maximize 3X1 + 4X2
Subject to X1 + X2 12
2X1 + 3X2 30
X1 + 4X2 36
X 1, X 2 0
We know that the optimal solution to the primal is X1* = 6, X2* = 6, u3* = 6 Z* = 42
We know that the optimal solution to the dual is Y1* = 1, Y2* = 1 W* = 42
If we add a small to the third resource and solve the resultant problem assuming X 1, X2 and u3
as basic variables, we realize that the solution does not change and the optimum value of Z
remains at 42.
This means that the marginal value of the third resource at the optimum is zero. This is because
the resource is not completely used at the optimum.
The fact that u3 = 6 at the optimum means that only 30 units out of 36 is only consumed and a
balance of 6 units is available.
Therefore the person will not want to buy extra resources at extra cost because the resource is
already available.
Therefore the marginal value of the resource is zero. When a slack variable is in the basis, the
corresponding dual decision variable is non basic indicating that the marginal value of the
corresponding dual variable is zero.
Simplex method solves both the primal and the dual
Maximize Z = 6X1 + 5X2
Subject to
X1 + X 2 < 5 (3.1)
3X1 + 2X2 12 (3.2)
X1, X2 0
The simplex table is shown in the usual notation in following Table
6 5 0 0
X1 X2 u1 u2 RHS
0 u1 1 1 1 0 5 5
0 u2 3 2 0 1 12 4
Cj - Zj 6 5 0 0 0
Simplex method solves both the primal and the dual …..
6 5 0 0
X1 X2 u1 u2 RHS
0 u1 0 1/3 1 -1/3 1 3
6 X1 1 2/3 0 1/3 4 6
Cj - Zj 0 1 0 -2 24
5 X2 0 1 3 -1 3
6 X1 1 0 -2 1 2
Cj - Zj 0 0 -3 -1 27
In the optimal tableau, let us observe the Cj – Zj values.
These are 0, 0, -3 and –1 for variables X1, X2, u1 and u2.
We also know (from complimentary slackness conditions) that there is a relationship
between Xj and vj and between uj and Yj.
Therefore
Y1* = 3, Y2* = 1, v1* = 0, v2* = 0. We also know from complimentary slackness
conditions that if Xj is basic then vj =0.
This is also true because when Xj is basic, Cj – Zj is zero.
When uj is non basic and has value zero, its Cj – Zj is negative at optimum indicating a
non negative value of the basic variable Yj.
The optimum solution to the dual can be read from the optimum tableau of the
primal in the simplex algorithm. We need not solve the dual explicitly.
Let us look at an intermediate iteration (say with basic variable u 1 and X1).
The basic feasible solution is u1 = 1, X1 = 4 with non basic variables X2 = 0 and u2 =0.
When we apply the above rule (and complimentary slackness conditions) we get the
corresponding dual solution to be Y1 =0, Y2 = 2, v1 = 0, v2 = -1 with W= 24 (same value of Z)
• This solution is infeasible to the dual because variable v2 takes a negative value.
• This means that the second dual constraint Y1 + 2Y2 5 is not feasible making v2 = -1.
• The value of v2 is the extent of infeasibility of the dual, which is the rate at which the
objective function can increase by entering the corresponding primal variable.
• A non optimal basic feasible solution to the primal results in an infeasible dual when
complimentary slackness conditions are applied.
• When the primal basic feasible solution is non optimal, the dual
will be infeasible and when the dual becomes feasible, the optimal
solution for both primal and dual is known.
The Dual Simplex algorithm
Consider the linear programming problem (P5) given by
Minimize 4X1 + 7X2
Subject to
2X1 + 3X2 5
X1 + 7X2 9
X1, X2 0
Normally we would have added two artificial variables a1 and a2 to get an initial basic feasible
solution.
We do not add these now but write the constraints as equations with slack variables only. The
equations are written with a negative RHS (something that the simplex method does not approve).
-4 -7 0 0
X1 X2 X3 X4 RHS
0 X3 -2 -3 1 0 -5
0 X4 -1 -7 0 1 -9
Cj - Zj -4 -7 0 0
4 1
This solution is infeasible because both the basic variables have negative
sign. However, it satisfies the optimality condition because all Cj – Zj are 0.
To get the optimal solution, we have to make the basic variables feasible.
We first decide on the leaving variable (most negative) and choose
variable X4.
This row becomes the pivot row.
In order that we have feasibility, we should get a non negative value in the
next iteration. This is possible only when the pivot is negative.
-4 -7 0 0
X1 X2 X3 X4 RHS
0 X3 -2 -3 1 0 -5
0 X4 -1 -7 0 1 -9
Cj - Zj -4 -7
4 7/4
-4 -7 0 0
X1 X2 X3 X4 RHS
-4 X1 1 0 -7/11 3/11 8/11
-7 X2 0 1 1/11 -2/11 13/11
Cj - Zj 0 0 -21/11 -2/11 123/11
Now, both the basic variables X1 and X2 are feasible. In this algorithm, right from the
first iteration the optimality condition is satisfied. We do not have a leaving variable.
The optimum solution has been reached.
• The above algorithm is called the dual simplex algorithm.
• When this is used to solve a minimization problem with all type constraints, the
optimality condition is satisfied all the time.
• The feasibility condition is not satisfied by the starting solution and after some
iterations, when the solution is feasible we say that the optimum solution is
reached.
• This is called dual simplex because at any iteration, the dual (of the problem that
we are solving) has a feasible solution and the moment we get a primal feasible
solution, the optimum is reached.
• In fact, for the above example, the moment we get a feasible solution to the primal
(RHS 0) we can terminate even without showing that the optimality condition is
satisfied.
Solving problems with mixed type of constraints
Consider the following problem (P5)
Maximize -X1 + 5X2
Subject to
2X1 – 3X2 1
X1 + X2 3
X1, X2 0
We solve this problem without introducing artificial variables. We rewrite the constraints as
- 2X1 + 3X2 + X3 = 1
X1 + X2 + X4 = 3
The simplex table is set as shown in following Table with X3 and X4 as basic variables.
-1 5 0 0
X1 X2 X3 X4 RHS
0 X3 -2 3 1 0 -1 --
0 X4 1 1 0 1 3 2
Cj - Zj -1 5 0 0
We have a negative value for variable X3 as well as a positive value for Cj-Zj.
We can do a simplex iteration by entering variable X1 or do a dual simplex iteration considering
variable X3.
We choose the simplex iteration (When both are possible it is better to do the simplex iteration
first).
Variable X2 is the entering variable and replaces X4 (the only candidate for leaving variable).
In the next iteration we have
-1 5 0 0
X1 X2 X3 X4 RHS
0 X3 -5 0 1 -3 -10
5 X2 1 1 0 1 3
Cj - Zj -6 0 0 -5
6/5 5/3
-1 5 0 0
X1 X2 X3 X4 RHS
-1 X1 1 0 -1/5 3/5 2
5 X2 0 1 1/5 2/5 1
Cj - Zj 0 0 -6/5 -7/5 3
Here both the primal and dual are feasible. The optimal solution is
X1 = 2, X2 = 1, Z =3.
The optimal solution to the dual is Y1 = 6/5, Y2 = 7/5 W = 3
Consider another problem P6 given by
Maximize 7X1 – 3X2
Subject to
5X1 – 2X2 12
6X1 + 3X2 10
X1, X2 0
We solve this problem without introducing artificial variables. We rewrite the constraints as
- 5X1 + 2X2 + X3 = - 12
6X1 + 3X2 + X4 = 10
The simplex table is set as shown in the following Table with X3 and X4 as basic variables.
7 -3 0 0
X1 X2 X3 X4 RHS
0 X3 -5 2 1 0 -12 --
0 X4 6 3 0 1 10 5/3
Cj - Zj 7 -3 0 0
0 X3 0 9/2 1 5/6 -11/3
7 X1 1 1/2 0 1/6 5/3
7 -3 0 0
X1 X2 X3 X4 RHS
0 X3 -5 2 1 0 -12 --
0 X4 6 3 0 1 10 5/3
Cj - Zj 7 -3 0 0
Variable X1 is the entering variable and replaces X4 (the only candidate for leaving
variable). The simplex iteration (after the first iteration) is shown in the above Table
Now the primal is not feasible but the dual is.
We can only do a dual simplex iteration first leaving variable X3.
However, we do not find an entering variable because there is variable with
a negative coefficient in the pivot row.
This indicates infeasible solution
Matrix Representation of the Simplex method
• In the tabular form that we have been using, we compute (or store) a m
x n matrix of the constraint coefficients.
• Once the entering variable is known, we need to find the leaving variable.
• For this purpose we need to compute , for which we need the RHS values (m values) and the
column corresponding to the entering variable (m values).
• If the optimal solution is reached, we need to compute the value of the objective function.
• Therefore, in EACH iteration, we need only 3m values. Can we compute only these values
and get to the optimum or can we compute fewer than (m+1)(n+1) values per iteration?
• In the tabular form, we compute the values in iteration from the values of the previous iteration.
• Can we make these values dependent only on the problem data?
We answer these questions using the matrix representation of the simplex method.
The simplex method tries to identify the optimal set of basic variables.
Every iteration is characterized by the set of basic variables. Let us call this as XB.
The rest of the variables are non basic and take value zero. We solve for the set XB such
that
BXB = b,
where
b is the RHS of the given problem and
B is the matrix of the values corresponding to the basic variables.
If Pj is a column vector corresponding to variable Xj in the constraint matrix A, the B is a
sub matrix of A made of the Pj in XB.
From BXB = b
we have XB = B-1b (3.17)
Let us assume that in a given iteration Pj is the column corresponding to variable Xj.
Let us assume
Pj = B-1Pj (3.18)
(We shall prove equation 3.18 later)
We also have from 3.18
Cj - Zj = Cj - CB Pj = CB B-1Pj (3.19)
Sensitivity Analysis
Consider the linear programming problem
Maximize 4X1 + 3X2 + 5X3
Subject to
X1 + 2X2 + 3X3 9
2X1 + 3X2 + X3 12
X1, X2,X3 0
The simplex solution for this problem is
4 3 5 0 0
X1 X2 X3 X4 X5 RHS
0 X4 1 2 3 1 0 9 3
0 X5 2 3 1 0 1 12 12
Cj - Zj 4 3 5 0 0 0
4 3 5 0 0
X1 X2 X3 X4 X5 RHS
What happens to the solution if the values of the objective function coefficients
change?
However, here we iterate from the given optimal solution and evaluate the effect
of these changes.
Changes in values of objective function coefficients (Cj)
A value of C2 > 33/5 would make C2 – Z2 take a positive value resulting in variable
X2 entering the basis
Let us consider C2 = 7. This would make C2 – Z2 = 2/5 and the variable X2 enters
the basis.
4 7 5 0 0
X1 X2 X3 X4 X5 RHS
5 X3 0 1/5 1 2/5 -1/5 6/5 6
4 X1 1 7/5 0 -1/5 3/5 27/5 27/7
Cj - Zj 0 2/5 0 -6/5 -7/5 138/5
The optimum was found in one iteration starting from the modified optimum table.
Change in Cj value of a basic variable
Let us consider a change in the objective function coefficient of variable X1. Let us call it
C1. The change will affect all the non-basic Cj – Zj values.
We compute
C2 – Z2 = 3 – 1 – 7C1/5
C4 – Z4 = 0 – 2 + C1/5
C5 – Z5 = 0 + 1 – 3C1/5
For the present value of C1 = 4, the values are –18/5, -6/5 and –7/5. All the values are
negative.
4 3 5 0 0
X1 X2 X3 X4 X5 RHS
5 X3 0 1/5 1 2/5 -1/5 6/5
4 X1 1 7/5 0 -1/5 3/5 27/5
Cj - Zj 0 -18/5 0 -6/5 -7/5 138/5
We also observe that for C1 < 10/7, C2 – Z2 can become positive.
For C1>10, C4 – Z4 >0 and for C1 < 3/5, C5 – Z5 >0.
In the range 6/5 C1 10, the present set of basic variable will be
optimal.
Let us consider C1 = 12.
C2 – Z2 = C2 – y P2 = 3 – [12 x 7/5 + 1] = -74/5,
C4 – Z4 = -2 + 12/5 = 2/5 and
C5 – Z5 = 1 – 36/5 = -31/5.
Variable X4 enters the basis and we perform simplex iterations till it
reaches the optimum.
The modified optimum (for C1 = 12) and the final solutions are shown below
12 3 5 0 0
X1 X2 X3 X4 X5 RHS
5 X3 0 1/5 1 2/5 -1/5 6/5 3
12 X1 1 7/5 0 -1/5 3/5 27/5
Cj - Zj 0 -74/5 0 2/5 -31/5 354/5
0 X4 0 ½ 5/2 1 -1/2 3
12 X1 1 3/2 ½ 0 ½ 6
Cj - Zj 0 -15 -1 0 -6 72
Here also, the optimum was found within one iteration. The optimum solution now is
X1 = 12 and X4 = 3 with Z = 72
Changes in RHS values
Let us consider changes in RHS values. Let us consider changing the RHS of the first constraint. Let the value be b1. Due to this the RHS
values of the solution will change. This will become
RHS = B-1 b
We can read B-1 from the simplex table under the initial identity matrix for the chosen basic variables.
2 / 5 1 / 5 b1
/ 5
1 / 5 3and
B-1 = b=
12
2 / 5 1 / 5 b1 (2b1 12) / 5
RHS = =
1 / 5 3 / 5
12 (36 b1 ) / 5
As long as b1 is such that (2b1-12)/5 and (36-b1)/5 are 0, the variables X3 and X1 will be the basic variables at the optimum with values (2b 1-
12)/5 and (36-b1)/5 respectively.
This means that as long as 6 b1 36, variables X3 and X1 will be the basic variables at the optimum with values (2b 1-12)/5 and (36-b1)/5
respectively.
If b1 is outside this range then one of the variables X1 or X3 will become negative and will provide an infeasible solution.
For example , if b1 = 40, we get X3 = 68/5 and X1 = -4/5. In this case, we perform dual simplex iterations till the optimum is reached. This is
shown in Table 3.13 (next slide)
4 3 5 0 0
X1 X2 X3 X4 X5 RHS
6
4 X3 2 3 1 0 1 12
0 X4 -5 -7 0 1 -3 4
-4 -9 0 0 -4 48
Let us consider changes in the constraint coefficient of a non basic variable. Specifically we consider variable X 2 and its coefficient in the second constraint. Let the value be a. We have
P2 = 2
a
P2 = B-1 P2 and
C2 – Z2 = C2 - yP2.
From the simplex table the dual y = [6/5 7/5]
C2 – Z2 = 3 - [6/5 7/5] 2 – 7a/5 = 3/5 – 7a/5
= 3 - 12/5
a
If a is such that 3/5 – 7a/5 0, the present solution will be optimal. That is if a 3/7, the present solution is optimal. Let us consider the case when a = 0.
2 / 5 1 / 5 2 4 / 5
P2
a 2 / 5
= B P2 = =
1 / 5 3 / 5
-1
2
C2 – Z2 = 3 – [6/5 7/5]
= 3/5
a
P2
Variable X2 enters the basis. The values of and C2 –Z2 change. We perform simplex iterations till we reach the optimum.
4 3 5 0 0
X1 X2 X3 X4 X5 RHS
This is incorporated in the formulation by the introduction of a new variable X6. Let us
assume that this product requires 1 unit of resource 1 per product and 3 units of
resource 2 per product and fetches a profit of Rs 6/unit.
Variable X6 enters the basis. The modified optimum table incorporating changes in P’ 6
and C6 – Z6 is shown and the simplex iterations are shown in Table (next slide)
4 3 5 0 0 6
X1 X2 X3 X4 X5 X6 RHS
5 X3 0 1/5 1 2/5 -1/5 -1/5 6/5
4 X1 1 7/5 0 -1/5 3/5 8/5 27/5 27/8
If the constraint was X1 + X2 + X3 6, the present optimal solution violates the constraint. We rewrite
the constraint as an equation by adding a slack variable and write the basic variables in terms of the
non basic variables.
X1 + X2 + X3 + X6 = 8.
Substituting, we get
27/5 – 7/5 X2 + 1/5 X4 – 3/5 X5 + X2 + 6/5 – 1/5 X2 –2/5 X4 + 1/5 X5 + X6 = 6
-3/5 X2 –1/5 X4 –2/5 X5 + X6 = -3/5
(Please observe that if the constraint is binding, as in this case, the final equation after substitution
will have a negative value of the right hand side when the slack variable has a +1 coefficient). We
include this constraint into the optimal table and proceed with dual simplex iterations till the new
4 3 5 0 0 0
X1 X2 X3 X4 X5 X6 RHS
6 6 7/2