Professional Documents
Culture Documents
MSCI603 F2018 04 GraphSensitivity
MSCI603 F2018 04 GraphSensitivity
MSCI 603 2
Introduction to Sensitivity Analysis
We assumed so far that parameter values were known
Costs, revenues, available resources are just estimates
MSCI 603 3
What could change in an LP?
Right-hand sides
Objective function coefficients
Additional variables
Additional constraints
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
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
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
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
MSCI 603 16
Deleting a Constraint
Deleting a non-binding constraint
Will not change the optimal solution
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
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
MSCI 603 22
Formulation
Let xij be the amount of product j produced at plant i.
MSCI 603 23
Sensitivity Report: Variable Cells
≤ 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
MSCI 603 27
Next class
Duality
MSCI 603 28
Using LINGO
MSCI 603 29
Using GAMS
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
MSCI 603 32