Unit 6

The Art of Modelling and Integer Programming

The Art of Modeling and Integer Programming · Data, Models, and AI-Empowered Decision Making
6.1 The Art of Spreadsheet Modelling 6.2 Model Standards and Evaluation Criteria 6.3 TBA Airlines: Integer Programming 6.4 Binary Variables and Scheduling 6.5 Wyndor Setup Costs 6.6 AI and the Model Checklist 6.7 Summary and Assignment 5 interactive demonstrations · 5 classroom exercises
How to use this e-textbook. Orange panels are interactive demonstrations where selecting cells, choosing sequences or moving sliders recalculates the model and optimum immediately. Green panels are classroom exercises; complete them and select “Check” for feedback and reference values. This page makes three classic models hands-on:TBA aircraft purchasing,Southwestern Airways scheduling,Wyndor with setup costs.

6.1 The Art of Spreadsheet Modelling: Everglade Cash Flow

This section is not about one model but about the act of modelling itself: how to start, build, test and analyse. The case concerns Everglade’s 10-year cash flow and loan decisions.

Case: Everglade’s Cash-Flow Problem

Everglade is developing new retirement communities. A weak market and low occupancy previously held the company back, but the market has recovered and prospects are strong. Everglade plans to build more projects, yet near-term cash outflows exceed inflows. Without borrowing, it cannot meet short-term cash requirements.

  • It can apply for a 10-year long-term loan at an interest rate of 5%.
  • It may also take one-year short-term loans in individual years at an expected rate of 7%.

Question: Which loan type or combination, and how much, should the company choose to maximise its cash balance after 10 years?

Year2018201920202021202220232024202520262027
Project cash flow (USD millions)−8−2−4363−47−210

Four Phases of Modelling

  1. Plan anchor the final objective: What must ultimately be achieved? What information should the report contain? In what form should the conclusion appear? Which key figures must support the recommendation?
  2. Build start with a simple version, make sure the logic is correct, and then extend it into the full model.
  3. Test enter known values in the changing cells: all zeros, all ones, very large values and values from manual calculations.
  4. Analysis analyse the model before running Solver, then solve for the optimum and finally interpret the results.
The two most common obstacles are “where do I start?”—solved by asking what final objective must be achieved—and “how do I write the output-cell formula?”—solved by testing several values manually first.
Interactive Demonstration 1

Manual Trial: Does the Company Need to Borrow This Year?

Consider this plan: USD 6 million in long-term loans, USD 2 million in 2018 short-term loans and USD 5 million in 2019 short-term loans. Drag the three sliders and inspect year-end cash balances—if a balance turns negative, the company must borrow again that year.

2018 year-end balance
2019 year-end balance
2027 year-end balance
Years with a negative balance

Calculation basis: the long-term loan is received once in 2018, principal is repaid at the end of 2027, and interest is paid annually at 5%; each short-term loan is received in its year and repaid with 7% interest the following year.

Build, Test and Analyse

Start complex models with a simple version first: confirm the logic, copy the formulas across later years, and extend to the complete model. Test with known values (all zeros, all ones, very large values and manual calculations), then use Solver.

Classroom Exercise 1

Two Values from the Manual Trial

Using the assumptions above—long-term loan USD 6 million, 2018 short-term loan USD 2 million and 2019 short-term loan USD 5 million—enter year-end cash balances for 2018 and 2019 (USD millions; 5% tolerance).

6.2 Modelling Standards: What Makes a Good Model?

Modelling Guidelines

GuidelineHow to apply it
Enter base data firstLet data drive the model
Organise and label data clearlyGroup data into tables, describe each item and state units
Enter each data item onceReference the original data so a change is made in one place
Separate data and formulasDo not embed constants in formulas; put values in data cells
Keep the model simpleAvoid overly complex functions; break long formulas into intermediate steps
Use range namesUse Define Name to improve readability, without overusing names
Use relative and absolute references appropriatelyWrite the base formula once and fill it across to reduce manual errors
Use colour to distinguish cell typesBlue fill for data, yellow for variables, orange bold border for the objective cell
Make the complete model visibleKeep all data and constraints visible in the sheet; group constraints in contiguous rows or columns

