How to do sensitivity analysis in linear programming?

Solving a linear program once gives you a single “best” solution for a specific set of numbers. Sensitivity analysis asks the deeper question: How does this optimal solution behave when costs, capacities, or demands change? In real business and operations settings, those inputs are never fixed, so understanding sensitivity is what turns a mathematical solution into a robust decision.

On this page, we’ll explain what sensitivity analysis tells you, why it matters for managers and analysts, and walk through a concrete numerical example. If you want help interpreting your own Solver output, you can also explore:


1. What Sensitivity Analysis Answers That a Single LP Solution Cannot

A standard LP solution answers: “What is optimal for these exact numbers?” Sensitivity analysis answers questions like:

  • Objective coefficients: How much can profits or costs change before the optimal basis changes?
  • Right-hand sides (capacities/demand): How valuable is one more unit of a resource?
  • Structure of the solution: Which constraints are binding, and which variables are “almost” attractive?

Without sensitivity analysis, you risk over-trusting a solution that may flip as soon as a price, demand forecast, or capacity estimate moves slightly.


2. Key Concepts in Sensitivity Analysis

2.1 Binding vs. Nonbinding Constraints

A constraint is binding if it holds with equality at the optimal solution; it directly shapes the optimal corner point. A nonbinding constraint has slack and does not affect the current optimum.

Sensitivity analysis tells you:

  • Which resources are truly scarce (binding constraints).
  • Which resources have slack and could be reduced without changing the solution.
  • How much you can tighten or relax each constraint before the optimal basis changes.

2.2 Shadow Prices (Dual Values)

The shadow price of a constraint is the rate at which the optimal objective value improves if you increase the right-hand side (RHS) of that constraint by one unit, holding everything else constant (within a valid range).

Managerially, shadow prices answer: “If I could buy one more unit of this resource, how much extra profit (or cost savings) would I gain?”

2.3 Reduced Costs

The reduced cost of a decision variable that is currently zero tells you how much its objective coefficient would need to improve before it becomes attractive to include in the solution.

  • If a variable is at zero and has a positive reduced cost in a maximization problem, its profit per unit must increase by at least that amount to enter the basis.
  • Reduced costs explain why some products, routes, or projects are excluded from the optimal plan.

2.4 Allowable Ranges

Sensitivity reports typically show:

  • Allowable increase/decrease for objective coefficients (how far you can move a profit or cost before the basis changes).
  • Allowable increase/decrease for RHS values (how far you can change capacities or demands while keeping the same shadow price).

These ranges tell you how “stable” your solution is under parameter changes.


3. Numerical Example: Product Mix with Sensitivity Analysis

Consider a small product mix problem. A firm produces two products, \(x_1\) and \(x_2\), using two resources: machine time and labor hours.

3.1 Model Formulation

Decision variables

  • \(x_1\): units of Product 1 to produce
  • \(x_2\): units of Product 2 to produce

Objective (maximize profit)

Profit per unit: Product 1 = 40, Product 2 = 30.

Maximize: \[ Z = 40x_1 + 30x_2 \]

Constraints

  • Machine time: each unit of Product 1 uses 2 hours, Product 2 uses 1 hour, and there are 100 hours available. \[ 2x_1 + x_2 \le 100 \]
  • Labor: each unit of Product 1 uses 1 hour, Product 2 uses 1 hour, and there are 80 hours available. \[ x_1 + x_2 \le 80 \]
  • Nonnegativity: \(x_1, x_2 \ge 0\)

3.2 Solving the LP

We can solve this graphically or via Simplex. The intersection of the two constraints is found by solving:

2x₁ + x₂ = 100
x₁ + x₂ = 80
  

Subtract the second equation from the first:

(2x₁ + x₂) - (x₁ + x₂) = 100 - 80
x₁ = 20
  

Substitute back into \(x_1 + x_2 = 80\):

20 + x₂ = 80  ⇒  x₂ = 60
  

