You are on page 1of 22

Lecture 7:

Sensitivity Analysis

Reading: Chapter 9

Sensitivity Analysis:
Answering the What If Questions
After you have solved a given LP and found an optimal
solution:
1. What is the eect of a change in one or more parameters on the optimal tableau? current solution?
2. If the solution is no longer optimal, what needs to
be done in order to nd a new optimal solution?
3. What happens when we add a new variable? a new
constraint?
4. What if we want to test changes in parameters over
a range of possible parameter values?

Problem Parameters and the Optimal


Tableau
Suppose we start with a canonical max form tableau
z
0
0
..
0
1

x1
a11
a21
..
am1
c1

x2
a12
a22
..
am2
c2

. . . xn
. . . a1n
. . . a2n
..
. . . amn
. . . cn

s1
1
0
..
0
0

s2 . . .
0 ...
1 ...
...
0 ...
0 ...

sm rhs
0 b1
0 b2
..
1 bm
0 0

and we pivot (using whatever method) to optimal tableau


basis
xB1
xB2
..
xBm
z

z
0
0
..
0
1

x1
a11
a21
..
am1
c1

x2 . . .
a12 . . .
a22 . . .
..
am2 . . .
c2 . . .

xn
a1n
a2n
..
amn
cn

s1
s11
s21
..
sm1
y1

s2
s12
s22
..
sm2
y2

. . . sm
. . . s1m
. . . s2m
..
. . . smm

. . . ym

rhs
b1
b2
..
bm
z0

with b 0 and c 0. We start by identifying the


basis matrix B = [AB1 , . . . , ABm ], the basic costs cB =
[cB1 , . . . , cBm ], the inverse matrix S = B 1, and the
dual variables y = cB S .

Example: Woodys Problem


Initial tableau
z x1 x 2 x 3
0
8 12 16
0
0 15 20
0
3
6
9
1 35 60 75

s1
1
0
0
0

s2
0
1
0
0

s3
0
0
1
0

rhs
120
60
48
0

Optimal tableau
basis
s2
x2
x1
z

z
0
0
0
1

x1
0
0
1
0

x2 x3
s1 s2 s3 rhs
0 10 15/4 1 10 30
1
2 1/4 0 2/3 2
0 1 1/2 0 1 12
0 10 5/2 0
5 540

We can read o from the the slack columns

15/4 1 10

1/4 0
2/3
S =

1/2 0 1

y = ( 5/2, 0, 5 )
and note that
cB = ( c5, c2, c1 ) = ( 0, 60, 35 )
4

The Key Equations


Recall the matrix equations describing the nal tableau
derived in Lecture 4:
b = S b

(1)

A = S A

(2)

c = c cB S A
= c y A

(3)

= c cB A

(3)

z0 = cB S b
= y b

(4)

= cB b

(4)

In formulae:
(1) bi = si1b1 + si2b2 + . . . + simbm

i = 1, . . . , m

(2) aij = si1a1j + si2a2j + . . . + simamj

i = 1, . . . , m, j = 1, . . . , n

(3) cj = cj y1a1j y2a2j . . . ym


amj

j = 1, . . . , n

(3)

= cj cB1 a1j cB2 a2j . . . cBm amj j = 1, . . . , n

(4) z0 = y1b1 + y2b2 + . . . + ym


bm

(4)

= cB1 b1 + cB2 b2 + . . . + cBm bm


5

Dual Variables as Shadow Prices


The dual variables serve an important role as a mechanism for pricing the parameters of the LP. In particular,
The dual variable for the ith constraint represents the shadow price for that constraint,
and is the amount the objective function value
will increase per unit increase of bi. That is,
yi = z/bi.
Example: Suppose Woody has the opportunity to buy
additional amounts of either mahogany or pine at
$2 per linear foot. Which (if any) of these opportunities should he take advantage of?
Answer: The shadow price of pine is 5/2, which means
that each additional unit of pine obtained will result
in an increase of the in Woodys prots by $2.50.
Thus buying pine at $2 per linear foot results in a
prot of $.50 for each additional linear foot purchased. Mahogany has $0 shadow price (why?).
Thus there is no change in the objective per additional units of pine, and so there is no price attractive enough to convince Woody to buy more
mahogany.
6

