11.5 Solver (Brief)
Find the best plan inside real limits
A grocery store has sixty cold-room slots. Fruit earns more modeled contribution per crate than milk. A buyer who fills every slot with fruit would exceed the supplier limit and fail the daily minimum stock of milk. The decision is not just which product has the greater unit value. It is how many whole crates of each product fit all the rules and give the best objective. Excel Solver lets you write that kind of problem using worksheet formulas and explicit constraints.
This lesson uses fictional Kothrud store and bakery planning data. The real product names that might appear in a grocery store are familiar references, and none of the figures describes an actual company or market. You will build the original cold-room crate model, verify its unique best plan with a simple mathematical bound, then test a three-product extension and a separate case where many plans tie. The worksheets provide a way to reproduce an answer without relying on a result dialogue alone.
Define the objective, editable quantities and constraints before running Solver. Verify any returned quantities, overall result and every limit independently.
Know the three parts of an optimization model
- Objective. The main formula you want to maximize, minimize or reach. The first objective is modeled daily contribution in rupees.
- Decision variables. The editable cells Solver can change. Initially they are the numbers of milk and fruit crates.
- Constraints. Statements each allowed plan must satisfy. Space, supply, minimum stock, nonnegative quantities and whole numbers are examples.
Goal Seek adjusts one input toward a target. Solver can apply a set of limits and choose among several candidate decision quantities that affect the objective. A two-variable Data Table can show the results for selected pairs, including ones that exceed capacity. Solver can work with the permitted space you define. It still uses only the constraints you actually enter. If a staffing or equipment limit matters, write it as a reviewed rule rather than expecting Excel to infer it.
Build the original crate model
Write down the decision and the units
Create a disposable sheet named Crates. The decision variables B2 and B3 are whole daily crates. B5 totals their occupied slots, assuming each crate occupies exactly one slot. B6 measures the modeled contribution of the chosen crates with ₹180 for milk and ₹260 for fruit. Contribution means the specified amount left after the relevant variable costs in the practice case. It is a planning measure. Any rent, spoilage or other costs not included need separate review before calling the result net profit.
| Cell | Meaning | Enter |
|---|---|---|
| B2 | Milk crates | 20 |
| B3 | Fruit crates | 20 |
| B5 | Cold-room slots used | =B2+B3 |
| B6 | Modeled contribution ₹ per day | =180*B2+260*B3 |
Twenty milk and twenty fruit use forty slots. Their modeled contribution is 20 × ₹180 plus 20 × ₹260, or ₹8,800. It is a valid starting plan. The constraint limit on B5 is at most 60. Fruit B3 may be at most 25. Milk B2 must be at least 20. Both must be nonnegative integers. Int in Solver means whole-number decision values. A fractional crate or one with negative count fails the business rules even if the objective looks attractive.
Check examples of feasible and infeasible plans
A feasible plan satisfies every applicable constraint. Twenty milk and twenty-five fruit satisfy all limits and leave 15 slots. Thirty-six milk and twenty-five fruit use 61 and fail the space rule. Thirty-four milk and twenty-six fruit fit in 60 but exceed the fruit limit. Nineteen milk and twenty-five fruit fit the room and supplier limit but fail the milk minimum. Keep these examples in Notes to catch a missing constraint before trusting a high result.
Translate the shop's limits into spreadsheet inequalities
When the manager says “there are sixty slots,” it means no accepted plan can require more than 60. Enter total used at most 60. It does not mean every plan must use exactly 60. With all positive modeled contributions the best plan here fills the room, which we can prove from the objective. A different model with a loss-making product or unchanged fixed cost may leave unused capacity. Let the constraints state the real limits and let the objective choose how much use is worthwhile.
“At least twenty milk crates” becomes milk greater than or equal to 20. “At most twenty-five fruit crates” becomes fruit less than or equal to 25. Keep the inequality direction clear. If you type fruit at least 25 by mistake, a result can use more fruit and appear financially better while contradicting the supplier allocation. Enter one intentional example that would violate each rule and verify its observed constraint status before authorizing a plan.
A binding constraint sits exactly on its limit at the returned answer. In the original optimum occupied space equals 60 and fruit equals 25. The minimum milk constraint has 15 crates above minimum. That extra difference can be called slack for this greater-than condition. A useful review lists applied limits and actual use. This tells the store manager which assumptions are exhausted and which currently have room, without assuming relaxing a limit will always change the optimum.
Lab 1. Configure Solver and check the crate plan
Load the desktop add-in in a supported client
Microsoft describes loading the Solver Add-in in supported desktop Excel versions. On Windows the documented route is File → Options → Add-ins, choose Excel Add-ins under Manage, then Go and select Solver Add-in. On Mac use the Excel Add-ins item in the documented Tools menu. Then look for Solver on Data. A managed installation can have different choices or require its approved setup. Use the actual client your audience has. Microsoft says the desktop Solver add-in cannot run in Excel for the web; the independent model and exact check below still demonstrate the example.
- Set the objective. In Solver choose $B$6 as Set Objective and select Max.
- Choose the decisions. Enter $B$2:$B$3 for By Changing Variable Cells. Make sure those are numeric inputs in the model.
- Add space and supply. Add $B$5 ≤ 60 and $B$3 ≤ 25. Add $B$2 ≥ 20 for the milk minimum.
- Enforce quantity rules. Add $B$2:$B$3 as integer. Use the nonnegative option as appropriate or explicitly add $B$3 ≥ 0 with the milk minimum already positive. Check the actual constraints list.
- Choose the method. Select Simplex LP for this linear objective and linear constraints. Each decision cell is multiplied only by a constant, and the constraints are linear sums or bounds. The integer restriction belongs in the solver configuration.
- Read the status and verify. Solve and inspect the exact returned numbers, objective and limits. The verified best plan for this model is milk 35 and fruit 25, 60 slots, daily contribution ₹12,800.
- Keep or restore deliberately. If the answer is ready, keep the solution in a named practice copy. Look for an Answer report if supported and applicable. You can also choose the option to restore original values and record the expected result separately.
A report option depends on the method, what was solved and its status. Retain the solver status and the actual constraints. A found solution within allowed tolerance can be adequate for some business uses. A solver message alone does not prove mathematical uniqueness or an exact best value. For the small exercise the arithmetic bound and explicit feasible candidate provide a separate exact proof.
Prove the best two-product result independently
Every filled space earns at least ₹180 in this two-product model. Each fruit crate earns an additional ₹80 over the milk contribution at that slot. Rewrite the objective as 180 times the total filled slots plus 80 times the fruit count. Since filled slots at most 60 and fruit at most 25, the result is at most 180 × 60 + 80 × 25 = ₹12,800. That bound follows from the reviewed constraints. It is not derived from the solver readout.
The plan with 35 milk and 25 fruit fills all 60 slots and uses exactly the allowed fruit count. It also exceeds the minimum 20 milk and uses proper whole numbers. It reaches the upper bound, so no feasible plan in this model can beat it. Both positive coefficients in the rewritten objective require filling 60 and using 25 fruit to get the exact bound. Those two equalities force milk to be 35. The optimum is therefore unique for this case. That uniqueness depends on the assumptions and will not hold for every spreadsheet optimization.
Trace the 35-milk, 25-fruit decision
Identify the quantity variables
Milk B2 and fruit B3 are whole crate counts with an explicit space limit.
Write the bound
Sixty slots earn up to ₹10,800 at the milk baseline. Twenty-five fruit can add ₹2,000 compared with milk.
Test the candidate
At milk 35 and fruit 25, all limits are met and the objective reaches ₹12,800.
Record the decision conditions
Space and fruit supply are fully used. Milk exceeds its minimum by 15. A future approved assumption could change the plan.
Use the same bound to check one supplier change
If the approved fruit cap falls from 25 to 24 and the same unit contributions apply, the best use of the 60 slots becomes 36 milk and 24 fruit. This gives ₹12,720, an ₹80 drop from the original result. With an approved fruit cap of 26 the model instead gives 34 milk and 26 fruit, ₹12,880. Those differences come from replacing one milk crate with one fruit crate while keeping the room full. They do not apply if the fruit cap rises above what the milk minimum allows, or if demand for fruit is lower. Keep the test conditional on the same operating bounds.
In a copy, add the review inputs in worksheet cells for the space limit and fruit allocation. Reference those cells in Solver's constraints where your client supports it. Then change a bound with the original objective and decision model intact. Re-solve after an approved input edit. A kept result from a previous run does not automatically optimize again when a constraint's cell changes. The model formulas recalculate the outcome of the current plan, and the optimizer needs to run for the new set of possible plans.
Lab 2. Add bakery crates and test an actual change
Extend the model without shifting its existing decisions
Use a new practice copy of Crates. Put an initial 0 in B4 for bakery crates, with a modeled contribution of ₹150 each and supply cap 15. Change B5 to =SUM(B2:B4), and B6 to =180*B2+260*B3+150*B4. Expand the changing and integer cells to $B$2:$B$4. Keep the original space, fruit and milk rules, and add 0 ≤ bakery ≤ 15. Verify that the extra product's input is actually included in the space calculation.
With the original source assumptions there is no minimum bakery stock or maximum milk supply besides space. Bakery can be 0. Because each bakery crate earns ₹30 less than milk and they each take one slot, replacing a bakery crate with milk improves any feasible plan that has bakery. The expected best result stays at (35 milk, 25 fruit, 0 bakery), ₹12,800. The new product does not have to appear in the optimal plan simply because it is allowed.
In a separate trial add a supply cap of 30 milk crates to generate a useful change. Milk may now range from 20 to 30. Fruit is still at most 25, so after using 30 milk and 25 fruit there are 5 slots. Add five bakery crates, within the new cap of 15. The expected objective is 30 × ₹180 + 25 × ₹260 + 5 × ₹150 = ₹12,650. The other constraints are satisfied. Verify the updated modeled limit with the same rule and record the difference from the original outcome.
| Model case | Milk | Fruit | Bakery | Slots | Contribution ₹ |
|---|---|---|---|---|---|
| Original | 35 | 25 | 0 | 60 | 12800 |
| Bakery optional | 35 | 25 | 0 | 60 | 12800 |
| Bakery optional, milk cap 30 | 30 | 25 | 5 | 60 | 12650 |
For a quick proof in the milk-capped case, use a bakery base of ₹150 per occupied slot. Add ₹30 for each milk crate and ₹110 for each fruit crate. At most 60 slots, 30 milk and 25 fruit gives at most 9000 + 900 + 2750 = ₹12,650. The proposed mix reaches all three limits while keeping five bakery crates, so the bound is exact. Check the solver and Answer report if available, then verify the independent proof.
Test a product minimum instead of assuming every allowed product is needed
A campaign might require displaying at least ten bakery crates. On a fresh copy of the original optional-bakery model, add bakery ≥ 10 without changing the 15-crate supply cap or imposing the previous milk cap. The plan (25 milk, 25 fruit, 10 bakery) uses every slot and earns ₹12,500. Rewrite the objective as 180 times occupied slots plus 80 times fruit minus 30 times bakery. Since bakery must now be at least 10, the upper bound becomes ₹10,800 plus ₹2,000 less ₹300. The displayed candidate meets each relevant bound, so it is exact.
Compare the optional positive contribution with the required assortment. Economics alone selected zero bakery in the original setup. A policy introduced by the manager requires ten and has a cost of ₹300 relative to the maximum already found. That cost is a consequence of the assumption, not a reason to omit the required stock in the workbook. If the manager agrees to the policy, reflect it as a constraint and calculate the outcome with it in place.
See why rounding a continuous solution can fail
Try a separate crate-size example: a milk crate uses 1.5 slot units and a fruit crate uses 2 slot units. The capacity is 59 slot units, milk still must be at least 20 and fruit remains capped at 25. Replace the capacity formula with =1.5*B2+2*B3. Contributions stay at ₹180 and ₹260. In the unrestricted continuous arithmetic, fruit earns more per slot than milk. With milk at 20 and the final 29 slot units assigned to fruit, you get 14.5 fruit and a modeled result of ₹7,370.
If you round 14.5 up to 15 fruit and leave milk at 20, use becomes 60 and violates the 59-slot limit. If you round down to 14 fruit, the plan fits and earns ₹7,240. It is not the best whole-number plan. With 22 milk and 13 fruit, use is 33 plus 26, exactly 59, and contribution is ₹7,340. Specify integer quantities inside Solver and verify both decision cells and constraint formulas afterward. Independent enumeration of the small feasible grid agrees with 22 and 13.
There is also a short proof. The minimum milk stock leaves at most 29 slot units for fruit, so the fruit count is at most 14 when it is a whole number. With 14 fruit the space keeps milk at no more than 20 and caps contribution at ₹7,240. With no more than 13 fruit, use ₹120 per occupied slot as a base and add ₹20 per fruit. That bounds the objective by ₹120 × 59 plus ₹20 × 13 = ₹7,340. The 22-and-13 plan reaches the bound. This example shows exactly where blind rounding loses a better choice.
Tell a tied result from an infeasible one
Build a small bakery model with more than one optimum
On a separate practice sheet BakeryMix use B2 for whole units of product X and B3 for whole units of product Y. Keep both quantities nonnegative and editable. For this fictional case X uses two units of flour and one hour. Y uses one unit of flour and half an hour. The store has at most 40 flour units and 20 hours. X has modeled contribution ₹200 and Y ₹100. Create the following formulas and put the units in visible labels.
B5 =2*B2+B3
B6 =B2+0.5*B3
B7 =200*B2+100*B3
Maximize B7 by changing B2:B3. Set B5 ≤ 40, B6 ≤ 20 and enforce whole nonnegative decision quantities. Use the linear method. In this exercise the two resource constraints are proportional: doubling the hours requirement gives the flour requirement exactly. Any plan with both nonnegative quantities and 2X + Y = 40 uses both resources fully. The objective is 100 times that same combination, so every such plan earns ₹4,000 and no allowed plan earns more.
| Units X | Units Y | Flour | Hours | Contribution ₹ |
|---|---|---|---|---|
| 0 | 40 | 40 | 20 | 4000 |
| 10 | 20 | 40 | 20 | 4000 |
| 20 | 0 | 40 | 20 | 4000 |
There are 21 such integer pairs because X can take every whole value from 0 through 20 and Y is then fixed at 40 minus 2X. Solver can return one of them. An external preference such as serving more individual units or supplying a minimum product mix needs explicit rules. It is misleading to say that one solution uniquely wins on contribution. A secondary criterion can select one acceptable plan without changing the verified optimum value.
Show an infeasible condition without weakening constraints
On a separate copy require at least 30 of each bakery product. Even the new minimum uses 2 × 30 + 30 = 90 flour units and 45 hours. The resource limits remain 40 and 20. This model has no feasible solution. Do not remove an approved stock or capacity condition just to obtain a result. Ask which assumption can legitimately change. A second responsible output can explain the minimum capacity needed for the requested production even when the current plan cannot satisfy it.
Choose a second goal without changing the first
The tied bakery case can use a decision criterion after contribution is settled. If the shop wants the largest number of units while preserving ₹4,000 contribution, put =SUM(B2:B3) in B8. Constrain B7 to 4000, retain the same flour, hours and whole-number limits, then maximize B8. Given 2X + Y equals 40, total units equals 40 minus X. Therefore X equals 0 and Y equals 40 gives the largest count, 40. If the shop instead wants the smallest number of total items for equal contribution, X equals 20 and Y equals 0 yields 20 items. Those are separate priorities.
Sometimes the store needs at least ten of product X. When that policy is compatible with the contribution optimum, apply it explicitly. Under the goal of maximizing units while still targeting ₹4,000, X equals 10 and Y equals 20 is best among the options with X at least 10. Thirty total baked items serve the second goal. If the extra limit also requires Y to be at least 30, 2 × 10 + 30 already exceeds the flour limit at 50. Inspect feasibility before using a tie-breaker. A new policy can remove several candidates or all of them.
Choose a method and check the returned answer
Read which formulas depend on decision cells
Microsoft describes Simplex LP for linear models, GRG Nonlinear for smooth nonlinear objectives and constraints, and Evolutionary for nonsmooth formulations such as models with step-like behavior. Linear examples multiply decisions by constants and sum the contributions. Products of two decision values, nonlinear costs or functions that jump across a threshold can change the model's class. Read the actual formulas and test small cases. A different method does not establish an exact global optimum for a complicated nonconvex problem.
People sometimes round a fractional output after solving without integers. That can violate a limit or change which plan is best. Add integer constraints to the variable cells when they represent crates or whole items. Recompute the final solution under those exact business units. Inspect Solver's constraint precision, termination and any optimality tolerance as relevant, especially on larger integer cases. The toy proof checks exact values and does not rely on a default stopping condition.
Record the evidence a decision maker needs
- Known objective and units. Spell out modeled rupees per day under current cost assumptions.
- Decision and feasibility. Show quantities, available resources, actual use and applicable whole-number constraints.
- Bounds. Check the objective relative to a feasible lower or upper bound where a trustworthy one is available.
- Status. Distinguish found candidate, exact proof, approximate tolerance, no feasible solution and multiple optima.
- Approval. Confirm the assumptions and choices with the people who own the process before treating a modeled plan as an instruction.
A reproducible workbook retains the original starting quantities and formulas, the solver setup and the checked solution version. It is useful to write which limits could change. The crate exercise has no evidence about supplier reliability, daily demand or spoilage. Adding those limits later can give a different best plan. Preserve the intended objectives and compare before and after with the same units.
Check how integer search and solver status affect interpretation
Simplex LP addresses the underlying linear problem. With integer restrictions, the built-in Solver also needs to examine whole-number possibilities. Frontline, the Solver implementation vendor, describes the use of branch-and-bound for these cases. The solver can stop after finding a feasible solution within the specified optimality tolerance or when other practical stopping limits apply. If you are comparing outcomes, read whether the status proves the exact optimum or provides an acceptable candidate. The independently calculated bounds are more explicit for this small lesson. Frontline's Solver method reference.
A useful test in the original crate problem is to verify a nearby candidate with 36 milk and 24 fruit. It satisfies all limits and makes ₹12,720. That result is very close to the verified ₹12,800. It is feasible, but it does not meet the separately proved exact maximum. If a workplace accepts a tolerance, record the rules and amount difference instead of declaring that every high solution is exact. If the decision needs a guarantee, inspect the method, limits and proof evidence before using the answer.
Model alternatives without squeezing incompatible expressions into the method
Suppose volume drives unit economics: producing more fruit changes its contribution per crate. Now the objective can contain a product of a decision and a decision-dependent value. If a fixed staffing charge starts only above a threshold, an IF formula depending on decision cells can make the result jump. These structures are different from multiplying constant contributions by decision quantities. Selecting a method requires knowing the equations. Use a linear formulation where it accurately describes the decision, and compare boundary cases before trusting a more complicated model.
In a separate work plan a manager could ask to minimize carrying cost subject to supplying a minimum amount. That chooses Min instead of Max and keeps the quantity supplied as an explicit constraint. Otherwise the optimizer could return zero quantity to minimize nonnegative costs. A particular objective value can also be sought under constraints if supported by the design. Write the decision question first, then use the matching equations. A target amount lower than the maximum is not automatically a best feasible plan.
Make a tiny independent verification worksheet
For the crate exercise add a few candidate pairs in a practice area with separate columns Milk, Fruit, Slots, Contribution and Feasible. Calculate slots by adding the two counts and contribution with the original formula. For the feasibility column check the space cap, fruit cap, milk minimum and whole-number rules. Label test pairs such as 20 and 20, 36 and 24, 35 and 25, and 36 and 25. The last candidate earns more before checking the rules and uses 61 slots. Include only verified feasible rows when comparing model value.
If you enumerate all possible integer pairs with milk from 20 through 60 and fruit from 0 through 25, each candidate is small and bounded. Apply every rule and compare the numeric objectives for the accepted rows. An empty set needs “No feasible candidates.” Do not return the worksheet maximum of an empty or all-text results area as if it were a valid plan. The algebraic bound is a compact separate check for this exercise, and full enumeration is practical here. Large models need more deliberate methods and machine checks.
Have a teammate reproduce both the held constraints and the exact proposed values from the workbook. Ask them to explain why 35 and 25 wins originally, why bakery is selected only in the revised bounded case, and why 21 distinct bakery plans can share the same objective. Record which settings came from the toy problem. Their answers should name the equations and eligible conditions, rather than just quoting a dialog's status or numerical result.
Write an answer report note a teammate can verify
For the original solution record three lines. “Decision: 35 milk, 25 fruit.” “Limits: 60 of 60 slots, 25 of 25 fruit and at least 20 milk.” “Daily modeled contribution: ₹12,800, exact upper bound reached.” Add the status from Solver and any remaining practical limits outside the model. If the case changes after you save the report, keep the original with its original input definitions. Generate or verify another report for the updated assumption. The earlier answer is still useful as evidence for exactly the previous version.
Ask a teammate to verify what happens when the capacity cell changes from 60 to 59 in the original equal-slot case. With 25 fruit allowed and milk minimum 20, the new optimum at 34 milk and 25 fruit earns ₹12,620. One standard slot is lost, so contribution falls by ₹180. Keep this distinct from the separate crate-size example at 59 slot units, where milk and fruit use different amounts of space. A capacity value of 59 can refer to two different model designs.
If you need to compare the effect of losing space and losing fruit supply together, evaluate the revised constraints and do not add isolated changes without checking which limits become binding. At 59 total and fruit cap 24, the plan uses 35 milk and 24 fruit and earns ₹12,540 under the original equal-slot assumptions. The original milk minimum still has room, so both changes remain compatible here. A more restrictive constraint can change the choice entirely or make it infeasible.
Use safe classroom experiments when the add-in is unavailable
Reproduce the two-product objective and limits in ordinary Excel cells. Enter the known candidate, read the slot and objective formulas and compare the exact bound. Repeat with a deliberately impossible candidate before showing the answer. This independent route demonstrates the mathematics and checks that included rules express the decision. It doesn't pretend to run Solver. If you later open the file in a supported desktop version, configure the parameters and compare the same values and constraints.
Finally keep business requirements and status messages in plain language. “No feasible plan” calls for review of constraints or input assumptions. “Many best plans” calls for choosing a documented secondary objective when necessary. “Found within tolerance” calls for checking whether the decision can accept the difference and whether the candidate meets required constraints. A high numerical result under a broken formula or in an infeasible range should never become a purchase plan. The workbook should let reviewers reproduce whichever type of result it reports.
Recheck the initial baseline after saving your examples. If the workbook is still set to a later staffing or supply test, the original exercise will no longer reproduce its reported outcome.
Keep a little space for the acceptance check beside the input cells. A reader can quickly see which quantities are proposed, which assumptions are editable and where each constraint is calculated. If a report is static, make that visible in its title.
Check your interpretation
Five practice questions with worked answers
Which cells should change in the original crate model?
B2 and B3, the whole milk and fruit quantities. B5 and B6 are calculated formulas used by constraints and the objective.
What is the original best solution and result?
35 milk and 25 fruit use 60 slots and give ₹12,800 daily modeled contribution under the stated assumptions.
Why can the best plan leave bakery at zero?
Bakery is optional and earns less per slot than an available milk crate. The same feasible mix with no bakery can reach the original upper bound.
Should the bakery Solver return one unique plan at ₹4,000?
There are 21 exact whole-number plans at that value in the example. One returned plan does not establish uniqueness.
How do we know at least 30 of each bakery product is infeasible?
The two minimum quantities already use 90 flour units and 45 hours, both above the stated limits. Any larger quantities use even more.
Five interview questions with worked answers
How do you define a Solver model?
I write the objective formula, identify the editable decision inputs and add every approved feasibility condition with explicit, consistent units.
How do you verify a returned optimization?
I independently calculate the result and check every constraint against the actual variables. For a small model I compare a known bound or enumerate the allowed combinations.
Which method fits a linear crate model?
Simplex LP is the linear method. I separately configure the required whole-number decision constraints and check the actual termination status.
Does Solver make a modeled plan certain in real operations?
It chooses a result under the equations and constraints supplied. I keep the cost estimates, actual stock policy and any unmodeled conditions visible and reviewed.
When would you use a second goal to decide among tied best plans?
I keep the verified primary objective level as a constraint, then use a documented secondary objective such as units served. This selects among acceptable ties using a stated preference.
Revision cards
- Objective. What you optimize, measured in known units.
- Decision cells. The editable inputs Solver may vary.
- Feasible. A plan satisfying every stated limit.
- Whole quantities. Use integer constraints for crates and verify the result.
- Best value. A feasible candidate can reach a separately proved bound.
- Interpretation. Check exact or approximate, tied or unique, and the assumed scope.
Review the What-If Analysis overview, or use the Excel Task Hub for additional product mix calculations.