Criteria for a High-Quality Model

  1. Users should quickly distinguish data, changing and objective cells.
  2. Every model element, including all constraints, should be visible in the worksheet without opening Solver.
  3. Every formula should be easy to understand without clicking through output cells.
Interactive Demonstration 2

Model Self-Check Checklist

Check each item after building a model. Use the list in your assignments and to review AI-generated models.

Passed
Not yet

6.3 Integer Programming: TBA Airlines’ Purchasing Problem

Why Linear Programming Is Not Enough: The Divisibility Assumption

Linear programming includes a divisibility assumption: decision variables may take any value, including fractions, as long as constraints are satisfied. But an airline cannot buy 3.33 aircraft—the quantity must be an integer, which violates divisibility. Restricting variables to integers gives an integer programme.

Case and Data

TBA Airlines is a small regional carrier focused on short-haul routes. It is deciding whether to expand by buying more small aircraft for short-haul routes, buying large aircraft to enter national routes, or both.

ItemSmall aircraftLarge aircraftAvailable capital
Annual net profit per aircraftUSD 7 millionUSD 22 million—
Purchase cost per aircraftUSD 25 millionUSD 75 millionUSD 250 million
Maximum number5——
Let S = number of small aircraft purchased and L = number of large aircraft purchased
Maximise Profit = 7S + 22L (USD millions)
Constraints: 25S + 75L ≤ 250; S ≤ 5; S ≥ 0, L ≥ 0 S and L are integers
Interactive Demonstration 3

Examine Every Integer Combination

Each cell is a purchasing plan (horizontal axis L, vertical axis S). Green is feasible, grey infeasible, and dark green is the highest-profit integer solution. Select a cell to see capital usage.

Optimal integer solution
Maximum profit
Capital used
Number of feasible plans

Classroom Exercise 2

Find the Optimal Aircraft Purchase Plan

Enter the optimal numbers of small and large aircraft and maximum annual net profit (USD millions).

6.4 Applications of Binary Variables

Binary variables take only two values (0 or 1) and are ideal for “do it or not” decisions. This section presents two cases: scheduling and setup costs.

  • Should we undertake a project?
  • Should we make a fixed-size investment?
  • Should we build a plant at a particular site?

Case 1: Crew Scheduling at Southwestern Airways

A company must assign three crews to 11 flights based at San Francisco (SFO). Each “flight sequence” is an ordered set of flights operated by one crew.How can three crews be assigned to three sequences so that all 11 flights are covered at minimum cost?

The table below maps 11 flights to 12 feasible sequences. A number shows the flight’s position in a sequence; a blank means the sequence does not include that flight.

Interactive Demonstration 4

Scheduling Coverage Matrix: Select Three Sequences

Select up to three sequences (three crews). The table updates each flight’s coverage count and the total cost; a plan with any uncovered flight is infeasible.

Selected sequences
Total cost (USD thousands)
Uncovered flights
Feasible?

Classroom Exercise 3

Write Your Scheduling Plan

Enter the three selected sequence numbers (ascending, separated by spaces or commas) and total cost (USD thousands). There are two optimal solutions; either one is acceptable.

Case 2: Wyndor with Setup Costs

Now modify the original Wyndor problem in two ways. First, each product incurs a one-time setup cost regardless of quantity (doors USD 700; windows USD 1,300). Second, only one production batch is made this week, so D and W represent total output rather than production rates and must be integers.

Production quantityNet profit from doorsNet profit from windows
000
11×300 − 700 = −4001×500 − 1,300 = −800
22×300 − 700 = −1002×500 − 1,300 = −300
33×300 − 700 = 2003×500 − 1,300 = 200
44×300 − 700 = 5004×500 − 1,300 = 700
5Infeasible (Plant 1 has only 4 hours)5×500 − 1,300 = 1,200
6Infeasible6×500 − 1,300 = 1,700
Let y₁ = 1 if doors are produced, otherwise 0; y₂ = 1 if windows are produced, otherwise 0
Maximise P = 300D + 500W − 700y₁ − 1,300y₂
Constraints: D ≤ 4; 2W ≤ 12; 3D + 2W ≤ 18 D ≤ 99y₁ W ≤ 99y₂ D and W are integers; y₁ and y₂ are binary