Changes in a Resource
Suppose we want to change the values of one or more bk
values.
Eect on the optimal tableau: bk only appears in
Equations (1) and (4), i.e. only the right-handside column (b and z0) is aected
Eect on the current solution: All basic solution
values, as well as the objective function value, may
change. Dual solution remains the same (although its objective function value may change).
Eect on feasibility: Primal solution may become infeasible. Dual solution remains dual
feasible.
Reoptimization method: Dual Simplex Method.

Example
Suppose Woody wants to change the amount of pine he
uses each day, that is, he is changing b1 currently
120 to an amount b1 + = 120 + .
New tableau and
solution values:

b
2 1 15/4 1 10 120 +
s

xB = x2 = b2 = 1/4 0 2/3 60

b3 1/2 0 1 48
x1

30 + 15/4

2 1/4

12 + 1/2

120 +

60 = 540 + 5/2
z0 = ( 5/2, 0, 5 )

48

In particular, for every four linear feet of pine Woody


buys, he will make two more chairs and one less
table (and still no desks), with an additional prot
of $10. There is a limit here, however; if, say, Woody
buys 12 more linear feet of pine the RHS values will
be 75, -1, and 18 (and z0 = 570). In this case,
we would have to reoptimize by performing a dual
simplex pivot in Row 2, in particular, with x4
replacing x2 in the basis.
8

Changes in Nonbasic Cost Coecients


Suppose that we want to change the costs ck for one or
more variables that are nonbasic in the optimal
tableau.
Eect on the optimal tableau: ck only appears
in the Equation (3) and only for j = k, i.e. only
the entry ck is aected.
Eect on the current solution: Primal and dual
solution values and objective function value remain
the same.
Eect on feasibility: Primal solution remains feasible, but dual solution may become infeasible.
Reoptimization method: Primal Simplex Method

Example
Suppose that Woody wants to change the price for desks
so that the current value of c3 = 75 changes to an
amount 75 + .
New value of c3 :

16

c3 = (75 + ) ( 5/2, 0, 5 ) 20 = 10 +

Reduced costs and ranging for optimality:


The reduced cost of any nonbasic variable in the optimal tableau represents the minimum increase
allowed for the prot of that variable before it enters
the basis. (For a min problem, this represents the
minimum decrease in that cost.) Any less than
that increase will not aect the optimal solution for
either the primal or dual problem.
In our example, if the prots for desks stays below
75 + = $85 then there will be no change in the
optimal solution values for the problem. If prots
for desks exceed $85 then a pivot would be called for
in column 3, with desks (x3) replacing chairs (x2)
in the basis.
10

Changes in Basic Cost Coecients


Suppose we want to analyze a change in the cost ck of
a basic variable in the optimal tableau.
Eect on the optimal tableau: ck appears in Equation (3) and (4), and aects the entire objective
function row (z0 and all cj )
Eect on the current solution: Primal solution
remains the same (although its objective function
may change) and dual solution values may change.
Eect on feasibility: Primal solution remains feasible, dual solution may become infeasible.
Reoptimization method: primal simplex method

11

Example
Suppose that Woody wants to analyze a change in the
price of chairs from its current value of c1 = 35 to
an amount 35 + .
(Negative of the) new tableau values: Using (3),
(4) with cB = (c5, c2, c1) = (0, 60, 35 + ) we get
c = ( 35 + , 60, 75, 0, 0, 0 )

0 0 10 15/4 1 10

2 1/4 0 2/3
( 0, 60, 35 + ) 0 1

1 0 1 1/2 0 1
= ( 0, 0, 10 + , 5/2 1/2, 0, 5 + )

30

z0 = ( 0, 60, 35 + ) 2

12
= 540 + 12.