So one candidate corner point is \((x_1, x_2) = (20, 60)\). Check the other corners:

  • Corner A: \((0, 0)\) ⇒ \(Z = 0\)
  • Corner B: machine-only intersection with \(x_2 = 0\):
    2x₁ = 100 ⇒ x₁ = 50 ⇒ Z = 40(50) + 30(0) = 2000
  • Corner C: labor-only intersection with \(x_2 = 0\):
    x₁ = 80 ⇒ Z = 40(80) = 3200 (but this violates machine time: 2·80 = 160 > 100)
  • Corner D: intersection of both constraints:
    (x₁, x₂) = (20, 60) ⇒ Z = 40(20) + 30(60) = 800 + 1800 = 2600

The feasible corners are \((0,0)\), \((50,0)\), and \((20,60)\). The best objective value is \(Z = 2600\) at \((x_1, x_2) = (20, 60)\).

At this optimum:

  • Machine time: \(2(20) + 60 = 100\) (binding)
  • Labor: \(20 + 60 = 80\) (binding)

4. Interpreting Sensitivity Information for the Example

4.1 Shadow Prices for the Constraints

Because both constraints are binding, each has a positive shadow price in a maximization problem. Intuitively:

  • Machine time shadow price: the increase in optimal profit if we add one more hour of machine time.
  • Labor shadow price: the increase in optimal profit if we add one more hour of labor.

Suppose a Solver sensitivity report gives:

  • Shadow price for machine time: 10
  • Shadow price for labor: 20

Interpretation:

  • If we can buy 1 extra hour of machine time (within the allowable range), the optimal profit increases by 10.
  • If we can buy 1 extra hour of labor (within its allowable range), the optimal profit increases by 20.

If labor’s shadow price is higher, labor is the more valuable resource at the margin. This helps managers decide which capacity expansion is more profitable.

4.2 Allowable Range for a Right-Hand Side

The sensitivity report also shows how far we can change a RHS before the shadow price changes. For example, if the labor constraint has:

  • Current RHS: 80 hours
  • Allowable increase: 20 hours
  • Allowable decrease: 10 hours

Then:

  • As long as labor capacity stays between 70 and 100 hours, the same basis remains optimal and the shadow price of 20 is valid.
  • Beyond that range, the structure of the solution changes and a new shadow price applies.

4.3 Sensitivity of Objective Coefficients

Now consider the profit of Product 1 (currently 40). The sensitivity report might show:

  • Allowable increase: 15
  • Allowable decrease: 10

This means:

  • As long as Product 1’s profit stays between 30 and 55, the current optimal basis (producing both products) remains optimal.
  • If the profit drops below 30 or rises above 55, the optimal mix may change (e.g., more of one product, less of the other, or a corner solution).

4.4 Reduced Costs for a Zero Variable

In this example, both \(x_1\) and \(x_2\) are positive at the optimum, so their reduced costs are zero. If we had a third product \(x_3\) that ended up at zero, its reduced cost would tell us how much its profit per unit must increase before it becomes attractive to produce.

For instance, if the reduced cost of \(x_3\) is 8 in a maximization problem, then its profit per unit must increase by at least 8 for \(x_3\) to enter the optimal solution.


5. Why This Matters in Practice

Sensitivity analysis is not just a technical add-on; it is the bridge between a mathematical model and real managerial decisions:

  • Pricing and product mix: Understand how robust your mix is to changes in contribution margins.
  • Capacity planning: Use shadow prices to prioritize which resources to expand.
  • Scenario planning: Test “what-if” changes in demand, costs, and capacities without rebuilding the model from scratch.
  • Risk management: Identify models that are highly sensitive to small parameter changes and may require more conservative

    Speak Directly to a Tutor — Send Your Message Below

    No call centers. No delays. Your message goes straight to the tutor.

    Get help with linear programming, simplex method, corner points, BFS, and optimization theory.