Unit 5

Linear Programming

Linear Programming · Data, Models, and AI-Empowered Decision Making
5.1 What Linear Programming Is 5.2 Four-Step Wyndor Modelling 5.3 Graphical Solution 5.4 Solver and Sensitivity Analysis 5.5 Profit & Gambit and Typical Problems 5.6 Verifying an AI Model Draft 5.7 Summary and Assignment 4 interactive demonstrations · 5 classroom exercises
How to use this e-textbook. Orange panels are interactive demonstrations where changing profit or resource availability recalculates the feasible region, isoprofit lines and optimal solution immediately. Green panels are classroom exercises; complete them and select “Check” for feedback and reference values. The graphical solution on this page is not a pre-drawn chart:it is recalculated from the case data whenever the page opens, and dragging the sliders shows the optimal solution jumping among corner points.

5.1 Model Formulation and Graphical Solution: The Wyndor Case

Linear programming answers how to do the best under limited resources. This section uses the Wyndor Glass product-mix problem to work through four modelling steps and the graphical method.

Management Science and Linear Programming

Management science (or operations research) applies scientific methods to quantitative management problems. Linear programming is its most widely used class of model. Its defining features are:continuous decision variables and linear objectives and constraints.

Case: Product Mix at Wyndor Glass Co.

Wyndor has developed two new products: an 8-foot glass door with an aluminium frame and a 4×6-foot wood-framed window. The company has three plants:

  • Plant 1 produces aluminium frames and components, with 4 available hours per week.
  • Plant 2 produces wood frames, with 12 available hours per week.
  • Plant 3 produces glass and assembles doors and windows, with 18 available hours per week.

The question:should the company introduce both products, and if so, what product mix is best?

ResourceRequired per doorRequired per windowAvailable per week
Plant 1 (hours)104
Plant 2 (hours)0212
Plant 3 (hours)3218
Unit profit (USD)300500—

Analysis: Start with Four Questions

  1. What decision are we making? How many doors and windows to produce each week—two decision variables.
  2. What is our objective? Maximise total profit: 300 × doors + 500 × windows.
  3. Which resources are needed and available? Production hours at three plants, with weekly limits of 4, 12 and 18 hours.
  4. Are there implicit restrictions? Production cannot be negative, so D ≥ 0 and W ≥ 0.

Four Steps in Spreadsheet Model Building

StepActionWyndor example
1 Data cellsEnter all known data with consistent rows and columnsUnit profits, unit resource use by plant, available weekly hours
2 Variable cellsCreate one cell per decision variable; initialise at zero if neededD (doors) and W (windows)
3 Objective cellExpress the objective in one equation=SUMPRODUCT(unit_profit, production)
4 ConstraintsCalculate resource use and write “requirement relation availability” for each resourceOne row for each of the three plants

Algebraic Model

Decision variables D=Number of doors to produce,W=Number of windows to produce Objective function MaximiseP=300D+500W Constraints D≤4, 2W≤12, 3D+2W≤18 D≥0,W≥0 Units: D and W are weekly quantities; hours in the objective and constraints are weekly plant capacity.
Interactive Demonstration 1

Graphical-Solution Workbench: Feasible Region, Isoprofit Lines and Optimum

Drag the sliders to change profit coefficients and plant capacity. Observe how the feasible region changes, how the isoprofit line shifts and which corner holds the optimum. The table on the right mimics Excel output cells:usage = SUMPRODUCT(unit_hours, production).

Optimal doors D
Optimal windows W
Maximum profit
Binding constraint(s)

Graphical-Solution Summary

  1. Draw the boundary line of each constraint and determine which side is feasible.
  2. Use all constraints to identify the feasible region.
  3. Determine the slope of one objective-function contour.
  4. Shift the contour toward higher objective values until it just touches the feasible region.
  5. The touching point is the optimal solution (always a corner point).
The optimal solution to a linear programme always lies at a corner of the feasible region. Solvers are fast because they compare corners rather than checking every point in the region.
Classroom Exercise 1

Four Modelling Questions: Decisions, Objective and Constraints

Classify each of the following five statements within the Wyndor model.

Classroom Exercise 2

Read the Optimal Solution

Using the original data (door profit 300, window profit 500; plant capacities 4, 12 and 18 hours), find and enter the optimal solution.

5.2 Using Excel Solver

The graphical method teaches the logic, but real problems have dozens of variables and cannot be plotted. Use Excel Solver: give it the spreadsheet model you have already built and let it find the optimum.

