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

Topic #3: LP Software and Sensitivity Analysis

Reading: Textbook Chapter 3

In our last topic, we discussed how to formulate simple linear programming problems and
how to solve LPs with two variables graphically. We now address how LPs can be solved
using software (Excel and QM for Windows). As we did with break-even analysis, we will
also discuss the important topic of sensitivity analysis.

3.1 The Simplex Algorithm


In Topic #2, we discussed how to use the graphical method to solve LPs. It is useful to
understand, since it explains all of the things that can happen with an LP solution (unique
optimal solution, multiple optimal solutions, unbounded objective, infeasible problem).
However, this approach is rarely used for real-life problems. Why? Because the graphical
solution approach only works for problems that we can graph. Practically, that means the
graphical approach only works on problems with two variables, while meaningful real-world
problems can have hundreds, thousands, or millions of variables.

To solve problems with more than two variables, we need to use a solution technique
based on linear algebra. This approach, known as the simplex method, was developed by
George Dantzig in the 1940’s. It can be implemented by hand in augmented matrices called
tableaus. We will not cover the specifics of that algorithm in this course, but you should be
aware that it is the algorithm that is programmed into most optimization software
packages. We will now disciss the two software packages that are covered in our textbook:
Excel (using the Solver add-in) and QM for Windows.

3.2 Using Excel to Solve LPs


We will illustrate the two software options on the Beaver Creek Pottery example that was
discussed in Topic #2. Recall that we had the following LP model, where our decision
variables were 𝑥1 = # bowls produced and 𝑥2 = # mugs produced.

Maximize 𝑍 = 40𝑥1 + 50𝑥2


subject to 𝑥1 + 2𝑥2 ≤ 40 (Labor)
4𝑥1 + 3𝑥2 ≤ 120 (Clay)
𝑥1 , 𝑥2 ≥ 0

Before working with any software package, make sure that your LP is written correctly.
• Make sure that the objective function and constraints are all linear.
• The constraints should have all variables on the left-hand-side (LHS) and only a
number on the right-hand-side (RHS).

1
To set up LPs in Excel, we use the following steps.
1. For each decision variable, create a cell to store its value.
2. Store the values of all problem parameters (objective function coefficients,
constraint coefficients, constraint RHS values) in cells.
3. Create a cell that calculates the objective function value. (You can either write
out the product of variables times objective function coefficients and add them
up, or you can use the SUMPRODUCT function.)
4. For each linear constraint, create a cell that calculates the LHS value. (You can
either write out the product of variables times objective function coefficients and
add them up, or you can use the SUMPRODUCT function.) If desired, you can
also create a cell to calculate the amount of slack or surplus in each inequality.

We will now illustrate this process for the Beaver Creek Pottery example. The Excel file for
this example (as well as all textbook examples) can be found through the textbook site
given on the course syllabus. This file can also be found on our course page..

Throughout the course, I will use colors on the cells to help us tell them apart. The blue
cells store the values of our decision variables. The input parameters are in uncolored
cells. The LHS of constraints are in yellow, and the objective function is in orange.
Specifically, we want Excel to calculate the profit, number of labor hours used, amount of
clay used, and the unused amounts of labor and clay. Give the formulas for the yellow cells.

Profit: B12 =