The constraints containing 99 implement the rule that setup costs occur only when production occurs: if y = 0, output is forced to zero; if y = 1, the output cap is loose enough to be non-binding.

Interactive Demonstration 5

Setup Costs and Binary Variables

Use two switches to decide whether to make doors and windows this week, then drag sliders to set output. Net profit = 300D + 500W − setup costs. Observe why “no doors and only six windows” is best.

Gross profit
setup cost
Net profit
Feasible?

Classroom Exercise 4

Optimal Solution with Setup Costs

Enter optimal door output, window output and maximum net profit (USD).

6.5 AI and Model Standards

AI activity

Task: ask AI for a scheduling recommendation, then verify every item.
① Describe the Southwestern Airways scheduling problem to AI and ask for crew assignments.
② First verify that each crew operates only one sequence, all 11 flights are covered, and no more than three crews are used.
③ Ask what changes if one crew is understaffed.
④ Discuss fairness, fatigue and regulatory limits in addition to efficiency.
⑤ Record which constraints AI ignored and how you detected the omissions.

The model finds the minimum-cost schedule, but real scheduling must also consider crew rest, fatigue, seniority and labour law—factors often absent from the objective. This section therefore stresses:an optimised result is not automatically an implementable decision.

Model-Standards Checklist

CheckRequirementAdditional step when AI generates the model
Separate data and formulasDo not hard-code values in formulasCheck whether parameters are embedded in formulas
Group and label data with unitsDescribe every data itemVerify units against the case
Enter each data item onceReference original data elsewhereCheck for duplicate entry
Distinguish variables and objective by colourBlue data, yellow variables, orange objectiveTell AI not to change the colour convention
Keep the model readableAvoid stacked complex functionsRequire formulas to be built step by step
Classroom Exercise 5

Find the Problems in This AI Scheduling Recommendation

Below is an AI scheduling recommendation (a teaching example). Select a sentence to mark it as “problematic,” then select Check. It contains four problems.

Verification framework: crew limit, complete coverage, cost definition and omitted human factors.

6.6 Summary and Assignment

  • Four modelling steps:plan, build, test and analyse; when stuck, return to the question “what final objective must be achieved?”
  • Three standards for a good model: clear data, simple formulas and visible structure.
  • Integer and binary variables turn “whether,” “how many aircraft” and “how many crews” into mathematical expressions.
  • Binary variables express setup costs, scheduling and location decisions:D ≤ 99y is the formulation for “output only if the activity occurs.”
  • Fractional linear-programming relaxation solutions are often infeasible, and rounding does not necessarily produce an optimum.
Post-class assignment. Exercise 1: formulate and solve TBA’s integer programme. Exercise 2: formulate Southwestern Airways (11 coverage constraints plus three crew constraints). Exercise 3: formulate Wyndor with setup costs and explain the role of the two ≤ 99y constraints. Assignment: compare AI’s scheduling recommendation with the model, verify every item, record ignored constraints and add a one- to three-sentence AI-use statement.

Appendix: Interactive Demonstrations and Classroom Exercises

LocationTypeContent
6.1DemonstrationEverglade manual-trial calculator: loan plan and year-end cash balances
6.2DemonstrationNine-item model self-check
6.3DemonstrationTBA integer combinations compared with the LP relaxation
6.4DemonstrationSouthwestern Airways coverage matrix (select three sequences)
6.4DemonstrationSetup Costs and Binary Variables
6.1ExerciseTwo values from the Everglade manual trial
6.3ExerciseFind the Optimal Aircraft Purchase Plan
6.4ExerciseWrite Your Scheduling Plan
6.4ExerciseOptimal Solution with Setup Costs
6.5ExerciseProblems in an AI scheduling recommendation

Data sources: model parameters from TBA.xlsx, SW Airways.xlsx and WyndorExtension.xlsx. Every optimum is computed by enumeration on the page: 19 feasible TBA plans, 12-sequence combinations for Southwestern and the integer combinations with setup costs.

Unit Glossary (English–Chinese)

English中文
Integer programming整数规划
Binary variable二元变量
Setup cost启动成本
Covering constraint覆盖约束
Scheduling排班
Solver规划求解
Sensitivity report敏感性报告
Divisibility assumption可分性假设