Steps

  1. Define the objective and variable cells Under Data, select Solver; enter the objective cell, choose maximise or minimise, and select all variable cells under “By Changing Variable Cells.”
  2. Add constraints Select Add and enter the output cell, relation and available amount; do not forget non-negativity (or select “Make Unconstrained Variables Non-Negative”).
  3. Choose a solution method For linear programmes, select Simplex LP and enable “Assume Linear Model” in Options.
  4. Solve and read the results Solver writes the optimal values back to the variable cells and can generate Answer, Sensitivity and Limits reports.

The Solver Interface

The four screenshots below show the Solver interface, corresponding to the four steps above. You can follow them in sequence.

Dialog boxes differ slightly across Excel versions, but the steps and field names are the same.

A Common Trap: Solver Returns an Answer but Does Not Guarantee the Model Is Correct

  • Solver faithfully finds the optimum of the model you wrote. If the model is wrong, it will still return a polished wrong answer.
  • After solving, always check three things: whether constraints are sensible, whether units are consistent, and whether the answer makes business sense.
  • If Solver reports “Solver could not find a feasible solution,” suspect incorrect or contradictory constraints before doubting the data.

5.3 Second Case: Profit & Gambit and Typical LP Problems

Case: The Profit & Gambit Advertising Mix

Management wants to advertise three key products—stain remover, laundry detergent and laundry powder—using television and print media. The targets are:

  • stain-remover sales must rise by at least 3%; detergent by at least 18%; powder by at least 4%.
  • The question:How can these minimum targets be achieved at minimum cost?
Advertising mediumStain remover (%)Laundry detergent (%)Laundry powder (%)Unit cost (USD millions)
Television advertising (TV)03−11
Print media (PM)1242
Required≥ 3≥ 18≥ 4—
Decision variables TV=Number of TV advertisements,PM=Number of print-media advertisements Objective function MinimiseCost=TV+2PM Constraints PM≥3, 3TV+2PM≥18, −TV+4PM≥4 TV≥0,PM≥0 Units: Cost is USD millions; TV and PM are numbers of advertisements.
Note that the laundry-powder column is −1: TV advertising crowds out shelf space and attention for powder, so its coefficient is negative. Such “opposite-direction” effects are easy to omit when writing the model.
Interactive Demonstration 2

Feasible Region and Minimum Cost for Profit & Gambit

Drag the two sliders to choose an advertising mix and see whether all three constraints are met and what the cost is. Isocost lines improve toward the lower left, so the optimum lies at the lower-left corner.

Current cost
Optimal TV
Optimal PM
Minimum cost

Typical Linear-Programming Problems

TypeStructural featureExample
Resource-allocation problemresource used ≤ resource availableWyndor product mix
Cost-benefit trade-offachieved level ≥ minimum requirement; minimise costProfit & Gambit advertising mix
Blending problemcomponent-proportion constraintsingredient, alloy and feed blending
Transportation problemquantity supplied = quantity requiredshipping from warehouses to stores
Assignment problemtotal assigned = demand; total accepted = supplystaff scheduling and task assignment

Recognising the problem type is useful: the same type has essentially the same model structure, with different data.

Case Discussion: Automobile Assembly (Textbook Case 2-1)

Automobile Alliance produces two models at one plant: the Family Thrillseeker (FT) and the Classy Cruiser (CC). Read the textbook case, discuss it in groups using the four questions—decisions, data, constraints and objective—and write the algebraic model.

Classroom Exercise 3

Find the Optimal Advertising Mix

Using the Profit & Gambit model above, enter the optimal TV advertisements, print-media advertisements and minimum cost.

5.4 Sensitivity Analysis

Finding the optimum is only the first step. Managers must ask whether the conclusion still holds when parameters change. Sensitivity analysis answers “how far can a parameter change before the conclusion changes?”.

Changes in Objective Coefficients: When Does the Optimal Solution Move?

Interactive Demonstration 3

Change the Unit Profit of Doors and Watch the Optimum Move

Window profit is fixed at USD 500. Drag door profit and observe how the isoprofit-line slope rotates and when the optimal corner changes.

Current optimal solution
Maximum profit
Range over which the optimum is unchanged

Door profitOptimal solutionMaximum profitExplanation
200D = 2, W = 63,400Optimum unchanged; profit is lower
300 (original)D = 2, W = 63,600Original optimum
500D = 2, W = 64,000Threshold not yet reached
1,000D = 4, W = 35,500Corner changes: doors become valuable enough to use all of Plant 1’s hours

