Sub topic 13
When Resources Break the Critical Path
This chapter assumes you can run the forward and backward passes, calculate total float, and read the critical path from zero-float activities. The code example uses basic Python (dictionaries, loops, functions).
The assumption behind the basic method
The critical path calculation you have used so far assumes that resources are unlimited. A task can start as soon as its predecessors finish, because someone is always free to do it. The only constraints are the dependency links in the network.
Real teams have a fixed number of people, machines, and rooms. If two tasks that can run in parallel need the same person, they cannot actually run in parallel. The calculated critical path then understates the project duration, and it may point at the wrong tasks.
A worked example
A small project has four tasks:
| Task | Duration (days) | Predecessors | Needs the one developer? |
|---|---|---|---|
| Design | 3 | none | No |
| UI | 4 | Design | Yes |
| API | 4 | Design | Yes |
| Test | 2 | UI, API | No |
Using dependencies only, the forward pass gives these results:
- Design runs from day 0 to 3.
- UI and API both run from day 3 to 7.
- Test runs from day 7 to 9.
UI and API both have zero float, so there are two critical paths of 9 days each: Design, UI, Test and Design, API, Test.
Now add the fact that one developer must build both UI and API. The two tasks cannot overlap. One has to wait for the other, so the earliest possible finish is 3 + 4 + 4 + 2 = 13 days. The network says 9 days, but the project needs 13.
Resource dependencies
The fix is to treat the shortage as an extra dependency. If API goes first, there is now an implied link from API to UI that the original network did not contain. It is called a resource dependency, or a resource-driven predecessor.
With the dotted link in place, the longest chain is Design, API, UI, Test, which totals 13 days. This chain is the resource-constrained critical path. It contains a link that appears nowhere in the original dependency network.
Two points follow from this:
- The resource-constrained critical path can be longer than the dependency-only path. It can never be shorter.
- The choice of which task goes first is a scheduling decision. Putting UI first gives another valid 13-day schedule. The dependency network alone cannot tell you which.
Why float becomes misleading
Float computed from the dependency network alone assumes every task can use its float freely. With shared resources, that is often false.
Suppose two tasks each show 2 days of float and share a resource. Delaying one by 2 days may be harmless. But if the delay pushes it into the time slot the other task needed, the second task slips as well. The float was real for each task separately, but the two tasks could not both use it.
Because of this, tasks with float need a second look when they share a resource with a critical task. The result can be a task that looks safe but is delaying the project.
Building a resource-constrained schedule
To resolve conflicts you need a rule for who goes first. A common rule is to give priority to the task with the smallest latest start, which is the task with the least float. When two tasks compete for the same resource, the one that can least afford to wait goes first.
The following code does this. It runs the forward and backward passes to get latest start times, then schedules day by day. On each day it starts every ready task, in priority order, for which the resource is free for the whole duration.
tasks = {
# name: (duration in days, predecessors, developers needed)
"Design": (3, [], 0),
"UI": (4, ["Design"], 1),
"API": (4, ["Design"], 1),
"Test": (2, ["UI", "API"], 0),
}
CAPACITY = 1 # one developer available
# Forward pass (dependencies only)
es, ef = {}, {}
for t, (dur, preds, _) in tasks.items():
es[t] = max((ef[p] for p in preds), default=0)
ef[t] = es[t] + dur
project_end = max(ef.values())
# Successor lookup and backward pass
succs = {t: [] for t in tasks}
for t, (_, preds, _) in tasks.items():
for p in preds:
succs[p].append(t)
ls = {}
for t in reversed(list(tasks)):
lf = min((ls[s] for s in succs[t]), default=project_end)
ls[t] = lf - tasks[t][0]
# Day-by-day resource-constrained schedule
usage = {} # day -> developers in use
start, finish = {}, {}
day = 0
while len(start) < len(tasks):
ready = [
t for t in tasks
if t not in start
and all(p in finish and finish[p] <= day for p in tasks[t][1])
]
for t in sorted(ready, key=lambda x: (ls[x], x)):
dur, _, need = tasks[t]
days = range(day, day + dur)
if all(usage.get(d, 0) + need <= CAPACITY for d in days):
start[t] = day
finish[t] = day + dur
for d in days:
usage[d] = usage.get(d, 0) + need
day += 1
print(project_end) # 9
print(finish) # {'Design': 3, 'API': 7, 'UI': 11, 'Test': 13}
print(max(finish.values())) # 13UI and API tie on latest start (day 3), so the name breaks the tie and API goes first. UI has to wait until day 7, when the developer is free. Test then starts on day 11, and the project ends on day 13.
Limits of this code
- It is a greedy heuristic. It makes the best-looking choice each day and never goes back. Finding the shortest possible resource-constrained schedule is a hard problem (NP-hard) in general, so tools use heuristics like this one.
- Different priority rules can give different end dates on larger projects. Smallest latest start is a common default, not a guaranteed best.
- It assumes tasks cannot be paused and resumed, and that each task needs its resource for its whole duration.
Critical chain
The critical chain method, from Eliyahu Goldratt's work, builds on this idea. The critical chain is the longest chain of tasks once both dependencies and resource limits are taken into account. In our example it is Design, API, UI, Test.
The method also changes how safety time is handled:
- Individual task estimates are cut to remove padding that people add for themselves.
- The removed time is pooled into a project buffer at the end of the chain.
- Smaller feeding buffers are placed where non-critical chains join the critical chain.
The aim is to protect the end date without letting each task owner spend their own padding. You do not need to adopt the full method to use its main point: find the critical chain by including resource limits.
Practical guidance
- Compute the dependency-only critical path first. It gives a lower bound on the duration.
- List the resources that are shared by tasks that could run in parallel.
- Resolve each conflict by ordering the tasks, and record the order as a resource dependency.
- Recompute the longest path. This is your resource-constrained critical path.
- Review the float of tasks that share resources with critical tasks.
Options for shortening a resource-constrained schedule differ from the dependency-only case. Adding a second developer in our example would bring the project back to 9 days. Shortening a task that is not on the resource-constrained path does nothing.
Exercise
Using the table in this chapter, a second developer joins the team, so CAPACITY is 2. What happens to the schedule, and what is the critical path?
Show answer
UI and API can run in parallel from day 3 to day 7, because two developers are available. Test then runs from day 7 to 9, so the project takes 9 days. The resource dependency between API and UI disappears. The critical paths are again Design, UI, Test and Design, API, Test, which are the two dependency-only critical paths.
Exercise
Task X and task Y share one tester. Both show 3 days of total float, and neither is on the critical path. Why might the project still finish late if both use their float?
Show answer
Total float is calculated as if each task has its own resources. If X uses 3 days of float, it can occupy the tester during the period Y needed. Y must then wait, and Y may be pushed past its own float. The two tasks cannot both use their full float, so the project can slip even though neither task looks critical.