Labor Usage (# labor hours used): E6 =

Clay Usage (lb of clay used): E7 =

Left-Over (slack) Labor Hours: H6 =

Left-Over (slack) Clay: H7 =

To verify that the formulas are working, enter different values in cells B10 and B11, and
check that the yellow cells are calculated correctly.

2
Once the spreadsheet is set up, we need to invoke Solver to obtain the optimal solution. If
you have activated the Solver Add-In already, then Solver will appear on the Data tab. If
Solver does not appear on your Data tab, you need to activate the Solver Add-In, using
the instructions provided on the course syllabus.

After opening Solver, we need to complete a dialog box to tell Excel where the variables,
objective function, and constraints are located. Specifically, you need to do the following.

1. Define which cell stores the objective value.


2. Define the cells that store the values of the decision variables.
3. Use the Add button to define the problem constraints. You will want to list each
constraint LHS and state its relationship to the RHS value.
4. Check the box to restrict the decision variables to be non-negative, which means
that we will not need to write out non-negativity explicitly.
5. Select Simplex LP as the solving method.
6. Click Solve to obtain the solution.

Note: When you are specifying cells, you can either click on them or type in their cell
reference (B10, etc.) Excel will automatically add a $ to the cell reference to lock it in as an
absolute reference, but you do not need to enter that.

A screenshot of the Solver window is shown below.

Cell where
objective
Cells where
value is
values of
calculated
variables
are stored
Click Add to
Constraints open dialog
relating LHS box on next
and RHS page
values

Always check
this box

Always select
Simplex LP

3
The dialog box for adding a constraint is shown below.
Use drop-down menu
to select relationship

Cell(s) containing
LHS value(s)
Cell(s) containing
RHS value(s)

There are different ways of adding the constraints.


• Option 1: Type in each RHS Value as a Number (ex: E6 <= 40 and E7 <=120)
o This option enters the RHS value into Solver directly.
o I don’t like this option very much. If you want to re-solve for a different RHS
value, you would have to open the dialog box and change each number.
• Option 2: Type in each RHS Values as a Cell Reference (ex: E6 <= G6 and E7 <= G7)
o This option enters the cell where the RHS value was stored.
o I prefer this option. If you want to re-solve for a different RHS value, you just
need to change the value in the cell, and Solver will know that it changed
automatically.
• Option 3: Type in the LHS and RHS ranges at once (ex: E6:E7 <= G6:G7)
o This is essentially a short-cut version of Option 2.
o If you have several constraints in a row that are a similar form, you can
highlight all of them at once to save time.

Once the dialog box is complete, click Solve, and Excel will indicate in the top left whether
or not it could find an optimal solution. If it did, you will have the option to either keep the
optimal values or return to the original cell values. You can also select which (if any)
reports you would like to see. The Answers and Sensitivity Reports are shown below.

Optimal values of
objective and
Original Value variables are stored
shows what under Final Value.
values were in
the cells before
we ran Solver.
Usually, this is Cell Value
irrelevant gives the final
information. LHS value.
Status shows
if the LHS is
at its RHS
Answers Report limit (no
slack) or not.
4
The values of
variables are stored
under Final Value.

Final Value gives the


final LHS value.
Constraint R.H. Side
shows the RHS limit.

Sensitivity Report

3.3 Using QM for Windows to Solve LPs


Excel is convenient for solving LPs, since it is a program that most people are very familiar
with. However, software packages that are designed to only solve optimization problems
can be more user-friendly and faster. One such optimization package is QM for Windows.
Recall the Beaver Creek Pottery example we have been discussing, where our decision
variables were 𝑥1 = # bowls produced and 𝑥2 = # mugs produced.

Maximize 𝑍 = 40𝑥1 + 50𝑥2


subject to 𝑥1 + 2𝑥2 ≤ 40 (Labor)
4𝑥1 + 3𝑥2 ≤ 120 (Clay)
𝑥1 , 𝑥2 ≥ 0

To solve this problem in QM for Windows, we begin by selecting Linear Programming. In


the dialog box that appears, specify the title, number of constraints, and number of
variables. You will also select whether to maximize or minimize the objective.

5
You can also give names to the rows (constraints) and columns (variables). The default
variable names are 𝑥1 , 𝑥2 , …, which is usually what we want. After clicking OK, you can
easily enter the parameters in the objective function and constraints in a form that is very
similar to what you have written on paper. You just type in the coefficients, and it shows
you what the functions look like in terms in equation form. (You can also rename the
constraints to make them meaningful.)

Once the model is entered, you just click the green Solve button at the top of the screen. The
optimal values for the decision variables and objective function are displayed along with
other output values. You can find additional information by clicking the options at the
bottom of the screen.

The figure above shows both the initial results screen, as well as additional output available
in the ranging report. (We will discuss what these values mean shortly.) You also have the
option of viewing a graph of the problem (if it only had two decision variables). This can be
very helpful when you are checking homework solutions! The graph for the Beaver Creek
Pottery example is shown below.
6
3.4 Overview of Sensitivity Analysis
Sensitivity analysis considers how the optimal solution will change if the input parameters
change. For example, we might be interested in how Beaver Creek Pottery’s optimal
decision would change if the amount of clay changes or if the unit profit of the mugs
change. Would they need to come up with a whole new production strategy? Or would the
solution stay the same for some range of values? This type of information can be extremely
useful to a manager, since the parameters we take as constants in our model might change
in real-life.

Our focus will be to find the range of values for which the optimal production strategy is
unchanged. We want to be able to tell the Beaver Creek Pottery manager that, as long as the
parameter change stays within this given range, then they can be confident that the optimal
production strategy will stay the same.

Important Note: Throughout, we will be looking for the range of parameter values
that will keep the current production strategy optimal. These ranges are only valid if
one parameter changes at a time. If multiple parameters change at once, then we
would need to re-solve the model to see if the solution changes or not. For example,
we will be able to tell the Beaver Creek Pottery manager a range of bowl prices that
will keep the current solution optimal. We will also be able to give a range of mug
prices that will keep the current solution optimal. However, if both the bowl and
mug prices change, we do not know if/how the optimal solution will change. In that
case, we would need to re-solve the model with the new prices to see what happens.

7
3.5 Changes in Objective Function Coefficients for Beaver Creek
We are interested in how the optimal solution might change if the sales price of bowls or
mugs change. We will use the graphical approach to see how the solution changes as one of
the objective function coefficients change. The original problem is show below.

Original Problem
Maximize 𝑍 = 40𝑥1 + 50𝑥2
subject to 𝑥1 + 2𝑥2 ≤ 40
4𝑥1 + 3𝑥2 ≤ 120
𝑥1 , 𝑥2 ≥ 0

40 4
Slope of objective = − 50 = − 5

Optimal Solution: (𝑥1 , 𝑥2 ) = (24,8)

Profit = 40𝑥1 + 50𝑥2

= 40(24) + 50(8) = $1360


Figure 3.1
(Taylor, 2019, p. 84)

What if there was a change in the profitability of the bowls? Suppose that bowls now have
a unit profit of $100 (and mugs stay at $50 unit profit). In this case, the objective would be
to maximize 𝑍 = 100𝑥1 + 50𝑥2 subject to the same constraints.

Increased Bowl Profit


Maximize 𝑍 = 100𝑥1 + 50𝑥2
subject to 𝑥1 + 2𝑥2 ≤ 40
4𝑥1 + 3𝑥2 ≤ 120
𝑥1 , 𝑥2 ≥ 0

Slope of objective =

Optimal Solution:

Profit = 100𝑥1 + 50𝑥2

= Figure 3.2
(Taylor, 2019, p. 84)

8
What if there was a change in the profitability of the mugs? Suppose that mugs now have a
unit profit of $100 (and bowls stay at $40 unit profit). In this case, the objective would be
to maximize 𝑍 = 40𝑥1 + 100𝑥2 subject to the same constraints.

Increased Mug Profit


Maximize 𝑍 = 40𝑥1 + 100𝑥2
subject to 𝑥1 + 2𝑥2 ≤ 40
4𝑥1 + 3𝑥2 ≤ 120
𝑥1 , 𝑥2 ≥ 0

Slope of objective =

Optimal Solution:

Profit = 40𝑥1 + 100𝑥2


Figure 3.3
= (Taylor, 2019, p. 85)

3.6 Determining Optimal Objective Coefficient Ranges for Beaver Creek


As we have seen, there are some objective function coefficient changes that cause the
optimal solution to move to a different extreme point. There are other changes that would
keep extreme point B as optimal.

We are interested in the range of objective coefficients that will still have the original optimal
solution. If a manager sees that the unit profits have changed but are still within this range,
then he/she will know that the optimal solution will not change.

We are interested in which objective coefficients will keep extreme point B optimal. One
way for point B to be optimal is for the entire line segment AB to have alternative optimal
solutions. Note that the points on line segment AB lie on the labor limit, reproduced below.

Labor: 𝑥1 + 2𝑥2 ≤ 40 Slope = −1/2

Which objective function slope would cause the entire line segment AB to be optimal?
Recall that an entire edge of the feasible region is optimal if it has the same slope as the
objective function.

For AB to be optimal, we need objective function slope =

For example, line segment AB would be optimal if we were maximizing 10𝑥1 + 20𝑥2 or
3𝑥1 + 6𝑥2.

9
Another way for extreme point B to be optimal would be to have alternative optimal
solutions along the line segment BC. Note that the points on line segment BC lie on the clay
limit, reproduced below. What is the slope of the line segment BC?

Clay: 4𝑥1 + 3𝑥2 ≤ 120 Slope = −4/3

Which objective function slope would cause the entire line segment BC to be optimal?
Recall that an entire edge of the feasible region is optimal if it has the same slope as the
objective function.

For BC to be optimal, need objective function slope =

For example, line segment BC would be optimal if we were maximizing 40𝑥1 + 30𝑥2 or
20𝑥1 + 15𝑥2 .

It can be shown that for any objective function slope that is strictly between these two
constraint slopes, point B will be the unique optimal solution. In summary, we know

• Point B will be optimal when line segment AB is optimal, which happens when the
objective function slope is −1/2.
• Point B will be optimal when line segment BC is optimal, which happens when the
objective function slope is −4/3.
• Point B will be the unique optimal solution for any objective function slopes that are
strictly between −4/3 and −1/2.
4 1
• Overall, point B will be optimal as long as − 3 ≤ Objective Slope ≤ − 2.

4
In Section 3.5, we saw that the original objective function had a slope of − 5 = −0.8,
which made extreme point B the unique optimal solution. The other examples had
slopes outside of this range (-2 and -0.4), so extreme point B was not optimal for them.

Now that we know the slopes that will keep extreme point B optimal, we can determine the
unit profits for bowls and mugs that will keep this point optimal.

Suppose that we are interested in the range of unit bowl profits that will keep extreme
point B optimal, assuming that mug unit profit is unchanged (stays at $50). Let’s use 𝑐1 to
represent bowl profit. Then, our objective function would be to maximize 𝑍 = 𝑐1 𝑥1 + 50𝑥2.
What is the slope of this objective function, in terms of 𝑐1 ?

Objective slope =

10
4 1
As discussed above, to keep extreme point B optimal, we need − 3 ≤ Objective Slope ≤ − 2.
This means that we need to solve for the value of 𝑐1 that keeps

4 𝑐1 1
− ≤− ≤−
3 50 2

We can now solve for the ranges of 𝑐1 that satisfy these inequalities.

IMPORTANT REMINDER: In solving for values of 𝒄𝟏 𝐨𝐫 𝒄𝟐 , you will need to


multiply inequalities by negative numbers. Whenever you multiply an
inequality by a negative number, the direction of the inequality reverses.

4 𝑐
We always tackle the inequalities one at a time. Consider the inequality − 3 ≤ − 501 , and
solve for the values of 𝑐1 that satisfy this inequality.

𝑐 1
Now consider the other inequality − 501 ≤ − 2, and solve for the values of 𝑐1 that satisfy this
inequality.

Putting these together, we have found the values of 𝑐1 that keep extreme point B optimal.

Optimal Range for 𝑐1 :

Interpretation: As long as nothing else in the problem changes, then extreme point B will
remain optimal as long as bowls sell for between $25 and $66.67. (In the original problem,
bowls sold for $40, which is in this range.) The optimal profit will change if the sales price
of bowls changes, so we will need to re-calculate that value.

11
We can do a similar analysis to see what happens if bowls stay at $40 unit profit, but mugs
have a unit profit of $𝑐2 . In this case, our objective function would be to maximize 𝑍 =
40𝑥1 + 𝑐2 𝑥2 . What is the slope of this objective function, in terms of 𝑐2 ?

Objective slope =

4 1
As discussed above, to keep extreme point B optimal, we need − 3 ≤ Objective Slope ≤ − 2.
This means that we need to solve for the value of 𝑐2 that keeps

4 40 1
− ≤− ≤−
3 𝑐2 2

We can now solve for the ranges of 𝑐2 that satisfy these inequalities. Consider the
4 40
inequality − 3 ≤ − 𝑐 , and solve for the values of 𝑐2 that satisfy this inequality.
2

40 1
Now consider the other inequality − 𝑐 ≤ − 2, and solve for the values of 𝑐2 that satisfy this
2
inequality.

Putting these together, we have found the values of 𝑐2 that keep extreme point B optimal.

Optimal Range for 𝑐2 :

Interpretation: As long as nothing else in the problem changes, then extreme point B will
remain optimal as long as mugs sell for between $30 and $80. (The original problem had a
mug price of $50, which is in this range.) The optimal profit will change if the sales price
of mugs changes, so we will need to re-calculate that value.

12
3.7 Finding Optimal Objective Coefficient Ranges from Output Reports
Computer software packages often provides these optimality ranges, but they sometimes
do it in different methods. Excel shows the allowable change (increase or decrease) for
each objective function coefficient. You can see this in the Excel Sensitivity Report below.

Objective Coefficient shows the values were used in the


current model. Allowable Increase and Allowable
Decrease show how much the objective coefficients can
vary without changing the optimal values of the variables.

Objective Function Range for 𝑐1 :

Objective Function Range for 𝑐2 :

If you select the Ranging output in QM for Windows, it directly shows the lower and
upper limits of the optimality range (instead of an allowable increase of decrease).

QM for Windows gives the optimal ranges directly.

Optimal Objective Value Range for 𝑐1 : 25 ≤ 𝑐1 ≤ 66.67


Optimal Objective Value Range for 𝑐2 : 30 ≤ 𝑐2 ≤ 80

3.8 Evaluating the Impact of Changes to Objective Coefficients


We have seen how to find the optimality ranges for objective coefficients graphically, as
well as how to find them on computer output. Let’s practice how we could use that
information. Recall that the original Beaver Creek problem.

13
Optimal Solution: 𝑥1 = 24, 𝑥2 = 8
Maximize 𝑍 = 40𝑥1 + 50𝑥2
subject to 𝑥1 + 2𝑥2 ≤ 40 Optimal Profit = $1360
4𝑥1 + 3𝑥2 ≤ 120 Optimal Objective Coefficient Ranges:
𝑥1 , 𝑥2 ≥ 0 25 ≤ 𝑐1 ≤ 66.67 and 30 ≤ 𝑐2 ≤ 80

Determine the effect on the optimal solution if the following changes occur.
1. Sales price of bowls (𝑐1 ) changes from $40 to $70, and mugs (𝑐2 ) stay at $50.

Able to determine from sensitivity report?

Optimal solution: (𝑥1 , 𝑥2 ) = Optimal Profit = 70𝑥1 + 50𝑥2 =

2. Sales price of bowls (𝑐1 ) stays at $40, and mugs (𝑐2 ) change from $50 to $70.

Able to determine from sensitivity report?

Optimal solution: (𝑥1 , 𝑥2 ) = Optimal Profit = 40𝑥1 + 70𝑥2 =

3. Sales price of bowls (𝑐1 ) changes from $40 to $30, and mugs (𝑐2 ) stay at $50.

Able to determine from sensitivity report?

Optimal solution: (𝑥1 , 𝑥2 ) = Optimal Profit = 30𝑥1 + 50𝑥2 =

4. Sales price of bowls (𝑐1 ) stays at $40, and mugs (𝑐2 ) change from $50 to $20.

Able to determine from sensitivity report?

Optimal solution: (𝑥1 , 𝑥2 ) = Optimal Profit = 40𝑥1 + 20𝑥2 =

5. Sales price of bowls (𝑐1 ) changes from $40 to $65, and mugs (𝑐2 ) from $50 to $30.

Able to determine from sensitivity report?

Optimal solution: (𝑥1 , 𝑥2 ) = Optimal Profit = 65𝑥1 + 30𝑥2 =

NOTE: You can verify by re-solving the Beaver Creek models with these cost changes. You
can also check that the optimal solution to #1, #4, and #5 above is not at (𝑥1 , 𝑥2 ) = (24,8).
14
3.9 Optimal Objective Coefficient Ranges for Fertilizer Example
As reinforcement, we will perform a similar graphical analysis to obtain optimal objective
coefficient ranges for the fertilizer example where a farmer wanted to mix a custom
fertilizer at minimum cost. The LP model we formulated in Topic #2 is shown below.
Recall that 𝑥1 = # bags of Super-Gro and 𝑥2 = # bags of Crop-Quick.

Minimize 𝑍= 6𝑥1 + 3𝑥2


subject to 2𝑥1 + 4𝑥2 ≥ 16 (Nitrogen)
4𝑥1 + 3𝑥2 ≥ 24 (Phosphate)
𝑥1 , 𝑥2 ≥ 0

We will again perform a graphical analysis to find the optimality ranges for the objective
coefficients. The original problem is show below.

Original Problem
Minimize 𝑍 = 6𝑥1 + 3𝑥2
subject to 2𝑥1 + 4𝑥2 ≥ 16
4𝑥1 + 3𝑥2 ≥ 24
𝑥1 , 𝑥2 ≥ 0

6
Slope of objective = − 3 = −2

Optimal Solution: A = (𝑥1 , 𝑥2 ) = (0,8)

Cost = 6𝑥1 + 3𝑥2 = 6(0) + 3(8) = $24

Figure 2.19
(Taylor, 2019, p. 56)

We are interested in which objective coefficients will keep extreme point A optimal. One
way for point A to be optimal is for the entire line segment AB to have alternative optimal
solutions. Note that the points on line segment AB lie on the phosphate limit, reproduced
below. What is the slope of the line segment AB?

Phosphate: 4𝑥1 + 3𝑥2 ≥ 24 Slope = −4/3

Which objective function slope would cause the entire line segment AB to be optimal?
Recall that an entire edge of the feasible region is optimal if it has the same slope as the
objective function.

For AB to be optimal, need objective function slope = −4/3

15
For example, if the objective were to minimize 𝑍 = 4𝑥1 + 3𝑥2, then the objective function
slope would be −4/3, and line segment AB would be optimal.

Another way for extreme point A to be optimal would be to have alternative optimal
solutions along the line segment from A up the vertical axis. We already discussed that the
slope of a vertical line is undefined. However, sometimes we refer to its slope as −∞. The
reason is that if you push a downward sloping line closer and closer to vertical, its slope
gets more and more negative. It approaches negative infinity.

Vertical Axis: 𝑥1 ≥ 0 “Slope” = −∞

Which objective function slope would cause the vertical axis to be optimal? Recall that an
entire edge of the feasible region is optimal if it has the same slope as the objective
function.

For the vertical axis to be optimal, need objective function “slope” = −∞

For example, if the objective were to minimize 𝑍 = 𝑥1 , the objective “slope” would be

𝑎1 1
=− = − = −∞
𝑎2 0

That means that if we were minimizing 𝑍 = 𝑥1 , the objective function “slope” would be
"-1/0 = −∞,” and the vertical axis would be optimal.

For any objective function slope that is strictly between these two constraint slopes, point
A will be the unique optimal solution. That is, we have the following.

• Point A will be optimal when the vertical axis is optimal, which happens when the
objective function “slope” is −∞.
• Point A will be optimal when line segment AB is optimal, which happens when the
objective function slope is −4/3.
• Point A will be the unique optimal solution for any objective function slopes that are
strictly between −∞ and −4/3.
4
• Overall, point A will be optimal as long as −∞ ≤ Objective Slope ≤ − 3.

In the original problem, the objective function was minimize 𝑍 = 6𝑥1 + 3𝑥2, so we had
6
Objective Slope = − 3 = −2

Interpretation: Since the original problem had a slope within the optimal range for
point A, that was the unique optimal solution for the given problem.

16
Now that we know the slopes that will keep extreme point A optimal, we can determine the
unit costs for bags of Super-Gro and Crop-Quick that will keep this point optimal.

Suppose that we are interested in the range of unit cost of Super-Gro that will keep extreme
point A optimal, assuming that unit cost of Crop-Quick is unchanged (stays at $3). Let’s use
𝑐1 to represent Super-Gro cost. Then, our objective function would be to minimize 𝑍 =
𝑐1 𝑥1 + 3𝑥2 . What is the slope of this objective function, in terms of 𝑐1 ?

𝑐1
Objective slope = −
3

4
As discussed above, to keep extreme point A optimal, we need −∞ ≤ Objective Slope ≤ − 3.
This means that we need to solve for the value of 𝑐1 that keeps

𝑐1 4
−∞ ≤ − ≤−
3 3

We can now solve for the ranges of 𝑐1 that satisfy these inequalities.
𝑐
Consider the inequality −∞ ≤ − 31 , and solve for the values of 𝑐1 that satisfy this inequality.

𝑐1 𝑐1
−∞ ≤ − ⇒ ∞≥ ⇒ ∞ ≥ 𝑐1
3 3

⇒ 𝑐1 ≤ ∞

𝑐1 4
Consider the other inequality − ≤ − 3, and solve for the values of 𝑐1 that satisfy it.
3

𝑐1 4 𝑐1 4
− ≤− ⇒ ≥
3 3 3 3

⇒ 𝑐1 ≥ 4

Putting these together, we have found the values of 𝑐1 that keep extreme point A optimal.

Optimal Range for 𝒄𝟏 : 𝟒 ≤ 𝒄𝟏 ≤ ∞

Interpretation: As long as nothing else in the problem changes, then extreme point A will
remain optimal as long as the cost of each bag of Super-Gro is at least $4. (The original cost
was given as $6, which is why point A was optimal.)

17
We can do a similar analysis to see what happens if Super-Gro continues to cost $6, but
Crop-Quick has a unit cost of $𝑐2 . In this case, our objective function would be to minimize
𝑍 = 6𝑥1 + 𝑐2 𝑥2 . What is the slope of this objective function, in terms of 𝑐2 ?

6
Objective slope = −
𝑐2

4
As discussed above, to keep extreme point A optimal, we need −∞ ≤ Objective Slope ≤ − 3.
This means that we need to solve for the value of 𝑐2 that keeps

6 4
−∞ ≤ − ≤−
𝑐2 3

We can now solve for the ranges of 𝑐2 that satisfy these inequalities. Consider the
6
inequality −∞ ≤ − 𝑐 , and solve for the values of 𝑐2 that satisfy this inequality.
2

6 6
−∞ ≤ − ⇒ ∞≥
𝑐2 𝑐2

6
⇒ 𝑐2 ≥

⇒ 𝑐2 ≥ 0

6 4
Now consider the other inequality − ≤ − , and solve for the values of 𝑐2 that satisfy it.
𝑐2 3

6 4 6 4 4
− ≤− ⇒ ≥ ⇒ 6 ≥ 𝑐2
𝑐2 3 𝑐2 3 3

4 3 9
⇒ 𝑐2 ≤ 6 ⇒ 𝑐2 ≤ ( ) 6 ⇒ 𝑐2 ≤
3 4 2

Putting these together, we have found the values of 𝑐2 that keep extreme point B optimal.

Optimal Range for 𝒄𝟐 : 𝟎 ≤ 𝒄𝟐 ≤ 𝟒. 𝟓

Interpretation: As long as nothing else in the problem changes, then extreme point A will
remain optimal as long as the cost of each bag of Crop-Quick is between $0 and $4.50. (The
original cost was $3, which is why point A was optimal.)

18
We can verify these results by using QM for Windows on the model, and then looking at the
ranging output.

QM for Windows confirms the optimal objective


coefficient ranges that we determined graphically.

Optimal Objective Value Range for 𝑐1 : 4 ≤ 𝑐1 ≤ ∞

Optimal Objective Value Range for 𝑐2 : 0 ≤ 𝑐2 ≤ 4.5

We could now use these ranges to answer questions about the impact of cost changes,
similar to the questions we answered for Beaver Creek on page 14.

3.10 Summary of Finding Optimal Objective Coefficient Ranges Graphically


We have just seen two examples of how to obtain the optimality ranges for objective
functions graphically. Here is a summary, assuming that the objective is 𝑐1 𝑥1 + 𝑐2 𝑥2.

• Find the slope of the two constraints that meet at the optimal extreme point. (If the
vertical axis is one of the constraints, take its “slope” to be −∞ or +∞.)
• For this extreme point to remain optimal, the slope of the objective function must be
between the slope of these two constraints.
• That is, we must have
𝑐1
Smaller constraint slope ≤ − ≤ Larger constraint slope
𝑐2
• To find the optimality ranges for 𝑐1 , plug in the original value for 𝑐2 above and solve
for the ranges of 𝑐1 .
• To find the optimality ranges for 𝑐2 , plug in the original value for 𝑐1 above and solve
for the ranges of 𝑐2 .
• The ranges you find should match what is given in the sensitivity reports from
computer software.
• You can use these ranges to conduct what-if analysis regarding changes in the
objective coefficients (like we did on page 14). Remember: You would need to re-
calculate the optimal objective function value, since that value will change.

19
3.11 Changes in Right-Hand-Side Values for Beaver Creek Pottery
So far, we have determined the ranges for the objective coefficients that keep the current
solution optimal. This helps managers know that the solution will not change as long as the
objective coefficient remains in the optimal range.

It is possible to do a similar analysis for changes in the right-hand-side values of the


constraints. When we change the right-hand-side value of a constraint (but keep
everything else the same), what happens to that constraint on the graph?

This makes right-hand-side value ranges significantly more complicated to determine from
a graph than objective coefficient ranges. When the right-hand-side value of constraint 𝑖
(𝑞𝑖 ) changes, the graph of the feasible region changes. As a result, we no longer talk about
ranges that keep a particular extreme point optimal (since the extreme points will move as
the constraints shift). Instead, we only talk about ranges of right-hand-side values that keep a
particular solution mix optimal. Essentially, we are looking for the range of right-hand-
side values that will keep the solution at the intersection of the same two constraints.
To illustrate this, consider the Beaver Creek Pottery example again. The graph below
shows what would happen to the feasible region if the amount of available labor hours
increased from 𝑞1 = 40 to 𝑞1 = 60.

Point A moves to Point B moves to Point


Point A’. Both points B’. Both points
represent making represent making both
only mugs, so the bowls and mugs, so
same product mix. the same product mix.

Point C does not


change. It represents
only making bowls.

Figure 3.6: Increasing the Labor Constraint Quantity


(Taylor, 2019, p. 90)

20
1 40
Original Constraint (𝑥1 + 2𝑥2 = 40): Slope = − 2 Intercept = = 20
2

1 60
Revised Constraint (𝑥1 + 2𝑥2 = 60): Slope = − 2 Intercept = = 30
2

When the constraint is revised and moved to where shown above, the intersection of the
labor and clay constraints moves from point B to point B’. The new feasible region has the
following extreme points: the origin, A’, B’, and C.

If we solve the revised problem with the objective to maximize 𝑍 = 40𝑥1 + 50𝑥2 , the
optimal solution is at B’.

Interpretation: Even though the optimal solution has changed, it still lies at the intersection
of the labor and clay constraints (B’), just as it was in the original problem (B).
To find the optimality ranges for the labor right-hand-side value (𝑞1 ), we want to see how
far we can push the labor constraint until it no longer intersects the clay constraint at the
optimal solution.

Figure 3.7: Determining the Sensitivity Range for Labor Quantity


(Taylor, 2019, p. 90)

Max value of 𝑞1 : 80 Min value of 𝑞1 : 30

To find the optimality ranges for the clay right-hand-side value (𝑞2 ), we want to see how
far we can push the clay constraint until it no longer intersects the labor constraint at the
optimal solution.

21
Figure 3.8: Determining the Sensitivity Range for Clay Quantity
(Taylor, 2019, p. 91)

Max value of 𝑞2 : 160 Min value of 𝑞2 : 60

Since it is more complicated to determine the right-hand-side ranges graphically, in


this class, you will only need to find these ranges from computer output. The output
from the Beaver Creek Pottery example using QM for Windows is shown below. Verify that
the optimal ranges for the right-hand-side values match what we discussed above.

QM for Windows gives the optimal ranges directly


beside the original RHS value.

Available Labor Range: 30 ≤ Available Labor Hours ≤ 80

Available Clay Range: 60 ≤ Available Pounds of Clay ≤ 160

22
The same information is available in the Excel sensitivity report for Beaver Creek Pottery.

Excel shows the original RHS value, along with its


allowable increase and decrease.

Available Labor Range: 40 − 10 ≤ Available Labor Hours ≤ 40 + 40


⇒ 30 ≤ Available Labor Hours ≤ 80

Available Clay Range: 120 − 60 ≤ Available Pounds of Clay ≤ 120 + 40


⇒ 60 ≤ Available Pounds of Clay ≤ 160

Interpretations:
• If we stayed within the optimality range for an objective coefficient, we knew that a
particular solution (for example, (𝑥1 , 𝑥2 ) = (24,8)) would remain optimal.
• If we stay within the optimality range for right-hand-side values, we cannot say that a
specific point remains optimal. All that we can say is that the optimal solution will
still lie at the intersection of the same constraints, but that intersection will move to
new values of 𝑥1 and 𝑥2 as the right-hand-side values change.
• If there are no changes other than the amount of available labor, the optimal solution
will use all of the available labor and clay (lie at the intersection of the labor and clay
constraints) as long as the available labor is between 30 and 80 hours.
• If there are no changes other than the amount of available clay, the optimal solution
will use all of the available labor and clay (lie at the intersection of the labor and clay
constraints) as long as the available clay amount is between 60 and 160 pounds.
• We cannot say what the exact solutions will be in terms of 𝑥1 and 𝑥2 , since the graph
will change as these right-hand-side values change.

23
Consider the ranging output from the QM for Windows model of the fertilizer problem,
copied below.

The model for this problem is shown below.


Minimize 𝑍= 6𝑥1 + 3𝑥2
subject to 2𝑥1 + 4𝑥2 ≥ 16 (Nitrogen)
4𝑥1 + 3𝑥2 ≥ 24 (Phosphate)
𝑥1 , 𝑥2 ≥ 0

What right-hand-side ranges would keep the current product mix optimal?

Original Nitrogen Requirement = 16

≤ Nitrogen Limit ≤

Original Phosphate Requirement = 24

≤ Phosphate Limit ≤

3.12 Shadow Prices or Dual Variable Values


There is one last important piece of information available from sensitivity analysis reports.
The dual variable or shadow price of a constraint measures how valuable each unit of a
resource is. Specifically, it shows how the optimal objective value will improve as the RHS
values of the constraints change. This information can be a very meaningful for a manager.
If we know how much each hour of labor is worth, then we can make decisions about
whether we should add overtime hours. If we know how valuable each pound of clay is to
our overall profit, then we can decide whether we should purchase additional clay.

If we look back at the outputs for the Beaver Creek Pottery example, we can find the
shadow prices for each constraint (labor and clay).

24
QM for Windows ranging output for Beaver Creek Pottery.

Excel sensitivity report for Beaver Creek Pottery.

Although they use different words, we have the same information for the dual value or
shadow price of each resource.

Labor Shadow Price (or Dual Value):

Clay Shadow Price (or Dual Value):

Interpretations:
• If we gain obtain one additional hour of labor, our profit will increase by $16.
• If we lose one hour of labor, our profit will decrease by $16.
• If we gain obtain one additional pound of clay, our profit will increase by $6.
• If we lose one pound of clay, our profit will decrease by $6.

If you could obtain an additional unit of one resource (labor or clay), which one would you
choose? Why?

25
Shadow prices are very useful, since we can tell how the objective function will change as
the right-hand-side of a constraint changes. Instead of needing to re-solve the model, we
can tell what the optimal profit will be through some quick arithmetic.

For example, in the Beaver Creek Pottery example, the optimal solution for the original
problem (where labor was limited to 40 hours) was $1360. Suppose that we can obtain an
additional 20 hours of labor, taking the total available labor up to 60 hours. Knowing that
labor has a shadow price of $16, can we predict what would happen to our profit?

Value of each labor hour = Shadow price =

Profit changes by (change in RHS value) ∗ (Shadow price) =

New optimal profit =

To test if our shadow price analysis is correct, we could re-solve the model when the right-
hand-side of the labor constraint is changed to 60 hours. The result is shown below.

The results show that if labor hours increase to 60, the optimal profit will be $1680, as we
predicted using shadow prices. The advantage of shadow prices is that we knew that the
optimal profit would increase to $1680 without having to re-solve the model for the new
number of labor hours.

Important Note: While shadow prices correctly predicted the optimal profit, the
actual solution did not stay the same as in the original problem. Recall that the
original problem has the optimal solution at the point (𝑥1 , 𝑥2 ) = (24,8). Where is
the optimal solution in the revised problem with 60 labor hours available?

(𝑥1 , 𝑥2 ) =

Clearly, the values of the variables have changed, but the optimal solution in both
problems shares a common characteristic. In both problems, the optimal solution
lies at the intersection of the labor and clay constraints. Those constraints intersect
at different points because the constraint RHS values have changed. We can see that
from a graph of the revised problem when 60 hours of labor are available.

26
We just saw that we could use shadow prices to correctly predict the optimal profit when
the labor hours increased by 20 hours. The optimal profit increased by the labor shadow
price of $16 for each additional hour of labor that we obtained. Does this mean that if we
can obtain an additional 100 hours of labor, then our profit will increase by $1600 (from
$1360 to $2980)? Why or why not?

To verify this, we could re-solve the model where the available labor hours increase by 100
(from 40 to 140).

27
We can see that if labor hours increase to 140, optimal profit is only $2000, far less
than an increase of $1600. Why? Because we ran out of clay using only 80 hours of
labor. Any labor beyond that cannot be used to make products.

Essentially, we have changed the labor constraint so much that the optimal solution
will no longer lie at the intersection of the labor and clay constraints. In fact, a graph
of the revised problem shows that the labor constraint has moved so far out that it
does not even touch the feasible region any more, so the labor and clay constraints
no longer intersect.

As we mentioned, shadow price analysis can be very useful, since it allows us to know what
the optimal solution will be for a revised problem without re-solving it. However, we
always need to make sure that we are within the range where the shadow price analysis is
valid. How do we know what the range is?

IMPORTANT RESULT: Shadow prices can only ever be validly considered if the
change in the right-hand-side is within the allowable limits that we discussed
previously. Within these ranges, the shadow prices are valid. If you want to
know the impact of a change beyond that range, you cannot use shadow
prices; instead, you would need to re-solve the model with the new values.

28
3.13 Sensitivity Analysis Using Shadow Prices for Beaver Creek
In our example, the optimal range for labor (𝑞1 ) was 30 ≤ 𝑞1 ≤ 80. If someone asks us how
the profit will change when the available labor is outside of this range, we cannot answer
without re-solving the model. As a result, our shadow price analysis for 60 available hours
was valid, but the analysis for 140 labor hours was not valid.

Similarly, let’s look at what would happen if the number of labor hours decreases from 40
to 32 (perhaps one employee called off sick)? Recall the original optimal profit was $1360.
Is new right-hand-side value in allowable range (30 ≤ 𝑞1 ≤ 80)?

OK to use shadow price analysis?

Value of each labor hour = Shadow price =

Profit changes by (change in RHS value) ∗ (Shadow price) =

New optimal profit =

We can verify this by re-solving the model with a labor right-hand-side value of 32.

If labor hours decrease to 32, optimal profit would be $1232, which matches what we
predicted from shadow prices. The optimal solution changes, but still lies at the
intersection of the labor and clay constraints.

29
What if the available labor decreased from 40 hours to 24 hours (perhaps you had two sick
employees call off from work).

Is new right-hand-side value in allowable range (30 ≤ 𝑞1 ≤ 80)?

OK to use shadow price analysis?

Since the new right-hand-side is outside of the optimality range, we should not use shadow
prices to determine how profit changes. To show you what could go wrong if you did, let’s
just ignore the fact that we are out of the allowable range and use shadow price analysis to
(incorrectly) predict how the profit will change. We will then re-solve the model to see
what actually happens when the labor hours are limited to 24.

Value of each labor hour = Shadow price =

Profit changes by (change in RHS value) ∗ (Shadow price) =

New optimal profit =

Let’s re-solve the model with 24 labor hours to see how the optimal profit actually changes.

30
If labor hours decrease to 24, optimal profit is $960, not $1104. Note that that shadow
prices thought that profit would decrease by $256, but it actually decreased by $400. Since
the optimal solution is not at the intersection of the labor and clay constraints, shadow
prices do not give an accurate prediction about what the revised optimal profit will be.

MORAL: You always needs to check the allowable ranges before you do shadow
price analysis. If the change goes outside the allowable ranges, the results from
shadow price analysis are meaningless.

There are other types of sensitivity analysis that can be performed. See the textbook for
information about how the optimal solution is impacted by changing the coefficients on the
left-hand-sides of constraints, adding new constraints, and adding new variables.

Practice Exercises
Chapter 3 (pages 98-111), Problems: 3, 5, 7 (also determine the sensitivity ranges for the
objective coefficients using graphical analysis), 8, 15, 16, 17, 21, 22, 23, 36, 38, 55, 56, plus
the additional homework problem given below.

Southern Sporting Goods Company makes basketballs and footballs. Each product is
produced from two resources – rubber and leather. The resource requirements for each
product and total resources available are as follows.

Each basketball produced has a profit of $12, and each football earns $16 in profit.
a. Formulate a linear programming model to determine the number of basketballs
and footballs that will maximize profit.
b. Transform the model into standard form.
c. Identify the amount of unused resources (slack) at each of the extreme points.
d. Find the objective function coefficient sensitivity ranges using graphical analysis.
e. Verify the optimal solution and sensitivity ranges using computer software.
f. Using the computer output, either determine the effect on the optimal profit if
500 additional pounds of rubber could be obtained or explain why you cannot
answer the question. Repeat the same analysis if 500 additional square feet of
leather could be obtained.

Reference
Taylor, B. W. (2019). 3: Linear programming: Computer solution and sensitivity analysis.
In Introduction to management science (13th ed., pp. 76-113). Pearson.

31

You might also like