Changes in Resource Availability: Shadow Prices

The second part of a sensitivity report shows how much the objective can improve if one more unit of each resource is available—the shadow price. It answers whether one hour of overtime is worthwhile.

Interactive Demonstration 4

Shadow-Price Workbench: Add One Hour at a Plant

Drag a plant’s available hours and observe how maximum profit changes. A straight segment means each additional hour adds a constant amount—that is the shadow price.

Current profit
Shadow price of this constraint
Is this constraint binding?

The shadow price applies only within the constraint’s allowable range. Beyond that range, extra capacity may go unused, the shadow price may fall to zero, or another constraint may become binding.
Classroom Exercise 4

How to Read Shadow Prices

Using the original capacities (4, 12 and 18 hours), evaluate the following four statements.

5.5 AI-Assisted Modelling: Generate a Draft, Verify Every Line

AI can turn a natural-language description into a plausible-looking linear programme in seconds. It saves typing time and leaves a draft that must be checked line by line.

AI activity

Prompt (using the five components)
Role: You are an operations-research modelling consultant.
Task: formulate the following production-planning problem as a linear programme.
Data: [paste the Wyndor case description exactly].
Output format: provide decision variables, objective function and constraints (including non-negativity), and list every assumption you make.
Constraint: do not omit any constraint; label every coefficient with its unit in parentheses.

Verification Checklist: Common Errors in AI-Generated Models

Common errorSymptomHow to verify
Missing constraintWriting capacity constraints but omitting non-negativity or demand constraintsMatch each sentence in the case and count whether the constraints are complete
Reversed objectiveWriting minimise when the problem is maximiseFirst ask: what are we maximising?
Inconsistent unitsMixing dollars and labour hours in one expressionLabel the unit of every coefficient
Forgetting integer restrictionsAllowing fractional output without explanationAsk: can this variable take a fractional value?
Unstated assumptionAssuming unlimited raw materialsRequire AI to list every assumption
Classroom Exercise 5

Find the Problems in This AI Model Draft

Below is an AI-generated Wyndor model draft (a teaching example). Select a sentence to mark it as “problematic,” then select Check. The draft contains four problems.

Verification framework: are all decision variables present; is the objective maximise or minimise; are the number, direction and units of constraints correct; are assumptions stated?

5.6 Summary and Assignment

  • Three components of a linear programme:decision variables, objective function and constraints.
  • Four spreadsheet-model steps: data cells, variable cells, objective cell and constraints (using SUMPRODUCT to calculate outputs).
  • The graphical method shows the feasible region and corners; Solver calculates the optimum, which always lies at a corner.
  • Sensitivity analysis answers “how far can a parameter change before the conclusion changes?” via objective-coefficient ranges and resource shadow prices.
  • Solver is responsible only for the model you wrote; if the model is wrong, it will still return a polished wrong answer.
Post-class assignment. Exercise 1: complete the four-step Wyndor model and solve it in Excel. Exercise 2: formulate and solve the Profit & Gambit model. Exercise 3: read a sensitivity report and record the shadow prices and allowable ranges for all three plants. Assignment: use AI to generate a Profit & Gambit model draft, verify every line, record your revisions, and add a one- to three-sentence AI-use statement.

Appendix: Interactive Demonstrations and Classroom Exercises

LocationTypeContent
5.1DemonstrationWyndor graphical workbench: feasible region, isoprofit lines, corners and output cells
5.3DemonstrationProfit & Gambit feasible region and minimum cost
5.4DemonstrationObjective-coefficient changes: when the optimal corner moves
5.4DemonstrationShadow-price workbench
5.1ExerciseFour modelling questions: decisions, objective and constraints
5.1ExerciseRead the Optimal Solution
5.3ExerciseFind the Optimal Advertising Mix
5.4ExerciseHow to Read Shadow Prices
5.5ExerciseFour problem types in an AI model draft

Data sources: model parameters from WyndorGlass.xlsx and Profit&Gambit.xlsx; the four interface images are original screenshots of Solver. Every optimal solution, shadow price and allowable range is calculated on the page by enumerating corner points and can be checked against Excel Solver.

Unit Glossary (English–Chinese)

English中文
Linear programming线性规划
Decision variable决策变量
Objective function目标函数
Constraint约束条件
Feasible region可行区域
Binding constraint紧约束
Shadow price影子价格
Sensitivity analysis敏感性分析
Simplex method单纯形法