Show contents
Chapter 2 of 7 · 20 min
Estimate and plan honestly
By the end of this chapter, you'll be able to
- Estimate a task as a range with the three-point method
- Use a team's past velocity to forecast a date
- Simulate a schedule's uncertainty with a Monte Carlo method
- Communicate an estimate as a probability, not as a promise
A range rather than a figure
A single-figure estimate (“5 days”) hides the uncertainty. The three-point method asks for three values:
- O, the optimistic estimate: everything goes well;
- M, the most likely;
- P, the pessimistic: the foreseeable troubles happen.
The so-called PERT formula combines all three: expected duration = (O + 4M + P) / 6, with an uncertainty of about (P − O) / 6.
tasks = {
"Registration form": (2, 3, 6),
"Sending emails": (1, 1, 3),
"Dashboard": (2, 4, 9),
"Mobile money payment": (3, 5, 12),
}
total = 0
for name, (o, m, p) in tasks.items():
expected = (o + 4 * m + p) / 6
total += expected
print(f"{name:<22} {o:>2}-{m:>2}-{p:>2} d → {expected:.1f} d (± {(p - o) / 6:.1f})")
print(f"Expected total: {total:.1f} days, against {sum(m for _, m, _ in tasks.values())} keeping only the most likely")
Registration form 2- 3- 6 d → 3.3 d (± 0.7)
Sending emails 1- 1- 3 d → 1.3 d (± 0.3)
Dashboard 2- 4- 9 d → 4.5 d (± 1.2)
Mobile money payment 3- 5-12 d → 5.8 d (± 1.5)
Expected total: 15.0 days, against 13 keeping only the most likely
The expected duration is always a little higher than the most likely value: bad surprises lengthen more than good ones shorten. Payment, which depends on an outside provider, has the largest uncertainty.
Velocity: forecasting with the past
In an iterative approach, you measure velocity: the amount of work actually finished in each iteration, often in points (a relative unit of size, where a 2-point task is roughly twice as big as a 1-point task). You no longer forecast with intentions, but with facts.
import math
velocities = [18, 22, 15, 20, 21]
remaining = 120
average = sum(velocities) / len(velocities)
print(f"average velocity: {average:.1f} points per iteration")
for name, v in (("pessimistic", min(velocities)), ("average", average), ("optimistic", max(velocities))):
print(f"{name:<11} {math.ceil(remaining / v)} iterations")
average velocity: 19.2 points per iteration
pessimistic 8 iterations
average 7 iterations
optimistic 6 iterations
With 120 points left, the honest answer is not “7 iterations”, but “between 6 and 8 iterations, probably 7”. The range narrows as the project progresses and the history grows.
Simulating uncertainty
Adding up ranges by hand quickly gets complicated. The Monte Carlo method simulates the project thousands of times, drawing each task's duration at random within its range, then looks at the distribution of results:
import random
tasks = [(2, 3, 6), (1, 1, 3), (2, 4, 9), (3, 5, 12)]
rng = random.Random(7)
durations = sorted(
sum(rng.triangular(o, p, m) for o, m, p in tasks)
for _ in range(10_000)
)
for percent in (50, 80, 95):
print(f"{percent}% chance of finishing in {durations[len(durations) * percent // 100 - 1]:.1f} days or less")
print(f"Probability of finishing in 13 days (the sum of the “most likely”): {sum(d <= 13 for d in durations) / len(durations):.0%}")
50% chance of finishing in 16.9 days or less
80% chance of finishing in 19.3 days or less
95% chance of finishing in 21.6 days or less
Probability of finishing in 13 days (the sum of the “most likely”): 5%
rng.triangular(o, p, m)draws a duration betweenoandp, more often close tom;- 10,000 projects are simulated and their durations sorted: the 80% value is the duration that 80% of the simulations do not exceed;
- the fixed seed (
Random(7)) makes the result reproducible.
You announce a date with its probability, and update it regularly.
Text description of the animation
- Each task gets three estimates, rather than a single figure.
- The project is simulated thousands of times, drawing each duration within its range.
- You get the distribution of possible durations for the whole project.
- You read the duration matching the confidence level you want.
- You announce a date with its probability, and update it regularly.
Mini-lab: your own simulationPython 3.13
Output
Click “Run”: Python will load in your browser (about 10 MB the first time).Your code runs in your browser, isolated from the page. · Ctrl/⌘ + Enter to run · Esc then Tab to leave the editor
Your turn
Worked exercise
Worked exercise: when will we finish?
A team delivered [13, 17, 9, 15, 16, 14] points in its last six iterations, of two weeks each. 75 points remain in the backlog. Compute the number of iterations needed in the pessimistic case (minimum velocity), the average case and the optimistic case (maximum velocity), then the number of weeks for each case.
Hint 1
math.ceil.Hint 2
Show the solution and common mistakes
import math
velocities = [13, 17, 9, 15, 16, 14]
remaining = 75
average = sum(velocities) / len(velocities)
for name, v in (("pessimistic", min(velocities)), ("average", average), ("optimistic", max(velocities))):
iterations = math.ceil(remaining / v)
print(f"{name:<11} velocity {v:>4.1f} → {iterations} iterations, that is {iterations * 2} weeks")
pessimistic velocity 9.0 → 9 iterations, that is 18 weeks
average velocity 14.0 → 6 iterations, that is 12 weeks
optimistic velocity 17.0 → 5 iterations, that is 10 weeks
The answer to give: “between 10 and 18 weeks, probably 12”. The range is wide, because one 9-point iteration drags the pessimistic case down. It is worth understanding what happened that time: a one-off surprise, or a problem likely to come back?
Common mistakes:
- Using
roundinstead ofmath.ceil: 75 / 14 ≈ 5.4 would be rounded to 5 iterations, when 6 are needed to finish everything. - Counting points started rather than finished in the velocity: the forecast becomes optimistic, because half-done work cannot be delivered.
Summary
- 1An honest estimate is a range: optimistic, likely, pessimistic.
- 2The three-point method gives an expected duration (O + 4M + P) / 6, often higher than the “most likely”.
- 3Velocity measures the work actually finished: forecast with past facts.
- 4A Monte Carlo simulation turns ranges into probabilities of finishing on time.
- 5Adding up the “most likely” estimates produces a schedule that is almost never met.
Your progress is saved on this device. Create a free account to keep your progress on all your devices.