Thus if c1 increases by = 5 the optimal solution value would not change, although its objective
function now becomes 600, and the dual solution
becomes y = (5, 0, 0). If prots decrease by, say,
= 10, though, then c4 becomes 5 (corresponding tableau value is 5) and so x4 enters the basis,
replacing x5.
12

Changes in Nonbasic Production Coecients


Suppose we want to analyze a change in the value akl
of a nonbasic variable in the optimal tableau.
Eect on the optimal tableau: akl appears in Equations (2) and (3), and aects all values in Column l (and nothing else).
Eect on the current solution: Primal and dual
solution values and objective function value remain
the same.
Eect on feasibility: Primal solution remains feasible, but dual solution may become infeasible.
Reoptimization method: Primal Simplex Method

13

Example
Suppose that Woody wants to decrease the number of
carpenter-hours spent on making desks from its current value of a33 = 9 to value a33 = 9 , to
see when it becomes protable to make desks.
New tableau values:

16
10
+
10
a

15/4
1
10

13

20
2

2/3
2/3
=

23 = 1/4 0

1 +

a33
1/2 0 1 9

16

20 = 10 + 5
c3 = 75 ( 5/2, 0, 5 )

Value at which Woody would start making


desks: Since the only change in the objective row
occurs at c3, then the tableau and hence current
solution will remain optimal as long as
c3 = 10 5 remains nonnegative.
In this case we need 10 5 < 0, i.e. > 2 (a33 < 7)
before it becomes preferable to pivot on Column 3,
that is, make desks. We would then make primal
simplex method pivot to reoptimize.
14

Adding a Variable
Suppose Woody wants to consider producing executive
desks, with each executive desk requiring 12 linear feet of
pine, 30 linear feet of mahogany, and 15 carpenter-hours,
with a prot of $175.
Eect on the optimal tableau: A new column (using
x4 = number of executive desks) is added, using Equations (2) and (3), as if the Revised Simplex Method
were being applied. Remaining values remain unchanged.
Eect on the current solution: Solution value and objective function value remain the same.
New tableau
values:

14
a
15/4 1 10 12
75

2/3
7
24 = 1/4 0
30 =

a34
1/2 0 1 15
9

12

c4 = 175 ( 5/2, 0, 5 ) 30 = 70

15
c4 = 70, so Woody should produce executive desks.
Reoptimization Method: Primal Simplex Method.
In this case the rst pivot would be in Row 2, that is,
Woody would replace table production with executive
desk production.

15

Changes in Basic Production Coecients


Suppose we want to analyze a change in the value akl
of a basic variable xl = xBr in the optimal tableau.
Eect on the optimal tableau: Again, akl appears
in Equations (2) and (3), and aects values in Column l. Unfortunately, Column l is a basic column, and hence the resulting tableau may stop
being basic.
Remedy: After substituting in the new column values, we pivot on the (r, l)th entry. The tableau
then becomes basic again, but all tableau entries can change. Tableau can become primal
infeasible, dual infeasible, or both.
Method of reoptimization: Depends upon tableau
status. If the tableau happens to remain primal
feasible apply the Phase II Simplex Method;
if the tableau happens to remain dual feasible apply the Dual Simplex Method. If it becomes
both primal and dual infeasible, then we would have
to apply some Phase I method.

16

Example
Suppose that Woody wants to analyze a change
in the amount of carpenter-hours spent on making
chairs (a31) from 3 to 2. Then the values in Column
1 become

a11

a21 =

a31

10
15/4 1 10 8

1/4 0 2/3 0 = 2/3

2
1/2 0 1 2

c1 = 35 ( 5/2, 0, 5 ) 0 = 5

We replace Column 1 by the above values, and then


pivot on entry (3, 1), to get new tableau
basis
s2
x2
x1
z

z
0
0
0
1

x1
0
0
1
0

x2
x3
s1 s2
s3 rhs
0 5
5/4 1 5 30
1 5/3 1/12 0 1/3 6
0 1/2
1/4 0 1/2 6
0 15/2 15/4 0 5/2 570

