Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Graphical Sensitivity Analysis

Excel Report Sensitivity Analysis


MSCI 603 Section 1
Instructor: Mehrdad Pirnia
Last Lecture
 Simplex method
 Other forms
 Infeasible, unbounded, multiple solutions
 Big M method

 How can we analyze our solutions?

MSCI 603 2
Introduction to Sensitivity Analysis
 We assumed so far that parameter values were known
 Costs, revenues, available resources are just estimates

 We use sensitivity analysis to test how a change in


parameters values will affect the optimal solution
 You do not necessarily have to re-solve the entire model
 Instead, use information from sensitivity reports or simplex
tableau

MSCI 603 3
What could change in an LP?
 Right-hand sides
 Objective function coefficients
 Additional variables
 Additional constraints

How will a change in one of the above affect the OFV?


Or the optimal solution?

MSCI 603 4
Important Concepts
 Tightening a constraint
 Making the constraint more restrictive
 Example: x + y ≥ 10  x + y ≥ 11 (Increase the RHS)
 Example: 2x + 3y ≤ 20  2x + 3y ≤ 19 (Decrease the RHS)
 Reduce the feasible region
 May worsen the objective function

 Loosening a constraint
 How will this affect the LP?

MSCI 603 5
Example
 How many soldiers and train should we produce in order to
maximize profits?
Hrs
max 3X1 + 2 X 2 = Z
Required s.t. 2X1 + X 2 ≤ 100
X 1 + X 2 ≤ 80
Soldiers Trains
Process
Finishing 2 1 100 hours
Constraint X 1 ≤ 40
Carpentry 1 1 80 hours X 1, X 2 ≥ 0
Constraint
Demand 1 40
Profit 3 2
Contribution

MSCI 603 6
Changes in Objective Function Coefficients
max 3X1 + 2 X 2 = Z
s.t. 2X1 + X 2 ≤ 100
X 1 + X 2 ≤ 80
X 1 ≤ 40
X 1, X 2 ≥ 0

What if our profit


contribution estimates
are incorrect? By how
much can the profit
change before the
solution changes?

MSCI 603 7
Important!
 We consider that each change takes place one at a time
 E.g. the objective function coefficient of X1 decreases or the
coefficient of X2 increases, not both at the same time.

MSCI 603 8
Changes in RHS Values of Constraints
What if we had an
additional hours of
finishing and
carpentry available?

MSCI 603 9
Important!
 We consider that each change takes place one at a time
 E.g. the RHS of the Finishing constraint decreases or the RHS
of the Carpentary constraint increases, not both at the same
time.

MSCI 603 10
Sensitivity Report from Excel Solver
 Objective Function Coefficients

 Optimal solution remains the same as long as coefficients of x1


and x2 remain within the allowable decrease and increase
(range of optimality)

 Reduced Cost always equals zero for basic variables

MSCI 603 11
Non-basic Variables
 Say profit contribution from soldiers is only $1
max z = 13 x1 + 2 x2
s.t. 2 x1 + x2 ≤ 100 New optimal solution: x1 = 0 (non-basic), x2 = 80 (basic)
x1 + x2 ≤ 80
For a max problem, Allowable Increase indicates by how
x1 ≤ 40 much profit for that variable must increase so that it
x1 , x2 ≥ 80 becomes a basic variable

Reduced Cost indicates by how much coefficient of


variable must decrease in order for that variable to become
basic: 1 – (-1) = 2

MSCI 603 12
Changes in RHS Constraints
 Back to original problem (max 3x1 + 2x2)
 For binding constraints:
 If RHS changes, optimal solution will change
 Constraint remains binding if RHS value remains within the
allowable decrease and increase range
 E.g. if RHS of Carpentry increases by more than 20 hours, the Carpentry
constraint will no longer be binding

MSCI 603 13
Changes in RHS Constraints
 For non-binding constraints
 Will remain non-binding if RHS value remains within the
allowable decrease and increase range
 Optimal solution will not change if within the allowable
increase/decrease range
 E.g. RHS of Demand constraint can increase infinitely and will not be
violated, nor will solution change

MSCI 603 14
Shadow Prices
 Indicates by how much the objective function value will
