Excel Sensitivity Explained
Excel Sensitivity Explained
Lecture Outline
Sensitivity Analysis
1
Steps in Modeling
STEP 1: Formulate
Problem Statement
Boxers and Briefs Example - Revisited
2
Algebraic
Formulation
Constraint Coefficients
• Constraints:
– Material: ( .4 x Boxers ) + ( .5 x Briefs ) <= 300 yards
– Labor: ( 1 x Boxers ) + ( 2 x Briefs ) <= 900 hrs
– Demand: ( 0 x Boxers ) + ( 1 x Briefs ) <= 375 units
– Logos: ( 1 x Boxers ) + ( 0 x Briefs ) <= 600
– Non-Negativity:
Boxers >= 0
Briefs >= 0 Constraints Right Hand Sides (RHS)
6
3
Graphical
Formulation
E
500 E 600 120 $2,340.00
D Optimum
400 F 600 0 $1,800.00
Demand
300 A
200
C Material
100
B
100 200 300 400 500 600 700 800 900
Briefs
8
4
Excel
Formulation
10
5
Excel Tools for Sensitivity Analysis
• SolverTable
Pertains to changing
Objective Function
Coefficients
11
12
6
Steps in Modeling
STEP 1: Formulate
13
14
7
Excel Answer Report - Revisited
Boxers and Briefs Example: Profit Maximization
Optimum
Objective
Function Value
Optimum
Product Mix
Status of the
Constraints
16
8
Steps in Modeling
STEP 1: Formulate
17
Answer Report
The Answer Report also shows us which constraints are binding and non-
binding at the optimum. “Slack” indicates the spare capacity on a non-binding
constraint at the optimum.
– Slack = 0 implies constraint is binding: resources are exhausted
– Slack ≠ 0 implies constraint is non-binding: there are left-over resources
We can see below, for instance, that:
– getting additional logos
wouldn’t help us improve profit
since we already have 100
unused logos at the optimum
– advertising our briefs to
stimulate demand (at the
current price) would be
money wasted, since demand
for briefs is already greater
than the number of briefs we
should produce at the
optimum.
– material and labor constraints
are cramping our profit. 18
9
Slack and Binding
• Binding constraints
– Optimal solution lies on binding constraints
– Multiple binding constraints means solution is at intersection of
constraints: a vertex
19
Pertain to
Objective
Function
Coefficient
Ranging
Pertain to
Right Hand Side
(RHS) Ranging
on Constraints 20
10
Excel Sensitivity Analysis Report
21
Sensitivity Analysis
Changing a Decision Variable
Co-Efficient in a Constraint
Graphical Intuitions
The Sensitivity Report doesn’t tell us anything about what happens when the
coefficients of a decision variable in a constraint change, but here are some
graphical intuitions…
900 900
Hours Assume we Hours
800 changed the amount 800
700
of material required 700
per brief from 0.5 Logos
Logos yards to 1 yard.
600 600
Boxers
100 200 300 400 500 600 100 200 300 400 500 600
Briefs Briefs 22
11
Sensitivity Analysis Report
Changing the Right Hand Side (RHS)
of a Constraint
Graphical Intuitions
Changing the RHS of a constraint causes the constraint line to shift left or right,
but does not alter the slope of the line !
900 900
Hours Assume an extra Hours
800 Demand 100 yards of 800 Demand
700
material became 700
Logos available (increasing Logos
600 our total available to 600
Boxers
Boxers
500 how the material 500 Material
constraint shifts
400 right. The change is 400
100 200 300 400 500 600 100 200 300 400 500 600
Briefs Briefs 23
Sensitivity Analysis
Changing the Right Hand Side (RHS)
of a Constraint
The Shadow Price
From the previous slide, we saw that the original optimal vertex was:
“at the intersection of the materials and hours constraints”.
However, when we increased the RHS of the materials constraint beyond the
maximum ‘allowable increase’ (i.e. by 100 yards), the optimal vertex shifts to:
“at the intersection of the logos and hours constraints”.
Had the change in materials been within the allowable increase, then the
optimal vertex would have stayed the same (i.e. it would still have been “at the
intersection of the materials and hours constraints) but the optimal product
mix and the optimal solution value would have changed.
24
12
Sensitivity Analysis
Changing the Right Hand Side (RHS)
of a Constraint
Graphical Intuitions
Changing the RHS of a constraint causes the constraint line to shift to a
parallel position to the left or right, but does not alter the slope of the line !
900
Assume a extra 100 hours of labor Hours
became available (increasing our 800 Demand
total available to 1000 hours). 700
Notice how the labor constraint
shifts right, and the optimal Logos
600
solution value and optimal
Boxers
product mix change. 500
400
However, the change is less than
the ‘allowable increase’ for this 300
constraint and the optimum Material
solution vertex stays the same: 200
the optimal solution is still at the 100
intersection of the materials and
labor hours constraints .
100 200 300 400 500 600
Briefs 25
Sensitivity Analysis
Changing the Right Hand Side (RHS)
of a Constraint
• Tighten constraint: make feasible region smaller.
– Optimal value can only get worse (fewer choices)
• Assume b is a positive number and the constraint line has the form
y = ax + b (i.e. y – ax = b) then increasing the RHS (i.e. b) will cause the
line to shift vertically up and will:
– Tighten the constraint if it’s a lower-bound constraint
– Loosen the constraint if its an upper-bound constraint
So notice that increasing the RHS may have positive or negative effects
on the optimum, depending on the type of constraint !
• In contrast, if b is a positive number and the constraint line has the form
y = ax – b (i.e. ax – y = b) then increasing the RHS (i.e. b) will cause the
line to shift vertically down !
26
13
Sensitivity Analysis Report
Changing the Right Hand Side (RHS)
of a Constraint
The Shadow Price
The Shadow Price for a constraint is the change in the optimal objective
function value per unit increase in the Right Hand Side (RHS) of a given
constraint.
The Shadow Price only remains valid within the Allowable Increase and
Decrease shown for that Shadow Price.
27
Shadow Prices
Example
14
Shadow Prices
Example
E Demand
500
D
D 500 200 $2,400.00
400 E 600 120 $2,340.00
G F 600 0 $1,800.00
300 A
G 333.3 333.3 $2,500.00
200
C
100
B Material
100 200 300 400 500 600 700 800 900
Briefs
30
15
Shadow Prices
Example
How much would you pay for one additional insignia logo?
• Shadow price
– Shadow price = marginal change to objective function value of
increasing constraint RHS by 1 unit
– Scaling issues: changing one model unit
(e.g. model may be in millions of units …)
16
Shadow Price / RHS Ranging
33
34
17
Allowable Increase / Decrease
for the RHS of a Constraint
35
36
18
Shadow Price in
Maximization vs Minimization Problems
37
38
19
Shadow Prices in a Minimization Problem
Sodium was an upper bound constraint. It has a negative shadow price:
increasing the RHS of the sodium constraint would loosen the constraint
and allow us to achieve a better optimum: i.e. a lower meal cost.
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$D$21 TOTAL Protein 80.7 0.00000E+00 55 25.70794559 1E+30
$E$21 TOTAL Fat 52.5 0.00000E+00 54.7 1E+30 2.242552634
$F$21 TOTAL Sodium 3000 -2.98066E-04 3000 80.04881803 864.3523347
$G$21 TOTAL VitaminA 100 1.57422E-02 100 79.62482802 42.4869867
$H$21 TOTAL VitaminC 100 6.80000E-03 100 1E+30 38.07812436
$I$21 TOTAL VitaminB1 138 0.00000E+00 100 38.48083748 1E+30
$J$21 TOTAL VitaminB2 116 0.00000E+00 100 16.44004464 1E+30
$K$21 TOTAL Niacin 124 0.00000E+00 100 24.04707449 1E+30
$L$21 TOTAL Calcium 100 1.38042E-02 100 78.48290598 13.19677205
$M$21 TOTAL Iron 100 3.38561E-02 100 28.82593 8.011547469
39
40
20
Sensitivity Analysis Report
Changing an Objective Function Coefficient
Graphical Intuitions
Boxers
the optimal vertex will change, and the optimal 500
product mix will change, as illustrated to the
right. At right we see the relative contribution 400
of briefs (i.e. the coefficient of ‘briefs’ in the 300
objective function) increasing, causing the Material
objective function to become steeper, until 200
eventually (beyond the allowable increase) the 100
optimal product mix and optimal vertex shift.
The new optimal solution favors more briefs in 100 200 300 400 500 600
the optimal product mix. Briefs 41
Multiple Optima
Notice that, for a certain combination of
objective function coefficients, the objective
900
function can becomes tangent to a segment Hours
of a constraint line (in this case, to a segment 800 Demand
of the Hours constraint). In this case, every 700
point along the tangential line segment is an Logos
optimum, so multiple optimal product mixes 600
Boxers
21
Summary
Changing a Decision Variable
Co-Efficient in the Objective Function
43
Summary
Changing a Decision Variable
Co-Efficient in the Objective Function
22
Changing a Decision Variable
Co-Efficient in the Objective Function
Example
23
Reduced Cost
47
24
Reduced Costs
Example
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$B$11 Production Boxers 500 $0.00 3 0.6 0.3
$C$11 Production Padded 0 ($1.00) 6 1 1E+30
$D$11 Production Briefs 200 $0.00 4.5 1.5 0.75
49
Amended Model
To Demonstrate Reduced Cost
• Objective function:
– Maximize ( $10.00 x Boxers ) + ( $1 x Briefs )
• Constraints:
– Material: ( 1 x Boxers ) + ( 0.5 x Briefs ) ≤ 300 yards
– Logos: ( 1 x Boxers ) + ( 0 x Briefs ) ≤ 600 logos
– Labor: ( 1 x Boxers ) + ( 2 x Briefs ) ≤ 900 hrs
– Demand: ( 0 x Boxers ) + ( 1 x Briefs ) ≤ 375 units
– Boxers ≥ 0 Briefs ≥ 0
50
25
Reduced Cost
Example
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$E$6 Material 300 10 300 300 300
$E$7 Logos 300 0 600 1E+30 300
$E$8 Labor 300 0 900 1E+30 600
$E$9 Demand 0 0 375 1E+30 375
Now, the President comes to visit Penn, but he has forgotten his
briefs … so we must manufacture at least one pair. What is the
penalty? … Think carefully …
51
Reduced Cost
Example (Amended Model)
– Maximize: ( $10.00 x Boxers ) + ( $1 x Briefs )
– Material: ( 1 x Boxers ) + ( 0.5 x Briefs ) ≤ 300 yards
Adjustable Cells
Final Reduced Objective Allowable Allowable
Cell Name Value Cost Coefficient Increase Decrease
$C$3 Decision Variables Boxers 300 0 10 1E+30 7.999999955
$D$3 Decision Variables Briefs 0 -3.999999967 1.00000002 3.999999967 1E+30
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price
Only Binding
R.H. Side
Constraint
Increase Decrease
$E$6 Material 300 10 300 300 300
$E$7 Logos 300 0 600 1E+30 300
$E$8 Labor 300 0 900 1E+30 600
$E$9 Demand 0 0 375 1E+30 375
26
Multiple Optima
Reduced Cost in
Maximization vs Minimization Problems
• Reduced cost tells you the effect on the objective function value of forcing
a variable into the optimal solution. Forcing a variable into the optimal
solution always worsens the solution, irrespective of whether its a max or
min problem. However:
• a worse solution in a max problem involves a lower optimal value
(i.e. negative reduced cost)
• a worse solution in a min problem involves a higher optimal value
(i.e. positive reduced cost).
• This is why:
• max problems have negative reduced costs
• min problems have positive reduced costs
54
27
Changing Multiple Parameters Simultaneously:
The 100% Rule
55
• Remember:
– Change constraint functions, production mix changes
– Change objective function (within allowable increase /
decrease), production mix does not.
56
28
The 100% Rule
Example
If material decreases from 300 to 290 yards and labor increases from 900 to 1000
hours, what is the change in weekly contribution?
100 / 131.25 labor hours + 10 / 52.5 material
= 0.7619 + 0.1905 = 0.9524 < 1.0000
So, change in Objective Function Value =
($1/hr x 100 hrs) - ($5/yard x 10 yards) = $50
So, new Objective Function Value =
$2,450 (= $2,400 + $50)
100% Rule
Example: Pricing out a New Product
Constraints
Final Shadow Constraint Allowable Allowable
Cell Name Value Price R.H. Side Increase Decrease
$D$4 Yards_Material 300 5 300 15 52.5
$D$5 Logos 500 0 600 1E+30 100
$D$6 Hours_Labor 900 1 900 131.25 60
$D$7 Demand_Briefs 200 0 375 1E+30 175
29
SolverTable
SolverTable is an Excel Add-In that allows you to produce 2-way data tables
which look at the sensitivity of the optimum solution to changes in any 2
parameters.
Question:
How does SolverTable differ from a regular 2-way data table ?
Answer:
They’re pretty much the same, except:
• SolverTable reruns Excel Solver for each combination of parameter
values, whereas a regular 2-way data table could not do that.
• SolverTable does not auto-update – it merely pastes values. So
SolverTable would need to be rerun if other model parameters
(besides the 2 you are testing) change. In contrast, a regular 2-way
data table uses formulas, and the values of these formulas
automatically update as model parameters change.
59
SolverTable
– Getting it:
• Download it from
http://highered.mcgraw-hill.com/sites/0072493682/student_view0/cd_update__solver_table.html
– Installing It:
• Follow the instruction on the web-page above.
• Then open Excel and go to Tools | Add-Ins… | Solver Table Add-in
– Using it:
• Lay out your 2-way table, putting the formula to evaluate under the
different scenarios in the top left hand corner, like you would in a
regular 2-way data table.
• Go to Tools | SolverTable…
Warning: Because of the complexity of the 2-way data tables and SolverTables in the Boxers and
Briefs example spreadsheet, it could take you up to 20 minutes to run the scenario analysis. Press
Escape repeatedly at any time, or Ctrl+Break, if you wish to terminate the analysis.
60
30
SolverTable Example
Changing Multiple Decision Variables Coefficients in a Constraint
The example below shows the results of running SolverTable to investigate the effects
of changing per-unit labor requirements for boxers and briefs on the optimal solution. In
other words, it shows the effect of changing the coefficients of the decision variables in
the labor constraint. The top table shows the effect on the optimal solution value (i.e.
optimal profit in dollars). The bottom table shows the effect on the optimal product
mix. You can see that increasing the number of hours required per product type
(boxers or brief) decreases the amount of that product type in the optimal mix.
Effect on
Optimal
Solution Value
Effect on
Optimal Product
Mix
61
Key Points
31
Sensitivity Analysis Report
Summary
Optimal product mix Non-zero if the Allowable objective function
(Optimal decision variable is not coefficient range:
variable values) in the solution. Solution vertex stays the same.
Zero if it is.
Sensitivity Analysis
Why Should You Care ?
64
32