Engine.Schedule#
Schedules a ProjectData snapshot once and returns the result. The call is stateless: it runs new Project().Solve(data, options) on a temporary Project that's discarded when the call returns. Nothing is kept between calls. To keep the schedule and send edits to it, use Project.Solve.
Signature#
public static ScheduleResult Schedule(ProjectData data, SolveOptions options)
A static method of the static class Engine. Synchronous and CPU-only. The same data and options always produce the same result.
Parameters#
| Name | Type | Description |
|---|---|---|
data |
ProjectData |
The full snapshot to schedule |
options |
SolveOptions |
What to schedule and what to report. new SolveOptions() schedules the whole project. |
Behavior#
- The call deep-copies
databefore scheduling, so the caller'sProjectDatanever changes. - The call always validates
datawithValidation.Strict. It rejects invalid data and never repairs it.
Returns#
A new ScheduleResult. No project holds a reference to it, so the caller can modify it freely.
The result's BaselineId is set, but it names the baseline of the temporary project, so no later call can use it.
Errors#
| Error | When |
|---|---|
InputException |
data fails strict validation, or options.Subtree names an unknown or unscheduled task. The validation rules are listed on ProjectData. |
ArgumentNullException |
data or options is null |
Schedule never throws ProjectException: each call starts from a fresh project.
Example#
using Plen;
var monday = Moment.FromYmdHm(2026, 8, 10, 8, 0) ?? throw new InvalidOperationException("invalid date");
var data = new ProjectData
{
Tasks =
[
new TaskData("design") { StartDate = monday, Duration = 2.0 },
new TaskData("build") { StartDate = monday, Duration = 3.0 },
],
Links = [new LinkData { Id = "l1", Source = "design", Target = "build" }],
};
var result = Engine.Schedule(data, new SolveOptions());
foreach (var update in result.Updates)
Console.WriteLine($"{update.Id}: {update.StartDate} .. {update.EndDate}");
Related#
Project.Solve- the stateful call that keeps the scheduleSolveOptions- the optionsScheduleResult- the returned result- Scheduling a project - loading, caching and solve options
- Reading results - writing updates back and handling each diagnostic