In this case the tableau remains dual feasible, and


so we apply the dual simplex method to reoptimize,
pivoting on entry (1, 6). This again produces an
optimal tableau.
17

Adding a Constraint
Suppose we want to add a constraint of the type
am+1,1x1 + am+1,2x2 + . . . + am+1,nxn bm+1

1. Enter the corresponding equality constraint (including the slack variable) into the current tableau as the
(m + 1)st row.
2. Cost out the current basis by subtracting
am+1,Bi (Row i) from Row (m + 1). Equivalently,
use the formulae
Am+1, = Am+1 Am+1,B A
Sm+1, =
Am+1,B S
bm+1 = bm+1 Am+1,B b
where Am+1,B = (Am+1,B1 , . . . , Am+1,Bm ).
3. If bm+1 < 0, continue to apply the Dual Simplex
Method to reoptimize.

18

Example
Woody wants to limit himself to 10 pieces of furniture
each day, that is, he wants to add the constraint
x1 + x2 + x3 10
to his tableau. He can add this row directly to the
tableau and cost out the basic variables, or use the formulae:
A4, = A4 (A45, A42, A41)A

0 0 10

0 1
2
= ( 1, 1, 1 ) ( 0, 1, 1 )

1 0 1
= ( 0, 0, 0 )

S4, = (A45, A42, A41)S

15/4 1 10

= ( 0, 1, 1 ) 1/4 0 2/3

1/2 0 1
= ( 1/4, 0, 1/3 )

30
b4 = 10 ( 0, 1, 1 ) 2 = 4.

12

19

This gives the following tableau:


basis
s2
x2
x1
s4
z

z
0
0
0
0
1

x1
0
0
1
0
0

x2 x3
s1 s2 s3 s4
0 10 15/4 1 10 0
1
2 1/4 0 2/3 0
0 1 1/2 0 1 0
0
0 1/4 0 1/3 1
0 10 5/2 0
5 0

rhs
30
2
12
4
540

Two dual simplex pivots produce optimal tableau


basis
x3
x2
x1
s1
z

z
0
0
0
0
1

x1
0
0
1
0
0

x2
0
1
0
0
0

x3
1
0
0
0
0

s1 s2
s3
s4 rhs
0 1/10 1/2 3/2 3
0 1/5 2/3 2
0
0 1/10 1/6 1/2 7
1
0
4/3 4 16
0
1
10/3 25 470

so that Woody should produce 7 chairs and 3 desks.

20

Other Types of Inequalities


constraints: Negate the constraint and treat it as
a constraint.
Equality constraints: Add this constraint just as
you would a constraint, but without the slack
variable. Then do a dual simplex pivot on the
added row (ignore the sign of the RHS) to determine
a basic variable for that tableau. Then continue
with the Dual Simplex Method.
Example: Suppose Woody wanted to make exactly
10 pieces of furniture. The initial tableau will look
like
basis z x1 x2 x3
s1 s2 s3 rhs
s2 0 0 0 10 15/4 1 10 30
x2 0 0 1
2 1/4 0 2/3 2
x1 0 1 0 1
1/2 0 1 12
? 0 0 0
0 1/4 0 1/3 4
z 1 0 0 10
5/2 0
5 540
Pivot on the s1 column to put s1 into the basis in
Row 4. One more pivot gives the same optimal
tableau and solution as in the case, only without
the s4 column.
21

Summary of Sensitivity Analysis


parameter
changed

relevant
equation(s)

parts of tableau
aected

method of
reoptimization

bi

(1) & (4)

entire r.h.s. column

dual simplex

nonbasic cj

(3)

a0j only

primal simplex

basic cj

(3) & (4) entire objective row primal simplex

nonbasic aij

(2) & (3)

entire j th column

primal simplex

basic aij

(2) & (3)


+ pivot

all entries

(depends upon
type of tableau)

added column

(2) & (3)

new column

primal simplex

added constraint

cost out

new row

dual simplex

22