Week 8: Linear Programming: Solver
This week’s big question: real planning problems have dozens of variables and constraints, far too many to draw. How do you solve those? You hand the variables, objective, and constraints to Excel’s Solver, but first you have to understand what makes a plan feasible and what Solver is actually doing.
Before the week
Read: Taylor, Introduction to Management Science (13e), Chapter 3, pp. 97–104. Eight pages, four of them QM for Windows, which this course skips. The chapter PDF is in Canvas Files.
| Pages | Section | This week |
|---|---|---|
| 97–100 | Computer Solution; Excel Spreadsheets | Read. The three cells Solver needs, and what it hands back |
| 100–104 | QM for Windows | Skip, except the passage that opens it (pp. 100–101) on the proper form a constraint must be in, every variable on the left and the constant alone on the right. That is Monday’s standard form; the rest is software this course does not use |
Stop where “Sensitivity Analysis” begins on p. 104. That is Week 9, which reads the second report Solver can print.
Then the warm-up self-check, on an LP’s variables, objective, and constraints:
Session 1: Mon, Oct 12 · From model to spreadsheet
🧩 Puzzle
The tutoring nonprofit. Each week you schedule reading sessions (\(x\)) and math sessions (\(y\)). Each reading session delivers 2 impact points, each math session 3. Room A holds at most 4 reading sessions, Room B at most 5 math sessions, and you have volunteers for at most 7 sessions total. What weekly schedule maximizes impact?
Let \(x\) count reading sessions and \(y\) count math sessions. Maximize their total impact, subject to the room and volunteer limits. These resource rules are the starting part of the model:
\(\max\ 2x + 3y \quad \text{s.t.}\quad x \le 4,\;\; y \le 5,\;\; x + y \le 7,\;\; x, y \ge 0\).
The director also asks you to control spending, record the total session count, and keep reading sessions to no more than twice the math sessions. We will rewrite these three conditions in standard form, then include every one in the worked Solver model.
Build the skill 1: what makes a plan feasible?
Before optimizing, you need to recognize a feasible plan: one that breaks none of the limits. Each constraint divides the plane into “OK” and “not OK”; a plan is feasible only if it is on the right side of every line at once. Drag the dot to try plans and watch which limits turn red:
For these three resource rules, the set of all feasible plans is the feasible region, the area shaded blue in the widget. Its edges are the two axes and the three limit lines: the reading room at \(x = 4\), the math room at \(y = 5\), and the volunteers at \(x + y = 7\). Every point inside it meets these resource limits, and the dot turns red whenever you drag it outside. For this bounded LP, you can find the best plan at a corner, where two boundary lines meet.
A 10-second feasibility check. You do not need a picture to test a single plan. Just substitute it into every constraint. Is the plan 3 reading, 5 math feasible? Check each limit: reading room \(3 \le 4\) ✓, math room \(5 \le 5\) ✓, volunteers \(3 + 5 = 8 > 7\) ✗. One violation is enough to make the plan infeasible, because eight sessions need eight volunteers and you only have seven, however good its impact score would have been. This plug-and-check drill is the whole idea behind the dragging widget.
Build the skill 2: the three cells Solver needs
Solver is an Excel add-in. To enable it in desktop Excel, search for Excel Add-ins, open that command, check Solver Add-in (or Solver), and select OK. On a Mac, use the Help search field to find Excel Add-ins. The home page’s Software & setup list has the same instructions. Search results vary by Excel version. If that command is not returned, use Microsoft’s desktop Solver setup guide.
Illustrated Excel guide: enable Solver with search
These are drawn interface illustrations, using Excel’s command names. Your version’s layout may differ; the setup and cell references are the same.
It does for many variables what the graph did for two, but it cannot read a model written in symbols: the LP has to sit in cells, and each of the model’s three ingredients becomes one sort of cell:
| LP part | In Excel |
|---|---|
| decision variables | changing cells: one cell per variable (\(x\), \(y\), and total \(z\)), the only cells Solver is allowed to alter |
| objective | objective cell: one formula over the changing cells, =2*x + 3*y, and a direction: maximize |
| constraints | constraint cells: one left-hand-side formula per limit, =x, compared to its right-hand side, \(\le 4\) |
Solver chooses the numbers in the changing cells and touches nothing else. The objective cell and the constraint cells are computed from the changing cells, so each time Solver tries a plan they recalculate, and Solver reads them to see how much impact the plan delivers and whether it breaks a limit. Excel’s dialog asks for the same three things in its own words: Set Objective, By Changing Variable Cells (your changing cells), Subject to the Constraints. If you can write the model, you can set up Solver; the skill being assessed is knowing what you asked it to do.
Build the skill 3: put every condition in standard form
A constraint cell holds a formula, and the limit beside it is a plain number. Put the condition in standard form first: all variables on the left, all constants on the right. Some algebraic methods add a slack variable to turn an inequality into an equation. Solver needs no slack variable; here we use Taylor’s variables-left, constant-right convention on p. 100.
The room limits already have that form. Now include the director’s three additional conditions:
| Condition | As first written | Standard form |
|---|---|---|
| Spending on math must not exceed spending on reading; math costs \$30 per session and reading \$25 | \(30y \le 25x\) | \(25x-30y \ge 0\) |
| Choose a total session count \(z\) along with its reading/math split | \(x+y=z\) | \(x+y-z=0\) |
| No more than twice as many reading as math sessions | \(x/y \le 2\) when \(y>0\) | \(x-2y \le 0\) |
The spending row is reading spending minus math spending, in dollars; it must be nonnegative. The total row says the two kinds of session add up to \(z\). Use that total in the volunteer limit, \(z \le 7\). The mix rule is \(x \le 2y\), written with both variables on the left. Unlike the ratio, this linear form also works when \(y=0\): it requires \(x=0\).
These are all requirements of the worked model below. Keep their signs: spending uses \(\ge\), total count uses \(=\), and the mix limit uses \(\le\). Also require \(x,y,z \ge 0\).
Build the skill 4: a worked Solver run (the complete tutoring model)
Translate the complete model into a blank worksheet. Column A holds labels, B the cells Solver reads, C a reminder of the relationship, and D its constant limit. The take-home uses its own addresses and headings; apply the same three roles there.
Click Copy for Excel, select A1 on a blank worksheet, and paste. All ten data rows are copied, including the three conditions you just rewrote. Row numbers and column letters stay on this page.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Reading sessions, x | |||
| 2 | Math sessions, y | |||
| 3 | Total sessions, z | |||
| 4 | Total impact | =2*B1+3*B2 | ||
| 5 | Reading room | =B1 | <= | 4 |
| 6 | Math room | =B2 | <= | 5 |
| 7 | Volunteers | =B3 | <= | 7 |
| 8 | Spending balance | =25*B1-30*B2 | >= | 0 |
| 9 | Total-count balance | =B1+B2-B3 | equal to | 0 |
| 10 | Reading-to-math mix | =B1-2*B2 | <= | 0 |
- Changing cells B1:B3 hold \(x,y,z\). They start empty; Solver chooses all three quantities.
- Objective cell B4 computes impact from the reading and math sessions; set it to Max.
- Constraint cells B5:B10 compute every condition, including the spending, total-count, and mix rows.
The total \(z\) is a changing cell, not a formula: the equality in row 9 forces Solver to choose a total that agrees with \(x+y\). The volunteer row then compares that total with seven. B4:B10 must be formulas, so they respond when you change B1:B3.
Test the formulas before Solve. Enter \(x=3,y=5,z=8\) in B1:B3. Impact is 21. The six condition values in B5:B10 are 3, 5, 8, -75, 0, -7: volunteers exceed seven, and the spending balance is below zero. Both violations make the plan infeasible. Now enter 4, 2, 6. Impact is 14, and B5:B10 read 4, 2, 6, 40, 0, 0; every condition passes. If a formula stays fixed, repair its references. After checking, set B1:B3 to zero so you can watch Solver choose the plan.
Search for Solver to open it; use Help search on a Mac. Set Objective B4, select Max, and set By Changing Variable Cells to B1:B3. Enter all four relationship groups below; the first group adds three resource conditions, so there are six conditions altogether:
| Cell Reference | Relationship | Constraint | Conditions |
|---|---|---|---|
| B5:B7 | <= | D5:D7 | Reading room, math room, volunteers |
| B8 | >= | D8 | Spending balance |
| B9 | = | D9 | Total-count equality |
| B10 | <= | D10 | Reading-to-math mix |
Tick Make Unconstrained Variables Non-Negative and choose Simplex LP. Column C is a label; you must enter the relationships in Solver’s dialog. Each worksheet has its own Solver settings.
Illustrated Excel guide: build and solve the complete model
Use Copy for Excel above, or the Tutoring tab in the ungraded demo workbook. Both put the complete model in A1:D10. These are labelled interface illustrations; select one for its full-size picture.
Before Solve, a guess. The infeasible plan scores 21; the feasible test scores 14. Which is a valid starting plan, and could Solver improve on its 14 points?
Press Solve. It chooses approximately 3.818182 reading sessions, 3.181818 math sessions, and seven total sessions, for 17.181818 impact points. Exactly, \(x=42/11,\quad y=35/11,\quad z=7\). The three quantities agree: \(x+y=z=7\). Reading and math spending both equal \(1{,}050/11\) dollars, and \(x-2y=-28/11 \le 0\), so the mix rule also passes. Both room limits are met. Every condition you rewrote has been used in the solve, and all six can be checked in its report on Wednesday.
Keep Excel’s unrounded values when checking these conditions. The method also works with many variables that you cannot graph; this small example lets you inspect every formula and condition.
In practice: a model is only as good as its inputs
- Where do the coefficients come from? “2 impact points per reading session” is an estimate. If it is really a range, your optimum may shift. Wednesday drags it to see how far.
- Whole numbers. The complete model returns fractional session counts. That is allowed in an LP, but may not fit how the nonprofit runs sessions. Rounding the reading count up to 4 while keeping math at 35/11 would require 79/11 sessions, more than the seven volunteer slots. Whole-session decisions need integer programming, which Week 10 takes up.
- The four quiet assumptions. Every LP rests on four things being true: proportionality (twice the sessions, twice the impact; no economies of scale), additivity (the total is the sum of the parts, with no interaction between \(x\) and \(y\)), divisibility (fractional values are allowed), and certainty (the coefficients are known, not guessed). If returns diminish, if two activities interfere, or if your numbers are really rough estimates, the model can give a confident-looking answer that is wrong.
Back to the puzzle
With all six conditions, the best plan is 42/11 reading sessions and 35/11 math sessions, with seven total sessions and 189/11, about 17.18, impact points. Solver chooses three changing cells; seven formulas compute the objective and check the conditions. The spending, total-count and mix rules from standard form all remain in this model. Wednesday reads its Answer Report and uses a clearly labelled resource-only comparison to explain the corner walk and sensitivity.
In-class group practice (wrap-up)
To close Session 1, formulate a small LP together and map it onto Solver’s three cells.
Write every member’s name on the sheet. You have 15 minutes for the practice, then two minutes to photograph your group’s own attempt before the solutions are shown. One member uploads the photo to Canvas by the end of class; participation credit is for attempting the work.
The instructor uses the final eight minutes to demonstrate the handout’s method, check the main results with units, and explain a common mistake. This demonstration closes the session.
- Download: Week 8 group practice (Word)
Session 2: Wed, Oct 14 · Solver finds the optimum, and explains it
🧩 Puzzle
Monday’s complete Tutoring model returned about 3.818 reading sessions, 3.182 math sessions, seven total sessions and 17.18 impact points. A director will ask why that plan is best, what limits it, and what would change it. How do you explain Solver’s answer?
First, use a resource-only comparison to see the corner walk on a two-dimensional graph. Set aside spending and the reading-to-math rule for this comparison, and substitute \(z=x+y\) into the volunteer limit. The remaining limits are \(x \le 4\), \(y \le 5\) and \(x+y \le 7\). The demo workbook’s Resource-only tab keeps the same cell addresses; configure B5:B7 <= D5:D7 and B9 = D9 for this comparison. Then return to the complete model’s report, which includes all six conditions from Monday.
Build the skill 1: Solver walks the corners
For this bounded, nonempty LP, at least one corner attains the best value. The Simplex LP method searches along edges between corners. The resource-only region has five corners, and you can score every one with \(Z = 2x + 3y\): \((0, 0)\) at 0, \((4, 0)\) at 8, \((4, 3)\) at 17, \((2, 5)\) at 19, and \((0, 5)\) at 15. An illustrative simplex walk visits fewer corners. Start at the origin, \(Z = 0\), where two edges leave: along one, each reading session adds 2 points; along the other, each math session adds 3. It takes the faster climb, math, straight up until the math room is full at \((0, 5)\), where \(Z = 15\). From there the only edge that climbs runs along the top, adding reading sessions at 2 points each, until the volunteers run out at \((2, 5)\), where \(Z = 19\). At \((2, 5)\) both edges lead down, back to \((0, 5)\) at 15 or on to \((4, 3)\) at 17. No neighboring corner scores higher, so it stops: two hops, and it never visits \((4, 0)\) or \((4, 3)\). That improving corner walk illustrates the Simplex Method, the Simplex LP method in the dialog. Excel may take a different route because of its starting basis and preprocessing; the widget shows one valid route. Press Walk corners below and the marker takes the same route, stopping at the origin, at \((0, 5)\) and at \((2, 5)\), and leaves the two edges it travels and each stop’s \(Z\) on the chart. Then press Maximize to slide the objective line out to that same corner. Two views of one fact: the best plan is a corner, and it is that one.
Use Check a value at 0, 15, and 19 to revisit the three objective levels on the walk. Then test 20: can the model reach it?
The resource-only optimum is 2 reading and 5 math sessions, for 19 impact points. The walk says which corner is best; it does not say which limits are holding that schedule there. Next read the complete model’s report, then compare the two sets of requirements.
Build the skill 2: read the Answer Report
When Solver finishes, choose Keep Solver Solution, select Answer in Reports, then OK. Excel creates a report with three sections: the objective value, the changing-cell values, and each condition’s value, status and slack. Binding means the condition holds with equality at this plan; its slack is zero. For a resource cap, slack is the available amount minus the amount used.
Here is the complete model from Monday, with all six conditions. Values are rounded to six decimals:
| Section | Item | Value | Status | Slack |
|---|---|---|---|---|
| Objective cell | Impact, B4 | 17.181818 | ||
| Variable cells | Reading x, B1 | 3.818182 | ||
| Variable cells | Math y, B2 | 3.181818 | ||
| Variable cells | Total z, B3 | 7 | ||
| Conditions | Reading room, B5 <= D5 | 3.818182 | Not Binding | 0.181818 |
| Conditions | Math room, B6 <= D6 | 3.181818 | Not Binding | 1.818182 |
| Conditions | Volunteers, B7 <= D7 | 7 | Binding | 0 |
| Conditions | Spending balance, B8 >= D8 | 0 | Binding | 0 |
| Conditions | Total-count balance, B9 = D9 | 0 | Binding | 0 |
| Conditions | Reading-to-math mix, B10 <= D10 | -2.545455 | Not Binding | 2.545455 |
Reading-room and math-room slack are unused session slots. Spending balance is in dollars. The total-count row is an equality that defines \(z=x+y\); it is binding because that definition must hold, not because it is another resource you could buy. The mix row \(x-2y \le 0\) has \(28/11\) sessions of slack: the reading count is that far below twice the math count. Every standard-form condition appears in this report.
Illustrated Excel guide: keep the solution and read the complete report
These are drawn interface illustrations of the complete Tutoring model. Select one for its full-size picture.
Compare with the resource-only model used in the graph. In that comparison, spending and the mix rule are set aside, while \(z=x+y\) still defines the total. Its best plan is \((x,y,z)=(2,5,7)\), for 19 impact points. Its resource rows read:
| Resource | Used | Available | Slack | Status |
|---|---|---|---|---|
| Reading room | 2 | 4 | 2 | Not Binding |
| Math room | 5 | 5 | 0 | Binding |
| Volunteers | 7 | 7 | 0 | Binding |
This comparison shows why you must read the report for the model you actually solved. The two sets of requirements produce different plans and binding conditions. In the resource-only case, extra reading-room capacity alone adds no impact; the math room and volunteers are the resources to investigate. We use this smaller case for the sensitivity preview next, so you can see each change on the graph.
Build the skill 3: what if a coefficient changes?
For the resource-only comparison, the impact of a reading session is an estimate. Suppose it rose from 2 to exactly 3. Does the best schedule change, and to what? Drag the impact per reading session slider and watch the optimal corner:
Use Check a value at 2, 3, and 4. Predict a corner or a tied edge before each click, and explain why the feasible region stays fixed.
At 3, a tie. The objective is now \(3x + 3y = 3(x + y)\), and every point on the volunteer edge has \(x + y = 7\), so it scores 21 at \((2, 5)\), at \((4, 3)\), and all along the edge between them. When the objective line runs parallel to a binding edge, every point along that edge is optimal. These are multiple optima. Taylor’s heading for the case is multiple optimal solutions, and he calls the two tied corners the alternate optimal solutions. The widget draws the tied edge and names it. Solver does not: its Answer Report prints only the one corner it stopped on, so a tie is yours to spot.
Past 3 it jumps to \((4, 3)\), and at an impact of 4 the line \(4x + 3y = 25\) touches \((4, 3)\) alone. Drag the other way and the plan stays at \((2, 5)\): its two reading sessions run on volunteers the full math room cannot use, so they add impact at any value above 0. Only at exactly 0 does the line lie flat along the math-room edge, where \((0, 5)\) ties: the same case on the other binding edge. The corner never drifts; it stays or it jumps. So “a linear program has exactly one optimal point” is false, and a tie like this is the standard counterexample. How far a coefficient can move before the corner jumps is sensitivity analysis, and it is Week 9’s first question.
A preview of Week 9: what is one more unit of a bottleneck worth? Move a limit instead of a coefficient, on the same region. One more volunteer slot (relax \(x + y \le 7\) to \(\le 8\)): the line moves out one, the corner slides to \((3,5)\), and impact rises from 19 to 21. That one extra slot bought 2 impact points. One more reading slot (\(x \le 5\) instead of \(\le 4\)): the line moves out one, the corner stays at \((2,5)\), and 19 stays 19. Worth 0. That 2 is the volunteer constraint’s shadow price: what one more unit of your bottleneck is worth to the objective. A slack resource is worth nothing more at the margin, which is what the 0 says. Next week’s report prints these for every constraint, and says over what range they hold.
Read the two endpoints and distinguish the two kinds of change
The original plan \((2,5)\) earns \(2c+15\) when a reading session is worth \(c\) impact points. The competing corners \((0,5)\) and \((4,3)\) earn 15 and \(4c+9\). Comparing those totals gives \(0 \le c \le 3\): inside the band the same plan wins, and at either endpoint another corner ties. The objective-line tilt changes which plan is best without moving any resource boundary.
An extra volunteer changes the boundary instead. At 7 volunteer slots the best plan is \((2,5)\) for 19 impact points; at 8 it is \((3,5)\) for 21; at 9 it is \((4,5)\) for 23. Each extra slot in that interval adds 2 impact points. Beyond 9, both rooms are full, so more volunteers add nothing. That is why a shadow price has a range. Week 9 develops the full Sensitivity Report; this is its foundation, and the midterm still draws its questions from the existing Weeks 1–8 self-checks and take-home items.
In practice: read the report, not just the number
- Infeasible or unbounded. For a linear model solved with Simplex LP, “could not find a feasible solution” means no plan satisfies all the entered constraints. “The objective cell values do not converge” means the objective can keep improving without a finite best value. Check the formulas and constraints first: infeasibility can reflect genuinely conflicting requirements, while an unbounded objective often reveals a missing limit.
- Spend effort on what binds. Investigate binding resource limits, then re-solve to see whether more capacity helps. Loosening a resource cap with slack adds no impact by itself. In the resource-only comparison, two more volunteers would move the schedule to \((4, 5)\) and fill the reading room too. Re-read the report after every change.
- The map is not the territory. Solver optimizes your model. If the model omits something real (equity, morale, a soft limit), the “optimal” plan may be a poor decision. Sanity-check the plan against the things the model was never told.
Back to the puzzle
The complete model gives 42/11 reading, 35/11 math and seven total sessions, for 189/11, about 17.18, impact points. Its report includes all six conditions; both rooms have slack, while volunteers, the spending balance and the total-count equality bind. The reading-to-math rule is met with slack.
The resource-only comparison gives 2 reading, 5 math, seven total sessions and 19 impact points. That is the case used in the graph and sensitivity preview: its math room and volunteers bind, and its reading room has two spare slots. One more volunteer adds two impact points within the range we checked; more reading-room capacity alone adds none. These figures describe that smaller model. The director’s full requirements still call for the complete plan, so name which conditions you enforced when you report your answer.
After-class check
Questions spanning feasibility, the Solver setup, standard form, the simplex method, reading the Answer Report, binding constraints and slack, multiple optima, and the four LP assumptions. Retry freely; nothing is submitted. The tutoring questions use Wednesday’s resource-only comparison.
Weekly take-home (graded: submit on Canvas)
This week’s take-home is an LP solved in Solver for a city public-works department planning a month of street repairs, and when you open the model sheet, nothing on it computes anything. In the Your model block you define the variables and write the objective and all three constraints from the brief, converting a labor pool quoted in worker-days, and name which cells will play Solver’s three roles. You then test one plan by hand, write the objective and constraint cells as live Excel formulas of your own, run Solver, and read its Answer Report to find which limits bind and which one has room to spare. One short recommendation plus the required AI-use disclosure go on the Free responses sheet. Upload the completed .xlsx on Canvas. That one file is your entire submission.
AI use. Tier 1: AI is allowed as a tool here, provided you disclose it on the Free responses sheet and could rebuild and modify the model unaided on an exam. See Using AI.
Audit the AI’s model (optional practice: Tier 2)
A community health clinic asked an AI assistant to build a scheduling LP of its own, a separate case from your graded take-home. It produced a model, ran Solver, and recommended running no flu-shot clinics at all, and its model contains exactly one error. Download the companion workbook, find and fix the flaw, re-solve, and work out what the mistake would have cost the clinic.
Optional and ungraded, but it is excellent preparation for an exam, and the most realistic task in the course: in practice you will inherit someone else’s model far more often than you build one from scratch. AI is allowed and encouraged here (Tier 2. See Using AI).