Back to Blog

PERT Diagrams with Monte Carlo Simulation

pertmonte-carloproject-planningdiagrams-as-code

When a project slips, it’s almost never the activity you expected. The “obvious” critical path on paper rarely survives contact with reality — a parallel arm runs long, a buffer evaporates, and the bottleneck shifts. Classical PERT (the Program Evaluation Review Technique) tells you what the critical path is on average. Monte Carlo PERT tells you what it actually will be, percentage of the time.

We just shipped PERT in DGMO with both views, plus an interactive duration scrubber so you can ask “what happens if this slips a week?” and watch the criticality redistribute live.

What you write

A PERT diagram is an Activity-on-Node project network. Each activity carries a three-point estimate: optimistic, most-likely, pessimistic. DGMO renders this directly:

Pirate voyage to the atoll
Pirate Voyage to the Atolloutfit ship0w◆ voyage approved2.17w1.08w3.25wload powder2.17w0w3.25w0w1.58w1.58wcareen hull0.58w0.58w2.17w0w2.17w2.17wrecruit crew0w0w2.17w3.25w5.17w8.42wsail to atoll3.25w0w8.42w8.42w2w10.42wcount gold9.58w1.17w11.58w8.42w3.17w11.58wrepair hull8.42w0w11.58w11.58w2w13.58wdivvy shares11.58w0w13.58wActivity Risksail to atoll−2.17+2.83repair hull−1.17+1.83recruit crew−0.58+1.83divvy shares−1+1load powder−0.58+0.92careen hull+0.33Expected duration: 13.6 weeks (± 1.17 weeks)0%25%50%75%100%Probability of completionP50 · 13.6w50% chance within 13.6wP80 · 14.8w80% chance within 14.8wP95 · 15.8w95% chance within 15.8w12.4w13.2w13.9w15.5w16.3w
source
pert Pirate Voyage to the Atoll
time-unit w
default-confidence medium
trials 5000
seed 42

voyage approved 0
  -> recruit crew

[outfit ship]
  load powder 0.5 1 2
  careen hull 1 1.5 2.5
    -> load powder
  recruit crew 1 2 4 as rc
    -> load powder
  load powder
    -> sail to atoll

sail to atoll 3 5 8
  -> count gold
  -> repair hull

count gold 1 2 3
  -> divvy shares
repair hull 2 3 5
  -> divvy shares

divvy shares 1 2 3

The renderer shows the M-world critical path with stars and saturated accent fills, the project μ and σ in a footer, and — when at least one activity has a three-point estimate — gamma-curved tints proportional to each activity’s criticality index (the fraction of trials where it sat on the longest path).

Reading the diagram

VisualMeaning
Saturated fillHigh criticality — activity is on the longest path most of the time
Light tintLow criticality — activity has slack
Diagonal stripesCriticality ≥ 0.9 (a non-color signal so deuteranopic readers can still find the modal critical path)
★ before nameActivity is on the M-world critical path
Diamond shapeMilestone (zero duration)
Dashed borderGroup bounding rect

The footer shows P50 / P80 / P95 — the project completion percentiles. If your stakeholder asks “when will this be done?”, the honest answer is rarely a single date. P80 is what you tell them.

Determinism

The Monte Carlo simulator uses a deterministic mulberry32 PRNG. A given (seed, inputs) tuple produces the exact same output across machines, browsers, and CI runs — which means MC results are reviewable in pull requests, not just inspectable in the moment.

Interactive scrubbing

In the desktop and web editors, putting the cursor on an activity’s source line expands the activity inline — header, μ ± σ, ES/EF, LS/LF, slack, predecessor and successor chips, and a duration slider. Drag the slider to explore “what if this takes longer?” and the rest of the diagram re-runs Monte Carlo on every animation frame. Release the slider and the canonical 10K-trial run dispatches off the main thread to a Web Worker so the high-fidelity criticality lands without blocking the UI.

Hammocks and clusters

Wrap related activities in [group-name] and DGMO auto-classifies the group:

  • Hammock — single entry, single exit. Click the group label to collapse it into a rolled-up super-element with the group’s μ.
  • Cluster — multi-entry or multi-exit. Same collapse behaviour, dashed bounding rect.

Either way, the activities inside still feed the analysis; the collapse is just visual housekeeping for big networks.

When to reach for it

PERT pairs well with Gantt — Gantt for the calendar view, PERT for the dependency network. Use PERT when:

  • The work has meaningful uncertainty and you want to express it
  • Multiple parallel arms feed a single deadline
  • You want to know which activities drive the schedule, not just a critical path
  • You’re presenting to stakeholders who deserve P80, not “we’ll see”

Try it

Open the web editor, pick PERT from the new-file dialog, and start sketching. The voyage above is preloaded as an example. The full syntax reference lives in the language guide.