Back to examples

Add a person, finish sooner

The launch is six working days behind its deadline, and the manager can borrow someone. Who, and for which task? Adding a person to the wrong task costs a salary and buys nothing. The engine tries every option on a copy of the plan and says how many days each one buys.

Hover a row on the right to see that plan on the chart; click it to take it. The plan is applied, leveled again, and the list is rebuilt for the new plan.

Why most options buy nothing

The tasks here carry work, and most are effort-driven: a second person on an 8 person-day task makes it 4 days long. But a shorter task only helps if it is on the path that sets the launch. Frontend build gets four days shorter with Eli on it, and the launch does not move. Acceptance tests sit right before the launch, so the same person there buys two and a half days.

Data migration and Compliance review are fixed duration: more people share the load and the dates stay. Yet adding Dee to Data migration still moves the launch a day. Cy works on both tasks and was overbooked, so leveling had to delay one of them. With Dee taking half of the migration, Cy fits, and the delay goes away. The row notes say where a gain comes from: a shorter task, or leveling that no longer has to wait.

One call scores them all

A candidate is a change set. evaluate applies each one to a copy, solves it, and levels it with the options the page commits with. Every number is measured against the accepted plan, and that is the leveled plan on the chart: the days gained are the candidate's leveled finish delta, and the overload column is what the change books above capacity before leveling sorts it out.

Scoring every option
// One candidate per free person on each task.
const candidates = [
  { id: "7:ana", changes: { assignments: {
    add: [{ id: "7-ana", task: 7, resource: "ana", value: 1 }],
  } } },
  { id: "4:eli", changes: { assignments: {
    add: [{ id: "4-eli", task: 4, resource: "eli", value: 1 }],
  } } },
  // …
];
const LEVEL = { allowSplits: false };
const result = project.evaluate(candidates, {
  level: LEVEL,
  focus: [1, 2, 3, 4, 5, 6, 7],
});

// The baseline is the plan on the chart,
// so a delta is what taking the option changes.
const gain = c => -c.leveled.finish.project.delta;   // working days sooner

evaluate returns numbers, not plans. The plan of the row under the pointer comes from preview with the same level options: the dates apply and level would give, read from a copy. The deadline is the project end, so a late launch is a project-end-violation, and its size is the "working days late" above the list.

Showing one option
// Hover = the plan the commit would give, without committing it.
const shown = project.preview(candidate.changes, { level: LEVEL, state: true });
shown.state.tasks;   // every task of that plan: dates, delay, pauses
// still 3.5 working days late:
// { kind: "project-end-violation", size: 3.5, … }
shown.conflicts;

The list is ranked on days gained, then on the overload left, not on the engine's cost. That score counts only finishing later (max(0, delta)), so a candidate that gains three days and one that changes nothing get the same score.

Taking the best one
// Accept = the same change and the same leveling
// the score and the preview used.
project.apply(candidates.find(c => c.id === "7:ana").changes);
// re-levels from zero; assignmentUpdates, if units were rescaled
project.level(LEVEL);

What this demo leaves out

A candidate adds one full-time person to one task. The people are free when they have room on some day of the task; the evaluation itself shows the overload an option creates. See the task types demo for what one added person does to each kind of task.