Excel Sensitivity Analysis
Excel Sensitivity Analysis
Lecture Outline
Sensitivity Analysis
Effects on the Objective Function Value (OFV):
Changing the Values of Decision Variables
Looking at the Variation in OFV:
Excel One- and Two-Way Data Tables, and Scenario Manager
Finding the Optimum OFV: Excel Solver
Effects on the Optimum:
Making One Change to the Model Parameters:
Changing a Decision Variable Coefficient in a Constraint
(Graphical intuitions)
Changing the Right Hand Side (RHS) of a Constraint:
Slack & Shadow Price
Changing a Decision Variable Coefficient in the Objective Function:
Reduced Cost
Making Multiple Changes to the Model Parameters
The 100% Rule
SolverTable
2
Steps in Modeling
STEP 1: Formulate
STEP 2: Solve (Find the Optimum)
STEP 3: Do a Sensitivity Analysis
Problem Statement
Boxers and Briefs Example - Revisited
Champion Sports manufactures two types of custom men's
underwear: boxers and briefs. How many boxers and how
many briefs should be produced per week, to maximize
profits, given the following constraints
The (profit) contribution per boxer is $3.00, compared to $4.50
per brief.
Briefs use 0.5 yards of material; boxers use 0.4 yards. 300
yards of material are available.
It requires 1 hour to manufacture one pair of boxers and 2
hours for one pair of briefs. 900 labors hours are available.
There is unlimited demand for boxers but total demand for
briefs is 375 units per week.
Each boxer uses 1 insignia logo and 600 insignia logos are in
stock.
Algebraic
Formulation
Objective function:
Constraint Coefficients
Labor:
Logos:
Non-Negativity:
Boxers >= 0
Briefs >= 0
Graphical
Formulation
Optimal Solution
900
Hours
800
700
Boxers
Logos
600
500
E
D
Optimum
400
300
Demand
Total
Profit
$1,800.00
$1,687.50
$2,137.50
$2,400.00
$2,340.00
$1,800.00
200
100
A
B
C
D
E
F
$3.00 $4.50
Boxers Briefs
300
200
0
375
150
375
500
200
600
120
600
0
Material
C
B
Briefs
Excel
Formulation
10
Slack
SolverTable
Pertains to changing
Objective Function
Coefficients
11
12
Steps in Modeling
STEP 1: Formulate
STEP 2: Solve (Find the Optimum)
STEP 3: Do a Sensitivity Analysis
13
14
15
Optimum
Product Mix
Status of the
Constraints
16
Steps in Modeling
STEP 1: Formulate
STEP 2: Solve (Find the Optimum)
STEP 3: Do a Sensitivity Analysis
17
Answer Report
The Answer Report also shows us which constraints are binding and nonbinding 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
wouldnt 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
Pertain to
Objective
Function
Coefficient
Ranging
Pertain to
Right Hand Side
(RHS) Ranging
on Constraints
20
10
21
Sensitivity Analysis
Boxers
700
600
500
400
300
Hours
Assume we
changed the amount
of material required
per brief from 0.5
Logos
yards to 1 yard.
Notice how the
shape of the
Demand
feasible region
changes, and the
optimal solution
changes.
200
Material
100
900
700
Briefs
Logos
600
500
Demand
400
300
200
100
Hours
800
Boxers
900
Material
100 200 300 400 500 600
Briefs
22
11
Boxers
700
600
500
400
300
200
100
Hours
Assume an extra
Demand
100 yards of
material became
Logos available (increasing
our total available to
400 yards). Notice
how the material
constraint shifts
right. The change is
greater than the
Material allowable increase
(see later) and the
optimum solution
vertex changes.
900
Hours
Demand
800
700
Logos
600
Boxers
900
Material
500
400
300
200
100
Briefs
Briefs
23
Sensitivity Analysis
12
Sensitivity Analysis
900
Hours
Demand
800
700
Logos
600
Boxers
500
400
300
Material
200
100
100 200 300 400 500 600
Briefs
25
Sensitivity Analysis
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 its 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
27
Shadow Prices
Example
28
14
Shadow Prices
Example
29
900
Hours
800
Boxers
700
600
500
Logos
F
Demand
D
400
300
200
G
A
$3.00 $4.50
Total
Boxers Briefs Contribution
A 300 200 $1,800.00
B
0 375 $1,687.50
C
150 375 $2,137.50
D 500 200 $2,400.00
E
600 120 $2,340.00
F
600
0 $1,800.00
G 333.3 333.3 $2,500.00
100
Material
Briefs
30
15
Shadow Prices
Example
How much would you pay for one additional insignia logo?
Nothing: logos are not constraining the solution!
Notice the range for logos: what is 1E+30?
31
32
16
34
17
35
36
18
Shadow Price in
Maximization vs Minimization Problems
For maximization problems:
increase in the objective function value is good
(+ve shadow price is good, and helps the optimum solution)
decrease in the objective function value is bad
(-ve shadow price is bad, and hurts the optimum solution)
37
38
19
Constraints
Cell
$D$21
$E$21
$F$21
$G$21
$H$21
$I$21
$J$21
$K$21
$L$21
$M$21
Name
TOTAL Protein
TOTAL Fat
TOTAL Sodium
TOTAL VitaminA
TOTAL VitaminC
TOTAL VitaminB1
TOTAL VitaminB2
TOTAL Niacin
TOTAL Calcium
TOTAL Iron
Final
Value
80.7
52.5
3000
100
100
138
116
124
100
100
Shadow
Constraint
Price
R.H. Side
0.00000E+00
55
0.00000E+00
54.7
-2.98066E-04
3000
1.57422E-02
100
6.80000E-03
100
0.00000E+00
100
0.00000E+00
100
0.00000E+00
100
1.38042E-02
100
3.38561E-02
100
Allowable
Increase
25.70794559
1E+30
80.04881803
79.62482802
1E+30
38.48083748
16.44004464
24.04707449
78.48290598
28.82593
Allowable
Decrease
1E+30
2.242552634
864.3523347
42.4869867
38.07812436
1E+30
1E+30
1E+30
13.19677205
8.011547469
39
40
20
900
Hours
Demand
800
700
Boxers
Logos
600
500
400
300
Material
200
100
100 200 300 400 500 600
Briefs
41
900
800
Hours
Demand
700
Boxers
Multiple Optima
Notice that, for a certain combination of
objective function coefficients, the objective
function can becomes tangent to a segment
of a constraint line (in this case, to a segment
of the Hours constraint). In this case, every
point along the tangential line segment is an
optimum, so multiple optimal product mixes
are available, all with the same optimal
solution value.
Logos
600
500
400
300
Material
200
100
100 200 300 400 500 600
Briefs
42
21
Summary
43
Summary
22
46
23
Reduced Cost
47
24
Reduced Costs
Example
Adjustable Cells
Cell
Name
$B$11 Production Boxers
$C$11 Production Padded
$D$11 Production Briefs
49
Amended Model
To Demonstrate Reduced Cost
Force the model to construct ONLY boxers:
Objective function:
Maximize ( $10.00 x Boxers ) + ( $1 x Briefs )
Constraints:
50
25
Reduced Cost
Example
The optimal solution to the amended model is:
300 Boxers, 0 Briefs for Optimal Value: $3,000
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
Cell
$E$6
$E$7
$E$8
$E$9
Name
Material
Logos
Labor
Demand
Final
Value
300
300
300
0
Shadow
Price
10
0
0
0
Constraint
R.H. Side
300
600
900
375
Allowable
Increase
300
1E+30
1E+30
1E+30
Allowable
Decrease
300
300
600
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
Cell
$E$6
$E$7
$E$8
$E$9
Name
Material
Logos
Labor
Demand
Final
Value
300
300
300
0
Shadow
Price
10
0
0
0
Constraint
Allowable
Allowable
Only
Binding
Constraint
R.H. Side
Increase
Decrease
300
300
300
600
1E+30
300
900
1E+30
600
375
1E+30
375
52
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
55
Remember:
Change constraint functions, production mix changes
Change objective function (within allowable increase /
decrease), production mix does not.
56
28
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)
NOTE: The solution changes to 266.67 boxers and 366.67 briefs
(need to resolve to get this information)
57
100% Rule
Example: Pricing out a New Product
Constraints
Cell
$D$4
$D$5
$D$6
$D$7
Name
Yards_Material
Logos
Hours_Labor
Demand_Briefs
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:
Theyre 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
Constraint Right Hand Sides:
Slack and Shadow Price
Changes within the allowable / never alter whether a
constraint is (non) binding.
Change constraint RHS: value of decision variables (product
mix) changes.
Objective Function Coefficients:
Reduced Cost
Changes within the allowable / never alter the optimal
vertex.
Changes within the allowable / : value of decision
variables (product mix) does not change.
62
31
Summary
Optimal product mix
(Optimal decision
variable values)
Non-zero if the
variable is not
in the solution.
Zero if it is.
Usage of resource
(Left Hand Side of constraint)
63
Sensitivity Analysis
64
32