Release Schedule 3: Dependencies
Uses Only Free-Tier SpiceGrinder
Problem statement
The four tasks of the release don’t happen in any order we like: they have to be sequenced. Design comes first. Then Build runs, and Test follows it. Docs can be written alongside Build and Test, and the release is done when both the code and the docs are done.
For the rest of this track the team has settled on three-point estimates for every task, so the project network is easy to follow. Each task is a Triangular set by its best case, its most likely value and its worst case, in days:
| Task | Best | Most likely | Worst |
|---|---|---|---|
| Design | 5 | 8 | 15 |
| Build | 10 | 15 | 30 |
| Test | 3 | 5 | 12 |
| Docs | 4 | 6 | 12 |
The business wants the release by day 40. So the questions are: when will the release actually finish, how likely is it to miss day 40, and what date can we promise?
The model
The project’s logic fits in one line. Build and Test are in sequence, so together they take Build + Test; Docs runs alongside them, so the stretch after Design lasts as long as the slower of the two. Design comes first:
finish = Design + max(Build + Test, Docs)
The model draws the four tasks and then applies that line to every row:
- the four
Triangularnodes draw the task durations, as in lesson 2; - a
Copulawith the identity matrix joins them into one four-column row. With the identity matrix the tasks stay independent (it just hands each task’s own distribution through); it is here so that lesson 4 can change one number in it; - a
CalculatenamedFinishcomputes the line above into column 4.x[0]tox[3]are the four task columns it receives, andy[4]is the new column it writes. Itsdimension="6"makes the output two columns wider than the four it receives, which leaves room for the finish (column 4) and the late flag (column 5). Columns it doesn’t assign pass through unchanged, so the four task columns come out as they went in; - a second, chained
CalculatenamedLatesets column 5 to 1 if the finish is after day 40 and to 0 otherwise.x[4] > 40is a comparison: it gives 1 when it is true and 0 when it is false, with nothing to clamp.
<?xml version="1.0" encoding="UTF-8"?>
<dataset columns="design, build, test, docs, finish, late" seed="20261006">
<root node="Late"/>
<nodes>
<Triangular name="Design" min="5" mode="8" max="15"/>
<Triangular name="Build" min="10" mode="15" max="30"/>
<Triangular name="Test" min="3" mode="5" max="12"/>
<Triangular name="Docs" min="4" mode="6" max="12"/>
<Copula name="Durations" correlation="1,0,0,0; 0,1,0,0; 0,0,1,0; 0,0,0,1">
<input name="Design"/>
<input name="Build"/>
<input name="Test"/>
<input name="Docs"/>
</Copula>
<Calculate name="Finish" dimension="6" expression="y[4] = x[0] + max(x[1] + x[2], x[3])">
<input name="Durations"/>
</Calculate>
<Calculate name="Late" expression="y[5] = x[4] > 40">
<input name="Finish"/>
</Calculate>
</nodes>
</dataset>
Each row is one possible project: the four task durations, the finish day, and whether it was late. Run it a million times (a little over a second):
grind --count 1000000 release-schedule.xml
The first rows (samples/simulation/release-schedule.xml in your own install, if you want to reproduce this; leave the seed at 20261006 and you get exactly these values). The columns are Design, Build, Test, Docs, Finish and Late:
8.161203733984781,13.736032741571153,4.819713960768279,4.723453179547734,26.716950436324215,0.0
6.2693411836817585,27.87695337314853,7.755562697398926,7.628323641167152,41.90185725422921,1.0
11.355910972099174,22.12498020037074,9.978725982727902,9.510534116377194,43.45961715519781,1.0
11.985232292300566,27.800697478800213,9.861402657340943,9.98166229678867,49.64733242844172,1.0
Four columns become one answer
The first row is a lucky project: Design 8.2 days, then Build 13.7 plus Test 4.8 is 18.6 days, which is far longer than Docs’ 4.7, so the finish is 8.2 + 18.6 = 26.7. The second row is not lucky: a 27.9-day Build pushes the finish to day 41.9, and its Late flag is 1. Row by row the model turns four uncertain durations into one finish day, and the finish days are what we can question.
The chance of missing the deadline
The Late column is 0 or 1, so its average is the share of projects that were late: a probability. Over the million trials the average is 0.1474: about one project in seven finishes after day 40. This is the same kind of estimate as lesson 1’s share over 10 days, so the same rule gives its noise, sqrt(p(1-p)/n): 0.0004 for a million rows. (Lesson 5 comes back to how many rows are enough.)
A flag column like this is the standard way to ask a yes/no question of a simulation: add a column that is 1 when the thing happens, and its mean is the probability.
Percentiles are commitments
A single date is a promise, and the finish distribution tells us how safe each promise is. The P50 is the day by which half of the projects are done, the P80 the day by which 80% are done, the P90 the day by which 90% are done:
| Percentile | Finish day | Meaning |
|---|---|---|
| P50 (median) | 34.0 | a coin flip |
| P80 | 38.8 | late one project in five |
| P90 | 41.3 | late one project in ten |
(1,000,000 trials, seed 20261006.) So the date that is 80% safe is day 39, and the deadline of day 40 is a little better than 85% safe (1 − 0.1474). If the business needs 90% confidence, it has to ask for day 42, not day 40.
The plan against the odds
The usual way to plan is to add up the most likely values: 8 + max(15 + 5, 6) = 28 days. That plan is not wrong arithmetic; it just answers a different question from the one we’re asked, because it ignores that each task is as likely to overrun as to underrun, and that a late Build is much later than an early one is early. In our million trials only 10.4% of projects finish by day 28. The median finish is day 34, six days after the plan, and day 40 itself is met only about 85% of the time.
The companion page lets you slide the deadline, pick a confidence level, and read off the chance of missing the date and the day that is that safe, all from the same million runs.
Check: do the numbers match the math?
Two checks, one by hand and one against theory.
By hand, from the first row of the output: Design 8.161204, Build 13.736033, Test 4.819714, Docs 4.723453.
8.161204 + max(13.736033 + 4.819714, 4.723453)
= 8.161204 + max(18.555747, 4.723453)
= 8.161204 + 18.555747 = 26.716950
The file says 26.716950 and Late is 0, as it should be. Rows 2 and 3 work out to 41.901857 and 43.459617 (both late). The same holds for all 1,000,000 rows: the largest difference between the Finish column and the formula is 0, and the Late flag equals (Finish > 40) every time.
Against theory: the distribution of Design + max(Build + Test, Docs) for independent triangular tasks has no tidy closed form, but it can be computed numerically on a fine grid (step 0.01 day) by convolving the pieces. That computation gives:
| Simulated (1,000,000 rows) | Numerical theory | |
|---|---|---|
| P50 | 33.976 | 33.976 |
| P80 | 38.811 | 38.796 |
| P90 | 41.337 | 41.319 |
| P(finish after day 40) | 0.1474 | 0.1470 |
The late probability differs from theory by 0.0004, about one standard error, and the percentiles agree within 0.02 days.
What this gives you: a way to turn a set of uncertain tasks and the logic that joins them into one finish-day distribution; a flag column whose mean is a probability; and percentiles as dates with a stated confidence, which is a much better thing to promise than a single most-likely number.
One thing in this model is too tidy to be true: the four tasks are drawn independently. In a real project a Build that overruns tends to be followed by a Test that overruns too, and that changes the answer. The next lesson ties Build and Test together and measures how much.