Reschedule a branch#

Reschedule one task and the work that depends on it, and leave the rest of the project where it is.

The scope is the task you name, its summary ancestors and descendants, and its successors through links. With Inclusive on, the default, the scope also follows incoming links, so it takes in the task's predecessors and their branches too. Tasks outside the scope keep their dates.

Steps#

  1. Create a Subtree for the task the branch starts from and set it on SolveOptions. new Subtree(id) sets Inclusive = true, so the scope also takes in the task's predecessors:

    var options = new SolveOptions { Subtree = new Subtree("design") };
    

    To reschedule only the task and the work downstream of it, set Inclusive = false. The task itself stays in the scope either way:

    var subtree = new Subtree("design") { Inclusive = false };
    
  2. Pass the options to Project.Solve. Pass your ProjectData on the first load, or null to reschedule the current state:

    var result = project.Solve(null, options);
    
  3. Write the entries of result.Updates back to your model. Each Mutation is a task in the scope that moved. The scoped dates become the accepted baseline.

The full example below has two independent chains, backend → api and design → ui. Both successors start too early. The scoped solve fixes only the design branch:

using Plen;

var jan1 = Moment.FromYmdHm(2026, 1, 1, 0, 0) ?? throw new InvalidOperationException("invalid date");

var data = new ProjectData
{
    Tasks =
    [
        new TaskData("backend") { StartDate = jan1, Duration = 2.0 },
        new TaskData("api") { StartDate = jan1, Duration = 1.0 },
        new TaskData("design") { StartDate = jan1, Duration = 3.0 },
        new TaskData("ui") { StartDate = jan1, Duration = 1.0 },
    ],
    Links =
    [
        new LinkData { Id = "l1", Source = "backend", Target = "api" },
        new LinkData { Id = "l2", Source = "design", Target = "ui" },
    ],
};
// 24/7 time keeps the example dates easy to check.
data.Config.UseCalendars = false;

var options = new SolveOptions { Subtree = new Subtree("design") };

var project = new Project();
var result = project.Solve(data, options);

foreach (var m in result.Updates)
{
    Console.WriteLine($"{m.Id} {m.StartDate}..{m.EndDate}");
}

Preview a branch#

To see what rescheduling a branch would do without changing the project, set the same Subtree on PreviewOptions and call Project.Preview:

var preview = project.Preview(
    new SchedulingChanges(),
    new PreviewOptions { Subtree = new Subtree("backend") });

The preview scope applies to that call only. It doesn't touch the baseline or the cached solve result. A preview scope can also name a task that the same changes add.

Things to know#

  • Tasks outside the scope don't move until you solve them. In the example, the next project.Solve(null, new SolveOptions()) moves only api, because ui is already accepted.
  • The result cache uses the whole SolveOptions as its key, compared by value. A different Subtree replans from the accepted dates. Solving again with the same Subtree returns the same cached result object.
  • With IncludeUnchanged, a scoped solve reports every task in the scope, plus the out-of-scope tasks a sparse scoped solve would report.
  • On a project with a dependency cycle, nothing is scheduled, scoped or not. Check result.Cycles.
  • An unknown or unscheduled task in Subtree.Task throws InputException with Path subtree.task and the message unknown or unscheduled scope task. The project keeps its previous state and cached result. See Error handling.

Result#

The example prints one line. Only ui moves, to start after design ends. api still overlaps backend:

ui 2026-01-04 00:00..2026-01-05 00:00

Without Subtree, the same solve also moves api to 2026-01-03 00:00.