change for every unit of increase in the RHS of that
constraint
 For binding constraints: non-zero value
 For non-binding constraints: equals zero

MSCI 603 15
Shadow Prices and Objective Function Value
 If the RHS of a binding constraint changes by ∆b (and ∆b is
within the allowable RHS range), then

New z = Old z + (shadow price)*(∆b)

MSCI 603 16
Deleting a Constraint
 Deleting a non-binding constraint
 Will not change the optimal solution

 Deleting a binding constraint


 Optimal solution and OFV will change
 Feasible region will change
 Must re-solve the problem to determine new solution and OFV

MSCI 603 17
Adding a Constraint
 Example:
 The total number of soldiers and trains produced should be
greater than 70:

x1 + x2 ≥ 70
 Substitute optimal values into new constraint
 Check if constraint holds
 If holds, optimal solution and OFV unchanged
 If not, re-solve the problem

MSCI 603 18
Changes in LHS of a Constraint
 The sensitivity report will not help us find the optimal
solution if the LHS of any constraint is changed

 We must re-solve the problem


 If we add a new variable
 If we change a coefficient in any constraint

MSCI 603 19
Example 2
 XYZ Corporation produces three products at two different plants.
The cost of producing a unit at each plant is shown below:

Product ($)
Plant 1 2 3
1 5 6 8
2 8 7 10

 Each plant can produce a total of 10,000 units. At least 6,000


units of product 1, at least 8,000 units of product 2, and at least
5,000 units of product 3 must be produced. Formulate an LP to
minimize the cost of meeting demand, and answer the following
questions.

MSCI 603 22
Formulation
 Let xij be the amount of product j produced at plant i.

min z = 5 x11 + 6 x12 + 8 x13 + 8 x21 + 7 x22 + 10 x23


s.t. x11 + x12 + x13 ≤ 10000
x21 + x22 + x23 ≤ 10000
x11 + x21 ≥ 6000
x12 + x22 ≥ 8000
x13 + x23 ≥ 5000
all variables ≥0

MSCI 603 23
Sensitivity Report: Variable Cells

a) What is the optimal solution? Objective function value?


b) What would the cost of producing product 2 at plant 1 have to
be for the firm to make this choice?
c) If it cost $9 to produce a unit of product 3 at plant 1, then what
would be the new optimal solution?
MSCI 603 24
Sensitivity Report: Constraints

d) What would the total cost be if plant 1 had 9,000 units of


capacity?
e) How much should XYZ be willing to pay for another unit of
capacity at plant 2?
MSCI 603 25
Shadow Prices
 The amount by which the objective function changes for
every 1 unit increase in the RHS of a binding constraint

 ≤ constraint
 Increase RHS  loosen  improves z
 For max problem: non-negative shadow price

 ≥ constraint
 Increase RHS  tighten  worsens z
 For max problem: non-positive shadow price

MSCI 603 26
Shadow Prices and Objective Function Value
 If the RHS of a binding constraint changes by ∆b (and ∆b is
within the allowable RHS range), then

New z = Old z + (shadow price)*(∆b)

MSCI 603 27
Next class
 Duality

MSCI 603 28
Using LINGO

MSCI 603 29
Using GAMS

ord refers to the position of a


particular element within the
overall set

MSCI 603 30
Using Matlab/Gurobi
 Write LP in Matlab, call Gurobi to solve the model
 Matrix form of LP (will cover this in more detail later)

max z = 3 x1 + 5 x2 max z = cx
+ s1 =4 x 
s.t. x1 s.t. [A, I ]   = b
3 x1 + 2 x2 + s2 = 18 x s 
2 x2 + s3 = 12 x 
x1 , x2 , s1 , s2 , s3 ≥ 0 x  ≥ 0
 s

 s1  1 0 1 0 0
 x1 
c = [3 5] x=  x s =  s2  A = 3 2 I = 0 1 0
 x2   s3  0 2 0 0 1

MSCI 603 31
Using Matlab/Gurobi
 Write LP in Matlab, call Gurobi to solve the model

Matlab input Output from Gurobi (read in Matlab)

MSCI 603 32

You might also like