Learning objectives
- Formulate a constrained allocation problem with a stated objective, decision variables, and units on every constraint
- Solve a two-variable linear program by evaluating corner points and verify the answer using the dual
- Interpret shadow prices and their valid ranges as buy-or-not decisions about capacity
Formulation is most of the work
A linear program has three parts: decision variables, an objective that is linear in them, and constraints that are linear inequalities. Formulation deserves careful checking, especially the units of every variable and constraint. Every constraint must balance in a single unit on both sides. A machine capacity constraint is measured in machine hours per week, so each coefficient must be machine hours per unit of product and the right-hand side must be machine hours available per week. Writing the units beside every coefficient catches the majority of formulation bugs before any solver is opened. The objective should be contribution, not gross revenue and not fully absorbed profit. Contribution is price minus variable cost, and it is the correct objective because fixed costs are unaffected by the mix decision and allocated overhead is an accounting artefact that can invert the ranking of products. Also check feasibility and boundedness by inspection: if the constraints are contradictory there is no solution, and if a profitable variable faces no binding limit the model will drive it to infinity, which always signals a missing constraint such as market demand rather than an infinitely profitable product.
Corner points and why the optimum lives at one
For a two-variable linear program the feasible region is a polygon in the plane, formed by intersecting the half-planes defined by each constraint. Because the objective is linear, its contours are parallel straight lines, and sliding a contour as far as possible in the improving direction always leaves the feasible region last at a corner. This is the fundamental theorem of linear programming: if an optimum exists, one occurs at an extreme point. That turns a search over infinitely many feasible plans into a finite check, which is what makes hand solution possible. Enumerate the corners by taking the constraints two at a time, solve each pair of simultaneous equations, discard any intersection that violates another constraint, evaluate the objective at each surviving corner, and take the best. A constraint is binding at the optimum if it holds with equality there, meaning the resource is fully consumed; otherwise it has slack. This distinction drives everything that follows, because only binding constraints can have a positive value attached to relaxing them.
Shadow prices and the ranges over which they hold
The shadow price of a constraint is the improvement in the objective from one additional unit of that resource, holding everything else fixed. It answers a real purchasing question: what is one more machine hour worth. Compare the shadow price against the market price of the resource, and buy if and only if the shadow price is higher. Three properties are essential. First, a non-binding constraint has a shadow price of zero, because slack capacity is already going unused and more of it changes nothing. Second, shadow prices are valid only over a range of the right-hand side; beyond that range a different constraint becomes binding, the optimal corner changes, and the marginal value drops. Quoting a shadow price without its range is a misuse of sensitivity output, because it invites a manager to multiply it by a large capacity purchase and forecast a gain that will not materialise. Third, there is a parallel range on the objective coefficients: the current plan stays optimal only while each contribution margin stays within a band, and a product whose margin sits near the edge of its band signals a plan that a modest price or cost change would overturn.
Worked example
Problem
A hypothetical workshop makes two products. Product A contributes 30 dollars per unit and product B contributes 50 dollars per unit. Each unit of A needs 2 machine hours and 3 labour hours; each unit of B needs 4 machine hours and 2 labour hours. Available per week are 800 machine hours and 900 labour hours. Find the weekly production plan that maximises contribution, compute the shadow price of each resource, verify with the dual, determine the range over which the machine shadow price holds, and advise on renting extra machine capacity at 8 dollars per hour and overtime labour at 18 dollars per hour.
Step by step
- Formulate. Let A and B be units produced per week. Maximise 30A + 50B dollars per week, subject to machine hours 2A + 4B at most 800 hours per week, labour hours 3A + 2B at most 900 hours per week, and A, B at least 0.
- Corner 1, the origin: A = 0, B = 0, contribution 0.
- Corner 2, A = 0. Machine allows B up to 800 / 4 = 200; labour allows B up to 900 / 2 = 450. The binding limit is 200. Contribution = 50 x 200 = 10,000 dollars per week.
- Corner 3, B = 0. Machine allows A up to 800 / 2 = 400; labour allows A up to 900 / 3 = 300. The binding limit is 300. Contribution = 30 x 300 = 9,000 dollars per week.
- Corner 4, both constraints binding. Divide the machine equation by 2: A + 2B = 400. The labour equation is 3A + 2B = 900. Subtracting gives 2A = 500, so A = 250, and then 250 + 2B = 400 gives B = 75.
- Check corner 4 against both constraints: machine 2(250) + 4(75) = 500 + 300 = 800 hours, exactly the limit; labour 3(250) + 2(75) = 750 + 150 = 900 hours, exactly the limit. Both bind.
- Contribution at corner 4 = 30 x 250 + 50 x 75 = 7,500 + 3,750 = 11,250 dollars per week, which beats 10,000 and 9,000, so the optimum is A = 250, B = 75.
- Shadow prices from the dual. Let y1 be the value of a machine hour and y2 the value of a labour hour. Since both constraints bind, the dual constraints hold with equality for both products: 2y1 + 3y2 = 30 for A, and 4y1 + 2y2 = 50 for B.
- Solve. From the first, y2 = (30 - 2y1) / 3. Substituting into the second: 4y1 + 2(30 - 2y1) / 3 = 50. Multiply through by 3: 12y1 + 60 - 4y1 = 150, so 8y1 = 90 and y1 = 11.25 dollars per machine hour. Then y2 = (30 - 22.5) / 3 = 7.5 / 3 = 2.50 dollars per labour hour.
- Verify by strong duality. The dual objective is 800y1 + 900y2 = 800 x 11.25 + 900 x 2.50 = 9,000 + 2,250 = 11,250 dollars, which equals the primal optimum, confirming both solutions.
- Range for the machine shadow price. Let M be machine hours. Solving A + 2B = M / 2 together with 3A + 2B = 900 gives 2A = 900 - M / 2, so A = 450 - M / 4, and B = 0.375M - 225. Requiring A at least 0 gives M at most 1,800; requiring B at least 0 gives M at least 600. So the shadow price of 11.25 dollars holds for machine hours between 600 and 1,800, a range of 200 hours below and 1,000 hours above the current 800.
- Check the shadow price directly. Contribution as a function of M = 30(450 - M / 4) + 50(0.375M - 225) = 13,500 - 7.5M + 18.75M - 11,250 = 2,250 + 11.25M. The slope is 11.25 dollars per machine hour, and at M = 800 it gives 2,250 + 9,000 = 11,250, matching.
- Rental decision. Machine capacity rents at 8 dollars per hour against a shadow price of 11.25, so each rented hour nets 3.25 dollars. Renting 200 extra hours gains 200 x 3.25 = 650 dollars per week, but 200 is not the limit: every hour up to the 1,800 machine hour end of the valid range earns the same 3.25 dollars, so the profit-maximising rental is the full 1,000 extra hours for 1,000 x 3.25 = 3,250 dollars per week. Beyond 1,800 hours the shadow price falls to zero and further rental is a pure loss.
- Overtime decision. Labour overtime costs 18 dollars per hour against a shadow price of 2.50, so each overtime hour loses 15.50 dollars. Do not buy overtime.
- Objective coefficient range for product A. In the A-B plane the machine constraint has slope -1/2 and the labour constraint has slope -3/2, while the objective contour has slope -30/50 = -0.6. Corner 4 stays optimal while the ratio of A's margin to B's stays between 0.5 and 1.5, so with B fixed at 50 dollars, A's margin may range from 25 to 75 dollars. Check the lower edge: at 24 dollars, corner 4 yields 24 x 250 + 3,750 = 9,750 while corner 2 yields 10,000, so the plan flips to all-B, as predicted.
Answer. Produce 250 units of A and 75 units of B per week for 11,250 dollars of weekly contribution, with both machine and labour capacity fully consumed. The shadow prices are 11.25 dollars per machine hour and 2.50 dollars per labour hour, confirmed by the dual objective of 800 x 11.25 + 900 x 2.50 = 11,250 dollars. Rent extra machine capacity at 8 dollars per hour, gaining 3.25 dollars per hour up to the 1,800 hour limit of the valid range; do not buy labour overtime at 18 dollars per hour, since labour hours are worth only 2.50. The plan is also fragile in one direction worth flagging: product A's contribution of 30 dollars sits close to the lower edge of its 25 to 75 dollar range, so a fall of just over 5 dollars per unit in A's contribution, about 17 percent of that margin, would make the current mix suboptimal and shift production entirely to B. Note that this is 17 percent of A's contribution, not of A's cost; the cost increase that would erode the margin by 5 dollars depends on A's variable cost, which the problem does not state. All figures are per week and assume linear, deterministic production with no setup times, no minimum batch sizes, and unlimited demand for both products, none of which holds exactly in practice.
Practice
Work each question before opening the solution.
-
Using the workshop above, compute the new optimal contribution if machine hours rise from 800 to 900, and confirm your answer against the shadow price.
Show solution for question 1
Since 900 lies inside the valid range of 600 to 1,800, the shadow price of 11.25 dollars per hour applies to the full 100 extra hours, so contribution rises by 100 x 11.25 = 1,125 dollars to 12,375 dollars per week. Confirming from the formula, contribution = 2,250 + 11.25 x 900 = 2,250 + 10,125 = 12,375. The new plan is A = 450 - 900 / 4 = 225 units and B = 0.375 x 900 - 225 = 112.5 units; if only whole units can be made, this needs an integer rounding step and the true integer optimum will be slightly lower.
-
A third resource, packaging capacity of 1,000 units per week, is added to the workshop problem. Is it binding at the optimum, what is its shadow price, and what would you tell a manager who proposes expanding it?
Show solution for question 2
Total output at the optimum is 250 + 75 = 325 units per week against a limit of 1,000, so the constraint has 675 units of slack and is not binding. Its shadow price is zero. Tell the manager that expanding packaging capacity would add nothing to contribution, because packaging is not what limits the plan; the bottleneck is machine hours at 11.25 dollars per hour and labour at 2.50. Investment aimed at the non-binding resource is a common and expensive error, since spending follows visible activity rather than the actual constraint.
-
A consultant reports a shadow price of 11.25 dollars per machine hour and recommends buying 2,000 extra hours, projecting a gain of 22,500 dollars per week. What is wrong with the projection and what is the correct figure?
Show solution for question 3
The shadow price is valid only up to 1,800 machine hours, that is, 1,000 hours above the current 800. Beyond that point labour becomes the sole binding constraint, product A drops to zero, and further machine hours are worth nothing. The correct gain is 1,000 x 11.25 = 11,250 dollars per week from the first 1,000 hours and zero from the next 1,000, so 11,250 rather than 22,500. This is why a shadow price must always be quoted with its valid range.