Engineering Design and Optimization
Requirements, trade-offs, verification, documentation, budgets and the mathematics of the best design
Design is deciding under constraints, and optimisation is deciding with mathematics. Eight chapters move from one to the other: problem statements and requirements you can test, decision matrices and Pareto fronts, test plans and reliability, drawings, tolerances and design reviews, architectures with latency and power budgets, then formal optimisation with calculus, linear programming, search and gradient descent. Every chapter composes School lessons, with practice checked on the server.
Compiled and written by the Tactiverge team with AI assistance, from Tactiverge School lessons that were themselves written with AI assistance.
1. Problems and requirements
A good design starts before any idea: with a problem statement that names who has the problem, what success looks like and how you will know. Requirements then turn success into checkable sentences with a quantity, a tolerance, a condition and a verification method, without smuggling in a solution. This chapter writes them, separates constraints from functions, and traces each requirement to the test that proves it.
Figure 1.1. Anatomy of a testable requirement (described in words)
The requirement 'The feeder must dispense 25 g ± 3 g per portion at 5–35 °C, verified by 20 weighed trials' split into its parts: a binding verb, a quantity with tolerance, a condition and a verification method. Every portion must fall in the band from 22 to 28 g.
Explanation
1.1 Writing a sharp problem statement
'Make plants happier' and 'keep six pots moist for four days with nobody home' describe the same wish. Which one could you actually test?
Four parts
A sharp problem statement has four parts: who has the problem, what goes wrong (something you can see or measure), when it happens, and how you'll know it's solved. A template: [Who] [what goes wrong] [when]. It's solved when [test].
Words to watch
Some words feel helpful but hide the problem: better, easier, nice, works well, sometimes, people. Each makes a reader ask 'how much?' or 'who?' Swap them for numbers, names and situations. 'Sometimes' becomes 'twice a month'. 'People' becomes 'my grandmother, who uses a walking frame'.
No solutions allowed (yet)
If your statement contains a gadget (robot, app, sensor), it has already picked the answer. Take the gadget out and describe what it was supposed to fix. You might still build it, but you'll know why, and you'll have compared it with other ideas first.
Common mix-ups
A longer problem statement is a better one.
✓ A sharp one is better: four clear parts, no vague words, no gadget.You should mention your idea in the problem statement.
✓ Keep ideas out. They come after you understand the problem.
1.2 Requirements you can test
A robot gripper must lift an egg and a bolt. How do you write that down so that a computer can check whether your design passes?
A requirement is something you can check
A requirement says what the design must do, clearly enough for a test to give a yes or no. A good one has a quantity (40 g), often a tolerance (± 5 g) and a condition (at 6 pm, every day). If two people could test it and disagree, it isn't finished.
From problem to requirements
Each requirement should trace back to the problem. 'Soil stays moist for 4 days' comes straight from the problem statement. 'Holds at least 2 litres' comes from working out how much six pots need in 4 days. If a requirement doesn't trace back to anything, ask why it's there.
What, not how
Requirements say what the machine must achieve, not how. 'Uses a pump' is a design choice; 'delivers 50 mL to each pot per day' is a requirement. Keeping the 'how' out leaves room for better ideas, perhaps one with no pump at all.
Common mix-ups
Requirements say how the machine works.
✓ They say what it must achieve. How is your design's job.Any requirement with a number in it is testable.
✓ It also needs a clear condition: 40 g when, how often, measured how?
1.3 Requirements two strangers would agree on
The client says the gripper must be 'strong and easy to use'. You build it, they say it fails. Who was wrong?
Three parts of a testable requirement
A good requirement says what the system must do, how much (a number with a unit) and under what conditions (load, speed, temperature, number of trials). 'The gripper must close within 0.5 s of the command, in each of 10 trials' has all three. Use must for non-negotiables and should for strong wishes.
Preferences and disguised solutions
A preference ('blue would be nice') is worth recording but nobody fails if it is missed. A solution in disguise ('must use rubber pads') jumps to a design before stating the need. Ask 'why?': the answer ('must not slip on a wet bottle') is the real requirement, and rubber becomes one option among several.
Fixing a vague requirement
Words like strong, fast, easy, safe and reliable need numbers. Ask: strong enough for what load? Fast compared with what time? Easy for whom, doing what, in how long? 'Easy to use' might become 'a new operator sets it up in under 5 minutes using only the README'.
Common mix-ups
Requirements should describe the design so the builder knows what to make.
✓ Requirements describe what the design must achieve. Naming the design too early throws away better ideas.Adding 'very' or 'highly' makes a requirement clearer.
✓ Only a number, a unit and a condition make it clearer.
1.4 From a vague brief to budgets with margins
Your robot must weigh under 1 kg. Today's estimate is 850 g. Are you safe, or are you about to run out of room?
Constraints are limits
A requirement says what the design must do; a constraint limits how it can do it: at most 1 kg, under £40, no more than 10 W, must fit in a 20 cm cube. Clients often state constraints vaguely ('light', 'cheap', 'small'). Your job is to ask until each has a number and a unit.
Budgets add up
Mass, cost and power add across parts, so list every part with its estimate and total them. Frame 150 g + motors 100 g + battery 120 g + electronics 45 g = 415 g. Power works the same way: three 2 W motors plus a 1.5 W controller draw 7.5 W, so a 15 Wh battery lasts about 2 hours.
Keep a margin
Margin = (limit − total) ÷ limit × 100%. Early in a design, estimates are guesses and always grow, so teams aim for 20–30% margin at the start and accept less as numbers firm up. A negative margin means you are over budget now, before anything has been built.
Common mix-ups
If the total is under the limit, the budget is fine.
✓ Check the margin too. 2% under the limit at the sketch stage almost always ends over the limit.Power budgets only need the biggest component.
✓ Every component that draws power adds to the total, including sensors and the controller.
1.5 Every requirement needs a test and a reason
The gripper build runs 24 checks on your design. Where did those 24 come from, and what if one of your requirements has no check at all?
Four ways to verify
Inspection: look or measure ('the README lists every part'). Analysis: calculate ('motor torque under 0.15 N·m by free-body diagram'). Demonstration: show it works once ('the gripper opens and closes'). Test: measure performance under set conditions, usually repeated ('holds the bolt in 10 of 10 fast lifts'). Choose the cheapest method that gives trustworthy evidence.
The traceability table
Make a table with columns: requirement ID, requirement text, verification method, test or calculation, result, and the design decision it drove. R3 'squeeze ≤ 3 N on the paper cup' might trace to 'test: cup case in the build' and to 'decision: rubber pads, so a low squeeze still holds the bolt'.
Gaps tell you something
A requirement with no test is a promise you can't keep. A design decision with no requirement may be gold-plating, or may reveal a requirement you forgot to write. When a requirement changes, the table shows every test to re-run.
Common mix-ups
If the machine works in a demo, all requirements are met.
✓ A demo shows one case. Each requirement needs its own evidence, often across many cases.Traceability is paperwork for big companies.
✓ It's the fastest way to know what to re-test after a change, at any size.
Examples to try
Worked solutions are in the interactive chapter online.
Writing a sharp problem statement: example 1
Sharpen: 'Kids find school bags annoying.'
Requirements you can test: example 1
Rewrite 'the lunchbox should stay cool' as a testable requirement.
Requirements two strangers would agree on: example 1
Rewrite: 'The robot must be fast.'
Requirements two strangers would agree on: example 2
Rewrite: 'The sorter must use a colour camera.'
From a vague brief to budgets with margins: example 1
Client: 'It has to be cheap enough for schools.' Turn this into a constraint.
From a vague brief to budgets with margins: example 2
Power budget: two 3 W motors, a 0.5 W sensor and a 1 W controller. A 12 Wh battery lasts how long?
Every requirement needs a test and a reason: example 1
Pick a verification method: 'The gripper's motors must stay under 0.15 N·m in every grasp.'
Every requirement needs a test and a reason: example 2
Your design uses rubber pads, but no requirement mentions friction. What should you do?
Interactive figures, in words
Figure 1.2 from “Writing a sharp problem statement”
Start with the vague choices, then sharpen one part at a time and read the note under each. Which single change makes the statement most useful? Aim for 4/4.
The problem-statement builder works on paper. For each of four parts (who, what goes wrong, when, how you'll know it's solved) there are three choices: vague ones such as 'people' or 'sometimes', a solution in disguise ('need a robot that waters plants'), and a sharp one ('our family, away most weekends'; 'come home to find the six windowsill pots dried out'; 'after being away for 2 to 4 days'; 'every pot's soil is still moist after 4 days'). Combining the sharp choices gives a statement a designer could start from.
Figure 1.3 from “Requirements two strangers would agree on”
Sort every statement in the recycling-gripper brief as testable, vague, preference or solution in disguise, then check. For each vague one, write a testable rewrite on paper before moving on.
The requirements checker lists statements from a client brief. For each one you choose testable requirement, vague, preference or solution in disguise, then press check: each answer is marked with an explanation, for example 'The gripper should be really strong' is vague because it gives no load or test.
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Simulation OS: Design constraints and trade-offs (Simulation OS experiment)
Set the budget, power limit and minimum accuracy as hard constraints and see which designs remain feasible.
Open online - BUILD: Elevator, level 3 (BUILD level)
Write three testable requirements for the elevator's stopping accuracy and comfort, each with a verification method.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. 'We need a phone app that reminds Gran to take her tablets.' What's the main issue?
- It's too short
- It names a solution before stating the problem
- It doesn't mention cost
Check it in “Writing a sharp problem statement”
2. Which success test can you actually check?
- The machine works well
- The dog has water in his bowl at 4 pm on five school days in a row
- The dog is happier
Check it in “Writing a sharp problem statement”
3. Which is a requirement, not a design choice?
- The feeder uses a motor
- The feeder drops food within 5 minutes of 6 pm
- The feeder is made of wood
Check it in “Requirements you can test”
4. Two classmates test 'the alarm is loud enough'. One says pass, one says fail. What should you do?
- Average their opinions
- Rewrite it with a measurable condition, like 'heard clearly from the next room with the door shut'
- Delete the requirement
Check it in “Requirements you can test”
5. 'The gripper must hold 300 g.' What is missing that could cause an argument later?
- Nothing
- The conditions: for how long, while moving how fast, with which objects
- A colour
- The motor's brand
Check it in “Requirements two strangers would agree on”
6. Why do engineers keep a margin in a mass budget early in a project?
- To make the numbers look nicer
- Because estimates usually grow as cables, fasteners and fixes are added
- Because the limit will probably be relaxed
- Margins are only needed for cost
Check it in “From a vague brief to budgets with margins”
7. Which is a constraint rather than a functional requirement?
- The robot must sort parts into two bins
- The robot must fit inside a 30 cm cube
- The robot must stop when the guard opens
- The robot must detect red parts
Check it in “From a vague brief to budgets with margins”
8. Your traceability table shows a design decision ('add a second sensor') that traces to no requirement. What is the best response?
- Delete the table
- Ask which need it serves; either write that requirement or question the decision
- Keep it and say nothing
- Remove all sensors
Check it in “Every requirement needs a test and a reason”
Engineering applications
Medical devices
Every requirement for a medical device is traced to a test and every test to a requirement. An untested requirement, or a feature nobody asked for, is a finding in an audit.
Small projects
Even a weekend robot benefits from five testable requirements. They end arguments about whether it works and show which test to run after each change.
Summary
- A problem statement names the user, the problem, the success test and the limits, not a solution.
- A testable requirement has a binding verb, a quantity with tolerance, a condition and a verification method.
- Constraints limit the design space; functional requirements say what it must do.
- Traceability links each requirement to a design decision and a test, in both directions.
Glossary
- Writing requirements
- A requirement is a single, testable statement of what a system must do or be, usually written as 'The system shall…', with a measurable threshold and a way to verify it.
- Fair test and randomisation
- A fair test compares conditions so that the only systematic difference between them is the thing being studied; randomising the order of trials stops time-related effects favouring one condition.
- Design review
- A design review is a structured meeting where others examine a design against its requirements before it is built or released, and the outcomes are recorded as actions.
Project: A requirements table you can verify
Choose a small device to design. Write a problem statement, then eight requirements (at least two constraints), each with a tolerance, a condition and a verification method. Build a traceability table that links each to a planned test.
Deliverables
- The problem statement
- Eight requirements with verification methods
- A traceability table
References
- Karl T. Ulrich and Steven D. Eppinger (2016). Product Design and Development, 6th edition. McGraw-Hill Education.
- George E. Dieter and Linda C. Schmidt (2013). Engineering Design, 5th edition. McGraw-Hill.
2. Decisions and trade-offs
Designs compete on several criteria at once: cost, mass, accuracy, power. This chapter makes the choice explicit. A weighted decision matrix scores concepts against criteria; a sensitivity sweep shows whether the winner survives a change of weights; and dominance removes options that are worse in every way, leaving a Pareto front of genuine trade-offs where only judgement, stated openly, can choose.
Figure 2.1. The Pareto front (described in words)
Six designs plotted by cost and mass, both to be minimised: A (4, 9), B (5, 6), C (7, 5), D (6, 8), E (9, 3) and F (8, 6). A, B, C and E form the Pareto front. D is dominated by B and F by C, which are both cheaper and lighter.
Explanation
2.1 No free lunch: trade-offs
Keep the seedlings warm, or save energy: the greenhouse controller can't max out both. How do you choose where to land?
What a trade-off is
A trade-off is when improving one thing makes another worse. A bigger tank lasts longer but costs more and takes more space. A brighter light is easier to see but drains the battery faster. Trade-offs aren't mistakes; they're the shape of the problem.
Spotting them in your requirements
Look at your list in pairs. Cheap and reliable? Small and long-lasting? Quiet and powerful? When two requirements pull apart, your priorities decide which gives way. If both are Musts, you need a cleverer design or a conversation with the user.
When there's no trade-off
Sometimes one option is at least as good on every measure and better on one. It dominates the other, which can be dropped with no trade-off at all. The options that nothing dominates form the Pareto frontier: the set of honest choices left.
Common mix-ups
A good design has no trade-offs.
✓ Nearly every design has them. A good design makes them deliberately and explains them.The cheapest option is always the sensible choice.
✓ Only if it meets the Musts. Cheap and failing is not a bargain.
2.2 The weighted decision matrix
Concept A beats concept B on three criteria out of four. Is A the better design?
Musts first, then the matrix
Must-have requirements are pass or fail: a concept that fails one is out before any scoring. The matrix compares the survivors on the things you'd like more or less of. Mixing a must into the weights lets a dangerous design win by being cheap.
Weights and scores are judgements
Weights say what matters; scores say how well each concept does. Both are opinions, ideally backed by numbers (a mass estimate, a calculated grip force). Write down why you gave each score: '2 for mass because the claw has three motors'. Then others can challenge the reason, not just the number.
Close calls are information
If two concepts finish within a few points, the matrix is saying 'these are about equal given what we know'. That is a reason to prototype both or find better data, not to declare a winner. Report the margin honestly, and check sensitivity, which is the next lesson.
Derivation: Weighted total and percentage
List criteria from your requirements (cost, grip on odd shapes, mass, ease of repair). Give each a weight wᵢ from 0 to 5 for how much it matters.
Score each concept on each criterion, sᵢ from 1 to 5, where 5 is best. For 'cost', best means cheapest.
Weighted total = Σ wᵢ × sᵢ. Suction cup with weights (3, 4, 2, 2) and scores (4, 5, 4, 3): 12 + 20 + 8 + 6 = 46.
The best possible total is 5 × Σ wᵢ = 5 × 11 = 55, so the percentage is 46 ÷ 55 ≈ 84%.
Common mix-ups
The concept that wins the most criteria is the best.
✓ Weights matter: one heavily weighted criterion can outweigh several light ones.A decision matrix gives an objective answer.
✓ It organises judgements. The answer is only as good as the weights and scores, so record the reasons.
2.3 How fragile is your decision?
Change one weight from 2 to 1 and the 'best' gripper changes. Was your decision ever really made?
Sweep one thing at a time
Hold all weights fixed except one. Step it from 0 to 5 and record the winner at each step. If the winner never changes, the decision is robust to that weight. If it changes, note the switch point: in the starting matrix, the suction cup wins only while 'grips odd shapes' is weighted 2 or more.
Compare the switch point with your doubt
A switch point far from your chosen weight is reassuring. One right next to it means a small change of opinion flips the result. Ask the client or the requirements: is that criterion really a 4, or could it be a 2? That question is now worth asking, because the answer changes the design.
What to do when it's fragile
Options: get better information (measure grip on odd shapes rather than guessing), prototype both finalists, or look for a hybrid concept that does well on the disputed criterion. Never quietly nudge the weights until your favourite wins: that turns a decision tool into a justification tool.
Common mix-ups
If the matrix gives a winner, the decision is settled.
✓ Only if the winner survives reasonable changes to the weights and scores.Changing weights to see what happens is cheating.
✓ Exploring sensitivity is honest. Choosing weights to force a result is what's dishonest.
2.4 Never pick a dominated design
One design is cheaper AND more accurate than another. Is there any reason ever to choose the worse one?
What dominance means
Option A dominates option B if A is at least as good as B on every objective and strictly better on at least one. A dominated option can't win any weighted matrix with positive weights, so you can drop it without discussing weights at all.
The Pareto front
The options no one dominates form the Pareto front. Moving along it, you can only improve one objective by giving up some of another: cheaper means less accurate, more accurate means pricier. Plot cost against error and the front is the edge nearest the 'cheap and accurate' corner.
Choosing along the front
Every point on the front is a defensible choice for someone. Which one is right depends on the requirements: a must (error under 2 cm) cuts the front; a weight picks a point on what's left. That is why requirements come before trade-offs.
Common mix-ups
The Pareto front tells you the single best design.
✓ It tells you which designs are worth considering. Picking one needs requirements and priorities.A dominated option is useless forever.
✓ It is useless for these objectives. Adding a missing objective can change the picture, so list all that matter.
Examples to try
Worked solutions are in the interactive chapter online.
No free lunch: trade-offs: example 1
Design X costs $10 and keeps 5 pots moist. Design Y costs $12 and keeps 5 pots moist. Does either dominate?
The weighted decision matrix: example 1
Weights: safety 5, cost 2, speed 3. Concept X scores (4, 5, 2); concept Y scores (5, 2, 4). Which wins?
How fragile is your decision?: example 1
Two concepts: A = 20 + 3w, B = 26 + w, where w is one criterion's weight. Where does the winner switch?
Never pick a dominated design: example 1
Sensors (cost £, error cm): A (10, 5), B (20, 2), C (25, 4), D (40, 1). Which are dominated?
Interactive figures, in words
Figure 2.2 from “The weighted decision matrix”
With the starting weights, check one total by hand: weight × score for each criterion, then add. Then change one score you disagree with and see whether the winner changes. Is the soft suction cup's lead large or small?
The trade-off matrix compares three gripper concepts (two-finger pinch, three-finger claw, soft suction cup) on four criteria. Sliders set each criterion's weight and drop-down menus set each score. A table shows weighted totals; bars show percentages; the winner is starred. With the starting weights the totals are 39, 33 and 46.
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Simulation OS: Design constraints and trade-offs (Simulation OS experiment)
Change the weights on cost, power, compute and accuracy and record when the recommended design changes.
Open online - Playground: Constraints (Playground lab)
Explore a design space with competing constraints and mark which options are dominated.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. Which pair of requirements is most likely to be a trade-off?
- Runs on batteries and keeps mains electricity away from water
- Lasts 7 days without refilling and fits in a small box
- Waters the pots and keeps the soil moist
Check it in “No free lunch: trade-offs”
2. Two Must requirements clash. What's the best move?
- Quietly drop one
- Look for a cleverer design, or talk to the user about which matters more
- Ignore the clash
Check it in “No free lunch: trade-offs”
3. A concept scores highest in the matrix but fails a safety must. What happens?
- It wins: the numbers decide
- It is out; musts are checked before scoring
- Its safety score is lowered a bit
- The safety weight is raised until it loses
Check it in “The weighted decision matrix”
4. Two concepts total 71% and 70%. What is the most honest report?
- Concept 1 is clearly better
- They are effectively tied; the choice depends on judgement, so test both or get better data
- The matrix is broken
- Pick concept 2 to be safe
Check it in “The weighted decision matrix”
5. Sweeping 'cost' from 0 to 5 never changes the winner. What does that mean?
- Cost doesn't matter
- The decision is robust to how much you value cost
- The matrix is broken
- Cost should be removed
Check it in “How fragile is your decision?”
6. The winner flips if one weight changes by 1. Which is the best next step?
- Adjust the weight until your favourite wins
- Get better evidence for that criterion or prototype both finalists
- Pick at random
- Remove the criterion
Check it in “How fragile is your decision?”
7. Your requirement says error must be under 3 cm. Which options remain from A, B, C and D?
- A and B
- B and D
- Only D
- All four
Check it in “Never pick a dominated design”
8. Can a dominated option ever win a weighted matrix that uses only those objectives with positive weights?
- Yes, with the right weights
- No: the option that dominates it scores higher whatever the weights
- Only if it is cheaper
- Only in a tie
Check it in “Never pick a dominated design”
Engineering applications
Choosing a sensor
Engineers shortlist sensors by removing dominated ones, those that cost more and perform worse, then choose along the front according to which requirement is tightest.
Design reviews
A decision matrix shown with its sensitivity sweep convinces reviewers far more than a single total, because it shows the choice does not hinge on one arguable weight.
Summary
- Must requirements filter options first; only survivors are scored.
- A weighted matrix makes judgements visible; close totals are ties, not decisions.
- Sensitivity analysis shows whether the winner changes when a weight changes.
- An option is dominated if another is at least as good on every criterion and better on one; the rest form the Pareto front.
Glossary
- Design review
- A design review is a structured meeting where others examine a design against its requirements before it is built or released, and the outcomes are recorded as actions.
- Bill of materials
- A bill of materials lists every part needed to build something, with quantity, exact part number or specification, supplier and cost.
Project: Choose, then stress-test the choice
For a component in your own design, list at least five candidates with real or clearly estimated data. Remove dominated options, build a weighted matrix for the rest and sweep each weight. Report the winner and the weight change that would overturn it.
Deliverables
- The candidate table with data sources
- The Pareto set and the weighted matrix
- A sensitivity sweep and the decision
References
- Karl T. Ulrich and Steven D. Eppinger (2016). Product Design and Development, 6th edition. McGraw-Hill Education.
- Gerhard Pahl et al. (2007). Engineering Design: A Systematic Approach, 3rd edition. Springer.
3. Verification and reliability
A design is only as good as the evidence that it meets its requirements and keeps meeting them. This chapter writes test plans with predictions and pass criteria before testing, digs past the symptom to the root cause when something fails, and models reliability with blocks in series and in parallel. It ends with failure modes: how the system will fail, how badly, and what you will do about it.
Figure 3.1. Series and parallel reliability (described in words)
A motor (0.97), a controller (0.995) and one sensor (0.8) in series give a system reliability of 0.772. Replacing the sensor with two independent sensors in parallel gives the pair 1 − 0.2² = 0.96, raising the system to 0.927, but only if they cannot fail together.
Explanation
3.1 A test plan that could prove you wrong
You test your gripper on the egg and it works. Then the bolt slips and the cup crushes. Did testing fail you, or did you test too little?
Write the plan first
A test plan states: the question ('does one fixed squeeze meet R2 and R3 for every object?'), the cases (objects × pads × lift speeds), the prediction, the pass criteria (squeeze ≥ needed and ≤ crush limit) and what would change your mind ('if any case fails, the fixed-squeeze design is rejected'). Writing it before running stops you explaining away surprises.
Cover the matrix and the edges
Failures hide in combinations: heavy and slippery, light and fragile. Run every combination of the conditions that matter; with 4 objects, 2 pads and 2 speeds that is 4 × 2 × 2 = 16 cases. Then add edge cases at the limits of what's allowed, such as an emergency lift. If the full matrix is too big, explain how you chose a subset.
Report like an engineer
Give the pass rate and the list of failing cases with the reason for each: 'bolt on plastic at 4.9 m/s² slipped: needs 4.9 N, squeeze 3 N'. A 94% pass rate means nothing if the failing 6% is the safety case. Compare with your prediction and say what you learned.
Common mix-ups
A high pass rate means the design is good.
✓ Look at which cases failed. One failed must can sink the design.Testing is for checking the design works.
✓ Testing is for finding out whether it works, so a good test plan tries hard to break it.
3.2 Symptom, mechanism, root cause
The sorter dropped a red part in the blue bin. You lower the red threshold and the problem goes away. Have you fixed it?
Three layers
The symptom is what you see: red parts in the blue bin. The mechanism is how it physically happens: the sensor reads 40 instead of 85 because of glare. The root cause is the deepest cause you can act on, usually a design or process decision: the cleaning checklist doesn't mention the hood. Fix the root cause and the whole chain stops.
Evidence at every step
Each 'why?' answer must be something you could check: a log line, a replay, a test that switches the cause on and off. 'Shading the sensor stops the errors' is strong evidence. 'Someone was careless' isn't evidence and stops the investigation; ask what in the process allowed the mistake. A fishbone diagram helps list candidate causes before testing them.
Prevent, detect, tolerate
Prevent: remove the cause (fix the checklist). Detect: notice when it happens anyway (flag a reading far outside the normal range, or two sensors disagreeing). Tolerate: keep working safely despite it (two sensors that must agree). A patch hides the symptom (lower the threshold) and usually causes a new problem.
Common mix-ups
Once the failure stops, it's fixed.
✓ Only if you removed the root cause. A hidden symptom usually returns, often worse.Root cause means finding who made the mistake.
✓ It means finding the process or design decision that allowed it.
3.3 Chains and spares: reliability by multiplication
Every part of your robot works 95% of the time. With five parts, how often does the whole robot work?
Series: the chain gets weaker
If every part is needed, multiply their reliabilities. A 90% sensor, a 99% controller and a 95% motor give 0.9 × 0.99 × 0.95 ≈ 0.846, so about 85%. The more parts in series, the lower the total. Improving the weakest part gives the biggest gain.
Parallel: spares that cover each other
Redundant parts in parallel fail only if all fail. Two 90% sensors: both fail with probability 0.1 × 0.1 = 0.01, so the block works 99% of the time. Three: 99.9%. Each extra spare helps less, and once the sensor block is strong, the motor becomes the weakest link.
Real failures share causes
The formula assumes independence. Two sensors on the same power wire, or under the same glare, can fail together. Then the pair is barely better than one. Engineers use different sensor types, separate supplies and plausibility checks (does a reading fit physical limits and the other sensors?) so a failure is detected rather than trusted.
Derivation: Series and parallel rules
Reliability R is the probability a part works for the mission. Assume parts fail independently.
Series (all must work): the chance that A and B both work is R_A × R_B. For n parts: R = R₁ × R₂ × … × Rₙ.
Parallel (any one is enough): the block fails only if every branch fails. Failure chances multiply: (1 − R₁)(1 − R₂). So R = 1 − (1 − R₁)(1 − R₂)…
Two 90% sensors in parallel: 1 − 0.1 × 0.1 = 0.99. Then with a 95% motor in series: 0.99 × 0.95 ≈ 0.94.
Mixed systems: reduce each parallel block to one R, then multiply along the chain.
Common mix-ups
A machine made of 95% parts is 95% reliable.
✓ In series, reliabilities multiply: five 95% parts give about 77%.Adding more spares always improves reliability a lot.
✓ Each spare helps less, shared causes can defeat them, and the weakest series part soon dominates.
3.4 How will it fail?
Glare makes one colour sensor lie on 30 % of parts. Your sorter's accuracy drops from 99 % to 70 %. Did you plan for that, or discover it?
A failure-mode table
For each subsystem and interface, list: failure mode (sensor lies, message late, motor saturates), effect on the system, how it is detected, and mitigation. Rank by severity and likelihood; test the top few deliberately.
Detect, then make safe
A failure you cannot detect is the dangerous kind. Add checks: plausibility (is this reading possible?), freshness (timestamps), agreement between redundant sensors. On detection, move to a defined safe state, as in the FAULT state from week 29.
Measure mitigations
Treat a mitigation as a method to evaluate: compare with and without it, under the failure, over repeated trials, and also without the failure to check it doesn't cost too much in normal operation.
Common mix-ups
If the robot passes its tests, it has no failure modes.
✓ Tests check the conditions you tried. A failure table finds conditions you haven't tried yet.
Examples to try
Worked solutions are in the interactive chapter online.
A test plan that could prove you wrong: example 1
A sorter must be tested at 3 belt speeds, with 4 part types, in 2 lighting conditions. How many cases? Which edge case would you add?
Symptom, mechanism, root cause: example 1
A greenhouse overheated overnight. The log shows the vent never opened; the vent motor works when tested. Next why?
Chains and spares: reliability by multiplication: example 1
Battery 98%, controller 99%, two motors that are both needed, each 96%. System reliability?
Chains and spares: reliability by multiplication: example 2
Two independent 80% cameras, either one enough, feeding a 99% computer. System?
How will it fail?: example 1
Fill one row of a failure table for a rover's camera fix.
Interactive figures, in words
Figure 3.2 from “A test plan that could prove you wrong”
Before each run, set your predicted pass rate. Try squeezes of 1 N, 3 N and 5 N, then add the edge cases. Record each pass rate and which cases failed. Can you explain every failure from the 'needs' and 'crush' columns?
The test harness sets one fixed squeeze force, a required grip safety factor and an option for edge cases. Before running you enter a predicted pass rate. Running fills a table with every case (object, pad, lift acceleration, squeeze needed, crush limit, result) and reports the pass rate against your prediction. The bolt on plastic needs more than 3 N while the cup crushes above 3 N, so no single squeeze passes every case.
Figure 3.3 from “Symptom, mechanism, root cause”
Investigate both failures. At each 'why?', pick the cause the evidence supports; read why the others are ruled out. When you reach the root cause, pick the fix you'd ship first and read the feedback. Which fixes are patches?
The failure-mode explorer gives a symptom, then asks 'why?' up to four times. Each time you choose from three causes; wrong choices reveal the evidence that rules them out, right choices add the cause and its evidence to the chain. At the root cause you choose a fix and learn whether it prevents, detects, tolerates or only patches the failure.
Figure 3.4 from “Chains and spares: reliability by multiplication”
Start with one 90% sensor, a 99% controller and a 95% motor. Add a second and third sensor in parallel and record the system reliability each time. Then improve the motor instead. Which change helps more? Run 1000 simulated missions a few times and compare with the formula.
The reliability calculator draws one, two or three sensors in parallel, then a controller and a motor in series. Sliders set each part's reliability. The readout gives the sensor block's reliability 1 − (1 − R)ⁿ, the system reliability as the product, the expected failures in 1000 missions and the weakest block. A button runs 1000 simulated missions and reports how many succeeded.
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Simulation OS: Sorting conveyor sensors (Simulation OS experiment)
Raise the sensor fault rate and compare one sensor with majority voting across three; record the sorting error in each case.
Open online - BUILD: Sorting machine, level 4 (BUILD level)
List the sorting machine's failure modes, rank them by severity and likelihood, and add one mitigation for the worst.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. Why write the prediction and pass criteria BEFORE running the test?
- It's tidier
- So you can't move the goalposts after seeing the results
- Because tests take a long time
- It isn't necessary
Check it in “A test plan that could prove you wrong”
2. Which is the best edge case to add to a gripper test plan?
- The egg on rubber pads at a gentle lift
- The heaviest object on the slipperiest pad at the fastest allowed lift
- A random object
- The same case run twice
Check it in “A test plan that could prove you wrong”
3. Which fix is a patch rather than a real fix for a sensor that misreads under glare?
- Fit a hood and add it to the cleaning checklist
- Lower the colour threshold until the errors stop
- Flag readings far outside the normal range
- Use two sensors that must agree
Check it in “Symptom, mechanism, root cause”
4. An investigation concludes 'the operator forgot'. What should happen next?
- Close the investigation
- Ask why forgetting was possible: what in the checklist, design or training allowed it?
- Replace the operator
- Add a warning sign and stop
Check it in “Symptom, mechanism, root cause”
5. Sensor block 99.9%, controller 99%, motor 80%. Which single improvement helps the system most?
- Add another sensor
- Improve the motor
- Improve the controller
- They all help equally
Check it in “Chains and spares: reliability by multiplication”
6. Two 'redundant' colour sensors sit side by side under the same lamp. Why might the pair be much less reliable than 1 − (1 − R)²?
- Two sensors always interfere
- Glare from the lamp can fool both at once, so their failures aren't independent
- Parallel never helps
- The formula is wrong
Check it in “Chains and spares: reliability by multiplication”
7. Three-sensor majority voting tolerates…
- Any single sensor failure
- Any two failures
- Any number of failures
Check it in “How will it fail?”
8. Why also test a mitigation when nothing has failed?
- To check it doesn't harm normal performance
- It isn't necessary
- To make the report longer
Check it in “How will it fail?”
Engineering applications
Aircraft systems
Critical aircraft functions use several independent channels, often of different designs, so that one common cause such as a software bug or icing cannot take them all out.
Root causes in factories
When a machine jams, asking 'why?' repeatedly turns 'operator error' into a guard that hides the jam sensor. Fixing the cause stops the next jam; retraining only treats the symptom.
Summary
- Write the prediction and pass criteria before the test, and include edge cases.
- Root-cause analysis keeps asking why until it reaches something you can change in the design or process.
- Series reliabilities multiply, so the weakest block dominates; parallel redundancy gives 1 − Π(1 − Ri).
- Redundancy helps only if failures are independent; common causes defeat it.
- Failure-mode analysis ranks how things can fail and tests the mitigations, including when nothing has failed.
Glossary
- Engineering lab notebook
- A lab notebook is a dated, chronological record of what you planned, did, observed and decided, written at the time rather than afterwards.
- Repeated trials
- Repeating a measurement or test several times shows how much results vary and lets you average out random error.
- Design review
- A design review is a structured meeting where others examine a design against its requirements before it is built or released, and the outcomes are recorded as actions.
Project: A reliability case for a small robot
Draw the reliability block diagram of a robot you know, with stated (and sourced or clearly assumed) block reliabilities. Find the weakest block, propose one redundancy or design change, and recompute. Name one common-cause failure that would defeat your change.
Deliverables
- The block diagram with values and sources
- System reliability before and after
- A common-cause risk and its mitigation
References
- Patrick D. T. O'Connor and Andre Kleyner (2012). Practical Reliability Engineering, 5th edition. Wiley.
- George E. Dieter and Linda C. Schmidt (2013). Engineering Design, 5th edition. McGraw-Hill.
4. Documentation, tolerances and design review
A design that lives only in its designer's head cannot be built, checked or improved by anyone else. This chapter keeps an engineering notebook that a stranger could reproduce, draws parts with dimensions and tolerances that add up, checks a tolerance stack by worst case and by root-sum-square, and prepares for a design review where the job of the reviewers is to find the flaw before the hardware does.
Figure 4.1. A tolerance stack (described in words)
Three parts of 20 ± 0.1, 15 ± 0.05 and 10 ± 0.08 mm stacked end to end make 45 mm nominal. The worst-case variation is ± 0.23 mm; the root-sum-square estimate, assuming independent centred errors, is ± 0.137 mm.
Explanation
4.1 The engineering notebook: decisions with dates
Three weeks ago you changed the squeeze from 5 N to 3 N. Today the bolt slips. Can you say why you changed it, and what you tested afterwards?
What goes in an entry
Date, goal (what question you're answering), setup (which Build, lab or code version; every setting), prediction, results (numbers with units, or a pointer to a saved table), decision and next step. Short is fine. Missing settings are not: without them nobody, including you, can repeat the run.
Never tidy away failures
Write down tests that failed, ideas you dropped and mistakes you made, with the reason. Crossing out is fine; deleting isn't. In your capstone, the failure and what you changed is a required piece of evidence, and the notebook is where it comes from.
Decisions need reasons
'Chose rubber pads' is a fact. 'Chose rubber pads because the bolt needs 4.9 N with plastic but the cup crushes above 3 N (harness, 28 Nov)' is a decision record. The reason lets a reviewer check your logic and lets you undo a decision safely if the reason stops being true.
Common mix-ups
Notebooks are for writing up results at the end.
✓ They're written as you go, so they capture what you knew at the time, including mistakes.A tidy notebook shows good engineering.
✓ A complete, honest notebook does, crossings-out and failures included.
4.2 Dimensions, tolerances and the stack that bites
Three spacers, each 'about 12 mm', must fit a 40 mm slot. They fit on your drawing. Will they fit every time the parts are actually made?
Every dimension needs a tolerance
A drawing that says 12 mm leaves the maker guessing. 12 ± 0.1 mm says any part from 11.9 to 12.1 mm is acceptable. Tighter tolerances cost more to make and check, so engineers make them only as tight as the function needs. Unimportant dimensions get looser ones.
Stacks add up
When parts sit end to end, their tolerances add in the worst case. Four ± 0.1 to ± 0.2 mm tolerances can wipe out a 0.5 mm gap entirely. More parts in a stack means a bigger worst-case spread, which is one reason designers try to keep stacks short.
Fixing a stack
Options: change a nominal size (a 39.5 mm group in a 40 mm slot), tighten the tolerances that matter most, reduce the number of parts in the stack, or add something adjustable such as a shim or slot. Write the requirement first ('always fits, rattle ≤ 1 mm'), then check both worst cases against it.
Derivation: Worst-case stack-up
Each dimension is nominal ± tolerance: the real part lies anywhere in that range.
Tightest case: smallest slot and largest parts: gap_min = (slot − t_slot) − Σ(part + t_part).
Loosest case: largest slot and smallest parts: gap_max = (slot + t_slot) − Σ(part − t_part).
So gap_min = nominal gap − (t_slot + Σ t_part) and gap_max = nominal gap + (t_slot + Σ t_part): tolerances add.
Requirement 'always fits' means gap_min ≥ 0; 'never rattles more than 1 mm' means gap_max ≤ 1 mm.
Common mix-ups
If the nominal sizes fit, the parts will fit.
✓ Check the worst case: tolerances add across a stack.Tolerances are the maker's problem.
✓ The designer chooses them on the drawing; the maker can only meet what is written.
4.3 Design review: defend your mechanism
A reviewer points at your lever and asks: 'what's the worst-case force on that pivot, and what's your margin?' Can you answer in one sentence with a number?
The review in five minutes
1) The job and its requirements (with numbers). 2) Concepts considered and the decision matrix, including its sensitivity. 3) The free-body diagram and the key calculation: forces, torque or ratio, with units. 4) The factor of safety and what it doesn't cover. 5) Tests run, a failure found, and the next step. One slide or page each.
Answering questions
Answer with evidence: 'the pivot carries 125 N in the worst case; the pin is rated 500 N, so the factor of safety is 4'. If you don't know, say so and how you'd find out. If a reviewer finds a real flaw, thank them and write it down: finding flaws is the review working, not you failing.
Giving a review
When you're the reviewer, ask about the worst case, the assumptions and the evidence: 'what load did you assume, and where did it come from?' Be specific, kind and useful: point at a number or a decision, not at the person. Every question should help the design improve.
Common mix-ups
A good design review has no criticism.
✓ A good review finds the weak spots. No questions usually means nobody looked closely.Admitting you don't know something looks bad.
✓ Saying what you don't know and how you'd find out is what reviewers trust.
4.4 Present it, then defend it
A reviewer asks: 'Why should I believe your baseline was tuned fairly?' You have ten seconds. What do you say?
A five-minute structure
One slide each: the problem and question; the architecture (with interfaces); the method (baseline, alternatives, metric fixed in advance, trials, seeds); the results (one honest chart with labelled error bars); limitations and what you'd do next. Leave time for questions.
Prepare for the hard questions
Rehearse answers to: How was the baseline tuned? Why this metric? How many trials, and why is that enough? What would change on real hardware? What is the biggest limitation? Each answer should point to something in your method or results.
Defending trade-offs
Explain what you optimised and what you gave up: 'PID settled faster but needs a filtered derivative and is noisier; for this task the faster settling mattered more.' Naming the cost shows you chose it deliberately.
Common mix-ups
Admitting a limitation in a presentation makes the work look weak.
✓ Stating limitations clearly makes the rest of the claims more believable.
Examples to try
Worked solutions are in the interactive chapter online.
The engineering notebook: decisions with dates: example 1
Improve this entry: 'Tested sorter. Mostly OK.'
Dimensions, tolerances and the stack that bites: example 1
Slot 30 ± 0.1 mm, two parts 14 ± 0.05 and 15.5 ± 0.05 mm. Worst-case gaps?
Design review: defend your mechanism: example 1
Your geared lift needs 1 N·m and the train delivers 1.08 N·m. A reviewer says the margin is thin. Response?
Present it, then defend it: example 1
Answer: 'Why should I believe your baseline was tuned fairly?'
Interactive figures, in words
Figure 4.2 from “The engineering notebook: decisions with dates”
Run the test harness at three different squeezes. After each run, write a notebook entry: date, question, settings, prediction, pass rate, failing cases and your decision. Swap entries with someone: can they reproduce your run from your entry alone?
The test harness runs every combination of four objects, two pad materials and two lift accelerations for a squeeze you choose, and reports the pass rate and failing cases in a table. In this lesson you write a notebook entry after each of three runs, recording the settings, your prediction, the result and your decision.
Figure 4.3 from “Dimensions, tolerances and the stack that bites”
Set the predict question's numbers and read the worst-case gaps. Then find two different ways to make the assembly always fit and never rattle more than 1 mm: one by changing a nominal size, one by tightening tolerances.
The tolerance stack-up tool draws a slot holding three coloured spacers. Sliders set the slot's width and tolerance and each spacer's size and tolerance. The readout gives the nominal gap, the worst-case smallest gap (smallest slot, largest spacers) and largest gap, and whether the assembly always fits and never rattles more than 1 mm.
Figure 4.4 from “Design review: defend your mechanism”
Rebuild your term-project mechanism in the explorer (a lever or a gear train). Record the effort or output torque, the pivot force or output speed, and the mechanical advantage or ratio. Then work out a factor of safety against a capacity you state, and prepare a one-sentence answer to: 'what's the worst case, and what's your margin?'
The mechanism explorer offers a lever (class 1, 2 or 3, with sliders for load and distances) and a gear train (one or two stages, with sliders for tooth counts, motor speed and torque, and a choice of efficiency). Its readouts give effort, mechanical advantage and pivot force, or ratio, output speed, torque and power, which you use as the calculation in your design review.
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Robotics Workbench (Studio)
Document one design decision in the workbench with the options considered, the evidence and the reason for the choice.
Open online - Code Lab (Studio)
Simulate a tolerance stack by sampling each part within its tolerance and compare the spread with the worst-case and root-sum-square results.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. Which entry would let a stranger reproduce your test?
- 'Ran the harness, got 75%.'
- '2 Dec. Harness: squeeze 3.0 N, grip factor 1, no edge cases. Predicted 70%. Got 12/16 (75%). Fails: bolt plastic both lifts, egg plastic 4.9 m/s², tomato plastic 4.9 m/s².'
- 'Good test today.'
- 'See screenshot.'
Check it in “The engineering notebook: decisions with dates”
2. You tried slip sensing and abandoned it because it was too slow in your model. Should it go in the notebook?
- No, only successes belong
- Yes, with why it was abandoned and the evidence
- Only if it worked
- Only in pencil
Check it in “The engineering notebook: decisions with dates”
3. Which records a decision properly?
- 'Using 2 sensors.'
- 'Using 2 colour sensors that must agree, because glare fooled one sensor in 30% of parts in the L4 test (1 Dec).'
- 'Sensors are good.'
- 'Decided.'
Check it in “The engineering notebook: decisions with dates”
4. Why not give every dimension a very tight tolerance, like ± 0.01 mm?
- Tight tolerances are impossible
- They cost much more to make and inspect, and most dimensions don't need them
- They make parts weaker
- Drawings can't show them
Check it in “Dimensions, tolerances and the stack that bites”
5. Which reviewer question is most useful?
- 'Is this good?'
- 'What load did you assume at the pivot, and where did that number come from?'
- 'Why didn't you do it my way?'
- 'Did this take long?'
Check it in “Design review: defend your mechanism”
6. A reviewer finds that your gripper squeezes the cup above its 3 N limit in one case. What should you do?
- Argue the case is unlikely
- Thank them, record it with the case, and plan a fix and a re-test
- Remove the cup from the test plan
- Ignore it
Check it in “Design review: defend your mechanism”
7. Asked 'Would this work on a real motor?', the best answer is…
- Yes, definitely
- We tested only in simulation; friction and delay could reduce the advantage, and a hardware test with the same metric would check it
- That's not relevant
Check it in “Present it, then defend it”
8. Which statement explains a trade-off well?
- PID is just better
- PID settled 40 % faster but its command was noisier; settling mattered more for this task
- We picked PID because it has more letters
Check it in “Present it, then defend it”
Engineering applications
Assemblies that fit
A gearbox housing, its bearings and the shaft each have tolerances. A stack analysis before ordering parts shows whether every combination will assemble, or whether a tighter (and dearer) tolerance is needed on one part.
Patents and handovers
Dated notebook entries record when an idea was conceived and why options were rejected, which helps when a project changes hands or an idea's origin is questioned.
Summary
- A notebook entry records what, why, how and the result, including ideas that failed.
- Every dimension that matters needs a tolerance; tighter tolerances cost more.
- Worst-case stacks add tolerances; root-sum-square assumes independent errors and is smaller.
- A design review hunts for flaws; the best answers concede unknowns and point to evidence.
Glossary
- Engineering lab notebook
- A lab notebook is a dated, chronological record of what you planned, did, observed and decided, written at the time rather than afterwards.
- README
- A README is the front page of a project: what it is, how to set it up, how to use it, how to check it works, its current status and limitations, and its licence.
- Version control and commit messages
- Version control records every change to a project as a commit; a commit message explains in a short summary line, and optionally a body, what changed and why.
- Block diagram
- A block diagram shows a system as labelled boxes connected by arrows, each arrow naming what flows between them: power, a signal, data or a force.
- Technical report structure
- A technical report usually follows a predictable structure: title, abstract, introduction, method, results, discussion including limitations, conclusion, references and appendices.
Project: Prepare a design review pack
For one part of your design, produce a dimensioned sketch with tolerances, a tolerance stack for the critical fit, five notebook entries covering key decisions, and a list of the three questions you most fear in review, with your answers.
Deliverables
- A toleranced sketch and stack analysis
- Five dated notebook entries
- Three review questions with evidence-based answers
References
- Gerhard Pahl et al. (2007). Engineering Design: A Systematic Approach, 3rd edition. Springer.
- George E. Dieter and Linda C. Schmidt (2013). Engineering Design, 5th edition. McGraw-Hill.
5. System architecture and budgets
Before the details comes the architecture: which blocks exist, what flows between them and what each promises. This chapter draws systems as blocks with labelled interfaces, compares centralised and distributed designs, and allocates the scarce resources (time, power, mass and data) as budgets with margins. A budget turns 'it should be fast enough' into a number that each block owner must meet.
Figure 5.1. A latency budget (described in words)
A stacked bar of a robot's reaction time: sense 10 ms, process 25 ms, plan 15 ms, act 20 ms and link 5 ms make 75 ms against a 100 ms budget, a 25 % margin. At 1.5 m/s the robot travels 0.1125 m before it reacts.
Explanation
5.1 Blocks, arrows and promises
A warehouse robot has eight boxes on its diagram and twenty arrows between them. Which do engineers argue about more: the boxes or the arrows?
Subsystems and layers
A mobile robot's software and hardware fall into layers: sensing (encoders, cameras, IMU), perception and estimation (turning raw readings into 'I am here, a box is there'), planning (choosing what to do next), control (making motors follow the plan) and actuation (drivers and motors). Power runs underneath everything.
Data paths and power paths
In a block diagram, data arrows carry information (a pose, a speed command) and power arrows carry energy (battery to motor driver). Draw them differently, for example solid and dashed. A fault on a power path can take out several data paths at once, which is why engineers look for single points of failure there.
Every arrow is a promise
Label each arrow with its interface: the signal's name, unit, coordinate frame and rate. 'Pose' is vague; 'pose of the robot in the map frame, metres and radians, 50 Hz' is a promise the receiving team can build on and test against.
Common mix-ups
If every subsystem passes its own tests, the robot will work.
✓ Subsystem tests check each box against its own assumptions; the interfaces between boxes need their own tests.A block diagram is a picture of the hardware layout.
✓ It shows function and signal flow, not physical position. Two blocks can run on the same chip.
5.2 One brain or many?
Should a robot run everything on one powerful computer, or spread the work across several small ones? Both answers ship in real products.
Centralised
One computer runs perception, planning and control. Pros: one place for all data, simpler software, easy to debug. Cons: one busy processor must also meet fast loop deadlines, and if it crashes, everything stops.
Distributed
Small processors near each motor or sensor run fast local loops, and a main computer coordinates them over a bus. Pros: fast, predictable local loops and less wiring. Cons: more interfaces, bus delays and clock synchronisation to manage. A failure can be contained to one node, if the design plans for it.
Decide with criteria, not taste
List criteria (cost, latency, reliability, power, development time), weight them for this robot's users, score each option and check whether any option is dominated. Then record the decision and what you gave up, so the next engineer knows it was a choice, not an accident.
Common mix-ups
There is one correct robot architecture.
✓ The best architecture depends on the robot's users, budget and risks; record the criteria behind your choice.
5.3 The latency budget
At 1.5 m/s, a robot covers 9 cm in 60 ms. That is how far it travels after seeing an obstacle and before it even starts to brake.
Latencies in series add
Sense-to-act latency is the sum of every stage: sensor exposure and readout, transfer, processing, planning, communication to the motor controller, and the actuator's own response. Slack = deadline − total. Negative slack means the robot cannot meet its reaction requirement.
Latency is distance
Distance travelled before reacting = speed × latency. At 1.5 m/s, 60 ms is 9 cm. A safety requirement such as 'stop within 30 cm of an obstacle' therefore limits speed, latency or both, and braking distance comes on top.
Jitter and margin
Real stages do not take the same time every cycle; some frames take much longer. Budget with worst-case or high-percentile timings and keep a margin, and timestamp data so a late result can be recognised rather than trusted.
Common mix-ups
Making the fastest stage even faster is a good use of effort.
✓ Savings come from the largest stages; a 2 ms stage can save at most 2 ms.
5.4 Power, mass and data budgets with margins
Every subsystem team swears its estimate is right. Why does the mission still keep 20% in reserve?
Anatomy of a budget
List every consumer with its current best estimate (CBE): avionics 18 W, mobility 30 W, heaters 22 W… Sum them. Add contingency to reflect immaturity: perhaps 25–30% for a new design, 10% for something already built and measured. Compare with the capability (power available, mass allocation, bits per day). Policy usually demands a further margin in reserve.
Margin, the honest way
Margin = (capability − estimate with contingency)/(estimate with contingency). It is the engineering team's insurance against surprises: an instrument that turns out heavier, a colder-than-expected winter, a degraded solar array. Margins are tracked over time; a margin that shrinks every month is a warning sign even while it is positive.
Duty cycles and averages
Power budgets use averages over the cycle that matters (a sol, an orbit) plus a check on peaks. A 60 W radio on 20% of the time averages 12 W, but the battery and wiring must still deliver 60 W while it transmits. Energy budgets (Wh per sol) decide whether the battery survives the night.
When the budget breaks
Options, roughly in order of preference: reduce demand (duty-cycle the heaters, compress data), reallocate between subsystems, improve capability (bigger array, faster link), or descope requirements. Each has a cost elsewhere: a bigger array is more mass. Budgets are coupled, which is why one person keeps them all.
Common mix-ups
A positive margin means the budget is fine.
✓ The margin must meet the project's policy and stay stable over time; a shrinking margin is an early warning.Each subsystem can optimise its own budget line.
✓ Budgets are coupled: more power capability adds mass. One systems engineer balances them together.
Examples to try
Worked solutions are in the interactive chapter online.
Blocks, arrows and promises: example 1
Write a full interface label for the arrow from the wheel encoders to the wheel speed controller.
One brain or many?: example 1
A school robot must cost under 60 pounds and be easy for beginners to debug. Centralised or distributed?
The latency budget: example 1
Stages 12, 25, 5, 2, 6 ms; deadline 50 ms; speed 2 m/s. Find slack and reaction distance.
Power, mass and data budgets with margins: example 1
Loads: 18, 30, 22, 15, 12 W. Contingency 20%. Supply 110 W. Margin?
Interactive figures, in words
Figure 5.2 from “Blocks, arrows and promises”
Place each block of the warehouse robot in its layer and give it an update rate. Before you check, predict: which blocks run fastest, and why are they the ones closest to the motors?
The architecture builder can be done as a table: wheel encoders, sensing, 1 kHz; camera, sensing, 10 Hz; state estimator, estimation, 100 Hz; object detector, estimation, 10 Hz; mission planner, planning, 1 Hz; wheel speed PID, control, 1 kHz; motor driver, actuation, not a loop; battery, power, not a loop.
Figure 5.3 from “The latency budget”
Start with the default stages and a 60 ms deadline. Raise the robot's speed and watch the reaction distance. Then set the deadline to 40 ms and get back within budget by changing as few stages as possible.
The latency-budget lab shows five stages as a stacked bar against a dashed deadline line. Default stages add to 66 milliseconds, over a 60 millisecond deadline; at 1.5 metres per second that is about 10 centimetres travelled before reacting.
Figure 5.4 from “Power, mass and data budgets with margins”
On Power, set 20% contingency and find the smallest power supply with a healthy margin. Raise the heaters to 40 W (a cold-season night): what must give? On Mass, find the largest science payload that keeps a healthy margin within 400 kg. On Data, find a link setup that keeps up with 600 Mbit per sol.
The planner has tabs for power, mass, data, delta-v and light-time. In each, subsystem estimates are summed, contingency is applied, and the margin against capability is shown with a status word: healthy, below policy or over budget. For example, power loads summing to 97 W with 20% contingency need 116.4 W, so a 110 W supply is 5.5% over budget.
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Simulation OS: Battery sensor node (Simulation OS experiment)
Build a power budget for the node, add a 20 % margin, and find the reporting interval that still meets a one-year battery life.
Open online - Nexus: Smart junction (Nexus project)
Sketch the junction controller's architecture as blocks and interfaces, and give each interface a data rate and a timing promise.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. Why draw power paths differently from data paths?
- To make the diagram colourful
- Because a power fault can disable many data paths at once, so it needs its own analysis
- Because power paths never fail
Check it in “Blocks, arrows and promises”
2. In a robot where one 5 V regulator feeds the computer, the camera and the lidar, what is the regulator?
- A data path
- A single point of failure
- A redundant component
Check it in “Blocks, arrows and promises”
3. Which is a typical advantage of a distributed architecture?
- Fewer interfaces to specify
- Fast loops run close to the hardware with predictable timing
- No need to synchronise clocks
Check it in “One brain or many?”
4. Why write down what an architecture decision traded away?
- Documentation is required by law
- So later engineers know the weakness was a deliberate choice and when to revisit it
- It isn't useful
Check it in “One brain or many?”
5. You must cut 10 ms. Stages: camera 16, vision 30, plan 8, bus 2, motor 10. Where do you look first?
- Bus
- Vision
- Motor driver
Check it in “The latency budget”
6. Why budget with worst-case timings rather than averages?
- Averages are harder to compute
- A safety deadline must hold on the slow cycles too, not just typical ones
- Worst cases never happen
Check it in “The latency budget”
7. A radio draws 60 W while transmitting, 20% of the time. The average power budget shows 12 W. What else must you check?
- Nothing: the average is what matters
- That the battery and power system can deliver the 60 W peak
- That the radio is off at night
- That the average is 60 W
Check it in “Power, mass and data budgets with margins”
8. Why is contingency larger for a brand-new instrument than for one that has flown before?
- New instruments are always heavier
- Immature estimates tend to grow as the design is detailed; flown hardware has measured values
- It's a rule with no basis
- Flown hardware has no uncertainty
Check it in “Power, mass and data budgets with margins”
Engineering applications
Spacecraft design
Spacecraft carry mass, power and data budgets from the first sketch, with larger contingencies on new instruments. Each subsystem team owns a line in the budget and reports against it.
Interactive products
A game controller must respond within a latency budget players will not notice. Engineers allocate milliseconds to sensing, radio, processing and display, then measure each stage.
Summary
- An architecture is blocks, interfaces and the promises each interface makes.
- Power paths, data paths and single points of failure should be visible on the diagram.
- Centralised designs are simpler; distributed ones can be more robust and faster locally, at the cost of integration.
- Budgets allocate time, power, mass and data with margins; use worst cases, and size contingency to novelty.
Glossary
- Block diagram
- A block diagram shows a system as labelled boxes connected by arrows, each arrow naming what flows between them: power, a signal, data or a force.
- Battery capacity and runtime
- A battery's capacity in ampere-hours says how long it can supply a current; multiplied by its voltage it gives stored energy in watt-hours.
- Electrical power
- The power transferred in a component is the voltage across it multiplied by the current through it. For a resistor this can also be written I²R or V²/R.
- Payload
- Payload is the mass a robot can carry or manipulate while still meeting its specifications for speed, accuracy and lifetime.
Project: Budget a delivery robot
Draw the architecture of a small indoor delivery robot. Build its latency budget for stopping at an obstacle, its power budget for a four-hour shift and its mass budget, each with a stated margin. Identify the tightest budget and one design change to relieve it.
Deliverables
- An architecture diagram with interfaces
- Three budgets with margins
- The tightest budget and the proposed change
References
- Gerhard Pahl et al. (2007). Engineering Design: A Systematic Approach, 3rd edition. Springer.
- Panos Y. Papalambros and Douglass J. Wilde (2017). Principles of Optimal Design: Modeling and Computation, 3rd edition. Cambridge University Press.
6. Formulating optimisation problems
Optimisation begins with formulation: what can you choose (the variables), what you want (the objective) and what you must respect (the constraints). Get that right and the mathematics follows. This chapter formulates design problems, finds optima with calculus where the objective is smooth, and works three classics: the minimum-material can, maximum power transfer and the trade-offs that a single objective cannot capture.
Figure 6.1. The minimum-material can (described in words)
Surface area A(r) = 2πr² + 2V/r of a closed can holding 1000 cm³, plotted against radius. The curve has one minimum, 553.6 cm² at r = 5.42 cm, where the height 10.84 cm equals the diameter. Smaller radii need tall cans, larger ones wide lids.
Explanation
6.1 Formulate first: variables, objectives, constraints and Pareto fronts
The lightest arm draws the most power; the frugal one is heaviest. Is there a 'best' arm at all?
The three parts of a formulation
Decision variables: what you are free to choose (arm length, motor size, gain). Objective: one number to minimise or maximise (mass, energy, cost, error). Constraints: limits that every acceptable design must satisfy, written as inequalities or equalities (torque ≥ 2 N·m, mass ≤ 5 kg). Together: minimise f(x) subject to gᵢ(x) ≤ 0. The set of x that satisfies all constraints is the feasible region.
Hard constraints screen; objectives rank
A requirement that must be met (fits the launch envelope, survives −80 °C) is a constraint: designs that break it are out, however good they look otherwise. Things you would like more or less of are objectives. Screening first keeps a brilliant-but-illegal design from distorting your comparison.
Dominance and the Pareto front
Design A dominates B if A is no worse on every objective and strictly better on at least one. The non-dominated designs form the Pareto front: along it, improving one objective must cost another. Everything behind the front is simply worse and can be discarded without any value judgement.
Collapsing to one number
A weighted sum w·f₁ + (1 − w)·f₂ (on normalised objectives) always selects a front design, but which one depends on w, and the weights are a value judgement that should be stated and defended. Weighted sums can also miss designs in a concave part of the front; showing the whole front to decision-makers is often more honest.
Common mix-ups
Every optimisation problem has one best answer.
✓ With several objectives there is usually a front of equally defensible answers; choosing among them is a value judgement.Constraints and objectives are interchangeable.
✓ Constraints are pass/fail limits; objectives are ranked. Moving one into the other changes the problem.
6.2 Stationary points: the top of the hill
At the very best design, a small change in either direction makes things slightly worse. In calculus, that has a name: the derivative is zero.
Stationary points
Where f′(x) = 0 the tangent is horizontal: a stationary point. It may be a local maximum, a local minimum or a stationary inflection (like x³ at 0, flat but still rising). Solve f′ = 0 to find the candidates.
Classifying
Second-derivative test: f″ < 0 means a maximum (concave down), f″ > 0 a minimum, f″ = 0 inconclusive. Sign test: if f′ changes from + to − the point is a maximum; − to +, a minimum. The sign test always works.
Endpoints and domains
On a closed interval, the best value may sit at an end, not at a stationary point. A pump limited to 0 ≤ q ≤ 10 L/s whose stationary point is at 15 L/s has its best allowed design at q = 10. Always list candidates: stationary points inside the domain plus both endpoints.
Derivation: The optimum of a quadratic cost
Many design costs are well modelled near their optimum by a quadratic C(q) = a·q² − b·q + c with a > 0 (for example, wear rising with the square of flow rate while faster pumping saves time).
Differentiate: C′(q) = 2a·q − b.
Set C′(q) = 0: q* = b/(2a).
Second derivative: C″(q) = 2a > 0, so the curve is concave up and q* is a minimum.
Minimum cost: C(q*) = c − b²/(4a). The same steps give the vertex of any parabola.
Common mix-ups
f′ = 0 always means a maximum or minimum.
✓ It can be a stationary inflection, like x³ at 0. Classify every candidate.The optimum is always where the derivative is zero.
✓ With constraints or a limited domain, it can be at an endpoint.
6.3 The minimum-material can
A drinks company makes billions of cans. Shave a few square centimetres of aluminium from each and you save thousands of tonnes. What shape uses the least metal?
Objective, constraint, decision
Name three things before any calculus. Objective: what to minimise or maximise (metal area). Constraint: what must hold (volume = 330 cm³). Decision variable: what you choose (radius). The constraint lets you write everything in terms of one variable.
Reading the result
For 330 cm³: r* = (330/2π)^(1/3) ≈ 3.74 cm, h* ≈ 7.49 cm, A* ≈ 264 cm². A 3 cm radius needs 277 cm²: 5% more metal. Because the optimum is flat, being a few millimetres off costs very little; being far off costs a lot.
Why real cans are taller
Real drinks cans are about 6.6 cm wide and 11.5 cm tall. The model assumed uniform metal thickness, but can ends are much thicker than walls (they resist the pressure), so wall area is cheaper than end area. Grip, stacking and vending machines matter too. The model is right about its assumptions; the assumptions differ from reality.
Derivation: Minimising the surface area of a can
Objective: surface area A = 2πr² (two ends) + 2πrh (the wall). Constraint: volume V = πr²h is fixed.
Use the constraint to eliminate h: h = V/(πr²).
Substitute: A(r) = 2πr² + 2πr·V/(πr²) = 2πr² + 2V/r, a function of r alone.
Differentiate: A′(r) = 4πr − 2V/r².
Set A′ = 0: 4πr³ = 2V, so r* = (V/(2π))^(1/3).
Then h* = V/(πr²) = 2πr³/(πr²) = 2r: height equals diameter.
A″(r) = 4π + 4V/r³ > 0 for all r > 0, so this is the minimum.
Common mix-ups
With two unknowns you need two derivatives set to zero.
✓ Use the constraint to eliminate one variable first; then a single derivative does the job.If reality differs from the optimum, the optimisation was pointless.
✓ The gap points to the assumption that matters; a better model of costs explains real designs.
6.4 Maximum power transfer
A 12 V battery with 4 Ω of internal resistance drives a load. Make the load small and the current is huge; make it big and the current is tiny. Which load gets the most power?
The model
A real source is an ideal EMF V in series with an internal resistance r. With a load R the current is V/(R + r) and the load gets P = V²R/(R + r)². Both extremes give zero power: R = 0 (no voltage across the load) and R → ∞ (no current).
The result
Calculus gives R = r, P_max = V²/(4r). For 12 V and 4 Ω: 9 W. The curve is flat near the top: R = 8 Ω still gives 8 W. Matching does not need to be exact.
Power is not efficiency
At R = r, as much power is wasted inside the source as is delivered: 50% efficiency. Power grids run with loads far larger than the source resistance, for efficiencies above 90%. Choose the objective first: maximum power (signals, antennas) or maximum efficiency (energy systems).
Derivation: Why R = r maximises the load power
Current I = V/(R + r), so the load power is P = I²R = V²R/(R + r)².
Differentiate with the quotient rule (u = V²R, v = (R + r)²): P′ = V²[(R + r)² − R·2(R + r)]/(R + r)⁴.
Simplify by cancelling one (R + r): P′ = V²(R + r − 2R)/(R + r)³ = V²(r − R)/(R + r)³.
P′ = 0 only at R = r. For R < r, P′ > 0 (rising); for R > r, P′ < 0 (falling): a maximum.
Maximum power P_max = V²r/(2r)² = V²/(4r). Efficiency R/(R + r) = ½ at the optimum.
Common mix-ups
Maximum power transfer means maximum efficiency.
✓ At maximum power transfer the efficiency is only 50%.A smaller load resistance always draws more power.
✓ It draws more current, but below R = r the load power falls.
Examples to try
Worked solutions are in the interactive chapter online.
Formulate first: variables, objectives, constraints and Pareto fronts: example 1
Designs (mass kg, power W): P (3, 60), Q (4, 40), R (5, 45), S (6, 30). Which are on the front?
Stationary points: the top of the hill: example 1
Classify the stationary points of f(x) = x³ − 3x.
The minimum-material can: example 1
Find the minimum-metal radius for a 500 mL can.
Maximum power transfer: example 1
V = 12 V, r = 4 Ω. Find P at R = 8 Ω and compare with the maximum.
Interactive figures, in words
Figure 6.2 from “Formulate first: variables, objectives, constraints and Pareto fronts”
With 'Mass vs power', mark the designs you think are on the front and check. Then lower the mass limit to 5 kg: which designs drop out, and does the front change? Finally slide the weight from 0 to 1 and list the designs the weighted sum picks along the way.
Eight hypothetical arm designs A to H are plotted by two objectives. On mass versus power the non-dominated designs are those for which no other design is both lighter and lower-power. Lowering the mass limit greys out heavier designs and can change the front. A weight slider shows the weighted-sum choice moving between front designs as the weight changes, never onto a dominated design.
Figure 6.3 from “Stationary points: the top of the hill”
Choose 'Biggest pen against a wall'. Slide x and watch the sign of dA/dx in the readout: it tells you which way to move. Find the top by following the sign, then reveal the optimum. Change L and predict where the new optimum is before you look.
In the optimiser's pen mode, area A(x) = x(L − 2x) is a downward parabola. The readout gives dA/dx = L − 4x: positive for small x, negative for large x, zero at x = L/4, where the area is L²/8 (200 m² for L = 40 m).
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Equation Lab: Derivatives (Equation Lab exploration)
Plot a cost function and its derivative, and find where the derivative crosses zero.
Open online - Simulation OS: Freestanding stand (Simulation OS experiment)
Formulate the stand design as an optimisation: choose variables, a mass objective and tipping and bending constraints, then search by hand.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. 'The arm must lift a 2 kg sample' and 'the arm should be as light as possible'. Which is a constraint and which an objective?
- Both are objectives
- Lifting 2 kg is a constraint; lightness is the objective
- Lightness is a constraint; lifting is the objective
- Both are constraints
Check it in “Formulate first: variables, objectives, constraints and Pareto fronts”
2. Design X costs £900 and weighs 4.2 kg. Design Y costs £1,100 and weighs 4.8 kg. Lower is better for both. What can you say?
- Y dominates X
- X dominates Y
- Neither dominates
- They are on the same front
Check it in “Formulate first: variables, objectives, constraints and Pareto fronts”
3. A report picks design E 'by weighted sum' without stating the weights. What's the problem?
- None: weighted sums are objective
- The choice depends entirely on the weights, which are a value judgement the reader can't check
- Weighted sums always pick dominated designs
- E must be wrong
Check it in “Formulate first: variables, objectives, constraints and Pareto fronts”
4. At a stationary point f′(a) = 0 and f″(a) = 5. What is it?
- A local maximum
- A local minimum
- An inflection point
Check it in “Stationary points: the top of the hill”
5. A cost C(q) = 0.1q² − 3q + 50 has its stationary minimum at q = 15, but the pump can only run for 0 ≤ q ≤ 10. Where is the cheapest allowed setting?
- q = 15
- q = 10
- q = 0
Check it in “Stationary points: the top of the hill”
6. At the minimum-metal optimum, what is the ratio h/r?
Answer:
Check it in “The minimum-material can”
7. Real drinks cans are taller than h = 2r. What is the most important reason?
- The calculus is wrong
- The model assumed equal thickness everywhere, but the ends are much thicker, so end area costs more
- Tall cans hold more drink
Check it in “The minimum-material can”
8. Why do power stations not match their loads for maximum power transfer?
- They do, it is required by law
- Matching would waste half the generated energy as heat in the source and lines
- Matching would make the voltage too high
Check it in “Maximum power transfer”
Engineering applications
Packaging
Real drinks cans are taller than the material optimum because the objective includes more than metal: grip, stacking, the cost of thicker ends and what fits a vending machine.
Matching loads
Audio amplifiers and antennas are matched to their loads for maximum power transfer, but power stations are not, because matching wastes half the power as heat in the source.
Summary
- Formulate first: decision variables, objective and constraints, each with units.
- At a smooth interior optimum the derivative is zero; the second derivative tells minimum from maximum.
- Always check the boundaries: the optimum may sit on a constraint.
- Several objectives give a Pareto front; choosing a point on it is a judgement to state, not hide.
Glossary
- Derivative (rate of change)
- The derivative of a quantity is its instantaneous rate of change: the gradient of its graph at a point.
- Efficiency
- Efficiency is the fraction of input energy or power that comes out as useful output. The rest becomes heat, sound or other losses.
- Electrical power
- The power transferred in a component is the voltage across it multiplied by the current through it. For a resistor this can also be written I²R or V²/R.
- Power (rate of doing work)
- Power is how fast energy is transferred: energy divided by time. For a force moving at steady speed, power is force times velocity.
Project: Formulate and solve a sizing problem
Choose a sizing problem from your own design, such as a battery and motor pair or a bracket's thickness. Write the variables, objective and constraints with units, solve it with calculus or a careful sweep, and say which constraint is active at the optimum.
Deliverables
- The formulation with units
- The solution and how it was found
- The active constraint and what relaxing it would gain
References
- Panos Y. Papalambros and Douglass J. Wilde (2017). Principles of Optimal Design: Modeling and Computation, 3rd edition. Cambridge University Press.
- Stephen Boyd and Lieven Vandenberghe (2004). Convex Optimization. Cambridge University Press.
7. Linear programming and search
When the objective and constraints are straight lines, the best design always sits at a corner of the feasible region, and linear programming finds it. When the landscape is bumpy, engineers search: a grid tries everything at a fixed spacing, gradient descent walks downhill, and both can be fooled by local minima. Some problems, such as ordering many tasks, are so large that only good heuristics are practical, and they must be reported as such.
Figure 7.1. The optimum is at a corner (described in words)
A linear programme: maximise 3x + 2y subject to x + y ≤ 8, 2x + y ≤ 12 and x, y ≥ 0. The feasible region has corners (0, 0), (6, 0), (4, 4) and (0, 8), scoring 0, 18, 20 and 16. The best is the corner (4, 4) with 20.
Explanation
7.1 Linear programming: why the corners win
A workshop has 24 machining hours and 30 assembly hours. Among infinitely many weekly plans, you only need to check four. Why?
Drawing the region
Turn each inequality into its boundary line (2x + y = 24 meets the axes at (12, 0) and (0, 24)), then shade the side that satisfies it (test the origin: 0 ≤ 24, so the origin's side). Non-negativity keeps you in the first quadrant. The overlap of all shaded regions is feasible.
Binding and slack constraints
At the optimum, a constraint that holds with equality is binding: that resource is fully used. One with spare capacity has slack. In the example both machining and assembly bind at (8.4, 7.2). A non-binding constraint could be loosened without changing the answer at all.
Sensitivity: what's an extra hour worth?
Raise machining from 24 to 25 hours and re-solve: the optimum rises by the shadow price of machining. In the explorer it is about £0.80 per hour. If an extra hour costs less than its shadow price, buy it. Changes to the objective coefficients can make the best corner jump to a neighbour: the plan is stable only within a range of prices.
Beyond two variables
Real problems have thousands of variables, but the theorem still holds: optima sit at vertices of a high-dimensional polytope. The simplex method walks from vertex to better neighbouring vertex; interior-point methods cut through the middle. If the variables must be whole numbers (integer programming) the corner can be fractional, and the problem becomes much harder.
Derivation: The corner-point theorem in two dimensions
Maximise z = c₁x + c₂y subject to linear inequalities. Each inequality is a half-plane; their intersection is a convex polygon (the feasible region).
The level sets z = k are parallel straight lines with normal vector (c₁, c₂). Increasing k slides the line in the direction (c₁, c₂).
Suppose an optimum were at an interior point. A small step in direction (c₁, c₂) stays feasible and increases z, a contradiction. So the optimum is on the boundary.
On an edge, z varies linearly along the edge, so it is largest at one of the edge's two endpoints (or constant, if the edge is parallel to the level lines).
Therefore some vertex is optimal. Algorithm: find every vertex (intersect pairs of constraint lines, keep the feasible ones), evaluate z at each, take the largest.
Example: 2x + y ≤ 24, x + 3y ≤ 30, x, y ≥ 0. Crossing: from the first y = 24 − 2x; substitute: x + 72 − 6x = 30, x = 8.4, y = 7.2. Corners (0, 0), (12, 0), (0, 10), (8.4, 7.2). With z = 3x + 5y: 0, 36, 50, 61.2. The optimum is £61.20 at (8.4, 7.2).
Common mix-ups
The best plan uses a bit of everything, somewhere in the middle.
✓ For linear objectives and constraints, the best plan is at a corner of the feasible region.Adding resources always improves the optimum.
✓ Only binding constraints have a positive shadow price; spare capacity is worth nothing at the margin.
7.2 Searching a design landscape: grids, gradients and local minima
Rolling downhill finds a valley fast. But is it the deepest valley?
Grid search: thorough and expensive
Evaluate the cost on a regular grid and keep the best. It needs no derivatives, handles noisy or discontinuous costs, and with fine enough spacing can't miss a wide valley. But its cost is k^d evaluations, and its resolution is the grid spacing: the true optimum can sit between grid points. Use it for one to three parameters, or as a coarse first look.
Gradient descent: fast and local
Step against the slope: x ← x − η·f′(x). Near a minimum the slope shrinks, so steps shrink. Each step needs the gradient, which you can estimate with finite differences (two evaluations per parameter). It scales to many parameters, but it only ever goes downhill, so it settles in whichever valley it starts in.
The learning rate
η sets the step size. Too small and progress is painfully slow. Too large and the step jumps over the valley floor, bouncing or diverging. For f = a(x − b)², steps converge only if η < 1/a. In practice engineers try a few η values, or shrink η when the cost stops falling.
Guarding against local minima
A local minimum beats its neighbours but not the whole landscape. Defences: a coarse grid to find promising regions, then gradient descent to polish (a hybrid); several random restarts; or global methods (simulated annealing, genetic algorithms) that sometimes accept uphill moves. Always report the method and its limits: 'best found', not 'optimal'.
Common mix-ups
Gradient descent finds the best design.
✓ It finds a nearby stationary point, usually a local minimum. Restarts or global search are needed to be confident.A finer grid is always worth it.
✓ Its cost grows as k^d; for more than a few parameters, a fine grid is unaffordable.
7.3 When exact answers are out of reach
A delivery van must visit 20 shops. Trying every route would take a fast computer about two years. How do real route planners answer in a second?
Tractable means polynomial
A problem is usually called tractable if some algorithm solves it in O(n^k) time for a fixed k. Sorting, shortest paths (Dijkstra) and linear systems are tractable. Problems whose best known algorithms take 2ⁿ or n! time become impossible to solve exactly beyond a few dozen items, whatever the hardware.
P, NP and NP-hard, informally
P: problems solvable in polynomial time. NP: problems where a proposed answer can be checked in polynomial time (is this route shorter than 500 km? add up its legs). NP-hard: at least as hard as every NP problem; a fast algorithm for one would give fast algorithms for all. Nobody has proved P ≠ NP, but no one has found a polynomial algorithm for an NP-hard problem either, so engineers plan as if none exists.
Heuristics and approximations
A heuristic (nearest neighbour, greedy packing, simulated annealing) is fast but has no promise about quality. An approximation algorithm comes with a proof: for travelling-salesperson maps that obey the triangle inequality, Christofides' algorithm is never worse than 1.5× optimal. Either way, measure the gap on cases small enough to solve exactly, as the explorer does.
Common mix-ups
NP means 'not polynomial'.
✓ It means 'nondeterministic polynomial': solutions are checkable in polynomial time. P is inside NP.If a problem is NP-hard, engineers cannot solve it.
✓ They solve large instances well with heuristics, approximations and solvers, and small ones exactly.
Examples to try
Worked solutions are in the interactive chapter online.
Linear programming: why the corners win: example 1
Maximise 4x + 3y subject to x + y ≤ 10, 2x + y ≤ 16, x, y ≥ 0.
Searching a design landscape: grids, gradients and local minima: example 1
f(x) = 2(x − 3)², x₀ = 7, η = 0.1. Take two steps.
When exact answers are out of reach: example 1
How many distinct round trips through 12 cities, ignoring direction?
When exact answers are out of reach: example 2
A greedy route is 112 km and the exact best is 100 km. Report the heuristic's quality.
Interactive figures, in words
Figure 7.2 from “Linear programming: why the corners win”
Read the corner table and find the best corner. Move your trial plan (the square) to a point inside the region and compare its profit. Then raise the profit per chassis until the best corner jumps, and add machining hours to see how much one extra hour is worth.
The explorer shows the feasible region for 2x + y ≤ M (machining) and x + 3y ≤ A (assembly) with x, y ≥ 0, as a shaded polygon. A table lists each corner and its profit c₁x + c₂y; the largest is marked best. With M = 24, A = 30, c₁ = 3 and c₂ = 5 the corners are (0, 0), (12, 0), (0, 10) and (8.4, 7.2), and the optimum is 61.20 at (8.4, 7.2). Adding one machining hour raises it to about 62.00.
Figure 7.3 from “Searching a design landscape: grids, gradients and local minima”
Gradient descent from x₀ = 1: where does it end? Move x₀ to 5. Now try η = 4 and watch it overshoot. Switch to grid search: what is the smallest k that finds the global valley near 7.4, and how many evaluations does it cost?
The explorer plots an illustrative cost against one design parameter x from 0 to 10, with a local valley near x = 2.3 (cost about 1.52), a ridge near 3.8, and the deepest valley near 7.4 (cost about 0.61). Gradient descent from x₀ = 1 ends in the shallow valley; from x₀ = 5 it reaches the deep one; with a learning rate above about 3 it overshoots. Grid search with k points evaluates the cost k times and finds the deep valley once the spacing is fine enough.
Figure 7.4 from “When exact answers are out of reach”
Start at 4 cities and add one at a time up to 9, watching 'tours tried'. On several random maps, compare the greedy nearest-neighbour route with the exact best. How far off is greedy at its worst?
The explorer draws 4 to 9 random cities with two routes: the exact best tour (found by trying all (n−1)!/2 tours) and the greedy nearest-neighbour tour. A table reports tours tried, both lengths and the percentage gap; at 20 cities brute force would need about 6×10¹⁶ tours.
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Equation Lab: Optimisation (Equation Lab exploration)
Compare a coarse grid search with gradient descent on a two-variable landscape and count the function evaluations each needs.
Open online - Simulation OS: Traffic-light junction timing (Simulation OS experiment)
Search over green times for two directions to minimise the worst queue, and report whether your best setting is a corner of the allowed range.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. Corners of a feasible region are (0, 0), (12, 0), (0, 10) and (8.4, 7.2). What is the maximum of 3x + 5y?
Answer:
Check it in “Linear programming: why the corners win”
2. At the optimum, the assembly constraint has 6 hours of slack. What happens to the optimum if you buy 4 more assembly hours?
- It rises
- Nothing: assembly isn't the limiting resource
- It falls
- The problem becomes infeasible
Check it in “Linear programming: why the corners win”
3. The LP optimum is 8.4 frames and 7.2 chassis, but you can only build whole items. What is true?
- Round to (8, 7): that is guaranteed optimal
- The best whole-number plan must be found separately; rounding may be sub-optimal or even infeasible
- Fractional plans are always fine
- The LP was wrong
Check it in “Linear programming: why the corners win”
4. Gradient descent's cost goes up and down and then grows each step. What is the most likely cause?
- The learning rate is too small
- The learning rate is too large, so steps overshoot the minimum
- There is no minimum
- Gradient descent always does this
Check it in “Searching a design landscape: grids, gradients and local minima”
5. Gradient descent from three random starts gives costs 1.52, 0.61 and 1.52. What should you report?
- The average, 1.22
- The best found, 0.61, and that two of three starts reached a worse local minimum
- 1.52, because it occurred most often
- That the method failed
Check it in “Searching a design landscape: grids, gradients and local minima”
6. Which statement captures membership of NP?
- It can be solved in polynomial time
- A proposed solution can be checked in polynomial time
- It can never be solved exactly
- It needs a non-deterministic computer
Check it in “When exact answers are out of reach”
7. Your greedy scheduler beats random scheduling on every test. What should the report claim?
- It is optimal
- It is better than random on these tests; its gap to optimal is measured on small cases where the optimum can be computed
- NP-hard problems cannot be evaluated
- Nothing until P vs NP is solved
Check it in “When exact answers are out of reach”
8. Which problem has a known polynomial-time algorithm?
- Shortest path between two nodes in a road graph with positive lengths
- Shortest tour visiting every node once
- Choosing a subset of parcels that exactly fills a van's weight limit
- Colouring a map with 3 colours so neighbours differ
Check it in “When exact answers are out of reach”
Engineering applications
Production planning
A workshop deciding how many of two products to make with limited machine hours and materials is a linear programme. Its binding constraints show which resource is worth buying more of.
Scheduling tests
Ordering dozens of tests on shared rigs is a combinatorial problem with no fast exact method. Greedy schedules improved by swaps are used, and reported as good rather than optimal.
Summary
- In a linear programme the optimum lies at a vertex of the feasible region.
- Binding constraints at the optimum show where extra resources would pay off.
- Integer answers may not be at the LP vertex; rounding needs checking against the constraints.
- Grid search is simple but scales badly; gradient descent is efficient but can stop in local minima.
- For intractable problems, use heuristics and state honestly that the result is not proven optimal.
Glossary
- Efficiency
- Efficiency is the fraction of input energy or power that comes out as useful output. The rest becomes heat, sound or other losses.
- Bill of materials
- A bill of materials lists every part needed to build something, with quantity, exact part number or specification, supplier and cost.
Project: Plan a production run
Invent a small production problem with two or three products, at least three resource limits and profits per unit. Solve it graphically or by checking corners, report the binding constraints and the value of one more unit of the scarcest resource, then find the best whole-number plan.
Deliverables
- The LP with units
- The optimum and binding constraints
- The best integer plan and how it differs
References
- George B. Dantzig (1963). Linear Programming and Extensions. Princeton University Press.
- Stephen Boyd and Lieven Vandenberghe (2004). Convex Optimization. Cambridge University Press.
- Panos Y. Papalambros and Douglass J. Wilde (2017). Principles of Optimal Design: Modeling and Computation, 3rd edition. Cambridge University Press.
8. Gradient methods and convexity
Gradient descent is the workhorse of modern optimisation, from tuning controllers to training networks. This chapter studies it closely: how the learning rate decides between creeping, zig-zagging and exploding, why convex problems have a single answer that descent will find, how Newton's method and momentum go faster, and how constraints such as a motor's current limit are handled with penalties or by building them into the problem.
Figure 8.1. Learning rate decides everything (described in words)
Gradient descent on f(x) = 2x² from x = 2 with three step sizes. With η = 0.1 the iterates shrink smoothly towards 0; with η = 0.4 they zig-zag in sign but still shrink; with η = 0.55 they grow to 4.15 after 4 steps. Descent is stable only for η < 0.5.
Explanation
8.1 Gradient descent and the learning rate
Blindfolded on a hillside, you can only feel the slope under your feet. How big should each step downhill be?
The update
The gradient ∇f points uphill, steepest. Gradient descent steps the other way: x ← x − η∇f(x). η, the learning rate or step size, scales the step. Repeat until the gradient is (nearly) zero or progress stalls.
Too small, too big, just right
Too small: correct but painfully slow. Too big: overshoot, oscillate, diverge. For a quadratic the boundary is exact: η < 2/L. In practice, start small, increase until the loss stops falling smoothly, then back off; or use a line search that picks η each step.
Narrow valleys
When curvature differs a lot between directions (an ill-conditioned problem), the steep direction limits η and the shallow direction then moves slowly: the zig-zag path in the explorer. Rescaling variables (preconditioning), momentum, or second-order methods fix this.
Derivation: When does gradient descent converge on a quadratic?
Take f(x) = ½·a·x² with a > 0. Then f'(x) = a·x and the update is x_{k+1} = x_k − η·a·x_k = (1 − ηa)·x_k.
So x_k = (1 − ηa)^k · x₀: a geometric sequence. It shrinks to 0 if and only if |1 − ηa| < 1, i.e. 0 < η < 2/a.
Fastest: η = 1/a gives 1 − ηa = 0: one step. For 1/a < η < 2/a it overshoots and oscillates but still converges.
In two dimensions, f = ½(a₁x² + a₂y²) gives two independent factors (1 − ηa₁) and (1 − ηa₂). Stability needs η < 2/max(aᵢ).
With η limited by the steep direction, the shallow direction shrinks by (1 − a_min/a_max) per step at best. The condition number κ = a_max/a_min sets the pace: κ = 100 means about 100 steps per factor e.
For a general smooth f, L (the largest curvature, the Lipschitz constant of the gradient) plays the role of a_max: η < 2/L.
Common mix-ups
A bigger learning rate always gets there faster.
✓ Beyond 2/L it diverges, and between 1/L and 2/L it oscillates.Gradient descent finds the global minimum.
✓ On convex functions any minimum is global; on non-convex ones it finds a local minimum near the start (next lesson).
8.2 Convexity and local minima
Two engineers run the same optimiser on the same design problem and get different answers. Who is wrong?
Convex functions
f is convex if the straight line between any two points on its graph lies on or above the graph: f(θx + (1 − θ)y) ≤ θf(x) + (1 − θ)f(y). For twice-differentiable f this means f'' ≥ 0 (in 1-D) or a positive semi-definite Hessian. x², |x|, eˣ and ½xᵀAx with A positive semi-definite are convex.
Why convexity is precious
For a convex function on a convex set, every local minimum is a global minimum, and gradient methods with a sensible step converge to it from any start. You can also certify optimality: a zero gradient proves you are done.
Living with non-convexity
Non-convex functions can have many local minima, saddle points and flat regions. Practical responses: multiple random starts (report the spread of results), good initial guesses from physics, convex relaxations that give bounds, and global methods (simulated annealing, genetic algorithms) for small problems. Never present one run of a non-convex optimiser as 'the optimum'.
Common mix-ups
If an optimiser converges, it found the best answer.
✓ It found a stationary point. Only convexity (or a global method with proof) makes that the best.Non-convex problems cannot be optimised.
✓ They are optimised every day; you just report local results honestly and test robustness.
8.3 Newton's method, momentum and constraints
Gradient descent takes 200 steps down a narrow valley. Newton's method takes one. What is it using that gradient descent ignores?
Second-order methods
Newton's method uses curvature to scale the step in every direction, so ill-conditioning disappears: the narrow valley looks round to it. Quasi-Newton methods (BFGS, L-BFGS) build an approximation of H⁻¹ from gradients, keeping most of the benefit at a fraction of the cost, and are the default for medium-sized smooth problems.
Momentum
Momentum keeps a running velocity: v ← βv − η∇f, x ← x + v. Along a consistent shallow direction the steps add up; across a steep gully they cancel. It is cheap, first-order, and widely used in training neural networks.
Constraints by penalty
To minimise f subject to g(x) ≤ 0, minimise f(x) + μ·max(0, g(x))². Small μ: the constraint is violated a little. Large μ: closer to feasible, but the problem becomes ill-conditioned and slow. Increase μ gradually, or use exact methods (Lagrange multipliers, projection, interior-point solvers) when feasibility is non-negotiable, such as a safety limit.
Derivation: Newton's step from a quadratic model
Near x_k, approximate f by its second-order Taylor expansion: f(x_k + d) ≈ f(x_k) + f'(x_k)·d + ½f''(x_k)·d².
Minimise the model over d: derivative f'(x_k) + f''(x_k)·d = 0, so d = −f'(x_k)/f''(x_k).
Newton update: x_{k+1} = x_k − f'(x_k)/f''(x_k). In n dimensions: x ← x − H⁻¹∇f, with H the Hessian.
It is Newton–Raphson root-finding applied to f' = 0, which you met for solving equations.
Cost: forming and solving with H is O(n²) memory and O(n³) time per step, versus O(n) for a gradient step. Trade: few expensive steps versus many cheap ones.
Caution: if f'' ≤ 0 the step can go uphill; practical methods add a line search or modify H.
Common mix-ups
Second-order methods are always better.
✓ They take fewer steps, but each costs far more; for huge problems cheap first-order steps win.A penalty enforces the constraint exactly.
✓ Only in the limit μ → ∞; at finite μ the solution sits slightly outside.
Examples to try
Worked solutions are in the interactive chapter online.
Gradient descent and the learning rate: example 1
f(x) = 2(x − 3)², x₀ = 7, η = 0.1. Find x₁ and x₂.
Convexity and local minima: example 1
Is f(x) = x⁴ − 2x² convex?
Newton's method, momentum and constraints: example 1
Newton's method on f(x) = x⁴ from x₀ = 1. Find x₁ and x₂.
Interactive figures, in words
Figure 8.2 from “Gradient descent and the learning rate”
On the round bowl, find the learning rate that reaches the centre in one step. Switch to the narrow valley with b = 4: raise η until it diverges, and note the value. Then set b = 10 and see why a safe η crawls along the valley floor.
The explorer draws elliptical contours and the path of each gradient step. On f = ½(x² + 4y²) with η = 0.3, the y-coordinate shrinks by |1 − 1.2| = 0.2 per step and x by 0.7; at η = 0.6 the y-factor is |1 − 2.4| = 1.4 and the path diverges.
Laboratory (online)
These run in a browser on the full site. Simulations are simplified educational models.
- Equation Lab: Optimisation (Equation Lab exploration)
Find the largest learning rate that converges on a narrow valley, then rescale the variables and find it again.
Open online - Simulation OS: Robot joint under PID control (Simulation OS experiment)
Tune the joint's gains by repeated small changes in the direction that reduces settling time, and record each step like a gradient method.
Open online
Practice questions
Questions only. Each one is answered in its Lite lesson online, where it is checked on our server.
1. f(x, y) = ½(3x² + 12y²). What is the largest learning rate for which gradient descent converges? (Strict upper bound.)
Answer:
Check it in “Gradient descent and the learning rate”
2. Gradient descent zig-zags slowly down a long, narrow valley. The most direct cure is…
- A larger learning rate
- Rescaling the variables so the curvature is similar in every direction
- More random starting points
- Stopping earlier
Check it in “Gradient descent and the learning rate”
3. For f(x) = ½·5x², which learning rate reaches the minimum in exactly one step from any start?
Answer:
Check it in “Gradient descent and the learning rate”
4. Which function is convex on all real x?
- sin x
- x³
- eˣ + x²
- x⁴ − x²
Check it in “Convexity and local minima”
5. Your optimiser returns a point with zero gradient on a convex objective. What can you conclude?
- It may be a local maximum
- It is a global minimum
- Nothing without more starts
- It is a saddle point
Check it in “Convexity and local minima”
6. You tune a robot arm design with a non-convex objective. What is the honest report?
- 'We found the optimal design.'
- 'Best of 50 random starts; 38 reached within 1% of this value; results from the other 12 are shown.'
- 'Gradient descent converged, so it is optimal.'
- Report only the best run
Check it in “Convexity and local minima”
7. For a problem with a million variables, why is plain Newton's method rarely used?
- It converges too slowly
- Storing and solving with a million-by-million Hessian is far too expensive
- It only works in 1-D
- It cannot handle convex problems
Check it in “Newton's method, momentum and constraints”
8. A motor current must never exceed its rating. Which constraint method suits that best?
- A small penalty
- An exact constraint method (projection, interior-point or clamping) that guarantees feasibility
- Ignore it and check afterwards
- A random search
Check it in “Newton's method, momentum and constraints”
Engineering applications
Controller auto-tuning
Auto-tuners adjust controller gains to reduce a cost such as overshoot plus settling time. The cost surface is rarely convex, so good tuners start from several points and report the spread.
Trajectory optimisation
Robot arms plan smooth paths by minimising effort subject to joint limits. Limits that must never be broken are built in as hard constraints, not left to a penalty that might be outweighed.
Summary
- Gradient descent steps x ← x − η∇f; on a quadratic it is stable only below η = 2/λmax.
- Narrow valleys (poor conditioning) cause zig-zagging; rescaling variables helps.
- Convex functions have no local minima apart from the global one.
- Newton's method uses curvature for fast convergence but is costly in many variables; momentum is a cheap middle way.
- Hard limits belong in the constraints; penalties are for soft preferences.
Glossary
- Derivative (rate of change)
- The derivative of a quantity is its instantaneous rate of change: the gradient of its graph at a point.
- Efficiency
- Efficiency is the fraction of input energy or power that comes out as useful output. The rest becomes heat, sound or other losses.
- PID controller
- A PID controller adds proportional, integral and derivative actions: present error, accumulated past error and predicted future error.
Project: Tune a design by descent
Choose a design with two continuous variables and a cost you can compute, such as a stand's mass with a tipping penalty. Implement gradient descent, try three learning rates and several starting points, and report the best design, whether the problem appears convex, and how sure you are.
Deliverables
- The cost function and variables
- Convergence plots for each learning rate
- The best design with a convexity and uncertainty statement
References
- Stephen Boyd and Lieven Vandenberghe (2004). Convex Optimization. Cambridge University Press.
- Jorge Nocedal and Stephen J. Wright (2006). Numerical Optimization, 2nd edition. Springer.
Known limitations
- Not yet tested by a person using a screen reader; only automated structure checks have run.
- Some interactive lesson diagrams need a pointer or keyboard and a recent browser; their text alternatives carry the same idea without the interaction.
- Mathematics is written as plain text (for example x^2 and sqrt(x)), like the School lessons, not typeset notation.